Commit Graph

1620 Commits

Author SHA1 Message Date
Julien Fortin
4ef15f8114 Merge branch 'dev' into release/cl-stable 2016-08-21 14:35:56 -07:00
Julien Fortin
ddafc33dc2 rdnbrd "Interrupted system call" traceback in nlmanager
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   roopa@cumulusnetworks.com

Ticket: CM-12487
2016-08-21 14:35:04 -07:00
Julien Fortin
881af5985b Merge branch 'dev' into release/cl-stable 2016-08-20 20:48:53 -07:00
Julien Fortin
d3d4f288cb 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>
2016-08-20 20:43:51 -07:00
Roopa Prabhu
0383fcbb48 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-19 11:09:57 -07:00
John Berezovik
9b22fdfcfc Changing to a correct version fro EA track builds 2016-08-19 09:35:21 -07:00
Roopa Prabhu
bb69b8a2e2 Merge branch 'dev' into release/cl-stable 2016-08-12 23:56:12 -07:00
Roopa Prabhu
d9e75535d4 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-12 23:53:31 -07:00
Julien Fortin
03a9e1855a Merge branch 'dev' into release/cl-stable 2016-08-13 05:10:30 +02:00
Julien Fortin
fa01b17413 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>
2016-08-12 17:36:27 +02:00
Julien Fortin
7eca48a260 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>
2016-08-12 16:30:53 +02:00
Julien Fortin
b4ad3943f0 netlink: logging equivalent iproute2 commands
Ticket: None
Reviewed By: Roopa, Nikhil G
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-12 15:45:52 +02:00
Roopa Prabhu
d4d155b33a Merge branch 'dev' into release/cl-stable 2016-08-11 23:10:43 -07:00
Roopa Prabhu
07c1c00d39 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-11 22:36:39 -07:00
Roopa Prabhu
674fc93cb2 Merge branch 'dev' into release/cl-stable 2016-08-11 16:59:14 -07:00
Roopa Prabhu
3c705d7606 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-11 16:35:01 -07:00
Roopa Prabhu
de1b2b2b04 modulebase: dont set iface status to error if raise_err is False
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-11 16:30:00 -07:00
Roopa Prabhu
80be09bac1 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-11 16:20:16 -07:00
Julien Fortin
d0c2cf6c1d 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>
2016-08-11 03:05:04 +02:00
Roopa Prabhu
5061730ea5 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-10 17:45:36 -07:00
Julien Fortin
14593ccd63 addons: address: catching and logging exception coming from ip batch execution
Ticket: CM-8610
Reviewed By: Roopa, Nikhil G
Testing Done:

It used to be a silent exception, but not anymore because we catch it and log
accordingly (error) and flag the ifaceobj so that ifupdown2 returns 1.

$ cat /etc/network/interfaces
auto tap0
iface tap0
      mtu 9000
            address 172.17.28.0/31

$ ifreload -a
$ echo "address 2002:17:27:17/120" >> /etc/network/interfaces
$ ifreload -a
$ echo $?
0
$ # applying this patch
$ ifreload -a
error: tap0: cmd 'ip -force -batch - [addr add 172.17.28.0/31 dev tap0
addr add 2002:17:27:17/120 dev tap0
]' failed: returned 1 (RTNETLINK answers: File exists
Command failed -:1
Error: an inet prefix is expected rather than "2002:17:27:17/120".
)
$ echo $?
1
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-11 02:43:11 +02:00
Julien Fortin
58329e8d89 ifupdown: template: changing error message when import mako fail
Ticket: CM-11590
Reviewed By: Roopa, Nikhil G
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-11 02:42:52 +02:00
Julien Fortin
5b26c29724 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>
2016-08-11 02:41:29 +02:00
Julien Fortin
f78024a401 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>
2016-08-11 02:40:24 +02:00
Julien Fortin
d9bb082084 ifupdown: utils: user command output on stdout
Ticket: None
Reviewed By: Roopa, Nikhil G
Testing Done:

$ cat /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
      up ls -l
$

I realized that user command's output wasn't on stdout but in a pipe
This commit fixes this case, the user cmd output is now on stdout.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-10 17:48:32 +02:00
Julien Fortin
8d7584a093 ifupdown: template: changing error message when import mako fail
Ticket: CM-11590
Reviewed By: Roopa, Nikhil G
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-10 15:15:15 +02:00
Julien Fortin
093ffa0028 addons: address: catching and logging exception coming from ip batch execution
Ticket: CM-8610
Reviewed By: Roopa, Nikhil G
Testing Done:

It used to be a silent exception, but not anymore because we catch it and log
accordingly (error) and flag the ifaceobj so that ifupdown2 returns 1.

$ cat /etc/network/interfaces
auto tap0
iface tap0
      mtu 9000
            address 172.17.28.0/31

