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

41 Commits

Author SHA1 Message Date
7050c6fc73 Merge branch 'master-next' into python3
* master-next:
  This also adds ipip6 to nlpacket IFLA_INFO_KIND.
2020-02-04 15:47:00 +01:00
cb61aad1d9 This also adds ipip6 to nlpacket IFLA_INFO_KIND. 2020-02-04 13:51:42 +01:00
07325f6b5e 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.
2020-02-03 17:18:57 +01:00
8dcaeb6439 Add XFRM to IFLA_INFO_KIND and reverse change to iproute2 class. 2020-02-03 17:06:32 +01:00
69015cb30b Merge remote-tracking branch 'upstream/master-next' into bugfix/xfrm 2020-02-03 17:06:15 +01:00
f60f58374d Merge branch 'master-next' into python3
* master-next:
  nlmanager: nlpacket: add "ip6ip6" link kind to LINKINFO encode handler
2020-02-03 16:56:09 +01:00
51d0d2e477 nlmanager: nlpacket: add "ip6ip6" link kind to LINKINFO encode handler
Alternative to patch proposed in PR#137

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-02-03 15:23:37 +01:00
6552d825e0 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>
2020-02-03 14:23:44 +01:00
0c6b76af51 Merge branch 'master-next' into python3
* master-next:
  nlpacket: add tunnel link_kind to encode support list
  addons.conf: remove duplicate entry for tunnel pre-up
2020-01-28 12:00:03 +01:00
040192991d nlpacket: add tunnel link_kind to encode support list
fixing: TypeError: cannot concatenate 'str' and 'NoneType' objects

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-01-28 11:56:19 +01:00
bc7effff52 python3: ipnetwork: create new ipnetwork object from existing ones
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-01-21 08:56:41 +01:00
0e936c3ffa 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.

>>> import ipaddress
>>> ipaddress.ip_network("10.10.10.242/10", False)
IPv4Network('10.0.0.0/10')

This is a problem for us, so we need to use a custom IPNetwork object.
Our custom IPNetwork object uses ipaddress.IPAddress under the hood

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2020-01-08 11:09:08 +01:00
45864399b0 Revert "python3: ipaddress is now part of the standard library (removing python-ipaddr)"
This reverts commit 5dded70eaa1be660f80ebb50bfdb35e86d7e1fac.
2019-12-17 17:35:51 +01:00
5dded70eaa python3: ipaddress is now part of the standard library (removing python-ipaddr)
IPNetwork doesn't exists anymore and is replaced by ip_network. IPv?Network (4 and 6)
objects take an optional argument "strict" that defaults to True. If strict is set
and the ip address has the host bit set it will raise an exception. This is bad
for ifupdown2, so we need to replace all calls to IPNetwork and IPv?Network with
function who will set strict to False. That way we can limit the number of changes
for this patch.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:27:51 +01:00
eea20c9dff python3: nlpacket: encode_ipv4: convert to string before converting to bytes
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:19:12 +01:00
c8eec61e41 python3: nlpacket: importing python3 fixes from nlmanager repo
more fixes for strings/bytes, netlink packet pack/unpack and
python3 floating division

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:16:30 +01:00
997910cd2a python3: nlmanager: fix sequence.next() call
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:09:17 +01:00
fefbda193d python3: nlpacket: LINKINFO: info_kind as a string not bytes
The rest of the code expects link kind to be a string(str) and not bytes

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:02:34 +01:00
2ead3536f2 python3: nlpacket: LINKINFO: workaround: converting strings to bytes and ignoring NoneType
Not sure why there's NoneType objects here...

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:01:18 +01:00
90f5a2d19e python3: nlpacket: BRPORT: decode: convert data to byte before unpacking
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 17:01:00 +01:00
c9496c0ae4 python3: nlpacket: fix str vs bytes errors
python2 uses strings but python3 mainly uses bytes, and it's a mess...

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 16:59:56 +01:00
3b01ed7618 python3: 2to3 changes
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 16:55:49 +01:00
35681c0608 python3: shebang update
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 16:40:10 +01:00
223ba5af1d ifupdown2 2.0.0-1
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-12-17 13:46:18 +01:00
986965c169 nlmanager: nlmanager: retry binding tx_socket up to NLMANAGER_BIND_RETRY times
NLMANAGER_BIND_RETRY env variable defaults to 4242

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-09-18 12:49:42 +02:00
f279a8ef8f Merge pull request #111 from svenauhagen/feature/xfrm
This commit adds support for the new IPSec Interface XFRM.
2019-06-07 00:22:39 +08:00
255ffb1fc3 addons: bridge: set bridge mtu on device creation
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-06-06 19:18:29 +08:00
ca42da726a This release adds support for the new IPSec Interface XFRM.
It is available since Kernel 4.19 and has two parmeters:

1. XFRM ID to map to an SA/SAs
2. Underlying Interface if you want to take advantage of IPSec Hardware Offload

Otherwise it is treated as a normal interface and not like a tunnel (VTI).

I added two attributes to the interface to configure it and otherwise use it as a normal interface.
One example is:

auto ipsec1
iface ipsec1 inet
	xfrm-physdev lo
	xfrmid 1
2019-06-05 11:05:33 +02:00
dbc23e6cbf nlpacket: vxlan: encode: fix payload length
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-04-22 10:53:59 +08:00
b994bd3977 addons: addressvirtual: vrrp: fix multiline-merge attribute detection
Now we support the following config:
auto swp1
iface swp1
      vrrp 3 50.0.1.1/24
      vrrp 3 2001:50:0:1::1/64
      vrrp 3 2001:50:0:42::1/64

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-04-22 10:53:01 +08:00
ec25a08c3a addons: vxlan: add support for vxlan-ttl attribute
New vxlan-ttl attribute: specifies the TTL value to use in outgoing
packets. Valid values: range 1..255 or auto (0)

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2019-04-22 10:48:36 +08:00
35848ca0d3 nlpacket: add decode support for tunnel devices
Tunnel device now supported (decode):
- gre
- gretap
- erspan
- ip6gre
- ip6gretap
- ip6erspan
- ipip
- sit
- ip6tnl
- vti
- vti6

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-18 13:33:50 +01:00
d54d014d9c nlmanager: use strerror to deal with kernel error
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 15:17:09 -08:00
4d4aac88ec nlpacket:: add family string (AF_*) to debug dump
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
3479a0c3bb nlpacket:: add netconf support (RTM_GETNETCONF/RTM_NEWNETCONF)
$ cd python-nlmanager/examples
$ ./netconf_show.py
    2018-06-01 16:59:02,398   DEBUG: TXed RTM_GETNETCONF, length 32, seq 1, pid 14202, flags 0x0 ()

      Netlink Header
       1: 0x20000000   ...  Length 0x00000020 (32)
       2: 0x52000503  R...  Type 0x0052 (82 - RTM_GETNETCONF), Flags 0x0305 (NLM_F_REQUEST, NLM_F_ACK, NLM_F_DUMP)
       3: 0x01000000  ....  Sequence Number 0x00000001 (1)
       4: 0x7a370000  z7..  Process ID 0x0000377a (14202)
      Service Header
       5: 0x00000000  ....  Family 0x00 (0), Device Type 0x0000 (0 - ARPHRD_NETROM)
       6: 0x00000000  ....  Interface Index 0x00000000 (0)
       7: 0x00000000  ....  Device Flags 0x00000000 ()
       8: 0x00000000  ....  Change Mask 0x00000000
      Attributes

    Attributes Summary
    {}

    2018-06-01 16:59:02,401   DEBUG: RXed RTM_NEWNETCONF, length 68, seq 1, pid 14202, flags 0x2

      Netlink Header
       1: 0x44000000  D...  Length 0x00000044 (68)
       2: 0x50000200  P...  Type 0x0050 (80 - RTM_NEWNETCONF), Flags 0x0002 (NLM_F_MULTI)
       3: 0x01000000  ....  Sequence Number 0x00000001 (1)
       4: 0x7a370000  z7..  Process ID 0x0000377a (14202)
      Service Header
       1: 0x00000002  ....  Family 0x02 (2)
      Attributes
       5: 0x08000100  ....  Length 0x0008 (8), Type 0x0001 (1) NETCONFA_IFINDEX
       6: 0x01000000  ....  1
       7: 0x08000200  ....  Length 0x0008 (8), Type 0x0002 (2) NETCONFA_FORWARDING
       8: 0x01000000  ....  1
       9: 0x08000300  ....  Length 0x0008 (8), Type 0x0003 (3) NETCONFA_RP_FILTER
      10: 0x00000000  ....  0
      11: 0x08000400  ....  Length 0x0008 (8), Type 0x0004 (4) NETCONFA_MC_FORWARDING
      12: 0x00000000  ....  0
      13: 0x08000500  ....  Length 0x0008 (8), Type 0x0005 (5) NETCONFA_PROXY_NEIGH
      14: 0x00000000  ....  0
      15: 0x08000600  ....  Length 0x0008 (8), Type 0x0006 (6) NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN
      16: 0x01000000  ....  1

    Attributes Summary
    {'( 1) NETCONFA_IFINDEX': 1,
     '( 2) NETCONFA_FORWARDING': 1,
     '( 3) NETCONFA_RP_FILTER': 0,
     '( 4) NETCONFA_MC_FORWARDING': 0,
     '( 5) NETCONFA_PROXY_NEIGH': 0,
     '( 6) NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN': 1}

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
f8f6549ba7 nlpacket: add decode support for IFLA_AF_SPEC (AF_UNSPEC) family - inet6 attributes
This patch mostly adds support for IFLA_INET6_ADDR_GEN_MODE
nlmanager doesn't support multiple kernel version all the
other attributes like IFLA_INET6_CONF are based on DEVCONF_MAX
from _UAPI_IPV6_H.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:43:57 -08:00
53747c55ab nlmanager: nlpacket: update AttributeMACAddress decode comments
this commit adds some explanation/comments in the decode function of the
AttributeMACAddress class. Some comments are moved around and placed
in the right location.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:36 -08:00
08862a99f9 netlink: nlpacket AttributeMACAddress
This commits fixes AttributeMACAddress for GREv6.
Error message: info: netlink: link dump failed: Length of MACAddress attribute not supported: 20
Reproducible by adding a GREv6 Tunnel:

auto gre1
iface gre1 inet tunnel
    mode ip6gre
    local 2001:1000:1000:1000::123
    endpoint 2001:1000:1000:2000::123
    address 192.168.123.1/29

In netlink The IFLA_ADDRESS and IFLA_BROADCAST attributes for all interfaces has been a
6-byte MAC address. But the GRE interface uses a 4-byte IP address and GREv6 uses a 16-byte IPv6 address for this
attribute. This patch allows for decoding a 16-byte value as an IP address.
2018-12-13 14:42:35 -08:00
a382b488e9 backport: "Add support for setting phys-dev for VXLAN interfaces."
backporting the following commit to master-next:

commit eb92e5efff776602081b8bbd2cc74462293c4b79
Author: Maximilian Wilhelm <max@rfc2324.org>
Date:   Thu Oct 6 19:22:06 2016 +0200

    Add support for setting phys-dev for VXLAN interfaces.

      Add interface configuration option »vxlan-physdev« to set »dev« attribute
            of VXLAN interfaces and a check for the running configuration.

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

This backport also:
 - adds support for ifquery --running
 - uses the netlink cache
 - includes some pep8 fixes

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

Co-authored-by: Julien Fortin <julien@cumulusnetworks.com>
Co-authored-by: Maximilian Wilhelm <max@rfc2324.org>
2018-12-13 14:42:35 -08:00
aab17506cc nlmanager : nlpacket : IFLA_BRPORT_ARP_SUPPRESS : use 32 netlink value : (fixes #47)
this has been upstreamed recently in linux kernel, with
IFLA_BRPORT_NEIGH_SUPPRESS, with 32 as netlink value.
https://www.spinics.net/lists/linux-ethernet-bridging/msg06910.html

Cumulus is using a temp 152 number in his own kernel.

This is needed for bgp evpn and anycast gateway.

auto vmbr3
iface vmbr3
        bridge_ports vxlan3
        bridge_stp off
        bridge_fd 0

auto vxlan3
iface vxlan3 inet manual
        vxlan-id 3
        vxlan-local-tunnelip 10.59.100.231
        bridge-learning off
        bridge-arp-nd-suppress on

info: reading '/sys/class/net/vmbr3/bridge/stp_state'
debug: vmbr3: evaluating port expr '['vxlan3']'
debug: _cache_get(['vxlan3', 'hwaddress']) : ['hwaddress']
debug: reading '/sys/class/net/vxlan3/address'
info: writing '1' to file /proc/sys/net/ipv6/conf/vxlan3/disable_ipv6
info: executing /bin/ip -force -batch - [link set dev vxlan3 master vmbr3
addr flush dev vxlan3
]
info: vmbr3: applying bridge port configuration: ['vxlan3']
info: vmbr3: vxlan3: set bridge-learning off
debug: (cache None)
info: vmbr3: vxlan3: set bridge-arp-nd-suppress on
debug: (cache None)
info: vmbr3: vxlan3: vxlan learning and bridge learning out of sync: set False
info: vxlan3: netlink: ip link set dev vxlan3: bridge slave attributes
debug: vxlan3: ifla_info_data {7: False}
debug: vxlan3: ifla_info_slave_data {8: False, 152: True}
2018-12-13 14:42:35 -08:00
d486dd0df0 ifupdown2 2.0.0 release
This is a major update coming all at once from master-next branch
master-next branch was started with --orphan option which is basically a new
branch without history.

The major changes are:
    - repackaging
    - cleanup the directory tree
    - rewritte setup.py to allow install from deb file or pypi (pip install)
    - add a Makefile to make things (like building a deb) easier
    - review all debian files

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 11:43:32 -08:00