static executor: Add support for IPv4 'pointopoint' addresses.
Closes #96 Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
parent
cc06712611
commit
67163c6561
4 changed files with 40 additions and 4 deletions
|
@ -70,6 +70,11 @@ the system will only respond to certain keywords by default:
|
||||||
is for backwards compatibility and should not be used in new
|
is for backwards compatibility and should not be used in new
|
||||||
deployments.
|
deployments.
|
||||||
|
|
||||||
|
*pointopoint*
|
||||||
|
Sets the given IPv4 address as the peer address on the interface.
|
||||||
|
This setting only takes effect for the IPv4 address familiy and
|
||||||
|
only makes sense in combination with as /32 netmask.
|
||||||
|
|
||||||
*link-type* _link-type_
|
*link-type* _link-type_
|
||||||
Denotes the link-type of the interface. When set to _dummy_,
|
Denotes the link-type of the interface. When set to _dummy_,
|
||||||
the interface is created as a virtual dummy interfaces.
|
the interface is created as a virtual dummy interfaces.
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
[ -z "$VERBOSE" ] || set -x
|
||||||
|
|
||||||
[ -z "$IF_METRIC" ] && IF_METRIC="1"
|
[ -z "$IF_METRIC" ] && IF_METRIC="1"
|
||||||
[ -n "$IF_VRF_TABLE" ] && VRF_TABLE="table $IF_VRF_TABLE"
|
[ -n "$IF_VRF_TABLE" ] && VRF_TABLE="table $IF_VRF_TABLE"
|
||||||
[ -n "$IF_VRF_MEMBER" ] && VRF_TABLE="vrf $IF_VRF_MEMBER"
|
[ -n "$IF_VRF_MEMBER" ] && VRF_TABLE="vrf $IF_VRF_MEMBER"
|
||||||
|
@ -20,7 +22,13 @@ addr_family() {
|
||||||
configure_addresses() {
|
configure_addresses() {
|
||||||
for i in $(ifquery -p address -i $INTERFACES_FILE $IFACE); do
|
for i in $(ifquery -p address -i $INTERFACES_FILE $IFACE); do
|
||||||
addrfam=$(addr_family $i)
|
addrfam=$(addr_family $i)
|
||||||
${MOCK} ip $addrfam addr $1 $i dev $IFACE
|
if [ "${IF_POINTOPOINT}" -a "${addrfam}" = "-4" ]; then
|
||||||
|
PEER="peer ${IF_POINTOPOINT}"
|
||||||
|
else
|
||||||
|
PEER=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
${MOCK} ip $addrfam addr $1 $i $PEER dev $IFACE
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +39,6 @@ configure_gateways() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -z "$VERBOSE" ] || set -x
|
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
up)
|
up)
|
||||||
configure_addresses add
|
configure_addresses add
|
||||||
|
|
7
tests/fixtures/static-eth0-ptp.interfaces
vendored
Normal file
7
tests/fixtures/static-eth0-ptp.interfaces
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
auto eth0
|
||||||
|
iface eth0
|
||||||
|
address 203.0.113.2/32
|
||||||
|
pointopoint 192.0.2.1
|
||||||
|
gateway 192.0.2.1
|
||||||
|
address 2001:db8:1000:2::2/64
|
||||||
|
gateway 2001:db8:1000:2::1
|
|
@ -4,7 +4,14 @@
|
||||||
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/static"
|
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/static"
|
||||||
FIXTURES="$(atf_get_srcdir)/../fixtures"
|
FIXTURES="$(atf_get_srcdir)/../fixtures"
|
||||||
|
|
||||||
tests_init up down vrf_up vrf_down metric_up metric_down
|
tests_init \
|
||||||
|
up \
|
||||||
|
up_ptp \
|
||||||
|
down \
|
||||||
|
vrf_up \
|
||||||
|
vrf_down \
|
||||||
|
metric_up \
|
||||||
|
metric_down
|
||||||
|
|
||||||
up_body() {
|
up_body() {
|
||||||
export IFACE=eth0 PHASE=up MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0.interfaces"
|
export IFACE=eth0 PHASE=up MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0.interfaces"
|
||||||
|
@ -16,6 +23,17 @@ up_body() {
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
up_ptp_body() {
|
||||||
|
export IFACE=eth0 PHASE=up MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0-ptp.interfaces" \
|
||||||
|
IF_POINTOPOINT="192.0.2.1"
|
||||||
|
atf_check -s exit:0 \
|
||||||
|
-o match:'addr add 203.0.113.2/32 peer 192.0.2.1 dev eth0' \
|
||||||
|
-o match:'route add default via 192.0.2.1 metric 1 dev eth0' \
|
||||||
|
-o match:'addr add 2001:db8:1000:2::2/64 dev eth0' \
|
||||||
|
-o match:'route add default via 2001:db8:1000:2::1 metric 1 dev eth0' \
|
||||||
|
${EXECUTOR}
|
||||||
|
}
|
||||||
|
|
||||||
down_body() {
|
down_body() {
|
||||||
export IFACE=eth0 PHASE=down MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0.interfaces"
|
export IFACE=eth0 PHASE=down MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0.interfaces"
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
|
|
Loading…
Reference in a new issue