Skip to content

Commit f30ac6c

Browse files
committed
Mount eBPF filesystem in r3 and r5 routers of 8r-1c-srv6-pm topology; update r1 and r8 scripts to make them working with rev2 of srv6-pm-xdp-ebpf
1 parent 2d025a6 commit f30ac6c

File tree

6 files changed

+240
-22
lines changed

6 files changed

+240
-22
lines changed

nets/8r-1c-srv6-pm/nodeconf/r1/start.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ readonly CDIR="${PWD}/${BASE_DIR}/${COMMON_DIR}"
1717
readonly IPSET_START="${CDIR}/ipset_start.sh"
1818

1919
# script for setting up the env for pfplm using ebpf programs
20-
readonly EBPF_START="${WDIR}/ebpf_start.sh"
20+
# readonly EBPF_START="${WDIR}/ebpf_start.sh"
2121

2222
# This file contains the configuration of the node that should be enforced by
2323
# the controller.
@@ -51,7 +51,9 @@ sysctl -w net.ipv6.conf.all.forwarding=1
5151
#echo 0 > $i
5252
#done
5353

54-
source_file_if_defined "${EBPF_START}"
54+
mount -t bpf bpf /sys/fs/bpf/
55+
56+
# source_file_if_defined "${EBPF_START}"
5557
source_file_if_defined "${IPSET_START}"
5658

5759
echo "no service integrated-vtysh-config" >> /etc/frr/vtysh.conf
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
### !!! DO NOT CALL THIS FILE DIRECTLY !!! ###
4+
if [ -z "${CONTROLLER_CFG+x}" ]; then
5+
echo "CONTROLLER_CFG is unset. Do not call this script directly"
6+
exit 1
7+
fi
8+
9+
# End.OP configuration
10+
11+
ip -6 route add fcff:3::200 encap seg6local \
12+
action End.OP oif "${PUNT_IFNAME}" dev "${PUNT_IFNAME}"
13+
14+
# +-----------------+
15+
# | Egress |
16+
# +-----------------+
17+
18+
# Flow 1
19+
# SRv6 encap route
20+
# ip -6 route add fd00:0:81::2 encap seg6 mode encap \
21+
# segs fcff:4::1,fcff:8::100 dev r1-r2
22+
23+
# Flow 2
24+
# ...
25+
26+
# if [ -n "${IPSET_START+x}" ]; then
27+
# # Iptables/IPset configuration here
28+
29+
# # For each color we add the flow to monitor
30+
# ipset -A ${RED_HT_OUT} fcff:4::1,fcff:8::100
31+
# ipset -A ${BLUE_HT_OUT} fcff:4::1,fcff:8::100
32+
# fi
33+
34+
# if [ -n "${EBPF_START+x}" ]; then
35+
# xdp_pfplm_add_flow r1-r2 egr fcff:4::1,fcff:8::100
36+
# fi
37+
38+
# +-----------------+
39+
# | Ingress |
40+
# +-----------------+
41+
42+
# Flow1
43+
# SRv6 reverse path decap route
44+
# ip -6 route add fcff:1::100 encap \
45+
# seg6local action End.DX6 nh6 fd00:0:11::2 dev r1-h11
46+
47+
# Flow2
48+
# ...
49+
50+
51+
# if [ -n "${IPSET_START+x}" ]; then
52+
# # Iptables/IPset configuration here
53+
54+
# # For each color we add the flow to monitor
55+
# ipset -A ${RED_HT_IN} fcff:4::1,fcff:1::100
56+
# ipset -A ${BLUE_HT_IN} fcff:4::1,fcff:1::100
57+
# fi
58+
59+
# if [ -n "${EBPF_START+x}" ]; then
60+
# xdp_pfplm_add_flow r1-r2 igr fcff:4::1,fcff:1::100
61+
# fi
Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,80 @@
11
#!/bin/bash
22

