1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

1055 Commits

Author SHA1 Message Date
8329d2b8af LinkUtils: check device MTU and /proc/../disable_ipv6 before setting ipv6-addrgen
The minimum IPv6 MTU (ipv6 stack should handle at minmum this size)
is 1280 bytes. If you set the MTU below that then you can't really
have ipv6 addrconf follows the MTU changes and if it sees change
below 1280 then it disables ipv6 on the iface

$ ifquery swp1
auto swp1
iface swp1
      mtu 420

$ ifreload -a
error: swp1: cmd '/bin/ip -force -batch - [link set dev swp1 down
link set dev swp1 addrgenmode eui64
link set dev swp1 up
]' failed: returned 1 (RTNETLINK answers: Address family not supported by protocol
Command failed -:2
)

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
d5a6c42675 README: update build instruction to switch to maste-next branch
The building instruction didn't mention that users should checkout the master-next branch and build from it. This branch contains the lastest ifupdown2 version
2018-12-13 14:43:57 -08:00
dc0aeb8ffb README: remove rst2man from dependency list 2018-12-13 14:43:57 -08:00
664856a2ba debian: changelog: add ip[6]-forward entry for new validvals
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
17da0561bf addons: addressvirtual: address-virtual-ipv6-addrgen reset to default if removed from stanza
Ticket: CM-21656
Reviewed By: Roopa
Testing Done:

[8:39:13] root:~ # ifquery vlan1000
auto vlan1000
iface vlan1000
      address 192.168.10.1/24
      address fc00:10::1/64
      address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64
      address-virtual-ipv6-addrgen off
      vlan-id 1000
      vlan-raw-device bridge

[8:39:18] root:~ # nano /etc/network/interfaces
[8:39:24] root:~ # ifquery vlan1000
auto vlan1000
iface vlan1000
      address 192.168.10.1/24
      address fc00:10::1/64
      address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64
      vlan-id 1000
      vlan-raw-device bridge

[8:39:27] root:~ # ifreload -a -v |& grep addrgenmode
link set dev vlan1000-v0 addrgenmode eui64
[8:39:34] root:~ #

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
7b444c7cf4 addons: address: add yes, no, 1, 0 as valid values
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
307e814c59 addons: address: fix ifquery-check for ip(6)-forward 0/1 values
[18:18:12] root:~ # ifquery swp1
auto swp1
iface swp1
	ip-forward 0
	ip6-forward 0

[18:18:15] root:~ #
[18:18:16] root:~ # ifup swp1
[18:18:22] root:~ # echo $?
0
[18:18:23] root:~ # ifquery swp1 -c
auto swp1
iface swp1                                                          [pass]
	ip-forward off                                              [pass]
	ip6-forward off                                             [pass]

[18:18:27] root:~ #

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
007cae3525 ipv6-addrgen: add ifquery check/running/ifreload support using netlink cache
[13:09:20] root:~ # ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto vlan1903
iface vlan1903
	vlan-id 1903
	vlan-raw-device bridge
	ipv6-addrgen no
	address-virtual-ipv6-addrgen no
	address-virtual 00:00:5e:00:01:a3 2a06:c01:1:1903::1/64 fe80::1/64 185.98.123.1/24

auto bridge
iface bridge
	bridge-ports swp1

