Julien Fortin [Wed, 13 May 2020 14:58:24 +0000 (16:58 +0200)]
addons: dchp: add debug logs and retry mechanism for dhclient (controled by policy)
ifupdown2 now tries to monitor the dhclient call to see if an ip address was
successfully assigned on the requested device. The number of retry can be
customized using the "dhclient_retry_on_failure" policy variable (which defaults to 0)
This commit also add debugging capabilities by automatically enabling sysloging when
configuring dhcp at boot (with PERFMODE option).
Julien Fortin [Sat, 2 May 2020 17:14:09 +0000 (19:14 +0200)]
ifupdownmain: syntax-check: l2protocol-tunnel: replace regex with str.split()
Seems like the regex module might be behave a little bit different in python3.
The regexes used to validate l2protocol-tunnel were returning incorrect lists:
addons: addressvirtual: add link_kind check before deleting stale macvlan device
In the addressvirtual module we have some code that checks if stale macvlans should
be deleted (when the address-virtual or vrrp keywords are removed from the config).
To find those stale macvlans we basically do a glob search in /sys/class/net/ with
the macvlan prefix (ifname) defined by ifupdown2: '%s-v' % ifaceobj.name[0:13], which
for a device foo would create macvlans named foo-v0...foo-vN.
In this particular case we have a vxlan named: sha3szx4-vpn, which gets matched
and removed without actually checking if this device is a macvlan or not.
This commit adds a link_kind check to ensure that we are only removing macvlans.
Julien Fortin [Wed, 13 May 2020 18:27:21 +0000 (20:27 +0200)]
addons: bond: add support for es-sys-mac and es-bonds
ES bonds have the same "init state" requirements as CLAG bonds -
1. A bond needs to be designated as an "es-bond" for this purpose.
For clag-bonds we used "clag-id" attr (to designate a bond as a "clag-bond").
For ES bonds we will use "es-sys-mac" attr.
2. Slaves added to an "ES bond" must have protodown-on.
This is again similar to CLAG bonds
3. And vice-versa i.e. when a slave is removed from an "es-bond",
protodown-on must be cleared.
4. When es-sys-mac is first set on a bond, all the bond-slaves must be
placed in "protodown-on" state. This is needed whether FRR is running at that point or not.
nlmanager: ipnetwork: don't set prefixlen flag if prefix has default value
nlmanager: ipnetwork: fix 'IPv4Address' object has no attribute 'split' exception
nlpacket: use IP[v4|6]Address object when network mask is not provided or needed
nlpacket: AttributeIPAddress: fix decode handler for Routes
During the python2 to 3 migration there was some refactoring
Seems like some code specific to Route-decoding was removed
This patch is fixing the issue by re-adding this code and
tweaking it a little bit (to make it nice and clean :))
this feature doesn't seem to be working anyway. This can be revisited in the
future but this allows us to drop the python3-argcomplete dependency for now
addons: bond: refactor code to not use python3 set
Python3 sets are using the python hash seed to generate random hashes
which makes the sets ordering different everytime. In our case we need
to honor the user configuration (first device should be enslaved first)
Julien Fortin [Thu, 26 Mar 2020 02:02:53 +0000 (03:02 +0100)]
Merge branch 'master' into python3
* master:
addons: address: process MTU before addrgen and adddresses
ifupdownmain: support for marking interfaces as mgmt interfaces
addons: bridge: fix TypeError: sequence item 0: expected string, int found
addons: bridge: set bridge MTU after bridge creation addons: bridge: get bridge MTU from address policy not bridge
addons: mstpctl: check mstpctl-stp and bridge-stp and fix bridge cache update
lib: nlcache: fix dry_run exception
addons: address: add support for a separate default mtu policy for eth interfaces
debian: changelog: new 2.0.2-1 entry
addons: ethtool: add support for "ethtool_ignore_errors" policy
LinkUtils: mac_str_to_int: fix string to int conversion
addons: dhcp: if mgmt vrf context exec dhclient in default vrf
Julien Fortin [Wed, 18 Mar 2020 03:17:18 +0000 (04:17 +0100)]
addons: mstpctl: check mstpctl-stp and bridge-stp and fix bridge cache update
When an stp is enabled on an existing bridge mstpctl attributes are not always
configured by ifreload. This is due to a timing issue (cache) and some issue in
the mstpctl addon.
- Cache: when changing an existing bridge (done via netlink) we wait for the
kernel ack but we don't update our current cache with the new bridge attributes
This is bad because it means that the bridge cache data are stale until we
receive the notification from the kernel.
- Mstp addon: mstpctl-stp was deprecated in favor of bridge-stp, but in some
place, the mstpctl.py code checks for mstpctl-stp but not for bridge-stp. This
commit fixes the area related to this issue but this should be revisited in
a later commit
seems like when updating a method, it's associated dry-run method wasn't
updated accordingly. Maybe there is a way to programmatically check that
I will look into it.
warning: bridge: skipping port X invalid ether addr
warning: interface not recognized - please check interface configuration
Won't show on dry-run anymore
Log info for commands executed with utils.exec_command() weren't prefixed with
DRY-RUN.
Julien Fortin [Wed, 4 Mar 2020 15:16:30 +0000 (16:16 +0100)]
Merge branch 'master' into master-next
* master:
addons: ethtool: add support for "ethtool_ignore_errors" policy
LinkUtils: mac_str_to_int: fix string to int conversion
addons: dhcp: if mgmt vrf context exec dhclient in default vrf
don't change interface forwarding value if not defined
classic ifupdown don't change forwarding value if not defined in /etc/network/interfaces (don't even support it).
Currently ifupdown2 behaviour is to turn forwarding off when not defined. (and break sysctl manual enabling (net.ipv4.ip_forward = 1, net.ipv4.conf.all.forwarding = 1, net.ipv4.conf.default.forwarding = 1
on restart or reload).
Better to not change value when not defined, and keep user manual config.
seems like when updating a method, it's associated dry-run method wasn't
updated accordingly. Maybe there is a way to programmatically check that
I will look into it.
warning: bridge: skipping port X invalid ether addr
warning: interface not recognized - please check interface configuration
Won't show on dry-run anymore
Log info for commands executed with utils.exec_command() weren't prefixed with
DRY-RUN.
Julien Fortin [Fri, 14 Feb 2020 01:36:36 +0000 (02:36 +0100)]
nlpacket: AttributeIPAddress: fix decode handler for Routes
During the python2 to 3 migration there was some refactoring
Seems like some code specific to Route-decoding was removed
This patch is fixing the issue by re-adding this code and
tweaking it a little bit (to make it nice and clean :))
Julien Fortin [Mon, 3 Feb 2020 16:18:57 +0000 (17:18 +0100)]
Merge branch 'master-next' into python3
* master-next:
Add XFRM to IFLA_INFO_KIND and reverse change to iproute2 class.
This patch fixes the XFRM addon for ifupdown2 version 2. The nlpacket for XFRM had a bug, I also changed iproute2 to add the XFRM interface to the local cache after creation. Since XFRM has no IFLA_LINKINFO I made the argument optional. Otherwise no further operation will be done like adding an IP.
Sven Auhagen [Mon, 3 Feb 2020 13:23:44 +0000 (14:23 +0100)]
This patch fixes the XFRM addon for ifupdown2 version 2.
The nlpacket for XFRM had a bug, I also changed iproute2 to add
the XFRM interface to the local cache after creation.
Since XFRM has no IFLA_LINKINFO I made the argument optional.
Otherwise no further operation will be done like adding an IP.
I also removed an unecessary variable in the addon.
Signed-off-by: Sven Auhagen <sven.auhagen@voleatech,de>
Julien Fortin [Tue, 21 Jan 2020 08:20:41 +0000 (09:20 +0100)]
addons: ethtool: add support for "ethtool_ignore_errors" policy
The goal of this policy is to ignore ethtool related errors, this is
useful for specific scenario like VMs.
This policy is off by default. To turn it on simply set:
Julien Fortin [Tue, 7 Jan 2020 15:58:56 +0000 (16:58 +0100)]
python3: replacing ipaddr with custom ipnetwork.IPNetwork object
As mentioned in a previous commit:
python3 ipaddress behave differently from python2-ipaddr, this is
a serious problem for us since it breaks most of the ip addresses
code.
Julien Fortin [Thu, 2 Jan 2020 14:50:51 +0000 (15:50 +0100)]
Merge branch 'master-next' into python3
* master-next:
argv: move --nldebug option to common_argparse to avoid exception in ifreload
debian: changelog: new 2.0.1-1 entry
argv: add new command line argument --nldebug
This commit adds the feature to change offloads for nics. Currently GRO, LRO GSO, TSO, UFO, TX and RX Offload are supported.
Julien Fortin [Tue, 17 Dec 2019 16:37:40 +0000 (17:37 +0100)]
debian: postinst: add work-around to manually install python3-ipaddr
python3 ipaddress behave differently from python2-ipaddr, this is
a serious problem for us since it breaks most of the ip addresses
code. The work around install the python3-ipaddr via pip3 (and
installs pip3 if necessary). The workaround will stay in the code
util the ipaddress issue is fixed.