3-
BASE_DIR=nodeconf
4-
NODE_NAME=r3
5-
FRR_PATH=/usr/lib/frr
3+
readonly BASE_DIR="nodeconf"
4+
readonly COMMON_DIR="common"
5+
readonly NODE_NAME="r3"
6+
readonly FRR_PATH="/usr/lib/frr"
67

7-
#enable IPv4 forwarding
8+
# Punt interfce name
9+
readonly PUNT_IFNAME="punt0"
10+
11+
# Node working directory
12+
readonly WDIR="${PWD}/${BASE_DIR}/${NODE_NAME}"
13+
# Common working directory
14+
readonly CDIR="${PWD}/${BASE_DIR}/${COMMON_DIR}"
15+
16+
# script for setting up the env for pfplm using iptables/ipset
17+
readonly IPSET_START="${CDIR}/ipset_start.sh"
18+
19+
# script for setting up the env for pfplm using ebpf programs
20+
# readonly EBPF_START="${WDIR}/ebpf_start.sh"
21+
22+
# This file contains the configuration of the node that should be enforced by
23+
# the controller.
24+
#
25+
# IF you need to add/remove/change flows (and all the configs that SHOULD BE
26+
# enforced by the controller on this NODE):
27+
# !!! PLEASE EDIT THIS FILE !!!
28+
readonly CONTROLLER_CFG="${WDIR}/controller.cfg"
29+
30+
# daemon file configs
31+
# These variable can be rewritten by the EBPFs scripts:
32+
# DO NOT MAKE THEM READ ONLY!
33+
ZEBRA_CFG="${WDIR}/zebra.conf"
34+
ISIS_CFG="${WDIR}/isisd.conf"
35+
36+
37+
############################
38+
### BEWARE TO EDIT BELOW ###
39+
############################
40+
41+
source "${CDIR}/commons.sh" || exit $?
42+
43+
#enable IPv6 forwarding
844
#sysctl -w net.ipv4.ip_forward=1
945
sysctl -w net.ipv6.conf.all.forwarding=1
1046
#disable reverse path filtering (needed for dynamic routing)
1147
#sysctl -w net.ipv4.conf.all.rp_filter=0
1248
#sysctl -w net.ipv4.conf.default.rp_filter=0
1349
#the following for loop also disables all and default
1450
#for i in /proc/sys/net/ipv4/conf/*/rp_filter ; do
15-
# echo 0 > $i
51+
#echo 0 > $i
1652
#done
1753

54+
mount -t bpf bpf /sys/fs/bpf/
55+
56+
# source_file_if_defined "${EBPF_START}"
57+
source_file_if_defined "${IPSET_START}"
1858

1959
echo "no service integrated-vtysh-config" >> /etc/frr/vtysh.conf
20-
chown frr:frrvty $BASE_DIR/$NODE_NAME
21-
#chown quagga:quagga $BASE_DIR/$NODE_NAME
60+
chown frr:frrvty "${BASE_DIR}/${NODE_NAME}"
61+
#chown quagga:quagga "${BASE_DIR}/${NODE_NAME}"
2262

23-
$FRR_PATH/zebra -f $PWD/$BASE_DIR/$NODE_NAME/zebra.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/zebra.pid
63+
${FRR_PATH}/zebra -f ${ZEBRA_CFG} -d -z ${WDIR}/zebra.sock -i ${WDIR}/zebra.pid
2464

2565
sleep 1
2666

27-
$FRR_PATH/isisd -f $PWD/$BASE_DIR/$NODE_NAME/isisd.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/isisd.pid
67+
${FRR_PATH}/isisd -f ${ISIS_CFG} -d -z ${WDIR}/zebra.sock -i ${WDIR}/isisd.pid
2868