[13:09:25] root:~ # ifup -a -v
info: loading builtin modules from ['/usr/share/ifupdown2/addons']
info: executing /var/lib/ifupdown2/hooks/get_reserved_vlan_range.sh
info: executing /sbin/sysctl net.bridge.bridge-allow-multiple-vlans
info: executing /bin/pidof mstpd
info: executing /bin/ip rule show
info: executing /bin/ip -6 rule show
info: address: using default mtu 1500
info: 'link_master_slave' is set. slave admin state changes will be delayed till the masters admin state change.
info: processing interfaces file /etc/network/interfaces
info: lo: running ops ...
info: netlink: ip link show
info: netlink: ip addr show
info: executing /bin/ip addr help
info: address metric support: KO
info: lo: netlink: ip link set dev lo up
info: reading '/proc/sys/net/mpls/conf/lo/input'
info: reading '/proc/sys/net/ipv4/conf/lo/forwarding'
info: reading '/proc/sys/net/ipv6/conf/lo/forwarding'
info: reading '/proc/sys/net/ipv4/conf/lo/accept_local'
info: executing /bin/systemctl is-enabled vxrd.service
info: eth0: running ops ...
info: executing /sbin/ethtool eth0
info: reading '/sys/class/net/eth0/speed'
info: reading '/sys/class/net/eth0/duplex'
info: eth0: netlink: ip link set dev eth0 up
info: dhclient4 already running on eth0. Not restarting.
info: reading '/proc/sys/net/mpls/conf/eth0/input'
info: reading '/proc/sys/net/ipv4/conf/eth0/forwarding'
info: reading '/proc/sys/net/ipv6/conf/eth0/forwarding'
info: reading '/proc/sys/net/ipv4/conf/eth0/accept_local'
info: swp1: running ops ...
info: executing /sbin/ethtool swp1
info: reading '/sys/class/net/swp1/speed'
info: reading '/sys/class/net/swp1/duplex'
info: executing /sbin/ethtool -s swp1  speed 1000 duplex full
info: reading '/proc/sys/net/mpls/conf/swp1/input'
info: reading '/proc/sys/net/ipv4/conf/swp1/accept_local'
info: bridge: running ops ...
info: bridge: netlink: ip link add bridge type bridge
info: bridge: apply bridge settings
info: bridge: set bridge-ageing 1800
info: bridge: set bridge-hashel 4096
info: bridge: set bridge-hashmax 4096
info: bridge: set bridge-mcstats on
info: reading '/sys/class/net/bridge/bridge/stp_state'
info: bridge: stp state reset, reapplying port settings
info: bridge: netlink: ip link set bridge type bridge with attributes
info: writing '1' to file /proc/sys/net/ipv6/conf/swp1/disable_ipv6
info: executing /bin/ip -force -batch - [link set dev swp1 master bridge
addr flush dev swp1
]
info: bridge: applying bridge port configuration: ['swp1']
info: bridge: swp1: set bridge-portprios 8
info: swp1: netlink: ip link set dev swp1: bridge slave attributes
info: executing /sbin/brctl showmcqv4src bridge
info: bridge: applying bridge configuration specific to ports
info: bridge: processing bridge config for port swp1
info: swp1: netlink: ip link set dev swp1 up
info: bridge: setting bridge mac to port swp1 mac
info: executing /bin/ip link set dev bridge address 90:e2:ba:2c:b1:96
info: executing /sbin/mstpctl showportdetail bridge json
info: executing /sbin/mstpctl showbridge json bridge
info: bridge: applying mstp configuration specific to ports
info: bridge: processing mstp config for port swp1
info: bridge: netlink: ip link set dev bridge up
info: reading '/proc/sys/net/mpls/conf/bridge/input'
info: executing /sbin/sysctl net.ipv4.conf.bridge.forwarding
info: executing /sbin/sysctl net.ipv6.conf.bridge.forwarding
info: executing /bin/ip -force -batch - [link set dev bridge down
link set dev bridge addrgenmode eui64
link set dev bridge up
]
info: reading '/proc/sys/net/ipv4/conf/bridge/accept_local'
info: vlan1903: running ops ...
info: vlan1903: netlink: ip link add link bridge name vlan1903 type vlan id 1903 protocol 802.1q
info: vlan1903: netlink: ip link set dev vlan1903 up
info: reading '/proc/sys/net/mpls/conf/vlan1903/input'
info: reading '/proc/sys/net/ipv4/conf/vlan1903/forwarding'
info: reading '/proc/sys/net/ipv6/conf/vlan1903/forwarding'
info: executing /bin/ip -force -batch - [link set dev vlan1903 down
link set dev vlan1903 addrgenmode none
link set dev vlan1903 up
]
info: vlan1903: netlink: ip link add link vlan1903 name vlan1903-v0 type macvlan mode private
info: executing /sbin/sysctl net.ipv6.conf.vlan1903-v0.accept_dad
info: executing /sbin/sysctl net.ipv6.conf.vlan1903-v0.accept_dad=0
info: executing /sbin/sysctl net.ipv6.conf.vlan1903-v0.dad_transmits
info: executing /sbin/sysctl net.ipv6.conf.vlan1903-v0.dad_transmits=0
info: executing /bin/ip -force -batch - [link set dev vlan1903-v0 addrgenmode none
link set dev vlan1903-v0 down
link set dev vlan1903-v0 address 00:00:5e:00:01:a3
link set dev vlan1903-v0 up
addr add 2a06:c01:1:1903::1/64 dev vlan1903-v0
addr add fe80::1/64 dev vlan1903-v0
addr add 185.98.123.1/24 dev vlan1903-v0
route del 2a06:c01:1:1903::/64 dev vlan1903-v0
route del fe80::/64 dev vlan1903-v0
route add 2a06:c01:1:1903::/64 dev vlan1903-v0 proto kernel metric 9999
route add fe80::/64 dev vlan1903-v0 proto kernel metric 9999
]
info: reading '/proc/sys/net/ipv4/conf/vlan1903/accept_local'
[13:09:29] root:~ #
[13:09:30] root:~ #
[13:09:30] root:~ # ifquery -a -c
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp                                                [pass]

