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

312 Commits

Author SHA1 Message Date
8994bdd39a address: don't process_mtu for openvswitch interfaces
Openvswitch already manage mtu if ovs-mtu is defined.
(Ovs manage mtu in userland, and sync mtu for some interfaces in kernel).

If mtu is changed by address module, before the ovs userland mtu,
this give packets drop.
2020-06-05 08:07:04 +02:00
6cdb2b3d22 addons: openvswitch: allow multiple ovs-ports + glob/regex 2020-05-28 11:21:55 +02:00
523b347ad4 nllistener: increase netlink buffer to 64k
Currently 4k buffer is too small to handle some netlink messages

(Like bridge vlans for example, with 32k messages detected).
2020-05-27 15:49:49 +02:00
8ac72bb5b7 Merge branch 'master' of github.com:CumulusNetworks/ifupdown2
* 'master' of github.com:CumulusNetworks/ifupdown2:
  addon: openvswitch : add ovs-ports-condone-regex option
  allow systemd to execute the helper script
2020-05-17 19:06:25 +02:00
214cefb325 veth-peer-name: check if dependent interface exists in /e/n/i
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-17 19:01:35 +02:00
5efdf225e1 addon: openvswitch : add ovs-ports-condone-regex option
Like for bridge, add a option to skip delete a regex list of interfaces.
(can be usefull for hypervisor, when vm interfaces are dynamically plugged)
2020-05-16 08:11:22 +02:00
60edf8f14d Merge pull request #155 from bauen1/fix-start-networking-script
allow systemd to execute the helper script
2020-05-15 17:51:29 +02:00
100fab20b6 addons: link: use iproute2 to create custom devices (fixes #156)
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-15 17:49:56 +02:00
5cbe13d17a allow systemd to execute the helper script 2020-05-15 17:16:04 +02:00
5890ab714e addons: link: porting 'veth-peer-name' attribute to python3 branch
original commit ported to the python3 branch:

commit bffa619b11ae7aa9e567c26c255c17ac6df2c495
Author: Maximilian Wilhelm <max@rfc2324.org>
Date:   Sat Jan 14 19:08:01 2017 +0100

    Add option 'veth-peer-name' to veth links and ensure proper configuration.

      The option »veth-peer-name« forces an veth peer link to be created with
      a specific interface name. As the interface name of the "local" part of
      the veth link pair already is defined by the name of the interface stanza
      this option is added to, now both sides are clearly named.

      As there is a bidirectional dependency of both link pairs - both cannot
      exist without the other - this presents a problem when setting up all
      interfaces. Depending on which interface is set up first there might be
      a problem when only on dependency is specified. Therefore adding the
      »veth-peer-name« option to both interface of the veth link pair ensures
      that regardless of which side is configured first the peer name will be
      set correctly. This intentionally creates a circular dependency which is
      handled accordingly.

      Fixing the config check for veth link-type while at it :)

    Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 04:08:04 +02:00
8a78cd07bc addons: bridge: fix NoneType is not iterable exception
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 02:55:30 +02:00
e537a6e6d6 add support for single vxlan device (bridge-vlan-vni-map)
new attribute:

"bridge-vlan-vni-map": {
    "help": "Single vxlan support",
    "example": "bridge-vlan-vni-map 1000-1001=1000-1001",
}

example of config:

auto bridge
iface bridge
      bridge-vlan-aware yes
      bridge-ports vxlan0 swp1
      bridge-stp on
      bridge-vids 1000-1001
      bridge-pvid 1

auto vxlan0
iface vxlan0
      vxlan-local-tunnelip 27.0.0.9
      bridge-learning off
      # vlan 1000-1001 maps to vni 1000-1001
      bridge-vlan-vni-map 1000-1001=1000-1001

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 02:18:39 +02:00
7840bd2c09 addons: bridge: add support for new bridge-always-up attribute
Enabling this attribute on a bridge will
enslave a dummy interface to the bridge

example:

auto bridge
iface bridge
      bridge-vlan-aware yes
      bridge-always-up yes
      bridge-ports vni42

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 02:05:52 +02:00
4b706d71e2 addons: bond: fix es-sys-mac example
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 02:00:33 +02:00
b8ab3d5d7b main: catch ArgvParseError and don't display traceback
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 01:59:53 +02:00
4d9f4e59f3 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).

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-14 01:53:22 +02:00
9b451d11dc networking.service: use start-networking script to control start/stop/reload
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:47:47 +02:00
3101ff1d6f 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:

value=lldp,stp
regex=['', 'l', 'l', 'd', 'p', '', 's', 't', 'p', '']

