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

370 Commits

Author SHA1 Message Date
Julien Fortin
3ee939c3fa addons: vxlan: remove vxlan-local-tunnel-ip from bridge fdb add list
Ticket: None
Reviewed By: Roopa
Testing Done:

This was discover while working on CM-13767 and some other vxlan issues

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-29 01:43:14 +01:00
Julien Fortin
88d946862f addons: vxlan: continue to add or delete fdb entry after catching exception
Ticket: CM-13767
Reviewed By: Roopa, Purna, Nikhil G
Testing Done:

auto vx-1000
iface vx-1000
      vxlan-id 1000
      bridge-access 100
      vxlan-local-tunnelip 27.0.0.2
      vxlan-remoteip 27.0.0.1
      vxlan-remoteip 27.0.0.2
      vxlan-remoteip 27.0.0.3
      mstpctl-portbpdufilter yes
      mstpctl-bpduguard yes

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-29 01:20:38 +01:00
Julien Fortin
ff59bbc370 Revert "addons: vxlan: support for multiple ip addresses for vxlan-remoteip keyword"
This reverts commit 32e2363a69.

I pushed this commit by mistake. It was a local commit waiting to be reviewed.
Reverting it for now, might be applied later after positive review.
2016-11-28 17:47:11 +01:00
Julien Fortin
af8734d18a addons: ethtool: skip ethtool if current ifaceobj is loopback interface
Ticket: CM-13737
Reviewed By: Roopa, Nikhil G
Testing Done:

tested on VX and hardnodes
2016-11-28 17:42:29 +01:00
Julien Fortin
32e2363a69 addons: vxlan: support for multiple ip addresses for vxlan-remoteip keyword
Ticket: CM-11317
Reviewed By: Roopa, Purna, Nikhil G, Scott Laffer
Testing Done: ifupdown2 smoke + ifupdown2-tests

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-28 14:38:06 +01:00
Julien Fortin
22b49c2810 addons: warn or ignore if IP address is assigned to an enslaved interface
Ticket: CM-11967
Reviewed By: Roopa, Daniel W, Nikhil G
Testing Done: ifupdown2-tests

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Julien Fortin
18700e2676 addons: ifquery: re-ordering bridge-ports and bond-slaves interfaces
Ticket: CM-11953
Reviewed By: Roopa, Nikhil G
Testing Done: ifupdown2-tests and ifupdown2 smokes

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Julien Fortin
3e960ac241 netlink: moving ip link set master commands to netlink
Ticket:
Reviewed By: Roopa, Daniel W, Nikhil G, Dave O, Scott E
Testing Done: ifupdown2 smokes

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Julien Fortin
38365d4afa addons: address: syntax check for multiple gateways in the same addr family
Ticket: CM-12760
Reviewed By: Roopa, Daniel W, Nikhil G
Testing Done:

$ ifquery br0
auto br0
iface br0
	bridge-ports tap0 tap1
	gateway 1.1.1.2
	gateway 1.1.1.3
	gateway 2001::2
	gateway 2004::2

$ ifreload -a -s
warning: br0: address: 1.1.1.3: multiple gateways for inet family
warning: br0: address: 2004::2: multiple gateways for inet6 family
$
$ echo $?
1
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Roopa Prabhu
4ea6554108 addons: bridge: disable ip fwding on a bridge with no ip and no upperifaces
Ticket: CM-8363
Reviewed By: purna, balki, julien
Testing Done: Tested bridge bringup with and without addr and svi's

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Julien Fortin
dbac1c093e addons: usercmd: ifquery lists user commands and sets unknown status
Ticket: CM-12724
Reviewed By: Roopa, Nikhil G, Daniel W
Testing Done:

$ ifquery br0
auto br0
iface br0
      bridge-ports tap17 tap19
      		   up ls -l

$ ifquery br0 -c
auto br0
iface br0                                                           [pass]
      up ls -l                                                        []
      bridge-ports tap17 tap19					      [pass]

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Julien Fortin
004d1e6585 dhcp: add support for inet + inet6 dhcp on same interface
Ticket: CM-12370
Reviewed By: Roopa, Kanna, Scott E
Testing Done:

