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

1454 Commits

Author SHA1 Message Date
b2751c6f57 addons: bridge-vlan-vni-map: support multiple vni mapping per entry
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 18:04:24 +02:00
f422ae7c6c addons: bridge: bridge-vlan-vni-map: fix: not enough arguments for format string
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 17:58:32 +02:00
f54468e32b addons: bridge: check if bridge mac is already inherited from a port
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 17:50:20 +02:00
ecb7cc1365 addons: bridge: bridge-arp-nd-suppress should show up on ifquery --with-default if policy is set
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 17:38:01 +02:00
4b16a99797 clag: bridge l3vni: move bridge vxlan l3vni code to parent class + refactoring
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 17:36:11 +02:00
68d0005516 bridge.py: remove extra empty line in header
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 17:05:56 +02:00
32ef3071ec addons: bridge: fix bridge arp vni vlan syntax-check
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:55:54 +02:00
3e5e36410e addons: bridge: v2: arp suppression enabled when no vlan is configured
the previous patch didn't cover implicit vlan, format bridge.VLANID

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:54:50 +02:00
645fcb73e2 addons: bridge: skip bridge arp vni vlan for single vxlan device
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:54:38 +02:00
a037ffc5f0 addons: bridge: detect and warn when arp suppression is enabled and there is no vlan configured
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:52:45 +02:00
6a1110e3ed addons: bridge: detect VXLAN mis-config VNI "bridge-learning=on" and print log message
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:52:00 +02:00
20649b09c6 addons: bridge: enable ipv6 on SVD brport
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:50:51 +02:00
35dabe6add cosmetic: ifupdownmain: remove empty line (pep8)
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:43:41 +02:00
3b1f78c181 ifupdownmain: add "all" parameter to get_all_ifaceobjs
On a MLAG configured switch, only one vlan aware bridge is supported
The clag module need to access the full list of ifaceobjs. This is a
bit breaking the existing segmentation, not great but would otherwise
require a huge refactoring/rework.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:41:07 +02:00
20e8d38375 ifupdownmain: skip bridge vlan when checking running config
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:35:46 +02:00
e3dbe405ba ifupdownmain: add module name in get_dependent warning
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-06-30 16:31:16 +02:00
59ab29fbd1 addons: vxlan: inherit clagd-vxlan-anycast-ip from lo for clag vxlans (introduces old_ifaceobjs to get_dependent_ifacenames)
When clagd anycast ip configuration changes on an existing setup, we have two issues:
- populate_dependency_info is run twice (in the ifreload case), first on the new
ifaceobjs, then on the old ifaceobjs. Thus hitting vxlan.get_dependent_ifacenames twice
where vxlan._clagd_vxlan_anycast_ip is set (the first time properly, then reset to it's
old value).
The fix: add a "old_ifaceobjs" flag to avoid resetting vxlan._clagd_vxlan_anycast_ip

- when clagd anycast ip changes, clagd also updates the vxlan's ip but there's a chance
that the ifupdown2 cache won't get the netlink notification in time before UP ops are
running on the vxlans, running on a stale cache is no bueno.
The fix: add additional checks to see if we should trust the cache of not.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:29:40 +02:00
1db0cb7acc addons: address: remove stale fdb entry for svi (when hwaddress is used)
As seen in the example below we are seeing a corner case, first the user
/e/n/i is configured without 'hwaddress', then it is used to fix the svi
mac address. The current code only checks for the statemanager for old
'hwaddress' attribute but couldn't find any. Now we save the mac addr
before updating it, so we can later clear it from the fdb.

$ cat a
auto eth0
iface eth0 inet dhcp

auto bridge
iface bridge
        bridge-vlan-aware yes
        bridge-ports vx-1000
        bridge-stp on
        bridge-vids 1000 1002 1004 1006 1008
        bridge-pvid 1