the patch simplifies the code by using str.translate and str.split

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:42:19 +02:00
580a567b25 addressvirtual: fix argument of type 'IPv4Network' is not iterable
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:41:28 +02:00
c3a22da623 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.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:40:33 +02:00
488b10cad9 ifupdownmain: fix NameError: name 'Set' is not defined
Set() is a python2 object, set is the python3 way

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:33:16 +02:00
9808982edf 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.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:27:21 +02:00
85d04bab16 addons: mstpctl: ifquery: add VXLAN check before processing bpdu-mstpctl attributes
When --with-defaults is provided we update the stanza-data structure without
making sure we are dealing with a vxlan intf.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:24:49 +02:00
80f2b5535f addons: vrf-slave: keep vlan down if lower device has link-down yes
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:24:35 +02:00
a3df9e6930 addons: address: mtu: set bridge mtu with policy default
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-05-13 20:24:12 +02:00
bc2cf49ade 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 :))

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 18:19:10 +02:00
dc74cedae4 addons: vxlan: ifquery-running: fix incorrect diplayed data
Signed-off-by: Scott Laffer <slaffer@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 18:11:14 +02:00
62d960cc1b completion: removing argcomplete support
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

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 16:50:04 +02:00
9ddfbfff85 ifupdownmain: process addon alias translation right after user config
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 16:33:48 +02:00
6bc9fadc44 addons: bond: refactor get_bond_slaves function
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 16:33:48 +02:00
1f928890af 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)

https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHASHSEED

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 16:33:48 +02:00
db26516e01 addons: addressvirtual: fix byte/str exception
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 16:29:47 +02:00
62d222e3dd update __version__ and copyright year in __init__.py
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-04-14 16:27:23 +02:00
a4b5439507 addons: dhcp: remove code duplicate
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-27 15:53:40 +01:00
16de4e7988 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
2020-03-26 03:02:53 +01:00
2c152f8396 addons: address: process MTU before addrgen and adddresses
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 01:04:30 +01:00
a506093536 ifupdownmain: support for marking interfaces as mgmt interfaces
All interfaces starting with 'eth' are marked with
ifaceLinkPrivFlags.MGMT_INTF flag

This match can be changed by setting a 'main' module
'module_globals' policy attr 'mgmt_intf_prefix'.
example:
   $cat /var/lib/ifupdown2/policy.d/main.json
   {
    "main": {
        "module_globals" : {
            "mgmt_intf_prefix" : "ensp"
        },
        "defaults": {},
        "iface_defaults": {
            "eth0": {
                "exclude-companion": "mgmt"
            }
        }
    }
  }

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 00:59:54 +01:00
6d94c17b51 addons: bridge: fix TypeError: sequence item 0: expected string, int found
This is seen when running vids are different than
configured vids on a bridge port.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 00:52:22 +01:00
24084976f7 addons: bridge: set bridge MTU after bridge creation
addons: bridge: get bridge MTU from address policy not bridge

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 00:51:25 +01:00
24931ffa21 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

Ticket: CM-28951
Reviewed By: Roopa
Testing Done: precommit, smoke, evpn-smoke

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 00:39:03 +01:00
8598c690e3 lib: nlcache: fix dry_run exception
Ticket: CM-28312
Testing Done: Test from the ticket

error: link_set_bridge_info_data_dry_run() takes exactly 3 arguments (4 given)
error: link_set_brport_with_info_slave_data_dry_run() got an unexpected keyword argument 'kind'

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.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 00:38:54 +01:00
866c818344 addons: address: add support for a separate default mtu policy for eth interfaces
New module global policy mgmt_intf_mtu for mgmt interace mtu:
$cat /var/lib/ifupdown2/policy.d/address.json
{
    "address": {
        "module_globals": {
            "enable_l3_iface_forwarding_checks": "yes",
            "vlan_aware_bridge_address_support": "no",
            "l3_intf_arp_accept": "1",
            "mgmt_intf_mtu": "1500"
        },
        "defaults": {
            "mtu": "9216",
            "ip-forward": "on",
            "ip6-forward": "on"
        }
    }
}

If not specified mgmt_intf_mtu becomes equal to the mtu from defaults
section.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-26 00:02:58 +01:00
9a23f45770 Merge pull request #146 from aderumier/bond_primary_reselect
addons: bond: add support for bond-primary-reselect attribute
2020-03-04 16:59:35 +01:00
ff6e951d4f Merge pull request #143 from aderumier/python3
add openvswitch addons
2020-03-04 16:52:41 +01:00
f43edf057e debian: changelog: new 2.0.2-1 entry
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-03-04 16:24:50 +01:00
5ca7021683 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
2020-03-04 16:16:30 +01:00
7d6d434f18 addons: tunnel: Update examples to new attr names (#133)
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-02-26 15:08:25 +01:00
499d05970e Merge pull request #151 from aderumier/fix-forwarding-3
don't change interface forwarding value if not defined
2020-02-24 23:50:23 +01:00
54ada52023 ifupdownmain: support for marking interfaces as mgmt interfaces
All interfaces starting with 'eth' are marked with
ifaceLinkPrivFlags.MGMT_INTF flag

This match can be changed by setting a 'main' module
'module_globals' policy attr 'mgmt_intf_prefix'.
example:
   $cat /var/lib/ifupdown2/policy.d/main.json
   {
    "main": {
        "module_globals" : {
            "mgmt_intf_prefix" : "ensp"
        },
        "defaults": {},
        "iface_defaults": {
            "eth0": {
                "exclude-companion": "mgmt"
            }
        }
    }
  }

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-02-24 15:59:48 +01:00
34de87120a 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.
2020-02-24 15:45:19 +01:00