2969
# enable Segment Routing for IPv6
3070
sysctl -w net.ipv6.conf.all.seg6_enabled=1
3171
for dev in $(ip -o -6 a | awk '{ print $2 }' | grep -v "lo")
3272
do
3373
sysctl -w net.ipv6.conf.$dev.seg6_enabled=1
3474
done
75+
76+
# Add punt0 interface
77+
ip link add ${PUNT_IFNAME} type dummy
78+
ip link set ${PUNT_IFNAME} up
79+
80+
source_file_if_defined "${CONTROLLER_CFG}"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
### !!! DO NOT CALL THIS FILE DIRECTLY !!! ###
4+
if [ -z "${CONTROLLER_CFG+x}" ]; then
5+
echo "CONTROLLER_CFG is unset. Do not call this script directly"
6+
exit 1
7+
fi
8+
9+
# End.OP configuration
10+
11+
ip -6 route add fcff:5::200 encap seg6local \
12+
action End.OP oif "${PUNT_IFNAME}" dev "${PUNT_IFNAME}"
13+
14+
# +-----------------+
15+
# | Egress |
16+
# +-----------------+
17+
18+
# Flow 1
19+
# SRv6 encap route
20+
# ip -6 route add fd00:0:81::2 encap seg6 mode encap \
21+
# segs fcff:4::1,fcff:8::100 dev r1-r2
22+
23+
# Flow 2
24+
# ...
25+
26+
# if [ -n "${IPSET_START+x}" ]; then
27+
# # Iptables/IPset configuration here
28+
29+
# # For each color we add the flow to monitor
30+
# ipset -A ${RED_HT_OUT} fcff:4::1,fcff:8::100
31+
# ipset -A ${BLUE_HT_OUT} fcff:4::1,fcff:8::100
32+
# fi
33+
34+
# if [ -n "${EBPF_START+x}" ]; then
35+
# xdp_pfplm_add_flow r1-r2 egr fcff:4::1,fcff:8::100
36+
# fi
37+
38+
# +-----------------+
39+
# | Ingress |
40+
# +-----------------+
41+
42+
# Flow1
43+
# SRv6 reverse path decap route
44+
# ip -6 route add fcff:1::100 encap \
45+
# seg6local action End.DX6 nh6 fd00:0:11::2 dev r1-h11
46+
47+
# Flow2
48+
# ...
49+
50+
51+
# if [ -n "${IPSET_START+x}" ]; then
52+
# # Iptables/IPset configuration here
53+
54+
# # For each color we add the flow to monitor
55+
# ipset -A ${RED_HT_IN} fcff:4::1,fcff:1::100
56+
# ipset -A ${BLUE_HT_IN} fcff:4::1,fcff:1::100
57+
# fi
58+
59+
# if [ -n "${EBPF_START+x}" ]; then
60+
# xdp_pfplm_add_flow r1-r2 igr fcff:4::1,fcff:1::100
61+
# fi
Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,80 @@
11
#!/bin/bash
22

3-
BASE_DIR=nodeconf
4-
NODE_NAME=r5
5-
FRR_PATH=/usr/lib/frr
3+
readonly BASE_DIR="nodeconf"
4+
readonly COMMON_DIR="common"
5+
readonly NODE_NAME="r5"
6+
readonly FRR_PATH="/usr/lib/frr"
67

7-
#enable IPv4 forwarding
8+
# Punt interfce name
9+
readonly PUNT_IFNAME="punt0"
10+
11+
# Node working directory
12+
readonly WDIR="${PWD}/${BASE_DIR}/${NODE_NAME}"
13+
# Common working directory
14+
readonly CDIR="${PWD}/${BASE_DIR}/${COMMON_DIR}"
15+
16+
# script for setting up the env for pfplm using iptables/ipset
17+
readonly IPSET_START="${CDIR}/ipset_start.sh"
18+
19+
# script for setting up the env for pfplm using ebpf programs
20+
# readonly EBPF_START="${WDIR}/ebpf_start.sh"
21+
22+
# This file contains the configuration of the node that should be enforced by
23+
# the controller.
24+
#
25+
# IF you need to add/remove/change flows (and all the configs that SHOULD BE
26+
# enforced by the controller on this NODE):
27+
# !!! PLEASE EDIT THIS FILE !!!
28+
readonly CONTROLLER_CFG="${WDIR}/controller.cfg"
29+
30+
# daemon file configs
31+
# These variable can be rewritten by the EBPFs scripts:
32+
# DO NOT MAKE THEM READ ONLY!
33+
ZEBRA_CFG="${WDIR}/zebra.conf"
34+
ISIS_CFG="${WDIR}/isisd.conf"
35+
36+
37+
############################
38+
### BEWARE TO EDIT BELOW ###
39+
############################
40+
41+
source "${CDIR}/commons.sh" || exit $?
42+
43+
#enable IPv6 forwarding
844
#sysctl -w net.ipv4.ip_forward=1
945
sysctl -w net.ipv6.conf.all.forwarding=1
1046
#disable reverse path filtering (needed for dynamic routing)
1147
#sysctl -w net.ipv4.conf.all.rp_filter=0
1248
#sysctl -w net.ipv4.conf.default.rp_filter=0
1349
#the following for loop also disables all and default
1450
#for i in /proc/sys/net/ipv4/conf/*/rp_filter ; do
15-
# echo 0 > $i
51+
#echo 0 > $i
1652
#done
1753

