]> git.proxmox.com Git - mirror_ifupdown2.git/log
mirror_ifupdown2.git
2 years agoaddons: bridge-vlan-vni-map: add vlan reserved check
Julien Fortin [Sat, 19 Jun 2021 00:43:38 +0000 (02:43 +0200)]
addons: bridge-vlan-vni-map: add vlan reserved check

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: bridge-vlan-vni-map: add more details log error when finding duplicat...
Julien Fortin [Mon, 14 Jun 2021 10:40:58 +0000 (12:40 +0200)]
addons: bridge: bridge-vlan-vni-map: add more details log error when finding duplicated vnis

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: bridge-vlan-vni-map: fix consecutive vni ids mapped to incorrect...
Julien Fortin [Sun, 13 Jun 2021 12:52:34 +0000 (14:52 +0200)]
addons: bridge: bridge-vlan-vni-map: fix consecutive vni ids mapped to incorrect range vids

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: add batching commands for vids add/del
Julien Fortin [Thu, 20 May 2021 11:57:43 +0000 (13:57 +0200)]
addons: bridge: add batching commands for vids add/del

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: fix bridge-vlan-vni-map range processing
Julien Fortin [Thu, 20 May 2021 11:10:20 +0000 (13:10 +0200)]
addons: bridge: fix bridge-vlan-vni-map range processing

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: bridge-vlan-vni-map: fix delta calculation between old and new config
Julien Fortin [Tue, 18 May 2021 14:25:56 +0000 (16:25 +0200)]
addons: bridge: bridge-vlan-vni-map: fix delta calculation between old and new config

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: bridge-vlan-vni-map: remove stale entry from running config
Julien Fortin [Wed, 12 May 2021 15:02:26 +0000 (17:02 +0200)]
addons: bridge: bridge-vlan-vni-map: remove stale entry from running config

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: don't add old_ifaceobjs to internal MVAB list
Julien Fortin [Thu, 6 May 2021 14:50:34 +0000 (16:50 +0200)]
addons: bridge: don't add old_ifaceobjs to internal MVAB list

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: bridge_vlan_aware_list is now a set()
Julien Fortin [Wed, 14 Apr 2021 22:33:31 +0000 (00:33 +0200)]
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>
2 years agolib: iproute2: add vxlan bridge default fdb entries with state permanent
Roopa Prabhu [Tue, 4 May 2021 04:42:09 +0000 (21:42 -0700)]
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>
2 years agolib: iproute2: use self flag when adding svd fdb entries
Roopa Prabhu [Wed, 21 Apr 2021 19:18:31 +0000 (12:18 -0700)]
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>
2 years agoiproute2: link_set_address: dont check the cache on link up
Julien Fortin [Tue, 2 Mar 2021 12:20:06 +0000 (13:20 +0100)]
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>
2 years agoaddons: vxlan: add support for new attribute: vxlan-remoteip-map
Julien Fortin [Tue, 11 May 2021 12:31:56 +0000 (14:31 +0200)]
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>
2 years agoaddons: vxlan: process mcast groups after the addition of vnifilter
Roopa Prabhu [Fri, 30 Apr 2021 21:17:40 +0000 (14:17 -0700)]
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>
2 years agobridge: support values of auto, auto+, auto- for vni in bridge-vlan-vni-map
Roopa Prabhu [Wed, 14 Apr 2021 03:47:02 +0000 (20:47 -0700)]
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>
2 years agoaddons: vxlan: ifquery-check support for vxlan-mcastgrp-map
Julien Fortin [Fri, 23 Apr 2021 00:03:22 +0000 (02:03 +0200)]
addons: vxlan: ifquery-check support for vxlan-mcastgrp-map

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agovxlan: fix ttl for single vxlan device
Roopa Prabhu [Wed, 14 Apr 2021 06:19:12 +0000 (23:19 -0700)]
vxlan: fix ttl for single vxlan device

Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: vxlan: add support for vni/IP range and multi lines on SVD mcast group config
Quentin Zilberberg [Sun, 4 Apr 2021 05:24:36 +0000 (22:24 -0700)]
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>
2 years agoaddons: vxlan: add support for vni filter on single vxlan device
Roopa Prabhu [Wed, 24 Mar 2021 21:20:58 +0000 (14:20 -0700)]
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>
2 years agoaddons: vxlan: improve mcastgrp-map handling of fdb entries
Julien Fortin [Mon, 22 Mar 2021 17:53:49 +0000 (18:53 +0100)]
addons: vxlan: improve mcastgrp-map handling of fdb entries

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: vxlan: add support for vxlan-mcastgrp-map with ipmr-lo dummy physdev
Julien Fortin [Tue, 16 Mar 2021 23:04:32 +0000 (00:04 +0100)]
addons: vxlan: add support for vxlan-mcastgrp-map with ipmr-lo dummy physdev

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: vxlan: single-device: update log.warning when device already exists
Julien Fortin [Thu, 10 Sep 2020 14:50:54 +0000 (16:50 +0200)]
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>
2 years agoaddons: bridge: bridge-vlan-vni-map: use vlan and vni ranges within iproute2 cmds
Julien Fortin [Tue, 23 Mar 2021 15:11:28 +0000 (16:11 +0100)]
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>
2 years agoaddons: bridge: add multi bridge support when bridge_set_static_mac_from_port=yes
Julien Fortin [Tue, 8 Dec 2020 01:36:22 +0000 (02:36 +0100)]
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>
2 years agoaddons: bridge: bridge-vlan-vni-map: fix display error vnis=vlans instead of vlans...
Julien Fortin [Mon, 31 May 2021 13:27:20 +0000 (15:27 +0200)]
addons: bridge: bridge-vlan-vni-map: fix display error vnis=vlans instead of vlans=vnis

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: ifquery-running support for bridge-vlan-vni-map
Julien Fortin [Thu, 22 Apr 2021 20:54:20 +0000 (22:54 +0200)]
addons: bridge: ifquery-running support for bridge-vlan-vni-map

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge-vlan-vni-map: support multiple vni mapping per entry
Julien Fortin [Thu, 10 Sep 2020 15:23:34 +0000 (17:23 +0200)]
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>
2 years agoaddons: bridge: bridge-vlan-vni-map: fix: not enough arguments for format string
Julien Fortin [Thu, 10 Sep 2020 14:49:24 +0000 (16:49 +0200)]
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>
2 years agoaddons: bridge: check if bridge mac is already inherited from a port
Julien Fortin [Thu, 3 Sep 2020 13:49:27 +0000 (15:49 +0200)]
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>
2 years agoaddons: bridge: bridge-arp-nd-suppress should show up on ifquery --with-default if...
Julien Fortin [Fri, 14 May 2021 14:07:37 +0000 (16:07 +0200)]
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>
2 years agoclag: bridge l3vni: move bridge vxlan l3vni code to parent class + refactoring
Julien Fortin [Thu, 15 Apr 2021 01:56:31 +0000 (03:56 +0200)]
clag: bridge l3vni: move bridge vxlan l3vni code to parent class + refactoring

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agobridge.py: remove extra empty line in header
Julien Fortin [Wed, 30 Jun 2021 15:05:56 +0000 (17:05 +0200)]
bridge.py: remove extra empty line in header

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: fix bridge arp vni vlan syntax-check
Julien Fortin [Tue, 8 Jun 2021 13:40:15 +0000 (15:40 +0200)]
addons: bridge: fix bridge arp vni vlan syntax-check

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: v2: arp suppression enabled when no vlan is configured
Julien Fortin [Tue, 15 Jun 2021 16:20:06 +0000 (18:20 +0200)]
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>
2 years agoaddons: bridge: skip bridge arp vni vlan for single vxlan device
Julien Fortin [Mon, 12 Apr 2021 20:34:57 +0000 (22:34 +0200)]
addons: bridge: skip bridge arp vni vlan for single vxlan device

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: detect and warn when arp suppression is enabled and there is no vlan...
Julien Fortin [Tue, 2 Mar 2021 16:25:01 +0000 (17:25 +0100)]
addons: bridge: detect and warn when arp suppression is enabled and there is no vlan configured

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: detect VXLAN mis-config VNI "bridge-learning=on" and print log message
Julien Fortin [Mon, 14 Sep 2020 11:28:07 +0000 (13:28 +0200)]
addons: bridge: detect VXLAN mis-config VNI "bridge-learning=on" and print log message

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: bridge: enable ipv6 on SVD brport
Julien Fortin [Thu, 17 Jun 2021 21:37:35 +0000 (23:37 +0200)]
addons: bridge: enable ipv6 on SVD brport

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agocosmetic: ifupdownmain: remove empty line (pep8)
Julien Fortin [Wed, 30 Jun 2021 14:43:41 +0000 (16:43 +0200)]
cosmetic: ifupdownmain: remove empty line (pep8)

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoifupdownmain: add "all" parameter to get_all_ifaceobjs
Julien Fortin [Tue, 6 Apr 2021 21:30:34 +0000 (23:30 +0200)]
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>
2 years agoifupdownmain: skip bridge vlan when checking running config
Julien Fortin [Tue, 6 Apr 2021 22:20:23 +0000 (00:20 +0200)]
ifupdownmain: skip bridge vlan when checking running config

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoifupdownmain: add module name in get_dependent warning
Julien Fortin [Thu, 18 Feb 2021 15:09:33 +0000 (16:09 +0100)]
ifupdownmain: add module name in get_dependent warning

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2 years agoaddons: vxlan: inherit clagd-vxlan-anycast-ip from lo for clag vxlans (introduces...
Julien Fortin [Thu, 4 Feb 2021 04:23:22 +0000 (05:23 +0100)]
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>
2 years agoaddons: address: remove stale fdb entry for svi (when hwaddress is used)
Julien Fortin [Mon, 28 Jun 2021 23:07:48 +0000 (01:07 +0200)]
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>
2 years agoaddons: address: new policy: check_l3_svi_ip_forwarding
Julien Fortin [Fri, 7 May 2021 01:06:35 +0000 (03:06 +0200)]
addons: address: new policy: check_l3_svi_ip_forwarding

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: address: warn user if L3-SVI is configured with "ip-forward off"
Julien Fortin [Thu, 8 Apr 2021 00:07:04 +0000 (02:07 +0200)]
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>
2 years agoaddons: vlan: check vlan-id misconfiguration and print warning
Julien Fortin [Sat, 12 Dec 2020 00:20:57 +0000 (01:20 +0100)]
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>
2 years agoaddons: addressvirtual: check macvlan interface name lenght and war if len > 15
Julien Fortin [Thu, 13 May 2021 17:52:52 +0000 (19:52 +0200)]
addons: addressvirtual: check macvlan interface name lenght and war if len > 15

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoaddons: address: raise exception when detecting an invalid ip address
Julien Fortin [Tue, 6 Apr 2021 23:04:15 +0000 (01:04 +0200)]
addons: address: raise exception when detecting an invalid ip address

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2 years agoMerge pull request #210 from dabukalam/correct-bond-regex
Julien Fortin [Thu, 17 Jun 2021 11:59:22 +0000 (13:59 +0200)]
Merge pull request #210 from dabukalam/correct-bond-regex

Correct typo in bond-slaves regex example

2 years agoaddons: bond: correct bond-slaves regex example
Danny Abukalam [Wed, 16 Jun 2021 01:00:56 +0000 (21:00 -0400)]
addons: bond: correct bond-slaves regex example

Signed-off-by: Danny Abukalam <danny@softiron.com>
2 years agoMerge pull request #209 from BeStateless/feature/allow-validrange-on-number-keyword
Julien Fortin [Tue, 1 Jun 2021 20:47:03 +0000 (22:47 +0200)]
Merge pull request #209 from BeStateless/feature/allow-validrange-on-number-keyword

Support value-in-range with <number> keyword

2 years agoSupport value-in-range with <number> keyword
Sam Osterkil [Tue, 1 Jun 2021 19:45:34 +0000 (13:45 -0600)]
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.

2 years agoaddons: vxlan: vxlan-tos, vxlan-udp-csum refactoring and fixes
Julien Fortin [Thu, 20 May 2021 22:01:15 +0000 (00:01 +0200)]
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>
3 years agoaddons: bridge: fix error: write() argument must be str, not int
Julien Fortin [Wed, 7 Apr 2021 21:24:35 +0000 (23:24 +0200)]
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>
3 years agoaddons: bridge: bridge-access checks are not necessary for single vxlan devices
Julien Fortin [Thu, 18 Mar 2021 15:10:18 +0000 (16:10 +0100)]
addons: bridge: bridge-access checks are not necessary for single vxlan devices

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
3 years agoaddons: bridge: fix bridge-vlan-vni-map example in modinfo
Julien Fortin [Thu, 22 Apr 2021 20:39:29 +0000 (22:39 +0200)]
addons: bridge: fix bridge-vlan-vni-map example in modinfo

Ticket: #2623398
Reviewed By: PR#94

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
3 years agoaddons: vrf: removing extra \n from log messages
Julien Fortin [Thu, 29 Apr 2021 17:09:24 +0000 (19:09 +0200)]
addons: vrf: removing extra \n from log messages

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
3 years agoaddons: bridge: skip bridge-bridgeprio if mstpctl-treeprio is configured on the bridge
Julien Fortin [Tue, 16 Feb 2021 17:42:47 +0000 (18:42 +0100)]
addons: bridge: skip bridge-bridgeprio if mstpctl-treeprio is configured on the bridge

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agoadd support for new address policy: 'ip_blacklist'
Julien Fortin [Fri, 9 Apr 2021 00:59:46 +0000 (02:59 +0200)]
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>
3 years agolib: Addon: add new Bridge class with member "bridge_vlan_aware_list"
Julien Fortin [Wed, 7 Apr 2021 21:25:24 +0000 (23:25 +0200)]
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>
3 years agoMerge pull request #204 from BeStateless/support-tos-and-udp-checksum
Julien Fortin [Fri, 30 Apr 2021 09:40:21 +0000 (11:40 +0200)]
Merge pull request #204 from BeStateless/support-tos-and-udp-checksum

addons: vxlan: support ToS and udpcsum

3 years agoaddons: vxlan: support ToS and udpcsum
Sam Osterkil [Thu, 29 Apr 2021 18:19:22 +0000 (12:19 -0600)]
addons: vxlan: support ToS and udpcsum

3 years agoMerge pull request #202 from gaaf/usercmd_set_env
Julien Fortin [Tue, 20 Apr 2021 17:50:23 +0000 (19:50 +0200)]
Merge pull request #202 from gaaf/usercmd_set_env

addons: usercmds: Set environment just like the original ifupdown

3 years agoaddons: usercmds: Set environment just like the original ifupdown
Alex Hermann [Tue, 20 Apr 2021 16:42:40 +0000 (18:42 +0200)]
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.

3 years agoaddons: bond: bond mac should always be inherited from it's first slave
Julien Fortin [Fri, 2 Oct 2020 12:02:18 +0000 (14:02 +0200)]
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>
3 years agoaddons: bond: keep link admin up after being removed from bond
Julien Fortin [Mon, 7 Sep 2020 10:40:40 +0000 (12:40 +0200)]
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>
3 years agoaddons: bond: set proto-up on slaves if bond used to be a clag bond or es-bond
Julien Fortin [Wed, 9 Sep 2020 12:48:58 +0000 (14:48 +0200)]
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>
3 years agoaddons: bond: add ifname length check in sysfs back up path
Julien Fortin [Mon, 10 Aug 2020 14:02:13 +0000 (16:02 +0200)]
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>
3 years agoaddons: vlan: new attribute: vlan-bridge-binding
Julien Fortin [Thu, 16 Jul 2020 23:08:59 +0000 (01:08 +0200)]
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>
3 years agonlcache: master_slaves data-structure should use lists instead of sets
Julien Fortin [Wed, 25 Nov 2020 01:09:15 +0000 (02:09 +0100)]
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>
3 years agodhclient: use absolute path for sysfs carrier node
Andy Roulin [Tue, 5 Jan 2021 22:23:52 +0000 (14:23 -0800)]
dhclient: use absolute path for sysfs carrier node

Signed-off-by: Andy Roulin <aroulin@nvidia.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agodhclient: check for out variable being None
Andy Roulin [Mon, 4 Jan 2021 22:07:11 +0000 (14:07 -0800)]
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>
3 years agodhclient: wait to start dhcp if carrier is down
Andy Roulin [Tue, 1 Dec 2020 20:45:22 +0000 (20:45 +0000)]
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>
3 years agotemplate: update error message for python3-mako
Julien Fortin [Tue, 8 Sep 2020 22:53:53 +0000 (00:53 +0200)]
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>
3 years agoaddons: dhcp: don't release dhcp lease after timeout
Julien Fortin [Mon, 26 Oct 2020 01:15:29 +0000 (02:15 +0100)]
addons: dhcp: don't release dhcp lease after timeout

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agoaddons: addressvirtual: sync macvlan forwarding state with lower-device
Julien Fortin [Fri, 18 Dec 2020 03:07:36 +0000 (04:07 +0100)]
addons: addressvirtual: sync macvlan forwarding state with lower-device

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agoaddons: mtu: policy: accept integer value for mtu in policy file
Julien Fortin [Fri, 11 Sep 2020 16:25:36 +0000 (18:25 +0200)]
addons: mtu: policy: accept integer value for mtu in policy file

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agoaddons: address: enable ipv6 before adding new address
Julien Fortin [Mon, 28 Sep 2020 15:59:27 +0000 (17:59 +0200)]
addons: address: enable ipv6 before adding new address

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agoMerge pull request #180 from CumulusNetworks/issue-179/forwarding-disabled-on-dhcp...
Julien Fortin [Mon, 25 Jan 2021 18:03:58 +0000 (19:03 +0100)]
Merge pull request #180 from CumulusNetworks/issue-179/forwarding-disabled-on-dhcp-bridge

addons: bridge: enable forwarding on dhcp bridges (fixes: #179)

3 years agoMerge pull request #185 from moepman/cleanup-batman-adv
Julien Fortin [Mon, 23 Nov 2020 15:06:18 +0000 (16:06 +0100)]
Merge pull request #185 from moepman/cleanup-batman-adv

Cleanup batman adv

3 years agoMerge pull request #186 from kvadrage/switchdev-fixes
Julien Fortin [Fri, 20 Nov 2020 16:37:33 +0000 (17:37 +0100)]
Merge pull request #186 from kvadrage/switchdev-fixes

addons: bridge: add support for "bridge_always_up_dummy_brport" policy

3 years agoaddons: bridge: add support for "bridge_always_up_dummy_brport" policy
Alexander Petrovskiy [Fri, 20 Nov 2020 00:46:59 +0000 (03:46 +0300)]
addons: bridge: add support for "bridge_always_up_dummy_brport" policy

User may want to have persistent name of dummy port if
"bridge-always-up" option is enabled.
Now the name can be defined in "bridge_always_up_dummy_brport" policy
for bridge module.

Signed-off-by: Alexander Petrovskiy <alexpe@nvidia.com>
3 years agoaddons: batman_adv: drop unnecessary exception clause
Markus Hauschild [Thu, 19 Nov 2020 08:15:15 +0000 (09:15 +0100)]
addons: batman_adv: drop unnecessary exception clause

The exception could have never come from read_file_oneline, also value
was an undefined variable, so it would have thrown an exception while
handling an exception thus being useless anyway.

Signed-off-by: Markus Hauschild <markus@moepman.eu>
3 years agoaddons: batman_adv: fix netlink call
Markus Hauschild [Thu, 19 Nov 2020 08:13:06 +0000 (09:13 +0100)]
addons: batman_adv: fix netlink call

as suggested by @julienfortin in PR comment

Signed-off-by: Markus Hauschild <markus@moepman.eu>
3 years agoaddons: bridge: enable forwarding on dhcp bridges (fixes: #179)
Julien Fortin [Mon, 16 Nov 2020 15:22:31 +0000 (16:22 +0100)]
addons: bridge: enable forwarding on dhcp bridges (fixes: #179)

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agoaddons: batman_adv: improve readability
Markus Hauschild [Tue, 17 Nov 2020 14:38:19 +0000 (15:38 +0100)]
addons: batman_adv: improve readability

Signed-off-by: Markus Hauschild <markus@moepman.eu>
3 years agoaddons: batman_adv: fix unresolved reference
Markus Hauschild [Tue, 17 Nov 2020 00:05:54 +0000 (01:05 +0100)]
addons: batman_adv: fix unresolved reference

Signed-off-by: Markus Hauschild <markus@moepman.eu>
3 years agoaddons: batman_adv: cleanup according to PEP8
Markus Hauschild [Tue, 17 Nov 2020 00:00:24 +0000 (01:00 +0100)]
addons: batman_adv: cleanup according to PEP8

Signed-off-by: Markus Hauschild <markus@moepman.eu>
3 years agoMerge pull request #184 from moepman/fix-batman-adv-str
Julien Fortin [Tue, 17 Nov 2020 13:53:04 +0000 (14:53 +0100)]
Merge pull request #184 from moepman/fix-batman-adv-str

addons: batman_adv: use universal_newlines

3 years agoaddons: batman_adv: use universal_newlines
Markus Hauschild [Mon, 16 Nov 2020 23:48:48 +0000 (00:48 +0100)]
addons: batman_adv: use universal_newlines

This prevents the error: a bytes-like object is required, not 'str'

Signed-off-by: Markus Hauschild <markus@moepman.eu>
3 years agoMerge pull request #181 from moepman/fix-vxlan-modinfo
Julien Fortin [Mon, 16 Nov 2020 19:45:46 +0000 (20:45 +0100)]
Merge pull request #181 from moepman/fix-vxlan-modinfo

addons: vxlan: fix vxlan-svcnodeip help text

3 years agoaddons: vxlan: fix vxlan-svcnodeip help text
Markus Hauschild [Mon, 16 Nov 2020 17:59:47 +0000 (18:59 +0100)]
addons: vxlan: fix vxlan-svcnodeip help text

Signed-off-by: Markus Hauschild <markus@moepman.eu>
3 years agobump minimum required debhelper version to 9.20160709
Piotr Ożarowski [Tue, 15 Sep 2020 10:48:13 +0000 (12:48 +0200)]
bump minimum required debhelper version to 9.20160709

this is required by "--with systemd" in debian/rules

3 years agoMerge pull request #173 from JackSlateur/ip_repr
Julien Fortin [Fri, 28 Aug 2020 14:01:19 +0000 (16:01 +0200)]
Merge pull request #173 from JackSlateur/ip_repr

nlmanager: fix IPAddress's repr, which must return a str

3 years agonlmanager: fix IPAddress's repr, which must return a str
Alexandre Bruyelles [Thu, 27 Aug 2020 10:13:55 +0000 (12:13 +0200)]
nlmanager: fix IPAddress's repr, which must return a str

Signed-off-by: Alexandre Bruyelles <abruyelles@odiso.com>
3 years agodebian: changelog: updating 3.0.0-1 changelog entry
Julien Fortin [Thu, 6 Aug 2020 12:38:41 +0000 (14:38 +0200)]
debian: changelog: updating 3.0.0-1 changelog entry

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agonlcache: link_del: move log.info after get_ifindex check
Julien Fortin [Fri, 26 Jun 2020 12:49:24 +0000 (14:49 +0200)]
nlcache: link_del: move log.info after get_ifindex check

if the link doesn't exists get_ifindex will raise an exception
new code in the bridge module simply call link_del on a dummy port
that may not exists. It was a bit confusing to see the log.info
stating that a port was getting removed...

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agoaddons: vxlan: new attribute: vxlan-mcastgrp-map
Julien Fortin [Thu, 6 Aug 2020 12:29:28 +0000 (14:29 +0200)]
addons: vxlan: new attribute: vxlan-mcastgrp-map

"vxlan-mcastgrp-map": {
    "help": "vxlan multicast group for single-vxlan device",
    "validvals": ["<number-ipv4-list>"],
    "example": ["vxlan-mcastgrp-map 1000=239.1.1.100 1001=239.1.1.200"],
}

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
3 years agoaddons: vxlan: add vxlan-mcastgrp support for single-vxlan device
Julien Fortin [Mon, 13 Jul 2020 15:27:25 +0000 (17:27 +0200)]
addons: vxlan: add vxlan-mcastgrp support for single-vxlan device

this patch adds support for the vxlan-mcastgrp attribute on single
vxlan device. Prior to this commit the vxlan-mcastgrp was only
applied to regular vxlans.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>