$ ifreload -a
$ echo "address 2002:17:27:17/120" >> /etc/network/interfaces
$ ifreload -a
$ echo $?
0
$ # applying this patch
$ ifreload -a
error: tap0: cmd 'ip -force -batch - [addr add 172.17.28.0/31 dev tap0
addr add 2002:17:27:17/120 dev tap0
]' failed: returned 1 (RTNETLINK answers: File exists
Command failed -:1
Error: an inet prefix is expected rather than "2002:17:27:17/120".
)
$ echo $?
1
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-10 15:08:38 +02:00
Balakrishnan Raman
54f543296a 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>
2016-08-09 10:42:30 -07:00
Roopa Prabhu
151d80248e 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-08 23:17:43 -07:00
Roopa Prabhu
95432c3b81 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-08 23:17:43 -07:00
Roopa Prabhu
ba6e24ea20 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>
2016-08-08 23:17:33 -07:00
Roopa Prabhu
79cf576411 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>
2016-08-07 12:41:30 -07:00
Roopa Prabhu
1a72dc5af5 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>
2016-08-07 12:41:30 -07:00
Roopa Prabhu
b61913b50e 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>
2016-08-07 12:41:30 -07:00
Julien Fortin
9d3f53c6c9 mstpctl: cache improvement to reduce subprocess calls, vxlan opti
Ticket: CM-11274
Reviewed By: Roopa, Nikhil
Testing Done: ifupdown2 smoke, vxlan_aa smoke

The mstpctl addon and mstpctlutils file now contains a unified way to access
cached data (from mstpctl showportdetails json).

Some numbers:
- Without the patch ifreload -a on a scale vxlan config (1k vxlan) we used
to execute 5098 subcommands.
- With the patch "only" ~3000 (it should be 2k but clag ip link set protodown
needs to be move to netlink).

for ifquery -r -a: 11052 calls before patch, 1031 after.

This should improve time execution as well as CPU usage.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-06 02:51:46 +02:00
Julien Fortin
27588711d0 addons: address: removing netmask validval
Ticket: CM-12201
Reviewed By: Roopa
Testing Done:

The syntax: netmask <number> is ifupdown legacy support
We want to deprecate it so we don't want to officially support it.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-04 18:20:50 +02:00
Roopa Prabhu
540e22d460 addons: bridge: fix bridge vid error on ifaces with multiple stanzas
Ticket: CM-12151
Reviewed By: julien, nikhil
Testing Done: Tested bridge vid errors with multiple iface stanzas for
ports

This patch just uses the HAS_SIBLINGS and OLDEST_SIBLINGS
flags on an iface to make sure we flag the error
on the last interface ie oldest of the siblings. all interfaces
with multiple iface objects have HAS_SIBLINGS set and the last iface
has OLDEST_SIBLINGS set.

The other way to fix this for the user would be to set ifaceobj_squash=1
in /etc/network/ifupdown2/ifupdown2.conf

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-03 15:35:04 -07:00
Roopa Prabhu
63b0e389b9 addons: bridge: reset vlan_filtering when user moves from vlan aware to
unaware

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

The bug also talks about removing the vlans during this
transition. If the vlans are removed from the interfaces file,
ifupdown2 will delete them on an ifreload. In any case, once moved to
vlan unaware bridge settings, kernel and switchd
don't look at vlans any more.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-03 12:22:14 -07:00
Roopa Prabhu
2bba6c8917 ifupdownaddons: fix path to get_reserved_vlan_range.sh hook
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-01 18:30:25 -07:00
Roopa Prabhu
54ebaf3ef0 ifupdown: scheduler: add dependency debug dump function
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-01 16:18:20 -07:00
Julien Fortin
2c592263a4 ifupdown: valivals keyword: remove <auto> and renaming <ipaddr> to <ip>
Ticket: None
Reviewed By: Daniel Walton
Testing Done:

This commit was need to keep nclu and ifupdown2 consistent.
The naming were differing and we decided to keep nclu version.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-01 17:23:30 +02:00
Julien Fortin
386ea19b6c Merge branch 'dev' into release/cl-stable 2016-08-01 14:33:30 +02:00
Julien Fortin
ccc833043e Staging cl3u4 version for merge to stable and release
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-01 09:59:45 +02:00
Julien Fortin
bfceb63543 ifupdownaddons: mstpctl: treeportprio value is cached. It prevents ifupdown2 from executing mstpctl settreeportprio commands when the running value is the same as the one previously cached
Ticket: CM-11773
Reviewed By: Roopa, Nikhil G
Testing Done: smoke + hand testings :

$ cat /etc/network/interfaces
auto br2
iface br2
      bridge-vlan-aware yes
      bridge-vids 100
      bridge-pvid  1
      bridge-ports swp1 swp4 swp5
      bridge-stp on
$ ifreload -a -v
[...]
info: netlink: set link swp1 up
info: netlink: set link swp4 up
info: netlink: set link swp5 up
info: br2: applying mstp configuration specific to ports
info: br2: processing mstp config for port swp1
info: executing /sbin/mstpctl showportdetail br2 json
info: executing /sbin/mstpctl settreeportprio br2 swp1 0 128
info: br2: processing mstp config for port swp4
info: executing /sbin/mstpctl settreeportprio br2 swp4 0 128
info: br2: processing mstp config for port swp5
info: executing /sbin/mstpctl settreeportprio br2 swp5 0 128
info: netlink: set link br2 up
[...]
$

