]> git.proxmox.com Git - mirror_ifupdown2.git/log
mirror_ifupdown2.git
7 years agoifupdown: iface: fix changes in default json output and ifquery -r output for inet6
Julien Fortin [Mon, 21 Nov 2016 14:23:22 +0000 (15:23 +0100)]
ifupdown: iface: fix changes in default json output and ifquery -r output for inet6

Ticket: CM-12370
Reviewed By: Roopa, Nikhil G
Testing Done:

    incremental commit of:
    bef23f40a1e5 dhcp: add support for inet + inet6 dhcp on same interface

    (jessie-30-dev-switch-amd64-sbuild)root@host1:/home/cumulus# ifquery swp1 -o json
    [
        {
            "name": "swp1",
            "addr_method": "dhcp",
            "addr_family": "inet",
            "auto": true,
            "config": {
                "link-duplex": "full",
                "link-autoneg": "off",
                "link-speed": "10000"
            }
        },
        {
            "name": "swp1",
            "addr_method": "dhcp",
            "addr_family": "inet6",
            "auto": true,
            "config": {}
        }
    ]
    (jessie-30-dev-switch-amd64-sbuild)root@host1:/home/cumulus# ifquery swp1 -o json -c
    [
      {
        "name": "swp1",
        "addr_method": "dhcp",
        "addr_family": "inet",
        "auto": true,
        "config": {},
        "config_status": {},
        "status": "pass"
      },
      {
        "name": "swp1",
        "addr_method": "dhcp",
        "addr_family": "inet6",
        "auto": true,
        "config": {},
        "config_status": {},
        "status": "pass"
      }
    ]
    (jessie-30-dev-switch-amd64-sbuild)root@host1:/home/cumulus# ifquery swp1 -o json -r
    [
      {
        "name": "swp1",
        "addr_method": "dhcp",
        "addr_family": [
          "inet",
          "inet6"
        ],
        "auto": true,
        "config": {}
      }
    ]
    (jessie-30-dev-switch-amd64-sbuild)root@host1:/home/cumulus#

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoman: update ifreload man page to indicate that ifreload is
Roopa Prabhu [Thu, 17 Nov 2016 17:19:53 +0000 (09:19 -0800)]
man: update ifreload man page to indicate that ifreload is
non-disruptive

Ticket: CM-12655
Reviewed By: julien
Testing Done: tested build and help

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
7 years agoifupdown: iface: if auto %ifacename is not part of the first stanza we squash it
Julien Fortin [Fri, 18 Nov 2016 16:14:13 +0000 (17:14 +0100)]
ifupdown: iface: if auto %ifacename is not part of the first stanza we squash it

Ticket: CM-12713
Reviewed By: Roopa, Nikhil G
Testing Done: Test from the bug

% for i in range(1,49):
iface swp${i}
    mtu 9216
    link-speed 10000
    link-duplex full
    link-autoneg off
% endfor

auto swp1
iface swp1

% ifup -a -v # should only up swp1

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoifupdownmain: warn user if an interface matches a regex but doesn't exists in the...
Julien Fortin [Thu, 17 Nov 2016 20:56:37 +0000 (21:56 +0100)]
ifupdownmain: warn user if an interface matches a regex but doesn't exists in the config anymore

Ticket: CM-13316
Reviewed By: Roopa, Nikhil G
Testing Done:

auto v0
iface v0
      vlan-id 100
      vlan-raw-device tap1

auto v1
iface v1
      vlan-id 100
      vlan-raw-device tap2

auto v2
iface v2
      vlan-id 100
      vlan-raw-device tap3

auto br0
iface br0
        bridge-ports tap9 regex v.*

In this specific case, if you remove v0 then execute ifreload ifupdown2 will
barf and say that v0 still exists as a dependency of br0.

From roopa:
The problem here is that the dependency gathering should have been done after
the ifdown's. However the ifdown's  need the dependency tree for built in
interfaces which could be part of globs. And this dependency tree needs to be
the current state of things so can't do the selective picking of interfaces
either. So, its a chicken and egg problem.

Ideally when one uses regex, if he is removing an interface that was matched by
a regex, he has to do a 'ifdown' manually today. 'ifdown v0' in this case.

So today we decided to change the warning message to let the user know that he
should manually down the interface that matches a regex.
This is not a permanent fix but a work-around. We don't want to introduce new
changes that may introduce false positive case for existing and working config

post 3.2:
-----------
we should consider doing the down's in two phases during ifreload
a) down everything that we are very certain was removed from the file
(to make sure regex's don't catch it).
b) build dependency tree and run through the down's once more, to
catch all glob matches for built-in interfaces

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoaddons: bridge: disable ip fwding on a bridge with no ip and no upperifaces
Roopa Prabhu [Tue, 15 Nov 2016 05:27:02 +0000 (21:27 -0800)]
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>
7 years agosystemd: start-networking: include interface exclusions in all targets
Roopa Prabhu [Mon, 14 Nov 2016 20:48:41 +0000 (12:48 -0800)]
systemd: start-networking: include interface exclusions in all targets