auto vx-1000
iface vx-1000
        vxlan-id 1000
        bridge-access 1000
        vxlan-local-tunnelip 27.0.0.11
        bridge-learning off
        bridge-arp-nd-suppress on
        mstpctl-portbpdufilter yes
        mstpctl-bpduguard yes
        mtu 9152

auto vlan1000
iface vlan1000
        address 45.0.0.2/24
        vlan-id 1000
        vlan-raw-device bridge
        address-virtual 00:00:5e:00:01:01 45.0.0.1/24
        vrf vrf1

auto vrf1
iface vrf1
        vrf-table auto

$
$
$ cat b
auto eth0
iface eth0 inet dhcp

auto bridge
iface bridge
        bridge-vlan-aware yes
        bridge-ports vx-1000
        bridge-stp on
        bridge-vids 1000 1002 1004 1006 1008
        bridge-pvid 1

auto vx-1000
iface vx-1000
        vxlan-id 1000
        bridge-access 1000
        vxlan-local-tunnelip 27.0.0.11
        bridge-learning off
        bridge-arp-nd-suppress on
        mstpctl-portbpdufilter yes
        mstpctl-bpduguard yes
        mtu 9152

auto vlan1000
iface vlan1000
        address 45.0.0.2/24
        hwaddress 00:02:00:aa:aa:aa
        vlan-id 1000
        vlan-raw-device bridge
        address-virtual 00:00:5e:00:01:01 45.0.0.1/24
        vrf vrf1

auto vrf1
iface vrf1
        vrf-table auto

$
$
$ rm /etc/network/interfaces ; ln -s `pwd`/a /etc/network/interfaces ; ifreload -a ; rm /etc/network/interfaces ; ln -s `pwd`/b /etc/network/interfaces ; (ifreload -av |& grep vlan | grep 1000)
info: bridge: netlink: bridge vlan add vid 1000 dev bridge
info: vlan1000: netlink: ip link set dev vlan1000 down
info: vlan1000: netlink: ip link set dev vlan1000 address 00:02:00:aa:aa:aa
info: vlan1000: netlink: ip link set dev vlan1000 up
info: writing '1' to file /proc/sys/net/ipv4/conf/vlan1000/arp_accept
info: executing /sbin/bridge fdb del 4a:b3:1e:45:bf:bf dev bridge vlan 1000  self
info: executing /sbin/bridge fdb replace 00:02:00:aa:aa:aa dev bridge vlan 1000  self
info: executing /sbin/bridge fdb replace 00:00:5e:00:01:01 dev bridge vlan 1000  self
$

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:13:49 +02:00
20eab2b13e addons: address: new policy: check_l3_svi_ip_forwarding
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:12:11 +02:00
0b34071bf8 addons: address: warn user if L3-SVI is configured with "ip-forward off"
Context:
"user accidentally disabled ip4 and ip6 forwarding on the L3-SVI for all VRF's.
we should add a check in ifupdown2 to warn user this is a bad config (symmetric
routing will not work if routing is disabled in this way)."

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 16:10:28 +02:00
9c1176c849 addons: vlan: check vlan-id misconfiguration and print warning
patch adds the following warning when it detects a vlan-id misconfiguration
error: vlan13: cannot change vlan-id to 13: operation not supported. Please delete the device with 'ifdown vlan13' and recreate it to apply the change.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 15:52:37 +02:00
75a9503027 addons: addressvirtual: check macvlan interface name lenght and war if len > 15
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 15:38:39 +02:00
01a655366b addons: address: raise exception when detecting an invalid ip address
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 15:37:12 +02:00
7cc5525d22 Merge pull request #210 from dabukalam/correct-bond-regex
Correct typo in bond-slaves regex example
2021-06-17 13:59:22 +02:00
d34d1513ca addons: bond: correct bond-slaves regex example
Signed-off-by: Danny Abukalam <danny@softiron.com>
2021-06-15 21:00:56 -04:00
55d0c15c5e Merge pull request #209 from BeStateless/feature/allow-validrange-on-number-keyword
Support value-in-range with <number> keyword
2021-06-01 22:47:03 +02:00
b20f983630 Support value-in-range with <number> keyword
This allows syntax checking to pass for fields like vxlan-ttl/vxlan-tos
which can be a number in a range OR a string value representing a special
meaning (0-255 or "auto", for instance).  Without this, you can only pass
a --syntax-check for such fields if your value is one of those literally
specified because, for instance, "64" is not "auto", "0", or "255":

