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

92 Commits

Author SHA1 Message Date
a51aad8d60 add support for systemd logging
New CLI option: --systemd
will enabled journalctl logging when ifupdown2 is run in a systemd context

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2023-05-04 13:21:55 +02:00
7c8627f876 SONAR: Specify an exception class to catch or reraise the exception
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2023-05-04 13:21:55 +02:00
10ddf286f3 sonar: lib: nlcache: catch exception only once
Catch this exception only once;
it is already handled by a previous except clause

Ticket: #3035926

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-28 12:14:33 +02:00
b0a7a8bb3e graph: import gvgen class into ifupdown2 package
python2's ifupdown2 used python-gvgen to output the dependency graph in dot
format. There's not python3 version of that package available in debian.
Resulting in: error: main exception: name 'GvGen' is not defined

The package is in fact a single class that is already compatible with python3
According to the license (MIT) we can pull in the code in our own tree.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 15:00:05 +02:00
70263054b3 addons: tunnel: support non-disruptive config change
Current design destroys existing tunnel when a config
change is detected. This behaviour causes traffic loss.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 14:54:41 +02:00
1ac64c41d7 addons: bond: set IFLA_MASTER when updating bond settings
On bond creation and update, ifupdown2 directly caches the netlink
object sent to the kernel. If the bond already exists it overrides
the existing cached object. If the existing bond was enslaved to a
bridge, some bridge vlan data would get purged because the new
netlink object didn't have the IFLA_MASTER attribute (thus tricking
the cache into thinking that the bond got unslaved from the bridge).

Here is a snippet of the bond013 /en/i config in the first topology:

    auto bond013
    iface bond013
        bond-slaves swp1s3
        es-sys-mac 44:38:39:FF:00:02
        bridge-vids 101-144
        bond-lacp-bypass-allow yes
        mstpctl-portadminedge yes
        mstpctl-bpduguard yes

And here in the second topology:

    auto bond013
    iface bond013
          bond-slaves swp1s3
          es-sys-mac 44:38:39:FF:00:01
          bridge-vids 201-210
          bond-lacp-bypass-allow yes
          mstpctl-portadminedge yes
          mstpctl-bpduguard yes

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 14:21:06 +02:00
6a61093d73 bond: support for protodown reason bit settings for clag/frr
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 14:14:39 +02:00
2fbbfa7211 addons: vxlan: vxlan-vni: support vni change on existing config
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 12:17:16 +02:00
0500d5d882 addons: vxlan: add support for l3vxi via vxlan-vni
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-05-27 12:12:17 +02:00
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