54+
mount -t bpf bpf /sys/fs/bpf/
55+
56+
# source_file_if_defined "${EBPF_START}"
57+
source_file_if_defined "${IPSET_START}"
1858

1959
echo "no service integrated-vtysh-config" >> /etc/frr/vtysh.conf
20-
chown frr:frrvty $BASE_DIR/$NODE_NAME
21-
#chown quagga:quagga $BASE_DIR/$NODE_NAME
60+
chown frr:frrvty "${BASE_DIR}/${NODE_NAME}"
61+
#chown quagga:quagga "${BASE_DIR}/${NODE_NAME}"
2262

23-
$FRR_PATH/zebra -f $PWD/$BASE_DIR/$NODE_NAME/zebra.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/zebra.pid
63+
${FRR_PATH}/zebra -f ${ZEBRA_CFG} -d -z ${WDIR}/zebra.sock -i ${WDIR}/zebra.pid
2464

2565
sleep 1
2666

27-
$FRR_PATH/isisd -f $PWD/$BASE_DIR/$NODE_NAME/isisd.conf -d -z $PWD/$BASE_DIR/$NODE_NAME/zebra.sock -i $PWD/$BASE_DIR/$NODE_NAME/isisd.pid
67+
${FRR_PATH}/isisd -f ${ISIS_CFG} -d -z ${WDIR}/zebra.sock -i ${WDIR}/isisd.pid
2868

2969
# enable Segment Routing for IPv6
3070
sysctl -w net.ipv6.conf.all.seg6_enabled=1
3171
for dev in $(ip -o -6 a | awk '{ print $2 }' | grep -v "lo")
3272
do
3373
sysctl -w net.ipv6.conf.$dev.seg6_enabled=1
3474
done
75+
76+
# Add punt0 interface
77+
ip link add ${PUNT_IFNAME} type dummy
78+
ip link set ${PUNT_IFNAME} up
79+
80+
source_file_if_defined "${CONTROLLER_CFG}"

nets/8r-1c-srv6-pm/nodeconf/r8/start.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ readonly CDIR="${PWD}/${BASE_DIR}/${COMMON_DIR}"
1717
readonly IPSET_START="${CDIR}/ipset_start.sh"
1818

1919
# script for setting up the env for pfplm using ebpf programs
20-
readonly EBPF_START="${WDIR}/ebpf_start.sh"
20+
# readonly EBPF_START="${WDIR}/ebpf_start.sh"
2121

2222
# This file contains the configuration of the node that should be enforced by
2323
# the controller.
@@ -51,7 +51,9 @@ sysctl -w net.ipv6.conf.all.forwarding=1
5151
#echo 0 > $i
5252
#done
5353

54-
source_file_if_defined "${EBPF_START}"
54+
mount -t bpf bpf /sys/fs/bpf/
55+
56+
# source_file_if_defined "${EBPF_START}"
5557
source_file_if_defined "${IPSET_START}"
5658

5759
echo "no service integrated-vtysh-config" >> /etc/frr/vtysh.conf

0 commit comments

Comments
 (0)