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

1675 Commits

Author SHA1 Message Date
19b0c19bdf addons: bridge: don't add old_ifaceobjs to internal MVAB list
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 17:48:28 +02:00
995c38e29a addons: bridge: bridge_vlan_aware_list is now a set()
in the case of ifreload bridge.py:get_dependent is entered twice,
once for the old ifaceobjs and once for the new ones. Thus adding
bridges twice to the list. Having a set will prevent this issue.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 17:45:59 +02:00
c38ff73d90 lib: iproute2: add vxlan bridge default fdb entries with state permanent
This is to make it consistent with default entries added
by control plane (eg FRR E-VPN)

Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 17:37:43 +02:00
f3229eecaa lib: iproute2: use self flag when adding svd fdb entries
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 17:37:26 +02:00
0cb747dd9e iproute2: link_set_address: dont check the cache on link up
To change the mac address of the device we need to set it down,
then make the change, then bring it back up. Thus we don't need
to check the cache before bringing the device back up.

Also adding a TODO: link_up/down should check if we are running
in a batch context, if so the cache shouldn't be checked to avoid
situation like this.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:59:03 +02:00
66eb9ce3c5 addons: vxlan: add support for new attribute: vxlan-remoteip-map
syntax:
vxlan-remoteip-map 1000-1005=10.0.0.1,10.0.0.42-10.0.0.45,10.0.0.90-10.0.0.95
vxlan-remoteip-map vni-range=ip-range,comma-separated

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:42:48 +02:00
8e167b9e32 addons: vxlan: process mcast groups after the addition of vnifilter
The pre-mature setting of mcast fdbs led to inconsistent state in
mcast grp registration resulting in a deadlock seen in #2638104

more kernel changes towards #2638104 are in progress

Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:37:26 +02:00
7f0310a7a5 bridge: support values of auto, auto+, auto- for vni in bridge-vlan-vni-map
<vlan>=<vni>
<vlan>=auto  /* sets vni = vlan */
<vlan>=auto+2 /* sets vni = vlan+2 */
<vlan>=auto-2 /* sets vni = vlan-2 */

example:
$ifquery vxlan1
auto vxlan1
iface vxlan1
        vxlan-local-tunnelip 27.0.0.30
        bridge-vlan-vni-map 1000-1009=auto+2 2000-2020=auto-2
        mstpctl-portbpdufilter yes
        mstpctl-bpduguard yes

$ifup -v vxlan1
...
info: executing /sbin/bridge -force -batch - [vlan add vid 1000-1009 dev
vxlan1
vlan add dev vxlan1 vid 1000-1009 tunnel_info id 1002-1011
vlan add vid 2000-2020 dev vxlan1
vlan add dev vxlan1 vid 2000-2020 tunnel_info id 1998-2018]
...

changes include:
- supporting the new syntax
- moved vlan vni map handling into a utility function
to be used by bridge tunnel_info and vxlan vnifilter

Reviewed by: slaffer, david marshal, qzil, julien
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:36:46 +02:00
e6edcd2113 addons: vxlan: ifquery-check support for vxlan-mcastgrp-map
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:34:37 +02:00
9144496d01 vxlan: fix ttl for single vxlan device
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:33:29 +02:00
6015cce25b addons: vxlan: add support for vni/IP range and multi lines on SVD mcast group config
vxlan-mcastgrp-map config enhancements:
 - support for multi-line vxlan multicast group config.
 - support for vni range config.
 - support for mcast grp range config.
 - support for mcast network config.

Example:
    vxlan-mcastgrp-map 10001=239.5.2.1
    vxlan-mcastgrp-map 10002=239.5.2.2
    vxlan-mcastgrp-map 10003=239.5.2.3
    vxlan-mcastgrp-map 10005-10008=239.10.39.121
    vxlan-mcastgrp-map 10010-10020=239.10.39.152-239.10.39.162
    vxlan-mcastgrp-map 10005-10002=239.10.0.0/24

Reviewed-by: Julien Fortin <jfortin@nvidia.com>, Roopa Prabhu <roopa@nvidia.com>, Scott Laffer <slaffer@nvidia.com>
Signed-off-by: Scott Laffer <slaffer@nvidia.com>, Quentin Zilberberg <qzil@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:28:52 +02:00
84c47c4ff0 addons: vxlan: add support for vni filter on single vxlan device
- create single vxlan device with vnifilter flag
- install vni filter with vnis from bridge-vxlan-vni-map
- vni filter can only be applied when the vxlan interface
is in down state
- toggling of vni filter is unsupported (maybe in the future)
- vni filter on a single vxlan or collect metadata/external
device is a new kernel feature yet to be upstreamed
- move vlan/vni id math helpers to utils.py

Reviewed-by: Julien Fortin <jfortin@nvidia.com>
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:27:45 +02:00
56f3434979 addons: vxlan: improve mcastgrp-map handling of fdb entries
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:24:32 +02:00
1609696fe3 addons: vxlan: add support for vxlan-mcastgrp-map with ipmr-lo dummy physdev
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:23:51 +02:00
aa4c8a2d94 addons: vxlan: single-device: update log.warning when device already exists
updating an existing singe-vxlan-device is not supported yet, we should warn
the user accordingly.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 23:21:06 +02:00
8515db2733 addons: bridge: bridge-vlan-vni-map: use vlan and vni ranges within iproute2 cmds
Instead of exploding vlans and vnis ranges we can simply pass those ranges to iproute2
which will reduce the load on ifupdown2 side and scale better

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 18:16:07 +02:00
8b99615b83 addons: bridge: add multi bridge support when bridge_set_static_mac_from_port=yes
The policy bridge_set_static_mac_from_port was added to ifupdown2 back when we didn't
support a mix of traditional and vlan-aware bridges. The code wasn't revisited after
such config was allowed on the system.

how to repro:

- set bridge_set_static_mac_from_port=yes in module_globals of:
/var/lib/ifupdown2/policy.d/bridge.json

auto br1
iface br1
    bridge-vlan-aware no
    bridge-stp off
    bridge-ports swp1

auto bridge
iface bridge
    bridge-ports swp7
    bridge-vids 10
    bridge-vlan-aware yes

auto vlan10
iface vlan10
    address 192.168.0.20/32
    vlan-id 10
    vlan-raw-device bridge

br1 and bridge will share the same mac address (swp1's mac).

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 18:11:25 +02:00
31bddf7647 addons: bridge: bridge-vlan-vni-map: fix display error vnis=vlans instead of vlans=vnis
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 18:06:02 +02:00
d42c5f307e addons: bridge: ifquery-running support for bridge-vlan-vni-map
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-06-30 18:05:23 +02:00
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