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

83 Commits

Author SHA1 Message Date
6bd1ac25a8 log: use default chmod for os.mkdir
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-26 12:29:13 +02:00
d2f2cc01e5 update ifupdown2 debug logging to /var/log/ifupdown2
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-26 12:27:05 +02:00
dd29350f7f log: add extra try except when removing log dirs and fix eni.d cp
The extra try/except are necessary just in case something goes wrong
we still want to go through the entire list of extra log dir present
on the system.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-26 12:26:17 +02:00
29ed5855ba ifupdown2.conf: add persistent debug logging feature
enable persistent ifupdown2 debug logs
ifupdown2 will keep debug logs in /etc/network/ifupdown2/logs
by default the last 42 configurations logs will be kept.
 yes     - (default) enable persistent logging (42 configs)
 no      - disable persistent logging
 [2-9]+  - specify how many configuration logs should be stored
enable_persistent_debug_logging=yes

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-26 12:25:49 +02:00
ddb633fe44 Merge pull request #138 from svenauhagen/feature/bondarpcheck
This patch adds the ability to use an ARP IP for the bond check.
2022-05-25 00:23:47 +02:00
fdb535edd1 This patch adds the ability to use an ARP IP for the bond check.
It is only valid for balance-rr and balance-xor.

One Example is:

auto bond0
iface bond0 inet
        bond-slaves ens21 ens22
        bond-mode balance-rr
        bond-arp-interval 100
        bond-arp-ip-target 8.8.8.8
        address 10.10.10.1/24

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
2022-04-30 08:08:07 +02:00
24be632e93 nlcache: add nodad parameter to addr_add 2022-04-05 14:46:13 +02:00
3fd6c20143 Revert "Dad handling" 2022-03-25 14:29:51 +01:00
d7e9168692 nlcache: add nodad parameter to addr_add 2022-03-25 12:23:43 +01:00
24d5192df2 addons: vlan: retry vlan creation if bridge_binding capability is missing
On older ubuntu version bridge_binding is not supported, we can't rely
on `ip link help` to detect this. We have manually check if the first
netlink request is rejected then retry with iproute2.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-02-11 12:33:49 +01:00
cfc34b5b21 Fix adding a static IPv6 default route failed on RA networks
There may be adding a static IPv6 default route failed on networks where
router advertisements are also present.

The flow of up an interface is this:
1. ip link set dev $interface up
2. set sysctl config
3. config ip addr
4. config default ip route

After setting the link up, the kernel might learning an address and a
default route from RA before the default route config. The default route
will fail to be added. If the RA route is expired, and not be refreshed
for some reasons,the system looses IPv6 network connectivity.

Proposed fix is to use "route replace" instead of "route add". When the
RA learned route is still present it gets replaced, when it is not present
the route gets added.

Signed-off-by: Kunkun Li <likunkun@bytedance.com>
2021-10-25 17:08:31 +08:00
1bb6e6f0fb nlcache: fix TypeError: argument of type 'IPNetwork' is not iterable
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-30 11:58:54 +02:00
acfdbff891 nlcache: clean duplicated code (link_add)
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-05 17:00:44 +02:00
b334df6e88 nlcache: update link_set_bridge_info_data_dry_run
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-05 16:59:28 +02:00
9a6a305084 cleanups - upstream sync
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-02 18:20:42 +02:00
ba5437b9ec nlcache: addr_add: convert pointtopoint and broadcast attribute to ipaddress obj
the following config was broken:

auto swp1
iface swp1
      address 10.128.141.37/26
      broadcast 10.128.141.63

error: netlink: swp1: cannot add address 10.128.141.37/26 dev swp1: 'str' object has no attribute 'packed'

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-02 18:15:00 +02:00
f8ed376891 lib: nlcache: new netlink API "link_add" (waits for link creation)
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-02 18:11:09 +02:00
859b8643b6 nlcache: link_set_address: override cache after mac address change is aacked
after a successful mac change we should override our cache so that we don't
keep stale values in cache (in case the cache is queried before the kernel
notification arrives)

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-02 15:24:00 +02:00
9b23b7c684 iproute2: svd: convert vnifilter attr to boolean to cover all case
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:59:25 +02:00
e7ecab23d9 addons: vxlan: refactoring code to allow updating an existing SVD
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:51:12 +02:00
db4371de3c addons: vxlan: error out when an unsupported mix of SVD and TVDs are configured
Currently mixing SVDs and TVDs on the same system is not supported,
regardless of whether they are in the same vlan-aware bridge or
across different ones. NVUE will configure all VNIs as SVDs by
default so this would hopefully only arise if a user edits
/etc/network/interfaces and manages their configuration with ifupdown2.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:08:04 +02:00
eff6613023 lib: iproute2: fix missing bridge_vni_del function
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:05:36 +02:00
abb7644b9c lib: iproute2: batch vni filter commands
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:04:55 +02:00
af8d5db22b addons: vxlan: use new vni filter api to set mcast groups per vni
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 19:00:17 +02:00
8acbc3c523 ifupdown2: lib: dont bring down link during vni filter changes
Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 18:40:52 +02:00
06926b1979 addons: bridge: bridge-vlan-vni-map: remove stale entry from running config
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2021-07-01 17:53:27 +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
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
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
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
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
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
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
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
e521508b41 addons: vxlan: support ToS and udpcsum 2021-04-29 20:16:46 -06: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
5f0ba5190f 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>
2020-08-06 14:35:02 +02:00
ca43693778 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>
2020-08-06 14:32:07 +02:00
792b9a0700 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>
2020-08-06 14:20:41 +02:00
3218f49d81 use "except Exception:" instead of "except:"
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-06-24 01:12:24 +02:00
0e159829a6 lib: iproute2: re-add missing bridge_vlan_add_vid_list method
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-06-18 18:18:00 +02:00
5f6de69fd3 lockfile: return a specific exit code when another instance is already running
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-06-18 18:17:12 +02:00
7b56575ebd nlcache: force_add_slave: don't update internal data-structure if not needed
force_add_slave was designed to be called right after the link_set_master
call to override our internal cache and not wait for the kernel and register
the slave/master relationship in our internal data-structures. It turns
out the kernel can be faster than us here. So an additional check is needed
to make sure we don't do duplicate operations that would result in the
slave being removed from an internal data-structure.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-06-18 18:16:34 +02:00