invalid value "64": valid attribute values: ['0', '255']
info: exit status 1

Note that _applying_ such configuration still works, because netlink's
acceptance criteria are independent of ifupdown2's.
2021-06-01 14:11:59 -06:00
a8dd54b0fa addons: vxlan: vxlan-tos, vxlan-udp-csum refactoring and fixes
fix vxlan-tos inherit = 1 (was set to 0)
and other fixes to make sure we don't unnecessarily set
those attributes on vxlan creation

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-05-21 00:04:14 +02:00
47877f263d addons: bridge: fix error: write() argument must be str, not int
make sure to convert the mtu received via policy file back to string
before using it in the bridge module.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-05-18 17:19:25 +02:00
d38e9b1273 addons: bridge: bridge-access checks are not necessary for single vxlan devices
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-05-18 17:19:25 +02:00
f54c45deb9 addons: bridge: fix bridge-vlan-vni-map example in modinfo
Ticket: #2623398
Reviewed By: PR#94

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-05-18 17:19:25 +02:00
d0e5676882 addons: vrf: removing extra \n from log messages
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-05-18 17:19:25 +02:00
01f27c6789 addons: bridge: skip bridge-bridgeprio if mstpctl-treeprio is configured on the bridge
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-05-18 17:19:25 +02:00
3eb08b79e0 add support for new address policy: 'ip_blacklist'
context:
The IP address 169.254.0.1 is used by BGP unnumbered as an onlink
next-hop for IPv4 prefixes. When this is configured on the box, it
causes major issues which are very difficult to diagnose a debug.
It would be great if ifupdown2 could block this from being installed
on any interface as an address or address-virtual.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-05-18 17:19:25 +02:00
5f4ab65948 lib: Addon: add new Bridge class with member "bridge_vlan_aware_list"
we need to keep track of how many vlan-aware bridge we have in the user
configuration without having to loop over all ifaceobjs again. So we
store their name as they go through get_dependent_ifacenames

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-05-18 17:19:25 +02:00
d8b7a21e42 Merge pull request #204 from BeStateless/support-tos-and-udp-checksum
addons: vxlan: support ToS and udpcsum
2021-04-30 11:40:21 +02:00
e521508b41 addons: vxlan: support ToS and udpcsum 2021-04-29 20:16:46 -06:00
c1d01549a1 Merge pull request #202 from gaaf/usercmd_set_env
addons: usercmds: Set environment just like the original ifupdown
2021-04-20 19:50:23 +02:00
ac645a1a82 addons: usercmds: Set environment just like the original ifupdown
The original ifupdown sets all interface options as IF_<option> environment
variable. Duplicate that behavior for compatibility.
2021-04-20 18:42:40 +02:00
038136754c addons: bond: bond mac should always be inherited from it's first slave
check if the bond mac address is correctly inherited from it's
first slave. There's a case where that might not be happening:
$ ip link show swp1 | grep ether
   link/ether 08:00:27:04:d8:01 brd ff:ff:ff:ff:ff:ff
$ ip link show swp2 | grep ether
   link/ether 08:00:27:04:d8:02 brd ff:ff:ff:ff:ff:ff
$ ip link add dev bond0 type bond
$ ip link set dev swp1 master bond0
$ ip link set dev swp2 master bond0
$ ip link show bond0 | grep ether
   link/ether 08:00:27:04:d8:01 brd ff:ff:ff:ff:ff:ff