Ticket: CM-12934
Reviewed By: julien
Testing Done: tested systemctl <start|stop> networking with interface
exclusions

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
7 years agoaddons: usercmd: ifquery lists user commands and sets unknown status
Julien Fortin [Wed, 16 Nov 2016 11:02:54 +0000 (12:02 +0100)]
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>
7 years agodhcp: add support for inet + inet6 dhcp on same interface
Julien Fortin [Tue, 15 Nov 2016 17:33:07 +0000 (18:33 +0100)]
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>
7 years agoaddons: bridge/bond: fix ifquery regression where glob and regexes weren't expanded
Julien Fortin [Tue, 15 Nov 2016 13:25:10 +0000 (14:25 +0100)]
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>
7 years agoifupdown: fix built-in iface ranges to include swp[1-3].100
Roopa Prabhu [Sun, 13 Nov 2016 22:31:38 +0000 (14:31 -0800)]
ifupdown: fix built-in iface ranges to include swp[1-3].100

Ticket: CM-11536, CM-11537
Reviewed By: julien, nikhil
Testing Done: Tested ifup, ifdown, ifquery for inerface ranges

Code already supports 'iface swp1.[2-4]'
This patch extends that support to include 'iface swp[1-3].100'.

Also fixes boundary conditions described in CM-11537. This
makes it consistent with glob syntax.

example config file with all cases:

auto swp[2-4].100
iface swp[2-4].100

auto swp5.[100-104]
iface swp5.[100-104]

auto br0
iface br0
        bridge-ports glob swp[6-7].100

auto bridge.[100-104]
vlan bridge.[100-104]
        bridge-igmp-querier-src 123.1.1.1

auto bridge
iface bridge
        bridge-vlan-aware yes
        bridge-ports glob swp8-9
        bridge-vids 100-104

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
7 years agonetlink: force python to load ifupdown2's nlmanager cpy instead of python-nlmanager
Julien Fortin [Thu, 10 Nov 2016 18:14:43 +0000 (19:14 +0100)]
netlink: force python to load ifupdown2's nlmanager cpy instead of python-nlmanager

Ticket: CM-13453
Reviewed By: Roopa, Nikhil G, Daniel W
Testing Done: ifupdown2-tests

We had an issue where python-nlmanager and ifupdown2's nlmanager differed
When netd starts it loads ifupdown2's addons, so it also tries to do the
imports. Since the current working directy is not /usr/share/ifupdown2 but
netd directory it won't load ifupdown2's nlmanager first but python-nlmanager
if it exists.

Here we insert/hardcode /usr/share/ifupdown2/ first in the path to make sure
we load the right nlmanager

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoaddons: address: various fixes for mtu handling
Roopa Prabhu [Mon, 7 Nov 2016 18:48:24 +0000 (10:48 -0800)]
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>
7 years agoifupdown2:ethtool: Add link-fec extension support
Vidya Sagar Ravipati [Thu, 3 Nov 2016 17:47:54 +0000 (10:47 -0700)]
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>
7 years agonlmanager: removes 'Add support for decoding' debug msgs on -d output
Julien Fortin [Fri, 4 Nov 2016 10:36:25 +0000 (11:36 +0100)]
nlmanager: removes 'Add support for decoding' debug msgs on -d output

Ticket: CM-13208
Reviewed By: Roopa, Scott E, Daniel
Testing Done: smoke + ifupdown2-tests

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agonlmanager: pulling-in latest stable version
Julien Fortin [Fri, 4 Nov 2016 10:19:06 +0000 (11:19 +0100)]
nlmanager: pulling-in latest stable version

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agonlmanager: Provide option to prevent color output
Scott Emery [Mon, 29 Aug 2016 18:28:52 +0000 (11:28 -0700)]
nlmanager: Provide option to prevent color output

Ticket: CM-7361
Reviewed By: CCR-
Testing Done: Tested with clag

Certain loggers, most notably the syslog, don't allow non-printable characters
in their output, and so they convert them to a string of printable characters.
For example, the newline character is converted to #012. This results in output
that looks like this:

