Merge pull request #98 from BarbarossaTM/feature/pointopoint
static executor: Add support for IPv4 'pointopoint' addresses.
This commit is contained in:
commit
df6835bd62
5 changed files with 43 additions and 4 deletions
|
@ -70,6 +70,13 @@ 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.
|
||||||
|
|
||||||
|
*point-to-point* _address_
|
||||||
|
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 a /32 netmask.
|
||||||
|
For compatiblity with ifupdown and ifupdown2, _pointopoint_ is
|
||||||
|
an alias for this parameter.
|
||||||
|
|
||||||
*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_POINT_TO_POINT}" -a "${addrfam}" = "-4" ]; then
|
||||||
|
PEER="peer ${IF_POINT_TO_POINT}"
|
||||||
|
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
|
||||||
|
|
|
@ -81,6 +81,7 @@ static const struct remap_token tokens[] = {
|
||||||
{"offload-tso", "ethtool-offload-tso"}, /* Debian ethtool integration */
|
{"offload-tso", "ethtool-offload-tso"}, /* Debian ethtool integration */
|
||||||
{"offload-tx", "ethtool-offload-tx"}, /* Debian ethtool integration */
|
{"offload-tx", "ethtool-offload-tx"}, /* Debian ethtool integration */
|
||||||
{"offload-ufo", "ethtool-offload-ufo"}, /* Debian ethtool integration */
|
{"offload-ufo", "ethtool-offload-ufo"}, /* Debian ethtool integration */
|
||||||
|
{"pointopoint", "point-to-point"}, /* legacy ifupdown, ifupdown2 */
|
||||||
{"provider", "ppp-provider"}, /* legacy ifupdown, ifupdown2 */
|
{"provider", "ppp-provider"}, /* legacy ifupdown, ifupdown2 */
|
||||||
{"rx-offload", "ethtool-offload-rx"}, /* ifupdown2 */
|
{"rx-offload", "ethtool-offload-rx"}, /* ifupdown2 */
|
||||||
{"tso-offload", "ethtool-offload-tso"}, /* ifupdown2 */
|
{"tso-offload", "ethtool-offload-tso"}, /* ifupdown2 */
|
||||||
|
|
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_POINT_TO_POINT="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