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

33 Commits

Author SHA1 Message Date
730834002a addons: tunnel: pep8 refactoring
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
84ca91f165 addons: tunnel: Add support for master-next
This commit fixes the tunnel addon for the new master-next branch.
2018-12-13 14:42:35 -08:00
23e8546d39 addons: addressvirtual: new policy (bool): addressvirtual_with_route_metric (default: yes)
Ifupdown2 is now setting a default metric on macvlan ips. This policy will let
users disable this new default behavior. addressvirtual_with_route_metric is
boolean policy variable.

  addressvirtual_with_route_metric: yes|no|on|off|1|0 (default to yes)

$ cat /var/lib/ifupdown2/policy.d/addressvirtual.json
{
    "addressvirtual": {
        "module_globals": {
            "addressvirtual_with_route_metric": "no"
        }
    }
}

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
c3c78d9772 addons: tunnel: complete backport by updating imports + PEP8 refactoring
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
8e2f5fbef7 addons: tunnel: dependent device fix 2018-12-13 14:42:35 -08:00
60e7dc3a40 addons: tunnel: get_dependent_ifacenames: tunnel-physdev dependency 2018-12-13 14:42:35 -08:00
f40c629470 addons: tunnel: fix tunnel v4 to v6 change 2018-12-13 14:42:35 -08:00
33ebe60a9d addons: tunnel: add support for vti, ip6gre, ipip6, ip6ip6, vti6 tunnels 2018-12-13 14:42:35 -08:00
b2a87fe8eb addons: tunnel: Add support for GRETAP tunnels. (#34)
This commit adds support to configure and check gretap tunnels. An example
  configuration could look like this:

    iface tap0 inet tunnel
        mode gretap
        local 10.132.255.3
        endpoint 10.132.255.1
        ttl 64
        mtu 1400
        tunnel-physdev eth0
        #
        address 10.10.0.1/2

  ifup will happily configure the interface (which it does even without this
  patch) and ifquery now can successfully validate the configure interface:

    cr03.in.ffho.net:~# ifquery -c tap0
    iface tap0 inet tunnel                   [[ OK ]]
        tunnel-physdev eth0                  [[ OK ]]
        endpoint 10.132.255.1                [[ OK ]]
        local 10.132.255.3                   [[ OK ]]
        mode gretap                          [[ OK ]]
        ttl 64                               [[ OK ]]
        mtu 1400                             [[ OK ]]
        address 10.10.0.1/24                 [[ OK ]]

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2018-12-13 14:42:35 -08:00
ea3bd2b624 Addons/tunnel: fix typo in validvals (#31) 2018-12-13 14:42:35 -08:00
22aa65c782 Add support GRE/SIT tunnels. (#20)
This commit adds support for configuring GRE/IPIP/SIT tunnel interfaces as know
from previous versions of ifupdown. Currently only configuration checks for GRE
and SIT tunnels are implemented.

A tunnel interface configuration could look like this:

auto gre42
iface gre42 inet tunnel
        mode     gre
        local    198.51.100.1
        endpoint 203.0.113.2
	#
	# optional tunnel attributes
        ttl      64
        mtu      1400
	tunnel-physdev eth0
        #
        address  192.0.2.42/31
        address  2001:db8:d0c:23::42/64

auto he-ipv6
iface he-ipv6 inet tunnel
	mode sit
	endpoint 203.0.113.6
	local    198.51.100.66
	#
	# optional tunnel attributes
	ttl 255
	mtu 1466
	tunnel-physdev vrf_external
	#
	address 2001:db8:666::2/64

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
2018-12-13 14:42:35 -08:00
7cdb931e5d addons: vrf: add support for 'link-down yes' on VRF slaves
$ ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
	vrf mgmt
	link-down yes

auto mgmt
iface mgmt
	vrf-table auto

$ ifup -a -d
...
...
debug: mgmt: pre-up : running module vrf
info: executing /usr/lib/vrf/vrf-helper create mgmt 1001
debug: mgmt: eth0: slave configured with link-down yes
info: mgmt: netlink: ip link set dev mgmt up
...
$ ip link show eth0
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master mgmt state DOWN mode DEFAULT group default qlen 1000
    link/ether 08:00:27:80:e2:97 brd ff:ff:ff:ff:ff:ff

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
cc99b41d8c addons: bridge: fix 'NoneType' object has no attribute 'keys' exception
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
d1265fd548 addons: bridge: support multiple bridge-port configuration lines
Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Sam Tannous <stannous@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
b478792b8a addons: addressvirtual: fix typo in address-virtual-ipv6-addrgen examples
typo: missing 'n' in the example field

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
20e547e795 addons: addressvirtual: if system supports addr METRIC set skip route hack
Now that some system support ip addr METRIC sets we dont have to do this
"fix_connected_route" hack. The hack was previously introduced to make
sure the primary address was the first in the routing table. Some events
could cause some issues like having the macvlan address first in the
routing table. In that case the macvlan needs to be flapped. This shouldn't
happen when we are able to set the address metric

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
7b711dc521 addons: addressvirtual: new attribute: address-virtual-ipv6-addrgen [on|off]
[14:53:46] root:~ # ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto vlan1903
iface vlan1903
	alias LAB-CUST-VMS
	vlan-id 1903
	vlan-raw-device bridge
	address 2a06:c01:1:1903::3/64
	address 185.98.123.3/24
	address-virtual 00:00:5e:00:01:a3 2a06:c01:1:1903::1/64 fe80::1/64 185.98.123.1/24
	vrf public

auto public
iface public
	vrf-table auto

auto bridge
iface bridge
	bridge-ports swp1

[14:53:47] root:~ # ifup -a
[14:53:50] root:~ # ip addr show vlan1903-v0
46: vlan1903-v0@vlan1903: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master public state UP group default
    link/ether 00:00:5e:00:01:a3 brd ff:ff:ff:ff:ff:ff
    inet 185.98.123.1/24 scope global vlan1903-v0
       valid_lft forever preferred_lft forever
    inet6 2a06:c01:1:1903::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::200:5eff:fe00:1a3/64 scope link
       valid_lft forever preferred_lft forever
    inet6 fe80::1/64 scope link
       valid_lft forever preferred_lft forever
[14:53:52] root:~ #
[14:53:54] root:~ #
[14:53:54] root:~ # nano /etc/network/interfaces
[14:53:57] root:~ # ifquery vlan1903
auto vlan1903
iface vlan1903
	alias LAB-CUST-VMS
	vlan-id 1903
	vlan-raw-device bridge
	address 2a06:c01:1:1903::3/64
	address 185.98.123.3/24
	address-virtual 00:00:5e:00:01:a3 2a06:c01:1:1903::1/64 fe80::1/64 185.98.123.1/24
	address-virtual-ipv6-addrgen off
	vrf public

[14:54:05] root:~ # ifdown -a -X eth0
[14:54:08] root:~ # ifup -a -v
...
...
info: executing /bin/ip -force -batch - [link set dev vlan1903-v0 master public
link set dev vlan1903-v0 addrgenmode none
link set dev vlan1903-v0 down
link set dev vlan1903-v0 address 00:00:5e:00:01:a3
link set dev vlan1903-v0 up
addr add 2a06:c01:1:1903::1/64 dev vlan1903-v0
addr add fe80::1/64 dev vlan1903-v0
addr add 185.98.123.1/24 dev vlan1903-v0
route del 2a06:c01:1:1903::/64 table 1001 dev vlan1903-v0
route del fe80::/64 table 1001 dev vlan1903-v0
route add 2a06:c01:1:1903::/64 table 1001 dev vlan1903-v0 proto kernel metric 9999
route add fe80::/64 table 1001 dev vlan1903-v0 proto kernel metric 9999
]
...
...
[14:54:14] root:~ # ip addr show vlan1903-v0
50: vlan1903-v0@vlan1903: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master public state UP group default
    link/ether 00:00:5e:00:01:a3 brd ff:ff:ff:ff:ff:ff
    inet 185.98.123.1/24 scope global vlan1903-v0
       valid_lft forever preferred_lft forever
    inet6 2a06:c01:1:1903::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::1/64 scope link
       valid_lft forever preferred_lft forever
[14:54:16] root:~ #

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
3fc54eef3d addons: address: new attribute: ipv6-addrgen [on/off]
[14:49:15] root:~ # ifquery swp2
auto swp2
iface swp2

[14:49:18] root:~ # ip addr show swp2
4: swp2: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 90:e2:ba:2c:b2:95 brd ff:ff:ff:ff:ff:ff
[14:49:20] root:~ # ifup swp2
[14:49:23] root:~ # ip addr show swp2
4: swp2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 90:e2:ba:2c:b2:95 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::92e2:baff:fe2c:b295/64 scope link
       valid_lft forever preferred_lft forever
[14:49:25] root:~ #
[14:49:32] root:~ # nano /etc/network/interfaces
[14:49:34] root:~ # ifquery swp2
auto swp2
iface swp2
        ipv6-addrgen off

[14:49:41] root:~ # ifup -v swp2 |& grep addrgen
link set dev swp2 addrgenmode none
[14:49:57] root:~ # ip addr show swp2
4: swp2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 90:e2:ba:2c:b2:95 brd ff:ff:ff:ff:ff:ff
[14:50:01] root:~ #
[14:50:09] root:~ #
[14:50:09] root:~ # ifup -v swp2
info: executing /bin/ip -force -batch - [link set dev swp2 down
link set dev swp2 addrgenmode none
link set dev swp2 up
]
info: reading '/proc/sys/net/ipv4/conf/swp2/accept_local'
[14:50:13] root:~ #

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
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
dfaa8a2d19 addressvirtual: address: add default metric to ip4 and ip6 (if available)
Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2018-12-13 14:42:35 -08:00
aa895ecddf addons: addressvirtual: if device is VRF slave check vrf route table
auto bridge
iface bridge
      bridge-vlan-aware yes
      bridge-ports swp2

auto bridge.2
iface bridge.2
      address 10.254.1.2/24
      address 2a03:25e0:254:1::2/64
      address-virtual 00:00:5e:00:01:01 10.254.1.1/24 2a03:25e0:254:1::1/64 fe80::1/64
      vrf blue

auto blue
iface blue
      vrf-table auto

$ ifreload -a -v
...
info: executing /bin/ip route get 10.254.1.0/24 vrf blue
...
$

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
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
ff50f301d5 move ifupdown2/* .
ifupdown2 code was one level deeper because ifupdown2 initially
had ifupdown2 and ifupdown2-addons as two separate packages.
Since they were combined into one package, it makes sense to
move all combined code under the top level directory

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2015-08-02 05:05:52 -07:00
4fc71247f8 Don't allow IP addresses on ports enslaved in bonds or bridges
Testing Done: built new ifupdown package and ran testifupdown2 suite of tests

This patch prevents enslaved interfaces from having IP addresses.
(cherry picked from commit 0c00606fbc76db11557a8e946310e93a2b376aa7)
2015-06-03 13:20:10 -04:00
bbdf8d1da5 Move stale slave delete to after the adds are done
Testing Done: Tested with sample config in the bug
(cherry picked from commit e90149a1e8ea3bc94e07fb080361e6909b12e81b)
2015-06-03 13:17:56 -04:00
0b762139c6 Add default link parameter support for ethtool module
Testing Done: tested master and 2.5_br images with testifupdown2 suite and hand tested

This patch creates a json defaults file upon bootup
(which can be overridden by customer configs in /etc)
which the ethtool module in ifupdown2 will consult
when "link-x" configs are removed in order to restore
them to the initial settings used by the switch.
(cherry picked from commit 8388664f5a5a85f2a813cafbf40ac92d7b86f4bf)

Conflicts:
	packages/cl-utilities/dist-packages/cumulus/portconfig.py
	packages/cl-utilities/usrlib/update-ports
	tests/tests/smoke/testifupdown2.py
2015-06-03 13:15:49 -04:00
641719f9aa Fix bridge pvid add/del order
Testing Done: Tested with test case in the bug and other orders

kernel(upstream and us) does not seem to honor the vidinfo flags
during the deletes. Hence, this reordering becomes necessary.

tested with the example in the bug and also some other examples.

code wise this combines two existing methods but leaves the two existing methods
around for future use. Will remove them if they become completely
unnecessary.
(cherry picked from commit 992906e0771b7415cbd8c03563a99a8f050415bd)
(cherry picked from commit 1ad488b44e1a9a0e059765e8ee4a19164b386dfe)
2015-06-03 13:14:13 -04:00
5d664422b6 Fix addons man page for a few mstpctl defaults
Testing Done: build and tested man page
(cherry picked from commit 540aa30332a3c49e8a2be2c3975a3a24dbbf1209)
(cherry picked from commit 9426b13318950a6d285e6dcc1844d8cdc0d140df)
2015-06-03 13:11:53 -04:00
faaa176eed Add check for shared dependents during building dependency list
Testing Done: Tested with shared slaves in bridge and bonds
(cherry picked from commit 6f990450001d367a775681a29cdce74f862f7848)
(cherry picked from commit 8d9a5107112628ee8434e227dff49a0ef09966ee)
2015-06-03 13:08:58 -04:00
f7e2962a92 ifupdown2 loses interfaces on second down of swp port
Testing Done: tested bridge and bonds with interfaces with configs

Both bridge and mstpctl modules set priv_flags on interfaces
that have configs (like link-speed) even when used as bridge-ports.
And this collision causes statemanager.ifaceobj_sync() to never get called
because ifaceobj.priv_flags is 1 (we return immediately):
The fix was to create a new iface module_flags array to carry module info.
(cherry picked from commit 56924fef20984fd959939bf7f17c3dd6fd6b137a)
(cherry picked from commit 28d96f7643e2885b1f9c17ad9324a6dbb1b0f8c7)
2015-06-03 13:06:54 -04:00
e04e8cba9e Modified ifupdown support for vxlan head end replication
Replaced vxlan-peernodeip attribute with vxlan-remoteip.  Updated
the vxlan and iproute2 modules to configure head end replication
using bridge fdb commands.
(cherry picked from commit 567f445fc4a1828fc2aac0da3f2402a185656cb5)

Conflicts:
	packages/ifupdown2/addons/vxlan.py
	packages/ifupdown2/ifupdownaddons/iproute2.py

Conflicts:
	ifupdown2/addons/vxlan.py
	ifupdown2/ifupdownaddons/iproute2.py
2015-06-03 13:02:03 -04:00
9ab24843eb Prevent MTU from being set to 1500 on interface downing.
MTU settings are defaulted 1500 when interface is ifdowned.
This has the effect of changing the MTU on the interface and any subinterfaces to
1500.  And if these subinterfaces are in a bridge, the bridge will pick the MIN MTU
so the bridge keeps this MTU even after the interface is brought back up. The sub
interface does not change to a higher value then 1500 (kernel VLAN driver only
moves the MTU is the decreasing direction.
(cherry picked from commit 70e67ab15efb13e1499288152d801b39f28a190b)
(cherry picked from commit 56238543a980e983957a180c583b9412c3ab48ab)
2015-03-17 22:31:35 -04:00
f82758bf2c Merge 'vlan filtering bridge + vxlan + mlag + vrr' support from internal
tree to external

This also combines python-ifupdown2 and python-ifupdown2-addons package
into a single python-ifupdown2 package
2015-03-06 21:46:10 -08:00