auto vlan1903
iface vlan1903                                                      [pass]
	vlan-raw-device bridge                                      [pass]
	vlan-id 1903                                                [pass]
	ipv6-addrgen no                                             [pass]
	address-virtual 00:00:5e:00:01:a3 2a06:c01:1:1903::1/64 fe80::1/64 185.98.123.1/24     [pass]
	address-virtual-ipv6-addrgen no                             [pass]

auto bridge
iface bridge                                                        [pass]
	bridge-ports swp1                                           [pass]

[13:09:33] root:~ #
[13:09:35] root:~ #
[13:09:35] root:~ # ifquery -a -r
auto vlan1903-v0
iface vlan1903-v0
	ipv6-addrgen off
	address 185.98.123.1/24
	address 2a06:c01:1:1903::1/64

auto vlan1903
iface vlan1903
	vlan-id 1903
	vlan-protocol 802.1Q
	vlan-raw-device bridge
	ipv6-addrgen off
	address-virtual 00:00:5e:00:01:a3 185.98.123.1/242a06:c01:1:1903::1/64
	address-virtual-ipv6-addrgen off

auto bridge
iface bridge
	bridge-vlan-stats off
	bridge-mcstats 1
	bridge-ports swp1
	bridge-stp yes
	mstpctl-portp2p  swp1=auto
	mstpctl-treeportcost  swp1=20000
	mstpctl-portautoedge  swp1=yes

auto swp1
iface swp1

auto eth0
iface eth0 inet dhcp

auto lo
iface lo inet loopback
	mtu 65536

[13:09:38] root:~ # ip -d link show vlan1903
20: vlan1903@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
    link/ether 90:e2:ba:2c:b1:96 brd ff:ff:ff:ff:ff:ff promiscuity 1
    vlan protocol 802.1Q id 1903 <REORDER_HDR> addrgenmode none
[13:09:50] root:~ # ip -d link show vlan1903-v0
21: vlan1903-v0@vlan1903: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
    link/ether 00:00:5e:00:01:a3 brd ff:ff:ff:ff:ff:ff promiscuity 0
    macvlan  mode private addrgenmode none
[13:09:53] root:~ #
[13:09:56] root:~ # ip link set dev vlan1903-v0 addrgenmode eui64
[13:10:23] root:~ # ifquery -a -c
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp                                                [pass]

auto vlan1903
iface vlan1903                                                      [fail]
	vlan-raw-device bridge                                      [pass]
	vlan-id 1903                                                [pass]
	ipv6-addrgen no                                             [pass]
	address-virtual 00:00:5e:00:01:a3 2a06:c01:1:1903::1/64 fe80::1/64 185.98.123.1/24     [pass]
	address-virtual-ipv6-addrgen no                             [fail]

auto bridge
iface bridge                                                        [pass]
	bridge-ports swp1                                           [pass]

[13:10:29] root:~ # ifquery -a -r
auto vlan1903-v0
iface vlan1903-v0
	address 185.98.123.1/24
	address 2a06:c01:1:1903::1/64

auto vlan1903
iface vlan1903
	vlan-id 1903
	vlan-protocol 802.1Q
	vlan-raw-device bridge
	ipv6-addrgen off
	address-virtual 00:00:5e:00:01:a3 185.98.123.1/242a06:c01:1:1903::1/64
	address-virtual-ipv6-addrgen on

auto bridge
iface bridge
	bridge-vlan-stats off
	bridge-mcstats 1
	bridge-ports swp1
	bridge-stp yes
	mstpctl-portp2p  swp1=auto
	mstpctl-treeportcost  swp1=20000
	mstpctl-portautoedge  swp1=yes

auto swp1
iface swp1

auto eth0
iface eth0 inet dhcp

auto lo
iface lo inet loopback
	mtu 65536

[13:10:33] root:~ #

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
f8f6549ba7 nlpacket: add decode support for IFLA_AF_SPEC (AF_UNSPEC) family - inet6 attributes
This patch mostly adds support for IFLA_INET6_ADDR_GEN_MODE
nlmanager doesn't support multiple kernel version all the
other attributes like IFLA_INET6_CONF are based on DEVCONF_MAX
from _UAPI_IPV6_H.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
c4cc1f86f1 addons: addressvirtual: flush macvlan addr cache when setting addrgenmode
When setting addrgenmode it is necessary to flap the macvlan
device. After flapping the device we also need to re-add all
the user configuration. The best way to add the user config
is to flush our internal address cache.