$ ip link add dev bond1 type bond
$ ip link set dev swp1 master bond1
$ ip link show swp1 | grep ether
   link/ether 08:00:27:04:d8:01 brd ff:ff:ff:ff:ff:ff
$ ip link show swp2 | grep ether
   link/ether 08:00:27:04:d8:01 brd ff:ff:ff:ff:ff:ff
$ ip link show bond0 | grep ether
   link/ether 08:00:27:04:d8:01 brd ff:ff:ff:ff:ff:ff
$ ip link show bond1 | grep ether
   link/ether 08:00:27:04:d8:01 brd ff:ff:ff:ff:ff:ff
$
ifupdown2 will automatically correct and fix this unexpected behavior

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 21:37:36 +01:00
315f4f03b3 addons: bond: keep link admin up after being removed from bond
with kernel 4.19, slaves that are removed from a bond will be
admin down, this patch makes sure that the links are admin up
if they are part of the "auto" class and link-down yes is not set

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 21:36:15 +01:00
d079ad3fe8 addons: bond: set proto-up on slaves if bond used to be a clag bond or es-bond
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 21:34:50 +01:00
d0d657ed15 addons: bond: add ifname length check in sysfs back up path
When creating a bond, we first use a netlink call, if that
call fails we try to create and setup the bond via sysfs.

If the bond name is longer than 15 chars the netlink call
will fail, we will then enter the sysfs path which creates
the bond by writing to /sys/class/net/bonding_masters. In
this case the bonding driver will simply truncate the bond
name to fit into the 15 chars limit.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 21:33:36 +01:00
28bf72d8cb addons: vlan: new attribute: vlan-bridge-binding
From Mike Manning:
In the case of vlan filtering on bridges, the bridge may also have the
corresponding vlan devices as upper devices. Currently the link state
of vlan devices is transferred from the lower device. So this is up if
the bridge is in admin up state and there is at least one bridge port
that is up, regardless of the vlan that the port is a member of.

The link state of the vlan device may need to track only the state of
the subset of ports that are also members of the corresponding vlan,
rather than that of all ports.

Add a flag to specify a vlan bridge binding mode, by which the link
state is no longer automatically transferred from the lower device,
but is instead determined by the bridge ports that are members of the
vlan.
----

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 21:30:40 +01:00
872e4a6ec2 nlcache: master_slaves data-structure should use lists instead of sets
nlcache used a set to keep a master's slave list. This wasn't the right
choice as sets can't guarantee ordering. We need to keep an ordered list
of ports.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 19:25:25 +01:00
c7c7ce8c4d dhclient: use absolute path for sysfs carrier node
Signed-off-by: Andy Roulin <aroulin@nvidia.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 19:23:12 +01:00
f12bef8ba9 dhclient: check for out variable being None
Fixes: 765075ba392 ("dhclient: wait to start dhcp if carrier is down")
Signed-off-by: Andy Roulin <aroulin@nvidia.com>
2021-01-25 19:20:50 +01:00
1eacb76b3a dhclient: wait to start dhcp if carrier is down
This prevents DHCP requests failures taking time during
boot if the interface isn't up yet. If the interface is
down, dhclient will fail to send packets.

At boot-time, enslaving an interface to vrf flaps it. By
waiting for the interface to come back up before starting
dhclient reduces time to boot.

Reviewed-by: CCR-10987
Closes: CM-32460
Co-developed-by: Nilesh Shinde <nilesh@nvidia.com>
Signed-off-by: Andy Roulin <aroulin@nvidia.com>
2021-01-25 19:20:28 +01:00
dba88be45a template: update error message for python3-mako
since we've updated ifupdown2 to pytho3 the error
message should mention python3-mako and not
python-mako (python2)

Ticket: CM-29621
Reviewed By: Roopa

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 19:17:50 +01:00
adb4386268 addons: dhcp: don't release dhcp lease after timeout
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 19:15:28 +01:00