Commit Graph

1580 Commits

Author SHA1 Message Date
Sam Osterkil
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Sam Osterkil
e521508b41 addons: vxlan: support ToS and udpcsum 2021-04-29 20:16:46 -06:00
Julien Fortin
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
Alex Hermann
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Andy Roulin
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
Andy Roulin
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
Andy Roulin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
a6353bfb74 addons: addressvirtual: sync macvlan forwarding state with lower-device
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 19:12:41 +01:00
Julien Fortin
909377598e addons: mtu: policy: accept integer value for mtu in policy file
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 19:11:01 +01:00
Julien Fortin
190cf3e6eb addons: address: enable ipv6 before adding new address
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2021-01-25 19:10:05 +01:00
Julien Fortin
6860da4441
Merge pull request #180 from CumulusNetworks/issue-179/forwarding-disabled-on-dhcp-bridge
addons: bridge: enable forwarding on dhcp bridges (fixes: #179)
2021-01-25 19:03:58 +01:00
tjjh89017
912b8697d4 networking.service: fix start networking.service before network is marked online
In debian 10, ifupdown2 didn't ensure that it will start before network.target and network-online.target.
after local-fs.target because ifupdown2 need to read config file from local filesystem
Other network services will not start after networking.service and fail because no interface is up.
(e.g isc-dhcp-server, tftp-hpa)
2021-01-20 17:22:24 +08:00
Julien Fortin
0305c4125f
Merge pull request #185 from moepman/cleanup-batman-adv
Cleanup batman adv
2020-11-23 16:06:18 +01:00
Julien Fortin
cd67f88f8f
Merge pull request #186 from kvadrage/switchdev-fixes
addons: bridge: add support for "bridge_always_up_dummy_brport" policy
2020-11-20 17:37:33 +01:00
Alexander Petrovskiy
1b845b1bab 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>
2020-11-20 03:46:59 +03:00
Markus Hauschild
7db69c5b3c 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>
2020-11-19 09:15:15 +01:00
Markus Hauschild
344a97e31d addons: batman_adv: fix netlink call
as suggested by @julienfortin in PR comment

Signed-off-by: Markus Hauschild <markus@moepman.eu>
2020-11-19 09:13:06 +01:00
Julien Fortin
69825bb495 addons: bridge: enable forwarding on dhcp bridges (fixes: #179)
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-11-18 14:19:48 +01:00
Markus Hauschild
1dc2c4a7c2 addons: batman_adv: improve readability
Signed-off-by: Markus Hauschild <markus@moepman.eu>
2020-11-17 15:40:27 +01:00
Markus Hauschild
9436b6cb7a addons: batman_adv: fix unresolved reference
Signed-off-by: Markus Hauschild <markus@moepman.eu>
2020-11-17 15:40:27 +01:00
Markus Hauschild
1d9a8d4f6b addons: batman_adv: cleanup according to PEP8
Signed-off-by: Markus Hauschild <markus@moepman.eu>
2020-11-17 15:40:27 +01:00
Julien Fortin
e40c309ff3
Merge pull request #184 from moepman/fix-batman-adv-str
addons: batman_adv: use universal_newlines
2020-11-17 14:53:04 +01:00
Markus Hauschild
a8ea3ce57b 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>
2020-11-17 00:48:48 +01:00
Julien Fortin
5a3acab3d4
Merge pull request #181 from moepman/fix-vxlan-modinfo
addons: vxlan: fix vxlan-svcnodeip help text
2020-11-16 20:45:46 +01:00
Markus Hauschild
969257a4fb addons: vxlan: fix vxlan-svcnodeip help text
Signed-off-by: Markus Hauschild <markus@moepman.eu>
2020-11-16 18:59:47 +01:00
Piotr Ożarowski
288a88d3e4 bump minimum required debhelper version to 9.20160709
this is required by "--with systemd" in debian/rules
2020-09-16 01:10:00 +02:00
Julien Fortin
bb9e353b8a
Merge pull request #173 from JackSlateur/ip_repr
nlmanager: fix IPAddress's repr, which must return a str
2020-08-28 16:01:19 +02:00
Alexandre Bruyelles
0044f105ef
nlmanager: fix IPAddress's repr, which must return a str
Signed-off-by: Alexandre Bruyelles <abruyelles@odiso.com>
2020-08-27 12:13:55 +02:00
Julien Fortin
c7a0cd032c debian: changelog: updating 3.0.0-1 changelog entry
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-08-06 14:38:41 +02:00
Julien Fortin
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
Julien Fortin
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
Julien Fortin
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
Julien Fortin
a7e5fb2597 addons: vxlan: fix AttributeError: 'NoneType' object has no attribute 'ip'
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-08-06 14:19:58 +02:00