[10:12:10] root:~ # ifquery vlan1000
auto vlan1000
iface vlan1000
	address 192.168.10.1/24
	address fc00:10::1/64
	address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64
	vlan-id 1000
	vlan-raw-device bridge

[10:12:15] root:~ # ifup -a
[10:12:24] root:~ # echo $?
0
[10:12:26] root:~ # ifquery vlan1000 -c
auto vlan1000
iface vlan1000                                                      [pass]
	vlan-raw-device bridge                                      [pass]
	vlan-id 1000                                                [pass]
	address 192.168.10.1/24                                     [pass]
	address fc00:10::1/64                                       [pass]
	address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64     [pass]

[10:12:30] root:~ # ip -6 -o addr show vlan1000-v0
48: vlan1000-v0    inet6 fc00:10::1/64 scope global \       valid_lft forever preferred_lft forever
48: vlan1000-v0    inet6 fe80::200:5eff:fe00:101/64 scope link \       valid_lft forever preferred_lft forever
48: vlan1000-v0    inet6 fe80::1/64 scope link \       valid_lft forever preferred_lft forever
[10:12:33] root:~ #
[10:12:34] root:~ #
[10:12:34] root:~ # ifquery vlan1000
auto vlan1000
iface vlan1000
	address 192.168.10.1/24
	address fc00:10::1/64
	address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64
	address-virtual-ipv6-addrgen off
	vlan-id 1000
	vlan-raw-device bridge

[10:12:39] root:~ #
[10:12:41] root:~ # ifreload -a -d
...
debug: vlan1000: up : running module addressvirtual
debug: vlan1000-v0: reset address cache <<<<<<<<<<<<<<<<<<<<<< without this reset ifupdown2 would be in a broken state
info: vlan1000: checking route entry ...
info: executing /bin/ip route get 192.168.10.0/24
info: netlink: ip link show dev vlan1000
info: netlink: ip link show dev vlan1000-v0
info: vlan1000-v0: netlink: ip link set dev vlan1000-v0 up
info: executing /bin/ip -force -batch - [link set dev vlan1000-v0 down
link set dev vlan1000-v0 addrgenmode none
link set dev vlan1000-v0 up
addr add 192.168.10.1/24 dev vlan1000-v0
addr add fc00:10::1/64 dev vlan1000-v0
addr add fe80::1/64 dev vlan1000-v0
]
...
[10:12:50] root:~ #
[10:12:51] root:~ # ip -6 -o addr show vlan1000-v0
48: vlan1000-v0    inet6 fc00:10::1/64 scope global \       valid_lft forever preferred_lft forever
48: vlan1000-v0    inet6 fe80::1/64 scope link \       valid_lft forever preferred_lft forever
[10:12:53] root:~ # ifquery vlan1000 -c
auto vlan1000
iface vlan1000                                                      [pass]
	vlan-raw-device bridge                                      [pass]
	vlan-id 1000                                                [pass]
	address 192.168.10.1/24                                     [pass]
	address fc00:10::1/64                                       [pass]
	address-virtual 00:00:5e:00:01:01 192.168.10.1/24 fc00:10::1/64 fe80::1/64     [pass]

[10:13:03] root:~ # echo $?
0
[10:13:04] root:~ #

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
9b653c8542 addons: bridge: fix check_valid_bridge for DRYRUN mode
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
4b0b3fa3a0 addons: mstpctl: bridge vlan-unaware: check brport running config before setting attributes
when handling mstpctl attribute on vlan-unaware bridges we don't
check the running configuration of the bridge ports (cache) thus
misconfiguring some attributes on brports.

We first create a traditional bridge with:

auto bridge1
iface bridge1
    bridge-ports swp1 swp2
    bridge-vlan-aware no
We check the setting:

$ mstpctl showportdetail bridge1 swp1 | grep edge
  admin edge port    no                      auto edge port       yes
  oper edge port     yes                     topology change ack  no
We then add the setting for swp1:

auto swp1
iface swp1
    mstpctl-portautoedge no
We then do an ifreload -adv and we see two calls. First
info: executing /sbin/mstpctl setportautoedge bridge1 swp1 no

and then a little later
info: executing /sbin/mstpctl setportautoedge bridge1 swp1 yes

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
c8e0a11ed1 addons: bridge: warn users if bridge attributes are used under non-bridge stanza
This check is done without too much overhead because we rarely see a stanza
with more than a handful of attributes...

$ ifquery swp1
auto swp1
iface swp1
      bridge-vlan-aware yes
      bridge-stp off