2016-08-29T18:50:46.263178+00:00 act-5712-08 clagd[21539]: RXed RTM_NEWNEIGH,
length 68, seq 0, pid 0, flags 0x0#012#012  #033[91mNetlink Header#033[0m#012
1: #033[91m0x44000000#033[0m  D...  Length 0x00000044 (68)#012   2:
#033[91m0x1c000000#033[0m  ....  Type 0x001c (28 - RTM_NEWNEIGH), Flags 0x0000
()#012   3: #033[91m0x00000000#033[0m  ....  Sequence Number 0x00000000 (0)#012
4: #033[91m0x00000000#033[0m  ....  Process ID 0x00000000 (0)#012
#033[93mService Header#033[0m#012   5: #033[93m0x07000000#033[0m  ....  Family
0x07 (7)#012   6: #033[93m0x29010000#033[0m  )...  Interface Index 0x00000129
(297)#012   7: #033[93m0x02000000#033[0m  ....  State 0x0002 (2), Flags 0x00,
Type 0x0000 (0)#012  Attributes#012   8: #033[92m0x0a000200#033[0m  ....  Length
0x000a (10) padded to 12, Type 0x0002 (2) NDA_LLADDR#012   9:
#033[92m0x00020000#033[0m  ....  00:02:00:00:00:09#012  10:
#033[92m0x00090000#033[0m  ....  #012  11: #033[94m0x08000900#033[0m  ....
Length 0x0008 (8), Type 0x0009 (9) NDA_MASTER#012  12: #033[94m0x2b010000#033[0m
+...  299#012  13: #033[92m0x14000300#033[0m  ....  Length 0x0014 (20), Type
0x0003 (3) NDA_CACHEINFO#012  14: #033[92m0x00000000#033[0m  ....  0#012  15:
#033[92m0x00000000#033[0m  ....  0#012  16: #033[92m0x00000000#033[0m  ....
0#012  17: #033[92m0x00000000#033[0m  ....  0#012#012Attributes Summary#012{'(
2) NDA_LLADDR': '00:02:00:00:00:09',#012 '( 3) NDA_CACHEINFO': (0, 0, 0, 0),#012
'( 9) NDA_MASTER': 299}

which is rather hard to interpret. So this patch modifes the nlpacket debug
output so that the user can specify whether or not color output should be used
by including an extra, optional parameter when instantiating a NetlinkPacket
object. The default is for color output, just like before this patch. But if
color output is not desired, then no VT100 control sequences will be output. Nor
will there be any newline characters embedded in the output.

The NetlinkManagerWithListener and NetlinkManager classes were also modified to
add the same optional use_color attribute, which defaults to True. Thus when
class members which instantiate NetlinkPacket objects are created the
appropriate value for the use_color attribute will be applied.

I also noticed that the default pid_offset of the NetlinkListener class was 2,
when it should have been 1. So I fixed that too.

7 years agonlmanager: Support new attribute types
Scott Emery [Mon, 22 Aug 2016 19:51:40 +0000 (12:51 -0700)]
nlmanager: Support new attribute types

Ticket: CM-7361
Reviewed By: CCR-5124
Testing Done: Tested with clag

CLAG requires some additional nlmanager functionality. Firstly, different
threads in CLAG with the same PID may instantiate NetlinkManager objects. This
currently assigned each the same pid value, which causes issues. So an optional
pid_offset parameter is added which is added to the PID when instantiating a
NetlinkManager object. This allows multiple threads in the same PID to be able
to have distinct identifiers. If a pid_offset is supplied, it should be 2 or
greater, since 0 and 1 are used by the NetlinkManagerWithListener.

Added two new attribute classes: FourByteList and TwoByteValue. Added an encode
function for the IPAddress attribute, and corrected some length errors in the
MACAddress attribute.

The Neighbor class got actual values for the CacheInfo, VLAN, VNI, IfIndex, and
Master attributes. The "Self" and "Master" flag values were added.

Also added the "family" parameter to the constructor for all attribute classes.
This eliminates the special-casing required for certain attribute's
instantiation.

7 years agoaddons: bond: 'ifquery -c' doesn't re-order user's bond-slaves list
Julien Fortin [Mon, 31 Oct 2016 00:45:46 +0000 (01:45 +0100)]
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>
7 years agoaddons: bridge: 'ifquery -c' doesn't re-order user's bridge-ports list
Julien Fortin [Mon, 31 Oct 2016 00:37:02 +0000 (01:37 +0100)]
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>
7 years agoaddons: bridge: bridge-access + bridge-vids on the same intf give a warning
Julien Fortin [Mon, 31 Oct 2016 00:24:31 +0000 (01:24 +0100)]
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>
7 years agoaddons: mstpctl: ifquery -with-defaults update for vlan-aware bridge ports
Nikhil [Thu, 6 Oct 2016 00:26:09 +0000 (17:26 -0700)]
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>
7 years agobridge-vids needs to be multivalue
Daniel Walton [Fri, 28 Oct 2016 00:01:13 +0000 (00:01 +0000)]
bridge-vids needs to be multivalue

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: julien@cumulusnetworks.com
7 years agoman: ifup: fixing spelling mistake
Julien Fortin [Sun, 23 Oct 2016 22:41:21 +0000 (00:41 +0200)]
man: ifup: fixing spelling mistake

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agodebian: control: updating standards-version to 3.9.8
Julien Fortin [Sun, 23 Oct 2016 22:40:17 +0000 (00:40 +0200)]
debian: control: updating standards-version to 3.9.8

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoRevert "ifupdown: utils: user command output on stdout"
Roopa Prabhu [Tue, 1 Nov 2016 04:41:47 +0000 (21:41 -0700)]
Revert "ifupdown: utils: user command output on stdout"