/sbin/mstpctl settreeportprio br2 swpX 0 128 is executed for every port.
ifupdown2 tries to set this attr to 128 (the default value). This is a
problem at scale. We shouldn't try to set this value if the running value
is already 128.

With the attached patch:

$ ifreload -a
[...]
info: netlink: set link swp1 up
info: netlink: set link swp4 up
info: netlink: set link swp5 up
info: executing /sbin/mstpctl showportdetail br2 json
info: br2: applying mstp configuration specific to ports
info: br2: processing mstp config for port swp1
info: br2: processing mstp config for port swp4
info: br2: processing mstp config for port swp5
info: netlink: set link br2 up
[...]
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-01 09:49:08 +02:00
Julien Fortin
482b2fab80 attribute syntax check using validvals/validrange and keywords
Ticket: CM-8101
Reviewed By: CCR-4949
Testing Done: smoke tests + ran ifup -a -s on every interface configuration file from GSS cl-supports collection

This commit is introducing ~20 keywords. The value of the different attributes
will be check against raw values and <keywords>:

'<mac>'
'<text>'
'<ipv4>'
'<ipv6>'
'<auto>': "auto"
'<ipaddr>': ipv4/6 with preflix len
'<number>'
'<interface>'
'<ipv4-vrf-text>': equivalent to: <ipv4> "vrf" <text>
'<number-ipv4-list>': example: "100=172.16.100.1 101=172.16.101.1"
'<interface-list>': example: "swp1 swp2 swp3"
'<ipv4/prefixlen>'
'<ipv6/prefixlen>'
'<ipaddr/prefixlen>'
'<number-range-list>': example: "2000 2200-3000"
'<interface-range-list>': example: "swp1=100 swp2=100" ('validrange' : ['0', '65535'])
'<mac-ipaddr/prefixlen-list>'
'<number-interface-list>': example: "4 swp1 swp2"
'<interface-yes-no-list>': example: "swp1=yes swp2=no"
'<interface-yes-no-0-1-list>'
'<interface-yes-no-auto-list>'

It's possible to combine a keyword with a range from validrange. example:
validrange: 10-50
validvals: <intrface-range-list>
value: swp1=21 swp2=42 ...

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-01 09:28:16 +02:00
Nikhil
0dd2f0d18a addons: bridge & mstpctl: avoid printing default and port attributes under vlan aware bridge
Ticket: CM-12036
Reviewed By: roopa
Testing Done: used same config from bug

This patch avoids printing port attributes under
vlan-AWARE-bridge on 'ifquer -ra'.

This patch also avoids printing following attributes
on 'ifquer -ra' if not defined:
mstpctl-maxhops
mstpctl-portpathcost
mstpctl-treeportcost

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-07-29 15:33:14 -07:00
Roopa Prabhu
1b284018d5 addons: addressvirtual: enslave macvlans on vrf slaves to the vrf master
Ticket: CM-11803
Reviewed By: dsa, scotte, wkok, nikhil, julien
Testing Done: tested config of address-virtual lines on vrf slaves

This patch does the following:
- addressvirtual: enslaves macvlans created on vrf slaves
to the vrf master
- vrf: when looking for stale slaves on vrf master, skip
macvlan devices. This code does basic checking right now
and can be improved to include more cases.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-07-26 14:43:47 -07:00
Nikhil
1efda6c232 addons: bridge: Fix KeyError when 'bridge-pvid' is not in the set 'bridge-vid'
Ticket: CM-11998
Reviewed By: roopa
Testing Done: used same config given in bug descreption

When we try to unconditionally remove 'pvid' from 'vids' set,
we run into KeyError if 'vids' set doesn't contain 'pvid'

Example configuration:
auto swp9
iface swp9
   mstpctl-portautoedge no

auto frontnet
iface frontnet
   bridge-vlan-aware yes
   bridge-ports swp9
   bridge-vids 10
   bridge-stp on

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-07-26 10:33:46 -07:00
Nikhil
bb70f92385 addons: mstpctl: handle vlan aware bridge port config under port
Ticket: CM-8629
Reviewed By: roopa, julien
Testing Done: used same config given in bug description

This patch avoids vlan aware bridge over-writing it's port's
config with default values

Example configuration:

auto swp9
iface swp9
   mstpctl-portautoedge no

auto frontnet
iface frontnet
   bridge-vlan-aware yes
   bridge-ports swp9
   bridge-vids 10
   bridge-stp on

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-07-26 10:33:46 -07:00
Nikhil
0232d1bbfd addons: address: add both v4 and v6 gateways instead of just one.
Ticket: CM-8596, CM-5118
Reviewed By: roopa, julien
Testing Done: used same config mentioned in bug

Previously, only first configured gateway is set as default route.
This patch sets all the configured gateways as default routes.

This patch also removes default route on ifup
after removing 'gateway' from the interface

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-07-26 10:33:46 -07:00