$ ifup swp1 -v
...
info: swp1: running ops ...
warning: swp1: invalid use of bridge attribute (bridge-vlan-aware) on non-bridge stanza
warning: swp1: invalid use of bridge attribute (bridge-stp) on non-bridge stanza
..
$

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
52ac1cfc92 addons: bridge: if device exists - check if device is really a bridge
[18:43:47] root:~ # ip link show swp3
5: swp3: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 08:00:27:bc:04:3c brd ff:ff:ff:ff:ff:ff
[18:43:48] root:~ #
[18:43:49] root:~ #
[18:43:50] root:~ # cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto swp3
iface swp3
	bridge-vlan-aware yes
[18:43:50] root:~ #
[18:43:51] root:~ #
[18:43:51] root:~ # ifup -a
warning: swp3: error getting dependent interfaces (misconfiguration of bridge attribute(s) on existing non-bridge interface (swp3))
[18:43:56] root:~ # echo $?
1
[18:43:58] root:~ #

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
5b1fffafcd addons: addressvirtual: error in VRR mac address changes exit code (1)
$ ifquery -a
auto bridge
iface bridge
      bridge-vlan-aware yes
      bridge-ports swp1

auto bridge.2
iface bridge.2
      address-virtual 01:01:01:02:02:02	1.10.10.10/32

$ ifup -a
error: bridge.2: Multicast bit is set in the virtual mac address '01:01:01:02:02:02'
$ echo $?
1
$

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
79cde97bbd addons: ppp: fixes PEP8 warning
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
fecca2114a debian: changelog: 1.2.1: new entry: point-to-point protocol (ppp)
New addon to create/configure ppp interfaces

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
77054f7f5f addons: ppp: Add support for master-next
This commit fixes the ppp addon for the new master-next branch.
2018-12-13 14:43:57 -08:00
53747c55ab nlmanager: nlpacket: update AttributeMACAddress decode comments
this commit adds some explanation/comments in the decode function of the
AttributeMACAddress class. Some comments are moved around and placed
in the right location.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:36 -08:00
730834002a addons: tunnel: pep8 refactoring
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
08862a99f9 netlink: nlpacket AttributeMACAddress
This commits fixes AttributeMACAddress for GREv6.
Error message: info: netlink: link dump failed: Length of MACAddress attribute not supported: 20
Reproducible by adding a GREv6 Tunnel:

auto gre1
iface gre1 inet tunnel
    mode ip6gre
    local 2001:1000:1000:1000::123
    endpoint 2001:1000:1000:2000::123
    address 192.168.123.1/29

In netlink The IFLA_ADDRESS and IFLA_BROADCAST attributes for all interfaces has been a
6-byte MAC address. But the GRE interface uses a 4-byte IP address and GREv6 uses a 16-byte IPv6 address for this
attribute. This patch allows for decoding a 16-byte value as an IP address.
2018-12-13 14:42:35 -08:00
84ca91f165 addons: tunnel: Add support for master-next
This commit fixes the tunnel addon for the new master-next branch.
2018-12-13 14:42:35 -08:00
23e8546d39 addons: addressvirtual: new policy (bool): addressvirtual_with_route_metric (default: yes)
Ifupdown2 is now setting a default metric on macvlan ips. This policy will let
users disable this new default behavior. addressvirtual_with_route_metric is
boolean policy variable.

  addressvirtual_with_route_metric: yes|no|on|off|1|0 (default to yes)