This patch also fixes a problem where dhcp6 used to create lease file with
a trailing whitespace. dhcp6 operation were also sometimes using the wrong
pid file. I added some code in the debian.postinst script to correctly
rename these files if they exists when we install/update ifupdown2.

(cumulus-qa-infra/cl-tests/tests/smoke/testdhcp.py:Testdhcp_relay)
auto swp1
iface swp1 inet dhcp
      link-speed 10000
      link-duplex full
      link-autoneg off

auto swp1
iface swp1 inet6 dhcp

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Julien Fortin
99b652303f addons: bridge/bond: fix ifquery regression where glob and regexes weren't expanded
Ticket:
Reviewed By: Roopa, Nikhil G
Testing Done:

auto br0
iface br0
      bridge-ports tap17 glob tap[2-4].100 tap19 regex tap2.*

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Roopa Prabhu
9f30b2cca7 addons: address: various fixes for mtu handling
Ticket: CM-6908, CM-6110, CM-13221
Reviewed By: julien, nikhil
Testing Done: added a new test in ifupdown2-tests which covers all cases

- move all mtu handling to a single function in addons/address.py
- Have an ifupdown2 default of 1500 mtu
- add a policy manager max_mtu check (we want to default cumulus max mtu
  to 9216)
- special handling for bond and bridges
        -  print an info log abt setting mtu on bridge
        -  this can be enhanced in the future to look
        at individual port mtu and rejecting the bridge mtu.
        this operation can be expensive right now. Hence
        just an info log.
- bond and vxlan dev mtu follow the rules of physical device mtu

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-11-23 04:54:39 +01:00
Vidya Sagar Ravipati
d8b6aad0d5 ifupdown2:ethtool: Add link-fec extension support
Ticket:CM-12695
Reviewed By:TBD
Testing Done:
Validated
a) ifup -v <interface>
b) ifdown -v <interface>
c) ifreload -a

Changes:
a) Support for link-fec attribute for link to configure
   FEC configuration

Ex:
auto swp17
iface swp17
link-autoneg on
link-fec rs

Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Vidya Sagar Ravipati <vidya@cumulusnetworks.com>
2016-11-23 04:54:38 +01:00
Julien Fortin
f46dd16d39 addons: bond: 'ifquery -c' doesn't re-order user's bond-slaves list
Ticket: CM-11953
Reviewed By: Roopa, Nikhil G, Daniel W
Testing Done:

$ ifquery b0
auto b0
iface b0
      bond-slaves swp1 swp2

$ ifreload -a
$ ifquery -a -c
auto b0
iface b0
      bond-slaves swp2 swp1 [pass]

$ ifquery -a -c
auto b0
iface b0
      bond-slaves swp1 swp2 [pass]

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:38 +01:00
Julien Fortin
ca20e4311a addons: bridge: 'ifquery -c' doesn't re-order user's bridge-ports list
Ticket: CM-11953
Reviewed By:  Roopa, Nikhil G, Daniel
Testing Done:

auto br0
iface br0
      bridge-ports tap0 tap1

$ ifreload -a
$ ifquery br0 -c
auto br0
iface br0                                                           [pass]
      bridge-ports tap1 tap0                                      [pass]

$ ifreload -a
$ ifquery br0 -c

auto br0
iface br0                                                           [pass]
      bridge-ports tap0 tap1                                      [pass]

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:38 +01:00
Julien Fortin
970ece959f addons: bridge: bridge-access + bridge-vids on the same intf give a warning
Ticket: CM-12234
Reviewed By: Roopa, Nikhil G, Daniel
Testing Done:

auto tap0
iface tap0
      bridge-access 20
      bridge-vids 20