This reverts commit d9bb08208429349566139cd5fc65693c2493c372.

7 years agodebian: update changelog for version cl3u6
Julien Fortin [Mon, 24 Oct 2016 08:50:08 +0000 (10:50 +0200)]
debian: update changelog for version cl3u6

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoMerge branch 'dev' into release/cl-stable
Julien Fortin [Fri, 21 Oct 2016 21:10:09 +0000 (23:10 +0200)]
Merge branch 'dev' into release/cl-stable

7 years ago[PATCH ifupdown2] addons: addressvirtual: fixup macvlan device enslavements for vrfs
Roopa Prabhu [Wed, 19 Oct 2016 17:43:45 +0000 (10:43 -0700)]
[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>
7 years agoaddons: addressvirtual: ifquery normalizing ip address to IPNetwork format for compar...
Julien Fortin [Tue, 18 Oct 2016 22:41:02 +0000 (00:41 +0200)]
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>
7 years agoaddons: bridge: syntax check for illegal subintf as member of VLAN aware bridge
Julien Fortin [Tue, 18 Oct 2016 22:30:21 +0000 (00:30 +0200)]
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>
7 years agoifupdownmain: missing return statement and fixing 'network down' error checking
Julien Fortin [Mon, 10 Oct 2016 13:22:30 +0000 (15:22 +0200)]
ifupdownmain: missing return statement and fixing 'network down' error checking

Ticket:
Reviewed By: Roopa, Nikhil G

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agodocs: examples: adding new example interface file
Julien Fortin [Wed, 5 Oct 2016 14:44:42 +0000 (16:44 +0200)]
docs: examples: adding new example interface file

Ticket: None
Reviewed By: Roopa
Testing Done:

This new interface file uses bridge, vlan, vxlan, bond and vrf interfaces.
It's a good way to try ifupdown2 capabilities.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoaddons: vrf: cosmetic print statement fix
Nikhil [Tue, 4 Oct 2016 18:37:52 +0000 (11:37 -0700)]
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>
7 years agoifupdownaddons: bridgeutils: iproute2: skipping unsupported commands
Julien Fortin [Tue, 4 Oct 2016 08:18:26 +0000 (10:18 +0200)]
ifupdownaddons: bridgeutils: iproute2: skipping unsupported commands

Ticket:
Reviewed By: Roopa, Nikhil G
Testing Done:

When using ifupdown2 on regular distribution (debian/ubuntu etc...) users may
not have the latest iproute2/bridge-utils version. Thus the output parsed from
the various subcommands executed by ifupdown2 might defer and cause exception
to be throwned.
We identified several cases:
/sbin/bridge -c -json vlan show
/sbin/brctl showmcqv4src bridge0
/sbin/brctl showstp bridge0

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
7 years agoaddons: vrf: removing ifaceobj.name from exception message
Julien Fortin [Tue, 4 Oct 2016 08:13:23 +0000 (10:13 +0200)]
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>
8 years agoaddons may provide a list of ifupdown scripts to ignore
Julien Fortin [Tue, 27 Sep 2016 09:05:37 +0000 (11:05 +0200)]
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>
8 years agoaddons: mstpctl: warning user when using portadminedge attr on bridge vlan aware
Julien Fortin [Mon, 26 Sep 2016 13:59:43 +0000 (15:59 +0200)]
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>
8 years agoifupdownmain: sending ifaceobj to syntax_check method
Julien Fortin [Mon, 26 Sep 2016 08:37:33 +0000 (10:37 +0200)]
ifupdownmain: sending ifaceobj to syntax_check method

Ticket: None
Reviewed By: Roopa, Nikhil G

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoifupdown: scheduler: ignore errors generated by upperiface bring up
Roopa Prabhu [Wed, 21 Sep 2016 23:03:11 +0000 (16:03 -0700)]
ifupdown: scheduler: ignore errors generated by upperiface bring up

Ticket: CM-12923
Reviewed By: julien, nikhil
Testing Done: tested implicit upperiface bring up

upperiface bringup is best effort, so ignore errors.

$ifquery -c -a
..[snip]...
auto br0
iface br0
        bridge-vlan-aware yes                        [pass]
        bridge-ports vx-14 vx-11 vx-10 vx-13 vx-12   [pass]

$ifdown vx-10
$ifdown vx-11

before patch:
$ifup vx-10
..[snip]...
info: running upperifaces (parent interfaces) if available ..
info: br0: running ops ...
error: br0: bridge port vx-11 does not exist
....

After patch:
$ifup vx-10
..[snip]...
info: running upperifaces (parent interfaces) if available ..
info: br0: running ops ...
....

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: usercmds: add environment variables passed to user scripts
Julien Fortin [Tue, 20 Sep 2016 16:16:57 +0000 (09:16 -0700)]
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>
8 years agodebian: changelog: fixup last released and unreleased versions
Roopa Prabhu [Mon, 19 Sep 2016 23:30:42 +0000 (16:30 -0700)]
debian: changelog: fixup last released and unreleased versions

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agodebian: changelog: add cumulus ticket-ids to changelog entries
Roopa Prabhu [Mon, 19 Sep 2016 17:15:47 +0000 (10:15 -0700)]
debian: changelog: add cumulus ticket-ids to changelog entries

Adhere to cumulus changelog policy.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agodebian: changelog: update version to 1.1-cl3u5
Roopa Prabhu [Fri, 16 Sep 2016 19:50:42 +0000 (12:50 -0700)]
debian: changelog: update version to 1.1-cl3u5

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoMerge branch 'staging3.1.1' into dev
Roopa Prabhu [Fri, 16 Sep 2016 19:41:06 +0000 (12:41 -0700)]
Merge branch 'staging3.1.1' into dev

8 years agofix for passing parameters to templateEngine() class
Marek Grzybowski [Thu, 15 Sep 2016 19:39:16 +0000 (21:39 +0200)]
fix for passing parameters to templateEngine() class

Signed-off-by: Marek Grzybowski <marek.grzybowski@rtbhouse.com>
8 years agoifupdownmain: dont catch link_up and link_down errors in ifupdownmain
Roopa Prabhu [Fri, 16 Sep 2016 18:29:27 +0000 (11:29 -0700)]
ifupdownmain: dont catch link_up and link_down errors in ifupdownmain

Ticket: CM-12843
Reviewed By: julien, nikhil
Testing Done: Tested the failing test case in the bug

The scheduler already has some checking for errors from
link_up and link_down introduced by
commit 61c4d7244735 ("Suppress 'Network down' warnings when
link_master_slave feature is on").

The above fix was removed by a recent commit
707aeb737882 ("netlink ip link set up/down may silently fail, adding
try/except statements"). The scheduler does catch these errors.
so we will need to figure out why the scheduler is not catching it.
Right now this is failing an automation test. So the best fix
is to make sure the previous behaviour is restored.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vrf: close sockets when vrf interface goes down
Roopa Prabhu [Thu, 15 Sep 2016 17:10:39 +0000 (10:10 -0700)]
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>
8 years agoaddons: addressvirtual: fix handling of admin state of macvlan interfaces
Roopa Prabhu [Wed, 14 Sep 2016 18:19:57 +0000 (11:19 -0700)]
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>
8 years agoaddons: addressvirtual: adjusting macvlan mtu based on the lower device
Julien Fortin [Thu, 15 Sep 2016 00:15:36 +0000 (17:15 -0700)]
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>
8 years agonormalizing ip address(s) to IPNetwork format for string comparaison
Julien Fortin [Wed, 14 Sep 2016 23:00:25 +0000 (16:00 -0700)]
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>
8 years agoMerge remote-tracking branch 'origin/staging3.1.1' into dev
Julien Fortin [Wed, 14 Sep 2016 00:11:38 +0000 (17:11 -0700)]
Merge remote-tracking branch 'origin/staging3.1.1' into dev

8 years agoaddons: address: ignoring iproute2 'rtnetlink file exists' errors
Julien Fortin [Wed, 14 Sep 2016 00:03:24 +0000 (17:03 -0700)]
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>
8 years agoifupdown: netlink: removing log message when retrieving ifindex
Julien Fortin [Tue, 13 Sep 2016 18:27:14 +0000 (11:27 -0700)]
ifupdown: netlink: removing log message when retrieving ifindex

Ticket: None
Reviewed By: Roopa

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agodebian: fixing lintian warnings/errors
Julien Fortin [Fri, 9 Sep 2016 19:30:50 +0000 (12:30 -0700)]
debian: fixing lintian warnings/errors

Ticket:
Reviewed By: Roopa
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years ago3.2 - nclu - net add bridge alias not taking text in quotes
Daniel Walton [Wed, 7 Sep 2016 19:13:58 +0000 (19:13 +0000)]
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

8 years ago3.2 - nclu - adding v6 gateway followed by v4 - v6 is lost
Daniel Walton [Wed, 7 Sep 2016 16:57:55 +0000 (16:57 +0000)]
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

8 years agoMerge branch 'eadev' into dev
Roopa Prabhu [Fri, 2 Sep 2016 23:06:58 +0000 (16:06 -0700)]
Merge branch 'eadev' into dev

Conflicts:
addons/address.py
addons/bridge.py
nlmanager/nlmanager.py

8 years agoaddons: vrf: be more friendly to older iproute2 versions
Roopa Prabhu [Fri, 2 Sep 2016 22:10:24 +0000 (15:10 -0700)]
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>
8 years agoaddons: bridge: protect all vids to int calls under try/except
Roopa Prabhu [Fri, 2 Sep 2016 19:35:05 +0000 (12:35 -0700)]
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>
8 years agonlmanager: fixing error messages when receiving NLMSG_ERROR
Julien Fortin [Thu, 25 Aug 2016 21:57:21 +0000 (14:57 -0700)]
nlmanager: fixing error messages when receiving NLMSG_ERROR

Ticket: CM-12596
Reviewed By: Roopa, Daniel W
Testing Done:

before this patch:

$ cat /etc/network/interfaces
auto tapppppppppppp0.42
iface tapppppppppppp0.42
$
$ ifreload -a
warning: /etc/network/interfaces: line8: tapppppppppppp0.42: interface name too long
error: netlink: tapppppppppppp0: cannot create vlan 42: Operation failed with 'None' (RXed  NLMSG_ERROR, pid 3346, seq 6, 108 bytes)
$

after:

$ ifreload -a
warning: /etc/network/interfaces: line8: tapppppppppppp0.42: interface name too long
error: netlink: tapppppppppppp0: cannot create vlan 42: Operation failed with 'Numerical result out of range'
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agonlmanager: support for bridge vlan and show commands
Julien Fortin [Thu, 25 Aug 2016 21:39:36 +0000 (14:39 -0700)]
nlmanager: support for bridge vlan and show commands

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: julien@cumulusnetworks.com
Ticket: CM-12199

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agonetlink ip link set up/down may silently fail, adding try/except statements
Julien Fortin [Wed, 24 Aug 2016 21:20:45 +0000 (14:20 -0700)]
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>
8 years agoaddons: bridge: remove pvid from vids list on ifquery -r for bridge port
Nikhil [Wed, 24 Aug 2016 16:38:17 +0000 (09:38 -0700)]
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>
8 years agonlmanager: changing log level (info->debug) for TXed messages
Julien Fortin [Tue, 23 Aug 2016 23:38:36 +0000 (16:38 -0700)]
nlmanager: changing log level (info->debug) for TXed messages

Ticket: CM-11857
Reviewed By: Roopa, Daniel W
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agordnbrd "Interrupted system call" traceback in nlmanager
Julien Fortin [Sun, 21 Aug 2016 21:35:04 +0000 (14:35 -0700)]
rdnbrd "Interrupted system call" traceback in nlmanager

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: roopa@cumulusnetworks.com
Ticket: CM-12487

8 years agonlmanager: rdnbrd "Interrupted system call" traceback in nlmanager
Julien Fortin [Sun, 21 Aug 2016 03:43:12 +0000 (20:43 -0700)]
nlmanager: rdnbrd "Interrupted system call" traceback in nlmanager

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: roopa@cumulusnetworks.com
Ticket: CM-12487

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoaddons: bridge: fix running_vids value when cache is stale
Roopa Prabhu [Fri, 19 Aug 2016 18:09:57 +0000 (11:09 -0700)]
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>
8 years agoaddons: vrf: don't delete vrf map file at init if mgmt vrf already exists
Roopa Prabhu [Sat, 13 Aug 2016 06:49:29 +0000 (23:49 -0700)]
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>
8 years agonetlink: adding ifacename name at the beginning of log info msg
Julien Fortin [Fri, 12 Aug 2016 15:36:27 +0000 (17:36 +0200)]
netlink: adding ifacename name at the beginning of log info msg

Ticket: None
Reviewed By: Roopa
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoifupdownaddons: modulebase: log_error will log.error or raise an exception
Julien Fortin [Fri, 12 Aug 2016 14:30:53 +0000 (16:30 +0200)]
ifupdownaddons: modulebase: log_error will log.error or raise an exception

Ticket: None
Reviewed By: Roopa, Nikhil G
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agonetlink: logging equivalent iproute2 commands
Julien Fortin [Fri, 12 Aug 2016 13:45:52 +0000 (15:45 +0200)]
netlink: logging equivalent iproute2 commands

Ticket: None
Reviewed By: Roopa, Nikhil G
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoaddons: bridge: move the default running_pvid assignment to before
Roopa Prabhu [Fri, 12 Aug 2016 05:36:39 +0000 (22:36 -0700)]
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>
8 years agoaddons: vxlan: fix ifquery running to not proceed when vxlan-id is not
Roopa Prabhu [Thu, 11 Aug 2016 23:35:01 +0000 (16:35 -0700)]
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>
8 years agomodulebase: dont set iface status to error if raise_err is False
Roopa Prabhu [Thu, 11 Aug 2016 23:30:00 +0000 (16:30 -0700)]
modulebase: dont set iface status to error if raise_err is False

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vrf: change warn to error if vrf master is not configured
Roopa Prabhu [Thu, 11 Aug 2016 23:20:16 +0000 (16:20 -0700)]
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>
8 years agonlpacket: add new attribute: AttributeStringInterfaceName with length check
Julien Fortin [Thu, 11 Aug 2016 01:05:04 +0000 (03:05 +0200)]
nlpacket: add new attribute: AttributeStringInterfaceName with length check

Ticket: CM-12302
Reviewed By: Daniel, Roopa, Nikhil G
Testing Done: ifupdown2 smoke test

With this pretty straight forward, we introduce a new Attribute in nlmanager,
so that we have single check and no code redundancy for ifname length. This
also prevent loosing time sending a netlink packet for an known error.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoaddons: bridge: fix default pvid handling in cases where cache is stale
Roopa Prabhu [Wed, 10 Aug 2016 22:35:48 +0000 (15:35 -0700)]
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>
8 years agonlmanager: changing messages logged and raised when RXed NLMSG_ERROR
Julien Fortin [Thu, 11 Aug 2016 00:41:29 +0000 (02:41 +0200)]
nlmanager: changing messages logged and raised when RXed NLMSG_ERROR

Ticket: None
Reviewed By: Roopa, Nikhil G, Daniel
Testing Done: ifupdown2 smokes

The message logged and the exception raised by nlmanager, when receiving
an NLMSG_ERROR packet from the kernel, wasn't super explicit plus if the
error wasn't a netlink related failure we didn't provide any information
Now we use strerror with the provided error code to generate a nice msg.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agonlmanager: wait for ACK after single packet operation
Julien Fortin [Thu, 11 Aug 2016 00:40:24 +0000 (02:40 +0200)]
nlmanager: wait for ACK after single packet operation

Ticket: None
Reviewed By: Roopa, Nikhil G, Daniel
Testing Done: ifupdown2 smoke

We used to have these checks in the old rtnetlink python library.
They were missing in python-nlmanager this was a big regression for
ifupdown2.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoifupdownaddons: iproute2: Cache vxlan remote ip addresses only if
Balakrishnan Raman [Tue, 9 Aug 2016 05:09:32 +0000 (22:09 -0700)]
ifupdownaddons: iproute2: Cache vxlan remote ip addresses only if
statically configured

Ticket: CM-12277
Reviewed By: CCR-5059
Testing Done: ifreload with a VxlanClagClosConfig.py config

get_vxlan_peers gets remote ip addresses if they are statically configured
through ifupdown2 (vxlan-remoteip <address>). These are cached in
ifupdown2's link object so that they can be used in 'ip link set' (if link
exists already), 'ifquery -r' and 'ifquery -c'. ifupdown2 should ignore and
not cache these addresses if they are provisioned by vxrd. Check if vxrd is
running before caching remote ip addresses. This helps in optimizing time
taken to ifreload with 1k bridge/vxlan interfaces (vlan-aware bridge) in a
vxrd/vxsnd setup.

Signed-off-by: Balakrishnan Raman <ramanb@cumulusnetworks.com>
8 years agoaddons: ethtool: skip speed zero from query running
Roopa Prabhu [Tue, 9 Aug 2016 06:15:20 +0000 (23:15 -0700)]
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>
8 years agoaddons: address: never reset mtu on lo implicity
Roopa Prabhu [Mon, 8 Aug 2016 22:46:13 +0000 (15:46 -0700)]
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>
8 years agoaddons: bridge: use bridge json output for vlan
Roopa Prabhu [Mon, 8 Aug 2016 15:18:34 +0000 (08:18 -0700)]
addons: bridge: use bridge json output for vlan

Ticket: CM-11274
Reviewed By: julien, nikhil
Testing Done: tested with various bridge config

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vrf: bring up vrf master when ALL or CLASS
Roopa Prabhu [Fri, 5 Aug 2016 18:32:21 +0000 (11:32 -0700)]
addons: vrf: bring up vrf master when ALL or CLASS

Ticket: CM-12084
Reviewed By: julien, nikhil
Testing Done: Tested ifreload/ifup/ifdown --allow=<class>

vrf slave brings up the master if master is not up yet.
Today this is done only when ALL (auto) option is set
just as an optimization. because you dont want to bring
up the master in cases where user just wants to
bring up the vrf slave. eg ifup -v eth0.

This does not work so well, when user uses
--allow classes to bring up vrf master and slaves
together (eg mgmt vrf).

This patch removes the ALL check when bringing
up master and replaces it with an ALL or
CLASS check. ie make sure vrf master belongs to the
same class as you when CLASS is specified.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdown: move IFACE_CLASS ifupdownmain flag to ifupdownflags.CLASS
Roopa Prabhu [Fri, 5 Aug 2016 18:28:28 +0000 (11:28 -0700)]
ifupdown: move IFACE_CLASS ifupdownmain flag to ifupdownflags.CLASS

This patch moves ifupdownmain flag IFACE_CLASS to
ifupdownflags.CLASS. ifupdownflags.CLASS is set to true
if the user is asking for a class of interfaces.
example: ifreload --allow=mgmt

By moving it to ifupdownflags, we make it visible
to add modules.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: vlan: fix checking of vlan device in query-running
Roopa Prabhu [Thu, 4 Aug 2016 16:03:00 +0000 (09:03 -0700)]
addons: vlan: fix checking of vlan device in query-running

Ticket: CM-11804
Reviewed By: julien, nikhil
Testing Done: Tested with failing config in the bug

This patch makes sure macvlan devices are ignored by ifquery -ra

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agonlmanager: changing log level (info->debug) for TXed messages
Julien Fortin [Tue, 23 Aug 2016 23:38:36 +0000 (16:38 -0700)]
nlmanager: changing log level (info->debug) for TXed messages

Ticket: CM-11857
Reviewed By: Roopa, Daniel W
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoMerge branch 'dev' into release/cl-stable
Julien Fortin [Sun, 21 Aug 2016 21:35:56 +0000 (14:35 -0700)]
Merge branch 'dev' into release/cl-stable

8 years agordnbrd "Interrupted system call" traceback in nlmanager
Julien Fortin [Sun, 21 Aug 2016 21:35:04 +0000 (14:35 -0700)]
rdnbrd "Interrupted system call" traceback in nlmanager

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: roopa@cumulusnetworks.com
Ticket: CM-12487

8 years agoMerge branch 'dev' into release/cl-stable
Julien Fortin [Sun, 21 Aug 2016 03:48:53 +0000 (20:48 -0700)]
Merge branch 'dev' into release/cl-stable

8 years agonlmanager: rdnbrd "Interrupted system call" traceback in nlmanager
Julien Fortin [Sun, 21 Aug 2016 03:43:12 +0000 (20:43 -0700)]
nlmanager: rdnbrd "Interrupted system call" traceback in nlmanager

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: roopa@cumulusnetworks.com
Ticket: CM-12487

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoaddons: bridge: fix running_vids value when cache is stale
Roopa Prabhu [Fri, 19 Aug 2016 18:09:57 +0000 (11:09 -0700)]
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>
8 years agoChanging to a correct version fro EA track builds
John Berezovik [Fri, 19 Aug 2016 16:35:21 +0000 (09:35 -0700)]
Changing to a correct version fro EA track builds

8 years agoMerge branch 'dev' into release/cl-stable
Roopa Prabhu [Sat, 13 Aug 2016 06:56:12 +0000 (23:56 -0700)]
Merge branch 'dev' into release/cl-stable

8 years agoaddons: vrf: don't delete vrf map file at init if mgmt vrf already exists
Roopa Prabhu [Sat, 13 Aug 2016 06:49:29 +0000 (23:49 -0700)]
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>
8 years agoMerge branch 'dev' into release/cl-stable
Julien Fortin [Sat, 13 Aug 2016 03:10:30 +0000 (05:10 +0200)]
Merge branch 'dev' into release/cl-stable

8 years agonetlink: adding ifacename name at the beginning of log info msg
Julien Fortin [Fri, 12 Aug 2016 15:36:27 +0000 (17:36 +0200)]
netlink: adding ifacename name at the beginning of log info msg

Ticket: None
Reviewed By: Roopa
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoifupdownaddons: modulebase: log_error will log.error or raise an exception
Julien Fortin [Fri, 12 Aug 2016 14:30:53 +0000 (16:30 +0200)]
ifupdownaddons: modulebase: log_error will log.error or raise an exception

Ticket: None
Reviewed By: Roopa, Nikhil G
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agonetlink: logging equivalent iproute2 commands
Julien Fortin [Fri, 12 Aug 2016 13:45:52 +0000 (15:45 +0200)]
netlink: logging equivalent iproute2 commands

Ticket: None
Reviewed By: Roopa, Nikhil G
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
8 years agoMerge branch 'dev' into release/cl-stable
Roopa Prabhu [Fri, 12 Aug 2016 06:10:43 +0000 (23:10 -0700)]
Merge branch 'dev' into release/cl-stable