$ cat /var/lib/ifupdown2/policy.d/addressvirtual.json
{
    "addressvirtual": {
        "module_globals": {
            "addressvirtual_with_route_metric": "no"
        }
    }
}

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
43ea2a97e7 debian: changelog: new entry for version 1.2.1
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
c3c78d9772 addons: tunnel: complete backport by updating imports + PEP8 refactoring
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
8e2f5fbef7 addons: tunnel: dependent device fix 2018-12-13 14:42:35 -08:00
60e7dc3a40 addons: tunnel: get_dependent_ifacenames: tunnel-physdev dependency 2018-12-13 14:42:35 -08:00
f40c629470 addons: tunnel: fix tunnel v4 to v6 change 2018-12-13 14:42:35 -08:00
33ebe60a9d addons: tunnel: add support for vti, ip6gre, ipip6, ip6ip6, vti6 tunnels 2018-12-13 14:42:35 -08:00
b2a87fe8eb addons: tunnel: Add support for GRETAP tunnels. (#34)
This commit adds support to configure and check gretap tunnels. An example
  configuration could look like this:

    iface tap0 inet tunnel
        mode gretap
        local 10.132.255.3
        endpoint 10.132.255.1
        ttl 64
        mtu 1400
        tunnel-physdev eth0
        #
        address 10.10.0.1/2

  ifup will happily configure the interface (which it does even without this
  patch) and ifquery now can successfully validate the configure interface:

    cr03.in.ffho.net:~# ifquery -c tap0
    iface tap0 inet tunnel                   [[ OK ]]
        tunnel-physdev eth0                  [[ OK ]]
        endpoint 10.132.255.1                [[ OK ]]
        local 10.132.255.3                   [[ OK ]]
        mode gretap                          [[ OK ]]
        ttl 64                               [[ OK ]]
        mtu 1400                             [[ OK ]]
        address 10.10.0.1/24                 [[ OK ]]

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2018-12-13 14:42:35 -08:00
ea3bd2b624 Addons/tunnel: fix typo in validvals (#31) 2018-12-13 14:42:35 -08:00
22aa65c782 Add support GRE/SIT tunnels. (#20)
This commit adds support for configuring GRE/IPIP/SIT tunnel interfaces as know
from previous versions of ifupdown. Currently only configuration checks for GRE
and SIT tunnels are implemented.

A tunnel interface configuration could look like this:

auto gre42
iface gre42 inet tunnel
        mode     gre
        local    198.51.100.1
        endpoint 203.0.113.2
	#
	# optional tunnel attributes
        ttl      64
        mtu      1400
	tunnel-physdev eth0
        #
        address  192.0.2.42/31
        address  2001:db8:d0c:23::42/64

auto he-ipv6
iface he-ipv6 inet tunnel
	mode sit
	endpoint 203.0.113.6
	local    198.51.100.66
	#
	# optional tunnel attributes
	ttl 255
	mtu 1466
	tunnel-physdev vrf_external
	#
	address 2001:db8:666::2/64

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
2018-12-13 14:42:35 -08:00
70a6640ce1 bridge: vlan-aware: add new boolean policy "vlan_aware_bridge_address_support"
closes #58

In linux its possible to assign a vlan-aware bridge an ip address
For some use cases is it useful to restrict users from configuring
ips on bridges VA. This patch will let admins and distributions
decide if it is necessary to warn the user in such case.

The patch introduces a new 'address' policy:

 vlan_aware_bridge_address_support: yes|no|on|off|0|1 (default to yes)

[16:46:09] root:~ # cat /var/lib/ifupdown2/policy.d/address.json
{
    "address": {
	"module_globals": {
	    "enable_l3_iface_forwarding_checks": "yes"
	},
	"defaults": {
	    "mtu": "1500",
	    "ip-forward": "on",
	    "ip6-forward": "on"
	}
    }
}
[16:46:16] root:~ # ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto bridge
iface bridge
	bridge-ports swp1
	bridge-vlan-aware yes
	address 10.10.10.10/32

[16:46:20] root:~ # ifup -a --syntax-check
[16:46:22] root:~ # echo $?
0
[16:46:33] root:~ # nano /var/lib/ifupdown2/policy.d/address.json
[16:46:47] root:~ # cat /var/lib/ifupdown2/policy.d/address.json
{
    "address": {
	"module_globals": {
	    "enable_l3_iface_forwarding_checks": "yes",
	    "vlan_aware_bridge_address_support": "no"
	},
	"defaults": {
	    "mtu": "1500",
	    "ip-forward": "on",
	    "ip6-forward": "on"
	}
    }
}
[16:46:48] root:~ # ifup -a --syntax-check
warning: bridge: ignoring ip address. Assigning an IP address is not allowed on bridge vlan aware interfaces
[16:46:51] root:~ # echo $?
1
[16:46:52] root:~ #

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
9bbb13def2 Revert "ifupdown2.conf: vlan_aware_bridge_address_support: allow ip on vlan-aware bridge (closes #58)"
This reverts commit 3d06493205882c4485363bd63d5050c345c2fac9.
2018-12-13 14:42:35 -08:00
7b66b2fc47 debian: changelog: 1.2.0: new entry: metric on macvlan ip
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
7cdb931e5d addons: vrf: add support for 'link-down yes' on VRF slaves
$ ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
	vrf mgmt
	link-down yes

auto mgmt
iface mgmt
	vrf-table auto

$ ifup -a -d
...
...
debug: mgmt: pre-up : running module vrf
info: executing /usr/lib/vrf/vrf-helper create mgmt 1001
debug: mgmt: eth0: slave configured with link-down yes
info: mgmt: netlink: ip link set dev mgmt up
...
$ ip link show eth0
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master mgmt state DOWN mode DEFAULT group default qlen 1000
    link/ether 08:00:27:80:e2:97 brd ff:ff:ff:ff:ff:ff

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
cc99b41d8c addons: bridge: fix 'NoneType' object has no attribute 'keys' exception
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
d1265fd548 addons: bridge: support multiple bridge-port configuration lines
Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Sam Tannous <stannous@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
05a4955081 ifupdownmain: run up/down on manual interfaces, but ignore any errors. (closes #48)
ifupdown changed its original behavior on "manual" address method:
12d333d619

ifupdown2 needs to change it's behavior too.

Reported-by: Alexandre Derumier <aderumier@odiso.com>
Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Co-authored-by: Alexandre Derumier <aderumier@odiso.com>
Co-authored-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
e9b893536f debian: changelog: update/refactor changelog 1.2.0 entry
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
ffdf73e14a ifupdown2.conf: vlan_aware_bridge_address_support: allow ip on vlan-aware bridge (closes #58)
In linux its possible to assign an ip address to a vlan-aware bridge
For some use cases is it useful to restrict users from configuring ips on
bridges VA. This patch will let admins and distributions decide if it is
necessary to warn the user in such case.

The patch introduces a new configuration variable in:
    /etc/network/ifudpown2/ifupdown2.conf

vlan_aware_bridge_address_support: yes|no|on|off|0|1 (default to yes)

[8:30:41] root:~ # cat /etc/network/ifupdown2/ifupdown2.conf | grep "vlan_aware_bridge_address_support"
[8:30:43] root:~ # ifquery bridge
auto bridge
iface bridge
	bridge-ports swp1
	bridge-vlan-aware yes
	address 10.10.10.10

[8:30:46] root:~ # ifup bridge --syntax-check
[8:30:52] root:~ # echo $?
0
[8:30:54] root:~ # echo "vlan_aware_bridge_address_support=no" >> /etc/network/ifupdown2/ifupdown2.conf
[8:31:11] root:~ # ifup bridge --syntax-check
warning: bridge: ignoring ip address. Assigning an IP address is not allowed on bridge vlan aware interfaces
[8:31:14] root:~ # echo $?
1
[8:31:17] root:~ #
[8:31:20] root:~ # ifup -a
[8:31:22] root:~ # echo $?
0
[8:31:25] root:~ # ifquery bridge -c
auto bridge
iface bridge                                                        [fail]
	bridge-vlan-aware yes                                       [pass]
	bridge-ports swp1                                           [pass]
	address 10.10.10.10                                         [fail]

[8:31:29] root:~ # ifdown bridge && ifup bridge -v |& grep "bridge vlan aware interfaces"
info: bridge: ignoring ip address. Assigning an IP address is not allowed on bridge vlan aware interfaces
[8:31:57] root:~ #

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
0897d354c0 debian: changelog: 1.2.0: new entry for ipv6-addrgen attribute
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
b478792b8a addons: addressvirtual: fix typo in address-virtual-ipv6-addrgen examples
typo: missing 'n' in the example field

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
20e547e795 addons: addressvirtual: if system supports addr METRIC set skip route hack
Now that some system support ip addr METRIC sets we dont have to do this
"fix_connected_route" hack. The hack was previously introduced to make
sure the primary address was the first in the routing table. Some events
could cause some issues like having the macvlan address first in the
routing table. In that case the macvlan needs to be flapped. This shouldn't
happen when we are able to set the address metric

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
7b711dc521 addons: addressvirtual: new attribute: address-virtual-ipv6-addrgen [on|off]
[14:53:46] root:~ # ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto vlan1903
iface vlan1903
	alias LAB-CUST-VMS
	vlan-id 1903
	vlan-raw-device bridge
	address 2a06:c01:1:1903::3/64
	address 185.98.123.3/24
	address-virtual 00:00:5e:00:01:a3 2a06:c01:1:1903::1/64 fe80::1/64 185.98.123.1/24
	vrf public

auto public
iface public
	vrf-table auto

auto bridge
iface bridge
	bridge-ports swp1

[14:53:47] root:~ # ifup -a
[14:53:50] root:~ # ip addr show vlan1903-v0
46: vlan1903-v0@vlan1903: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master public state UP group default
    link/ether 00:00:5e:00:01:a3 brd ff:ff:ff:ff:ff:ff
    inet 185.98.123.1/24 scope global vlan1903-v0
       valid_lft forever preferred_lft forever
    inet6 2a06:c01:1:1903::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::200:5eff:fe00:1a3/64 scope link
       valid_lft forever preferred_lft forever
    inet6 fe80::1/64 scope link
       valid_lft forever preferred_lft forever
[14:53:52] root:~ #
[14:53:54] root:~ #
[14:53:54] root:~ # nano /etc/network/interfaces
[14:53:57] root:~ # ifquery vlan1903
auto vlan1903
iface vlan1903
	alias LAB-CUST-VMS
	vlan-id 1903
	vlan-raw-device bridge
	address 2a06:c01:1:1903::3/64
	address 185.98.123.3/24
	address-virtual 00:00:5e:00:01:a3 2a06:c01:1:1903::1/64 fe80::1/64 185.98.123.1/24
	address-virtual-ipv6-addrgen off
	vrf public

[14:54:05] root:~ # ifdown -a -X eth0
[14:54:08] root:~ # ifup -a -v
...
...
info: executing /bin/ip -force -batch - [link set dev vlan1903-v0 master public
link set dev vlan1903-v0 addrgenmode none
link set dev vlan1903-v0 down
link set dev vlan1903-v0 address 00:00:5e:00:01:a3
link set dev vlan1903-v0 up
addr add 2a06:c01:1:1903::1/64 dev vlan1903-v0
addr add fe80::1/64 dev vlan1903-v0
addr add 185.98.123.1/24 dev vlan1903-v0
route del 2a06:c01:1:1903::/64 table 1001 dev vlan1903-v0
route del fe80::/64 table 1001 dev vlan1903-v0
route add 2a06:c01:1:1903::/64 table 1001 dev vlan1903-v0 proto kernel metric 9999
route add fe80::/64 table 1001 dev vlan1903-v0 proto kernel metric 9999
]
...
...
[14:54:14] root:~ # ip addr show vlan1903-v0
50: vlan1903-v0@vlan1903: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master public state UP group default
    link/ether 00:00:5e:00:01:a3 brd ff:ff:ff:ff:ff:ff
    inet 185.98.123.1/24 scope global vlan1903-v0
       valid_lft forever preferred_lft forever
    inet6 2a06:c01:1:1903::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::1/64 scope link
       valid_lft forever preferred_lft forever
[14:54:16] root:~ #

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
3fc54eef3d addons: address: new attribute: ipv6-addrgen [on/off]
[14:49:15] root:~ # ifquery swp2
auto swp2
iface swp2

[14:49:18] root:~ # ip addr show swp2
4: swp2: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 90:e2:ba:2c:b2:95 brd ff:ff:ff:ff:ff:ff
[14:49:20] root:~ # ifup swp2
[14:49:23] root:~ # ip addr show swp2
4: swp2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 90:e2:ba:2c:b2:95 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::92e2:baff:fe2c:b295/64 scope link
       valid_lft forever preferred_lft forever
[14:49:25] root:~ #
[14:49:32] root:~ # nano /etc/network/interfaces
[14:49:34] root:~ # ifquery swp2
auto swp2
iface swp2
        ipv6-addrgen off

[14:49:41] root:~ # ifup -v swp2 |& grep addrgen
link set dev swp2 addrgenmode none
[14:49:57] root:~ # ip addr show swp2
4: swp2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 90:e2:ba:2c:b2:95 brd ff:ff:ff:ff:ff:ff
[14:50:01] root:~ #
[14:50:09] root:~ #
[14:50:09] root:~ # ifup -v swp2
info: executing /bin/ip -force -batch - [link set dev swp2 down
link set dev swp2 addrgenmode none
link set dev swp2 up
]
info: reading '/proc/sys/net/ipv4/conf/swp2/accept_local'
[14:50:13] root:~ #

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
a382b488e9 backport: "Add support for setting phys-dev for VXLAN interfaces."
backporting the following commit to master-next:

commit eb92e5efff776602081b8bbd2cc74462293c4b79
Author: Maximilian Wilhelm <max@rfc2324.org>
Date:   Thu Oct 6 19:22:06 2016 +0200

    Add support for setting phys-dev for VXLAN interfaces.

      Add interface configuration option »vxlan-physdev« to set »dev« attribute
            of VXLAN interfaces and a check for the running configuration.

    Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

This backport also:
 - adds support for ifquery --running
 - uses the netlink cache
 - includes some pep8 fixes

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

Co-authored-by: Julien Fortin <julien@cumulusnetworks.com>
Co-authored-by: Maximilian Wilhelm <max@rfc2324.org>
2018-12-13 14:42:35 -08:00
dfaa8a2d19 addressvirtual: address: add default metric to ip4 and ip6 (if available)
Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
aa895ecddf addons: addressvirtual: if device is VRF slave check vrf route table
auto bridge
iface bridge
      bridge-vlan-aware yes
      bridge-ports swp2

auto bridge.2
iface bridge.2
      address 10.254.1.2/24
      address 2a03:25e0:254:1::2/64
      address-virtual 00:00:5e:00:01:01 10.254.1.1/24 2a03:25e0:254:1::1/64 fe80::1/64
      vrf blue

auto blue
iface blue
      vrf-table auto

$ ifreload -a -v
...
info: executing /bin/ip route get 10.254.1.0/24 vrf blue
...
$

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
db61a1a8a0 debian: changelog: change version to 1.2.0
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00