$ ifreload -a -s
warning: tap0: `bridge-access` and `bridge-vids` are not allowed on the same interface
$ echo $?
1
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-11-23 04:54:38 +01:00
Nikhil
286a6b995b addons: mstpctl: ifquery -with-defaults update for vlan-aware bridge ports
Ticket: CM-13086
Reviewed By: roopa, julien
Testing Done: smoke testifupdown2:TestWithdefaults is run

'ifquery -with-defaults' should display default values of
mstpctl-portbpdufilter and mstpctl-bpduguard under bridge port,
but not under the bridge itself

added PORT_PROCESSED flag check to prevent processing
bridge ports again

Example:
auto vxlan1wd
iface vxlan1wd
     vxlan-id 1001

auto vxlan2wd
iface vxlan2wd
     vxlan-id 1002

auto brwithdef2
iface brwithdef2
    bridge_ports vxlan1wd vxlan2wd
    bridge-vlan-aware yes

Sample 'ifquery --with-defaults vxlan1wd' output before fix:
auto vxlan1wd
iface vxlan1wd
    vxlan-id 1001

Sample 'ifquery --with-defaults vxlan1wd' output after fix:
auto vxlan1wd
iface vxlan1wd
    vxlan-id 1001
    mstpctl-portbpdufilter yes
    mstpctl-bpduguard yes

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-11-23 04:54:38 +01:00
Daniel Walton
0c9f257797 bridge-vids needs to be multivalue
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   julien@cumulusnetworks.com
2016-11-23 04:54:38 +01:00
Roopa Prabhu
42e85fc834 [PATCH ifupdown2] addons: addressvirtual: fixup macvlan device enslavements for vrfs
Ticket: CM-12988
Reviewed By: julien, nikhil, dsa
Testing Done: tested ifup and ifdown of vrf devices with address virtual
slaves

This patch fixes up macvlan device enslavements when vrf device
or vrf slave is brought down and up. address virtual macvlan
devices on vrf slaves need to enslaved to the vrf. This
patch checks and fixes up those vrf enslavements for the following
cases:
ifdown <vrf_device> && ifup <vrf_device>
ifdown <vrf_slave> && ifup <vrf_slave>

starting state:
------------
$ip -br link show
myvrf            UP  46:c6:44:db:37:60 <NOARP,MASTER,UP,LOWER_UP>
bridge.901@bridge UP 44:38:39:00:77:88 <UP,BROADCAST,MULTICAST,UP>
bridge-901-v0@bridge.901 UP 00:00:5e:00:01:81 <UP,BROADCAST,MULTICAST,UP>

$ifdown myvrf
$ip -br link show
bridge.901@bridge DOWN           44:38:39:00:77:88 <BROADCAST,MULTICAST>
bridge-901-v0@bridge.901 DOWN    00:00:5e:00:01:81 <BROADCAST,MULTICAST,M-DOWN>

before patch (macvlan device bridge-901-v0 did not come up:
----------------------------------------
$ifup myvrf
$ip -br link show
bridge.901@bridge UP 44:38:39:00:77:88 <UP,BROADCAST,MULTICAST,UP>
bridge-901-v0@bridge.901 DOWN  00:00:5e:00:01:81 <BROADCAST,MULTICAST>
myvrf            UP             ce:a6:e1:85:75:73 <NOARP,MASTER,UP,LOWER_UP>

after patch:
------------
$ifup myvrf
$ip -br link show
bridge.901@bridge UP 44:38:39:00:77:88 <UP,BROADCAST,MULTICAST,UP>
bridge-901-v0@bridge.901 UP 00:00:5e:00:01:81 <UP,BROADCAST,MULTICAST,UP>
myvrf                   UP     ce:a6:e1:85:75:73 <NOARP,MASTER,UP,LOWER_UP>

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-10-19 22:23:05 -07:00
Julien Fortin
90649d374a addons: addressvirtual: ifquery normalizing ip address to IPNetwork format for comparaisons
Ticket: None
Reviewed By: Roopa
Testing Done:

Test from CM-8736:

auto bridge
iface bridge
      bridge-vlan-aware yes
      bridge-ports swp42
      mstpctl-treeprio 4096
      bridge-stp on
      bridge-vids 5 13 14 20 799 1001-1006
      bridge-pvid 192

auto bridge.20
iface bridge.20
      address 10.7.192.194/27
      address-virtual 44:38:39:ff:00:20 10.7.192.193

$ ifreload -a
$ ifquery bridge.20 -c
auto bridge.20
iface bridge.20                                                     [fail]
      address 10.7.192.194/27                                     [pass]
      address-virtual 44:38:39:ff:00:20 10.7.192.193/32           [fail]
$

it fails because ifquery is comparing : ['10.7.192.193/32'] with ['10.7.192.193']

after the patch:

$ ifquery bridge.20 -c
auto bridge.20
iface bridge.20                                                     [pass]
      address 10.7.192.194/27                                     [pass]
      	      address-virtual 44:38:39:ff:00:20 10.7.192.193              [pass]

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-10-19 00:41:02 +02:00
Julien Fortin
8e9fc17804 addons: bridge: syntax check for illegal subintf as member of VLAN aware bridge
Ticket: CM-12906
Reviewed By: Roopa, Nikhil G
Testing Done:

$ ifquery br0
auto br0
iface br0
      bridge-vlan-aware yes
      bridge-ports tap0 tap1.100
      bridge-vids 100 200
      bridge-pvid 1
      bridge-stp on

$ ifreload -a -s
error: br0: tap1.100: vlan sub-interface is not supported in a vlan-aware bridge
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-10-19 00:30:21 +02:00
Nikhil
04e4f35239 addons: vrf: cosmetic print statement fix
Ticket: CM-12753
Reviewed By: roopa, julien
Testing Done: used same config mentioned in the bug

Changed %d to %s inorder to print a string.

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-10-04 15:36:28 -07:00
Julien Fortin
9b35cb3e19 addons: vrf: removing ifaceobj.name from exception message
Ticket: None
Reviewed By:
Testing Done:

The function _create_vrf_dev is surrounded by a try/catch as follow:
    try:
        vrf_table = self._create_vrf_dev(ifaceobj, vrf_table)
    except Exception, e:
        self.log_error('%s: %s' %(ifaceobj.name, str(e)), ifaceobj)

Thus we shouldn't include the ifaceobj.name in any error message passed to
log_error(). Since this function will raise an exception by default, it will
result in something like this:

error:br0.4002: red: red: create failed (cmd 'ip link add name red type vrf table 1001' failed: returned 1 ...[snip]
error:red: red: create failed (cmd 'ip link add name red type vrf table 1002' failed: returned 1 ...[snip]

after this patch:
error: red: create failed (cmd 'ip link add name red type vrf table 1002' failed: returned 1 ... [snip]

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-10-04 10:13:23 +02:00
Julien Fortin
b6b8bd2b77 addons may provide a list of ifupdown scripts to ignore
Ticket:
Reviewed By: Roopa, Nikhil G
Testing Done:

ifupdown2's python addons are replacing some/most of the old ifupdown shell
scripts. When addon_scripts_support is set to 1, ifupdown2 will execute every
scripts present in /etc/network/if-$ACTION.d/ if a script exists with a name
identical to an ifupdown2 addon, this script won't be executed.

Sometimes an ifupdown2 addons doesn't have the same name as the ifupdown script
it's supposed to replace. Or maybe one addon is replacing several scripts.
For example: bond.py is replacing /etc/network/if-*.d/ifenslave

Now each addon is able to provide a list of script to ignore.

[16:54:40] root:ifupdown2 # ifquery bond0
iface bond0
      bond-slaves tap0 tap1

[16:54:49] root:ifupdown2 # ifreload -a -d &> /tmp/ifreload.log
[16:54:54] root:ifupdown2 # cat /tmp/ifreload.log | grep ifenslave
debug: tap1: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: tap1: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: lo: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: lo: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: eth0: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: eth0: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: tap0: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: tap0: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
[16:54:55] root:ifupdown2 #
...
apply patch
...
[16:55:16] root:ifupdown2 # ifreload -a -d &> /tmp/ifreload.log
[16:55:18] root:ifupdown2 # cat /tmp/ifreload.log | grep ifenslave
[16:55:19] root:ifupdown2 #

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-09-27 11:05:37 +02:00
Julien Fortin
8252491ed0 addons: mstpctl: warning user when using portadminedge attr on bridge vlan aware
Ticket: CM-12478
Reviewed By: Roopa, Nikhil G

Roopa: "For vlan aware bridge, we don't support the port attributes under the
bridge. It was deliberately done when vlan aware bridge config was introduced
because people wanted to get rid of the legacy under the bridge way of decla-
-ring port attributes. It was supported for a bit for evorack...in limited
 form. we should probably just warn the user about this."

auto br100
iface br100
      bridge_ports swp3 swp4 swp5
      mstpctl-portadminedge swp3=yes swp4=yes swp5=yes
      bridge-vlan-aware yes

$ ifreload -a -s
warning: br100: unsupported use of keyword 'mstpctl-portadminedge' when bridge-vlan-aware is on
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-09-26 15:59:43 +02:00
Julien Fortin
cd45e62956 addons: usercmds: add environment variables passed to user scripts
Ticket: github issue #14
Reviewed By: Roopa, Nikhil G
Testing Done:

$ cat /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
      up /root/test.sh
$
$ cat /root/test.sh
echo 'IFACE=' $IFACE
echo 'LOGICAL=' $LOGICAL
echo 'METHOD=' $METHOD
echo 'ADDRFAM=' $ADDRFAM
$
$ ifreload -a
IFACE= eth0
LOGICAL= eth0
METHOD= dhcp
ADDRFAM= inet
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-09-20 09:16:57 -07:00
Roopa Prabhu
6fa9b969ad Merge branch 'staging3.1.1' into dev 2016-09-16 12:41:06 -07:00
Roopa Prabhu
6fbd7444db addons: vrf: close sockets when vrf interface goes down
Ticket: CM-11393
Reviewed By: dsa, julien, nikhil
Testing Done: tested up and down of a vrf interface

$ifdown -v blue
..snip ..
info: executing /usr/lib/vrf/vrf-helper delete blue 1030
info: executing ip link del blue
info: executing /bin/ss -aK "dev == 54"
info: vrf: syncing table map to
/etc/iproute2/rt_tables.d/ifupdown2_vrf_map.conf

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-09-15 10:51:49 -07:00
Roopa Prabhu
dc3f4c4507 addons: addressvirtual: fix handling of admin state of macvlan interfaces
Ticket: CM-12823
Reviewed By: julien, nikhil
Testing Done: Tested addressvirtual config with vrfs (as described in
the bug)

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-09-15 08:10:32 -07:00
Julien Fortin
0493bac6cb addons: addressvirtual: adjusting macvlan mtu based on the lower device
Ticket: CM-11214
Reviewed By: Roopa
Testing Done:

Previously we were adjusting the macvlan mtu based on the wrong device.
We used to do, using the config example bellow:

get_mtu(ifaceobj.lowerifaces[0])
get_mtu("bridge")

instead of doing get_mtu(bridge.20)

$ cat /etc/network/interfaces
auto tap0
iface tap0
      #mtu 9000
      mtu 1500

auto bridge
iface bridge
      bridge-ports tap0

auto bridge.20
iface bridge.20
      address 10.7.192.194/27
      address-virtual 44:38:39:ff:00:20 10.7.192.193
$ ifreload -a
$ ip link show
bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
bridge.20@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
bridge-20-v0@bridge.20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
$ #change mtu to 9000
$ ifreload -a
$ ip link show
bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP mode DEFAULT group default
bridge.20@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP mode DEFAULT group default
bridge-20-v0@bridge.20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP mode DEFAULT group default
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-09-14 17:15:36 -07:00
Julien Fortin
82908a2d73 normalizing ip address(s) to IPNetwork format for string comparaison
Ticket: CM-12798
Reviewed By: Roopa, Nikhil G
Testing Done:

We are seeing some issue when using IP addresses with inner values padded with
zeros. Such as: 2a01:75e0:0000:09b0::1/64
The kernel will process the ip properly but when we query the kernel again (with
iproute2 or netlink) it returns 2a01:75e0:0:09b0::1/64

Since we are doing string comparaison we are seeing failures. We are now
converting all ip address to a standard format using IPNetwork or IPAddress obj

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-09-14 16:00:25 -07:00
Julien Fortin
df4327e9ca Merge remote-tracking branch 'origin/staging3.1.1' into dev 2016-09-13 17:11:38 -07:00
Julien Fortin
0309264919 addons: address: ignoring iproute2 'rtnetlink file exists' errors
Ticket: CM-12798
Reviewed By: Roopa
Testing Done:

A customer discovered a corner case: the kernel is shrinking/reducing the ip
address fields containing 0s. For example if we configure and address such as
2a01:75e0:0000:09b0::1/64

Then if we query the kernel (using iproute2 or netlink) it will come back as:
2a01:75e0:0:09b0::1/64

Because of this issue we were seeing
root@r4u28:~# ifreload -a
error: bridge.200: cmd 'ip -force -batch - [addr add 10.50.103.193/26 dev bridge.200
addr add 2a01:75e0:0000:09b1::1/64 dev bridge.200
]' failed: returned 1 (RTNETLINK answers: File exists
Command failed -:1
)

Before adding an address to an iface we query it to know if the change is
necessary, since we only do a string comparaison between:
2a01:75e0:0000:09b1::1/64 and 2a01:75e0:0:09b1::1/64

it fails, ifupdown2 thinks that a change is needed. So we try to add the new
address via iproute2. iproute2 will fail because this address in a "shrinked"
format already exists.

This patch hot-fixes this problem by ignoring the error if it's an "exists"
error, we don't want to confuse the user.
A later fix will the real issue by normalizing all ip addr to the IPNetwork
format.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-09-13 17:03:24 -07:00
Daniel Walton
1bb990bd98 3.2 - nclu - net add bridge alias not taking text in quotes
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   roopa@cumulusnetworks.com

Ticket: CM-12764
2016-09-07 19:13:58 +00:00
Daniel Walton
2ed2adeb6e 3.2 - nclu - adding v6 gateway followed by v4 - v6 is lost
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   roopa@cumulusnetworks.com

Ticket: CM-12725
2016-09-07 16:57:55 +00:00
Roopa Prabhu
89a0bc6512 Merge branch 'eadev' into dev
Conflicts:
	addons/address.py
	addons/bridge.py
	nlmanager/nlmanager.py
2016-09-02 16:06:58 -07:00
Roopa Prabhu
6f5b74f7cc addons: vrf: be more friendly to older iproute2 versions
Ticket: CM-12049
Reviewed By: dsa, julien, nikhil
Testing Done: tested with and without /etc/iproute2/rt_tables.d/

OS does not have /etc/iproute2/rt_tables.d, on errors just info:
$ifreload -a -v
info: unable to save iproute2 vrf to table map ([Errno 2] No such file
or directory: '/etc/iproute2/rt_tables.d/ifupdown2_vrf_map.conf')

info: cannot find /etc/iproute2/rt_tables.d. pls check if your iproute2
version supports rt_tables.d

OS has /etc/iproute2/rt_tables.d, on errors warn:
$ifreload -a
warn: unable to save iproute2 vrf to table map ([Errno 2] No such file

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-09-02 15:10:24 -07:00
Roopa Prabhu
29d834f6a8 addons: bridge: protect all vids to int calls under try/except
Ticket: CM-12716
Reviewed By: julien, nikhil
Testing Done: tested with non-int vids and pvid

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-09-02 12:35:05 -07:00
Julien Fortin
707aeb7378 netlink ip link set up/down may silently fail, adding try/except statements
Ticket: CM-12609
Reviewed By: Roopa, Nikhil G
Testing Done: ifupdown2 smoke tests

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-24 14:20:45 -07:00
Nikhil
781b55c5b0 addons: bridge: remove pvid from vids list on ifquery -r for bridge port
Ticket: CM-12494
Reviewed By: roopa, julien
Testing Done: used config mentioned in bug

'ifquery -r' on a specific bridge port was not removing
pvid from the list of vids.
This patch does that.

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-08-24 10:19:55 -07:00
Roopa Prabhu
5859b3228e addons: bridge: fix running_vids value when cache is stale
Ticket: CM-12552
Reviewed By: julien, nikhil
Testing Done: tested with failing config with bridge-access 1

This is similar to the fix done in the below commit for pvid:
"5061730ea5bf ("addons: bridge: fix default pvid handling in cases where
cache is stale")"

easier steps to reproduce:
- have a vlan aware bridge with more than one ports
- add 'bridge-access 1' to one of the ports
- boot the box with the config
- check that the  vlans are fine
- ifdown <interface_with_bridge_access_1>
- ifreload -a
- the interface with bridge_access 1 does
not have the pvid flag on vlan 1

This patch makes sure we assume the right running
vid and pvid value ie [1] and 1 if the
cache returns no values. vid = [1] and pvid = 1
are the kernel default/initial values for a port.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-24 10:19:55 -07:00
Roopa Prabhu
0184c8c537 addons: vrf: don't delete vrf map file at init if mgmt vrf already exists
Ticket: CM-12084
Reviewed By: julien, nikhil
Testing Done: tested with --allow=mgmt class

This fixes a problem where vrf map file was getting deleted
at boot during the second invocation of ifup. This is because
the code uses PERFMODE to check it is boot..but does
not realize that this may not be the first invocation of
ifup during the boot.

This patch adds additional checks for mgmt netdev to
make sure we delete the vrf map file only the first time.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-24 10:19:55 -07:00
Roopa Prabhu
bdd4e7fed0 addons: bridge: move the default running_pvid assignment to before
pvid_to_del is calculated

Ticket: CM-12355
Reviewed By: julien, nikhil
Testing Done: tested with failing config

My previous fix for the same bug did not fix the problem completly.
In this patch all running pvid calculation
is done before the pvid_to_del is calculated.
This makes sure the old pvid is deleted if it is not
the same as current pvid in all cases

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-24 10:19:54 -07:00
Roopa Prabhu
2906e48d49 addons: vxlan: fix ifquery running to not proceed when vxlan-id is not
available

Ticket: CM-12378
Reviewed By: julien, nikhil
Testing Done: tested ifquery running with examples in the bug

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-24 10:19:54 -07:00
Roopa Prabhu
4739898bf5 addons: vrf: change warn to error if vrf master is not configured
Ticket: CM-12360
Reviewed By: julien, nikhil
Testing Done: tested vrf slaves without master

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-24 10:19:54 -07:00
Roopa Prabhu
804dcbd02d addons: bridge: fix default pvid handling in cases where cache is stale
Ticket: CM-12355
Reviewed By: julien, nikhil
Testing Done: tested with failing config

This can happen if the bridge vlans were
cached before the interface become a bridge port.
and when the interface becomes a bridge port
kernel adds a default pvid of 1. so this patch
assumes a default pvid is 1 if we did not find
anything in the cache. This will delete
the default pvid of 1 if the user has configured a
different pvid.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-24 10:19:53 -07:00
Roopa Prabhu
c14de85ca4 addons: ethtool: skip speed zero from query running
kernel might return running speed 0 if port does
not have carrier

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-24 10:19:53 -07:00
Roopa Prabhu
6fa93b22fe addons: address: never reset mtu on lo implicity
we should leave the mtu on lo to the default mtu
if user has not requested to change it. lo has
a larger mtu because it does not really depend on a
physical mtu.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-24 10:19:53 -07:00