]> git.proxmox.com Git - mirror_ifupdown2.git/log
mirror_ifupdown2.git
8 years agoaddons: vrf: avoids ifupdown2 error when VRF defined but not used
Nikhil [Wed, 2 Mar 2016 21:07:11 +0000 (13:07 -0800)]
addons: vrf: avoids ifupdown2 error when VRF defined but not used

Ticket: CM-9596
Reviewed By: Roopa Prabhu
Testing Done: Yes, by installing ifupdown2 deb onto cel-e1031-01

This patch makes sure ifupdown2 will not report a NoneType error
when VRF is defined but not used

8 years agoifupdownaddons: iproute2: Fix for error while enslaving 'eth0' to a vrf
Nikhil [Wed, 2 Mar 2016 03:39:37 +0000 (19:39 -0800)]
ifupdownaddons: iproute2: Fix for error while enslaving 'eth0' to a vrf

Ticket: CM-9594
Reviewed By: Roopa Prabhu
Testing Done: Yes, by installing ifupdown2 deb onto cel-e1031-01

This patch fixes the failure to execute the command
'ip link set dev eth0 nomaster' when 'eth0' is associated with any vrf

This patch also include a review comment update for CCR-4210

8 years agoifupdownaddons: fix parsing of vlan attributes
Roopa Prabhu [Wed, 2 Mar 2016 06:42:44 +0000 (22:42 -0800)]
ifupdownaddons: fix parsing of vlan attributes

Ticket: CM-8729
Reviewed By: trivial
Testing Done: Tested with a config with vlan-raw-device

'ip -o -d link show' introduced a new attribute between
'vlan and id'. This makes the move to json or netlink
even more necessary.

The fixes were done for the following format:
61: vlan100@swp1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UP mode DEFAULT group default \    link/ether
00:e0:ec:27:4e:b7 brd ff:ff:ff:ff:ff:ff promiscuity 0 \    vlan protocol
802.1Q id 100 <REORDER_HDR> addrgenmode eui64

8 years agonetworkinterfaces: fix is_keyword to not match attribute names with keywords in them
Roopa Prabhu [Tue, 1 Mar 2016 07:04:08 +0000 (23:04 -0800)]
networkinterfaces: fix is_keyword to not match attribute names with keywords in them

Ticket: CM-8729
Reviewed By: Nikhil
Testing Done: Tested with vlan device with vlan-raw-device in interfaces
file

also reported here: https://github.com/CumulusNetworks/ifupdown2/issues/10

is_keyword was matching iface attribute 'vlan-raw-device' to the vlan
keyword and dropping it from ifaceobj config.

8 years agoifupdownmain: handle more than one upperifaces
Roopa Prabhu [Tue, 1 Mar 2016 06:23:24 +0000 (22:23 -0800)]
ifupdownmain: handle more than one upperifaces

Ticket: CM-9595
Reviewed By:
Testing Done: tested with failing vrf config in CM-9595

due to same upperiface getting processed more than once,
there was an unnecessary refcount inc on the lowerdevice.
This patch aborts processing upperiface if already
processed and also adds a new debug function to
dump lower and uppper ifaces of all interfaces in the
file.

8 years agoaddons: vrf: Ensures fib rule for local table have higher pref than fib vrf rule
Nikhil [Tue, 1 Mar 2016 01:32:23 +0000 (17:32 -0800)]
addons: vrf: Ensures fib rule for local table have higher pref than fib vrf rule

Ticket: CM-9541
Reviewed By: Roopa Prabhu
Testing Done: Yes, by installing ifupdown2 deb onto cel-e1031-01

This patch checks if fib rule for local table have higher pref
than vrf table, if not, it deletes fib rule for local table
with lower pref and adds fib rule for local table with
higher pref than vrf table.

This patch also avoid repeated addition of vrf rules on each ifup

8 years agostart-networking: introduce state lock file /run/network/ifstatelock in
Roopa Prabhu [Mon, 29 Feb 2016 23:31:52 +0000 (15:31 -0800)]
start-networking: introduce state lock file /run/network/ifstatelock in
non-persistant storage

This is a reimport of missing peices of commit
f819c3602e56 in 2.5cl ifupdown2.

commit log from 2.5cl:
Introduce a lock file in non-persistent storage
/run/network/ifstatelock to make sure the state
file in persistent storage is cleaned up correctly

ifupdown2 state file was moved to /var/tmp because /var/tmp was
tmpfs and was large enough (100MB) for the state file. But it
appears it has changed (or is not consistent) across all platforms.
We can move it under /run, but /run again size varies on various
platforms and it is too small on some platforms.

This patch:
- continues to keep the ifupdown2 state file under /var/tmp (because
  it needs the space)
- ntroduces a second level /run/network/ifstatelock file that stays
  on non-persistant storage and is used to delete the state file at
  /boot up

Closes: CM-9573, CM-7774
Review: CCR-3623 (original review)
Tested-by: Mallikarjuna rao Uppalapati <mallik@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agodocs: Add example config for mgmt-vrf
David Ahern [Mon, 29 Feb 2016 23:22:56 +0000 (15:22 -0800)]
docs: Add example config for mgmt-vrf

Ticket: none
Reviewed By: none

Add example of how to configure management vrf.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
8 years agoaddons: vrf: support to avoid changing table ids
Nikhil [Wed, 24 Feb 2016 21:45:26 +0000 (13:45 -0800)]
addons: vrf: support to avoid changing table ids

Ticket: CM-9107
Reviewed By: Roopa Prabhu
Testing Done: Yes, by installing ifupdown2 deb onto cel-e1031-01

This patch adds a check to detect change in vrf config table id
compared to running table id and throw an error accordingly.

8 years agomstpctlutil: fix strip on NoneType warning
Roopa Prabhu [Fri, 26 Feb 2016 23:32:18 +0000 (15:32 -0800)]
mstpctlutil: fix strip on NoneType warning

saw this during execution of the below command:
ifup --no-act -a

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agovrf: handle slaves when vrf device is brought up
Roopa Prabhu [Fri, 26 Feb 2016 14:32:28 +0000 (06:32 -0800)]
vrf: handle slaves when vrf device is brought up

The vrf device may not be up when ifup is executed on the
slaves. This commit makes sure:
- vrf slaves dont try to enslave themselves when vrf device is
not present
- And vrf master enslaves any missing slaves during ifup of vrf master
- Also make vrf device the link master, this will make sure
the vrf device brings the vrf slave links up. This is needed to work
around the ipv6 address flush issue

Closes: CM-9493
Review: dsa, nikhil, wkok (via git send-mail)
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdownmain: add support for getting and introducing upperiface dependencies
Roopa Prabhu [Fri, 26 Feb 2016 07:55:27 +0000 (23:55 -0800)]
ifupdownmain: add support for getting and introducing upperiface dependencies

This patch adds a new upperiface module handler get_upper_ifacenames
to get upperifaces from a addon module. This is called during building
dependency graph.

Closes: CM-9493
Review: dsa, nikhil, wkok (via git send-email)
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifreload: fix handling(downing) of builtin interfaces on changes
Roopa Prabhu [Fri, 26 Feb 2016 01:10:33 +0000 (17:10 -0800)]
ifreload: fix handling(downing) of builtin interfaces on changes

Ticket: CM-8455
Review: CCR-4181
Testing: tested ifreload on builtin interface change

This patch handles removal of builtin interfaces (example swp*.100
below..which dont have iface sections) during a ifreload.

{noformat}
auto bridge
iface bridge
        bridge-vlan-aware yes
        bridge-ports swp3.100 swp15.100
{noformat}

if user changes swp15.100 to another interface and does a ifreload,
before this patch swp15.100 used to be around. This patch makes sure
swp15.100 is deleted in the process

I had to do some cleanup of flags in the process. I might have added
some extra cycles to ifreload. But i dont see an easy way to handle this
case.

8 years agoRemoved lacp bypass priority mode
Wilson Kok [Fri, 26 Feb 2016 15:29:45 +0000 (07:29 -0800)]
Removed lacp bypass priority mode

Ticket: CM-9494
Reviewed By: CCR-4184
Testing Done:

Also removed legacy 'fallback' options.
Now lacp bypass is enabled and disabled on a bond with:

    bond-lacp-bypass-allow [0|1]

8 years agoservice node address config for vxlan device using "remote" attribute
Balakrishnan Raman [Fri, 26 Feb 2016 05:53:05 +0000 (21:53 -0800)]
service node address config for vxlan device using "remote" attribute

Ticket: CM-9520
Reviewed By: CCR-4152
Testing Done: verified service node configuration

Use "remote" attribute in iproute2 command to provision
service node address for service node based replication. Changes also
include allowing only one service node per vxlan device, so its user's
responsiblity to select one service node per vxlan device if there
are multiple nodes to distribute the load.

8 years agoaddons: vrf: support for vrf-default-route attribute
Nikhil [Tue, 23 Feb 2016 00:05:52 +0000 (16:05 -0800)]
addons: vrf: support for vrf-default-route attribute

Ticket:CM-9106
Reviewed By: Roopa Prabhu and Dave Olson
Testing Done: Yes, by installing ifupdown and cumulus-tools deb on to cel-e1031-01

This patch adds per vrf default route: "ip route add table <tbid> unreachable default"

It also accepts a policy file with vrf-default-route [yes/no]

This also includes ifquery fixes for running and check.

8 years agoaddons: address: fix processing of 'preferred-lifetime' attribute
Nikhil [Mon, 8 Feb 2016 21:05:33 +0000 (13:05 -0800)]
addons: address: fix processing of 'preferred-lifetime' attribute

Ticket: CM-8773
Reviewed By: CCR-4079
Testing Done:Yes, with following cofiguration

auto swp1
iface swp1
address 71.12.21.43
address 2001:620:5ca1:160::47
preferred-lifetime 30

Fix for this is, a small update in address.py method '_inet_address_convert_to_cidr'
where there is a check for different addres attributes.

8 years agoSet vlan-filtering on bridge before adding bridge ports
Wilson Kok [Fri, 19 Feb 2016 22:14:29 +0000 (14:14 -0800)]
Set vlan-filtering on bridge before adding bridge ports

Ticket: CM-6806
Reviewed By: CCR-4126
Testing Done:

Currently, when doing ifup of a bridge, the bridge is created
and ports are added to bridge before vlan_filtering is set on
the bridge. This causes extra churn on switchd which has to
configure the hardware one way and then tear it down and
reconfigure it again in the new way. For mlx, it causes even
more problems.

This patch moves the vlan_filtering setting of bridge to before
member ports are being added to the bridge, and it uses the new
iproute2 command for setting the attribute instead of through
sysfs.

8 years agoFix incorrect install location of networking default file
Dave Olson [Fri, 19 Feb 2016 21:14:55 +0000 (13:14 -0800)]
Fix incorrect install location of networking default file

Ticket: none
Reviewed By: roopa,satish
Testing Done: built, installed, verified correct location

The install file resulted in creating /etc/default/networking/ as a
directory and installing the networking.default file in it.  Rename
networking.default to networking, and change the install file.
Normally dh_installinit handles all this, but since the package is
ifupdown2, and the file is networking, that doesn't happen.

Also, because we had created a directory with the name of what we want
to install as a file, we need to remove it if it exists.  This addition
of a preinst file should not go upstream, and should be removed in a few
weeks when everybody has re-installed enough.

8 years agoifupdownaddons: iproute2: support for vrf linkinfo
Roopa Prabhu [Fri, 19 Feb 2016 21:43:08 +0000 (13:43 -0800)]
ifupdownaddons: iproute2: support for vrf linkinfo

Closes: CM-8518
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: Nikhil Gajendrakumar <nikhil@cumulusnetworks.com>
8 years agoifquery running not showing vlan ranges in 3.0
Sam Tannous [Thu, 18 Feb 2016 21:49:40 +0000 (16:49 -0500)]
ifquery running not showing vlan ranges in 3.0

Ticket: CM-9097
Reviewed By: Trivial
Testing Done: Tested on Chris' config

In 3.0, the bridge vlan show command does not print
VLAN ranges unless you use the "-c" option.
This patch modifies the bridge vlan show call in
iproute2.py to use "-c".

8 years agoRemove clag_enable dependancy from ifupdown2.
Anuradha Karuppiah [Wed, 10 Feb 2016 18:46:11 +0000 (10:46 -0800)]
Remove clag_enable dependancy from ifupdown2.

Ticket: CM-9078
Reviewed By: CCR-4110
Testing Done: clag bond add/del and clag slave add/del

This change basically does the following -
1. Proto-down swpX pre-clag-bond-enslave
2. Proto-up swpX post-clag-bond-release

Setting/clearing of clag-id will result in similar proto-state changes
and those are handled by clagd.

Note:
I really wanted to keep these changes out of ifupdown2 but the
order of setting is critical i.e. protodown has to happen enslave to
prevent additional flaps/STP TCNs. Theoretically #2 can be done by clagd
but there is no easy way to do #1.

8 years agoChanging source format to git to support revisions
John Berezovik [Mon, 15 Feb 2016 19:57:10 +0000 (11:57 -0800)]
Changing source format to git to support revisions

8 years agoReset version to CL3.0 convention. Package builds from jenkins will come as <base...
John Berezovik [Mon, 15 Feb 2016 19:55:30 +0000 (11:55 -0800)]
Reset version to CL3.0 convention. Package builds from jenkins will come as <base>~<time>.<commit id>. First release is cl3u1

8 years agoModified lacp-bypass-all-active support to use the new sysfs
wkok [Fri, 12 Feb 2016 17:18:55 +0000 (09:18 -0800)]
Modified lacp-bypass-all-active support to use the new sysfs
node /sys/class/net/bondx/bonding/lacp_bypass.

Ticket: CM-9266
Reviewed-by: trivial
Testing-done:

8 years agoDisable old LACP bypass options
wkok [Thu, 11 Feb 2016 04:58:23 +0000 (20:58 -0800)]
Disable old LACP bypass options

Ticket: CM-9266
Reviewed-by: trivial
Testing-done:

For now disable old LACP bypass options so that ifreload does
not give errors, as the corresponding sysfs nodes do not exist in
the latest 4.1.y kernel.

8 years agoFixed one more reference to /etc/init.d/networking; remove switchd dependency
Dave Olson [Mon, 8 Feb 2016 22:10:20 +0000 (14:10 -0800)]
Fixed one more reference to /etc/init.d/networking; remove switchd dependency

Ticket:
Reviewed By: trivial
Testing Done:  built, installed

Don't want to leave incorrect confusing references behind.

Instead of having the networking script depend on switchd, since
ifupdown2 is upstream, I'll add the reverse dependency to the
switchd.service.

Added Documentation line

8 years agoifupdown2 needs to set fdelay before maxage in bridge mstpctl.py addon module
Sam Tannous [Tue, 9 Feb 2016 00:43:20 +0000 (19:43 -0500)]
ifupdown2 needs to set fdelay before maxage in bridge mstpctl.py addon module

Ticket: CM-8725
Reviewed By: roopa
Testing Done: tested with user's config on amd64 platform

When setting mstpctl params from user given fdelay and maxage,
ifreload and ifup is setting maxage before fdelay.

Since there is a check for (Bridge Foward Delay - 1 second) >= Bridge Max Age
fdelay must be set before maxage because the fdelay is a default value.

8 years agoRemove /etc/init.d/networking after all - causes loops during image builds
Dave Olson [Mon, 8 Feb 2016 20:41:41 +0000 (12:41 -0800)]
Remove /etc/init.d/networking after all - causes loops during image builds

Ticket:  none
Reviewed By: trivial
Testing Done:  installed, Alex tried for image creations.

apparently with some of our packages like mstpd still using init.d for a
while longer, just having the init.d/networking file causes the original
complaints about loops between services.

So I'm purging it completely.

Also clean up the comments a bit in start-networking

8 years agoifupdown2: After loading bonding driver, continue to create bond
Scott Emery [Mon, 8 Feb 2016 20:47:08 +0000 (12:47 -0800)]
ifupdown2: After loading bonding driver, continue to create bond

Ticket: CM-9182
Reviewed By: Trivial
Testing Done: ifup'd bond when bonding module was not yet loaded.

The bond support in ifupdown2 would check to see if the bonding module is
loaded when creating a bond. If it was not it would load the driver and return.
The correct operation is to load the driver and then continue to create the
bond.

8 years agoCleanup clag enable references.
Anuradha Karuppiah [Sat, 6 Feb 2016 00:01:59 +0000 (16:01 -0800)]
Cleanup clag enable references.

Ticket: CM-9078
Reviewed By: Trivial
Testing Done: bond ifdown/ifup on s6000

This needs to be replaced with protodown of clag bond slaves
pre-enslave (TBD; coming soon).

8 years agoaddons: vrf: iproute2 only reads .conf files
Roopa Prabhu [Fri, 5 Feb 2016 06:00:31 +0000 (22:00 -0800)]
addons: vrf: iproute2 only reads .conf files

Fix iproute2 vrf map file to end with .conf

Closes: CM-9137
Reviewed By: Roopa
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
8 years agoifupdown2: Modify implementation of nowait option
Scott Emery [Thu, 4 Feb 2016 00:38:18 +0000 (16:38 -0800)]
ifupdown2: Modify implementation of nowait option

Ticket: None
Reviewed By: CCR-4058
Testing Done: ifup'd interface with both dhcp-wait: "no" and dhcp-wait: "yes"
and not specified at all.

A previous patch implemented the nowait option for DHCP. This patch changes the
name of the option to "dhcp-wait" and makes the default, if nothing is specified
in the policy files, to be "yes", which means dhclient will be called without
the "-nw" option, causing it to wait for up to a minute for a response from the
DHCP server before continuing.

The format of the JSON in the policy file for this option was also changed so
that it conforms to the other ifupdown2 policy options. This format is now:

{
    "dhcp": {
        "defaults": { "dhcp-wait": "no" }
    }
}

Also, the documented argument values are "yes" and "no". Any other values, will
be interpreted as "yes".

A subsequent patch in cl-basefiles will be made to include this fragment in
/var/lib/ifupdown2/policy.d/dhcp.json so that Cumulus Linux will default to
not waiting for DHCP to complete.

8 years agodebian: add /var/lib/ifupdown2/policy.d to .dirs file
Roopa Prabhu [Wed, 3 Feb 2016 06:28:39 +0000 (22:28 -0800)]
debian: add /var/lib/ifupdown2/policy.d to .dirs file

Fixes: ec205cb3f8b0("policymanager: fix default policy file paths")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdown2: Add nowait attribute for dhcp addon
Scott Emery [Tue, 2 Feb 2016 00:42:14 +0000 (16:42 -0800)]
ifupdown2: Add nowait attribute for dhcp addon

Ticket: None
Reviewed By: CCR-4058
Testing Done: ifup'd interface with both nowait=0 and nowait=1 and not specified
at all.

The Mellanox platform, as well as some others probably, has two management
interfaces: eth0 and eth1. The customer may plug a cable into either one of
these interfaces, and very rarely both of them. If only one cable is plugged in
and we don't know which one, then /etc/network/interfaces must be configured
by default to automatically bring up both interfaces using DHCP. But when an
interface does not have link, it stalls the boot process for 60 seconds while
dhclient times out.

This patch changes the default dhclient behavior to not wait for DHCP to
complete, by using the "-nw" option when calling dhclient. This means that
dhclient will immediately return and DHCP will complete in the background.

A module attribute has been added for the DHCP addon called "nowait", which
defaults to 1. If this attribute is set to 0, then dhclient will revert to its
previous behavior and delay up to a minute while DHCP completes. This attribute
can be specified in a policy file, e.g. /etc/network/ifupdown2/policy.d/dhcp.json,
with contents such as:

{
  "dhcp" :
  {
    "nowait" : 0
  }
}

8 years agopolicymanager: fix default policy file paths
Roopa Prabhu [Mon, 1 Feb 2016 21:28:54 +0000 (13:28 -0800)]
policymanager: fix default policy file paths

Change policy manager default policy file location:
from /var/lib/ifupdownaddons/policy.d to
/var/lib/ifupdown2/policy.d

This aligns well with the user policy file location:
/etc/network/ifupdown2/policy.d/

Fixes 59dad2ca80("debian: sync debian files with from upstream debian repo")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddons: support for new addon module for vrf
Roopa Prabhu [Thu, 28 Jan 2016 22:00:09 +0000 (14:00 -0800)]
addons: support for new addon module for vrf

This patch adds initial support for vrf in ifupdown2.

Example interfaces file section:
auto swp1.100
iface swp1.100
    vrf blue

auto blue
iface blue
    vrf-table 10

iproute2 vrf map is generated under:
/etc/iproute2/rt_tables.d/ifupdown2.vrf_map

this patch also adds prelimnary support for 'vrf-table auto'.
But this needs more work.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoCreate a networking service script, so we can run it after switchd
Dave Olson [Wed, 20 Jan 2016 19:57:41 +0000 (11:57 -0800)]
Create a networking service script, so we can run it after switchd

Ticket: CM-8790
Reviewed By: wkok,roopa
Testing Done: built, installed, rebooted

jessie's networking starts as an init.d service.   Trying to force ordering
between init.d and systemd services when there are dependencies doesn't work
well (especially since the init.d/networking service is forced very early
because of the remote filesystem requirement in jesie).

Converting networking to a script run as a systemd service allows us to start
networking after switchd.  The new script is /sbin/start-networking.  I chose
to keep it in /sbin, rather than put it in /usr/cumulus/bin, because it's core
functionaity.

I am not removing /etc/init.d/networking, it just gets ignored unless somebody
types it manually.  If somebody does that, systemctl runs through the lsb
hooks.  The two lost abilities below are just ignored if passed.  I'm
also preventing creating the rc.d symlinks to the init.d/networking
script to reduce future confusion.

We lose some init.d "convenience" functionality because it's not available
through systemd.  What we lose are:
  reload-currently-up - can still be done with ifreload --currently-up
  force-reload - can still be done with ifreload -f -a
We keep start, stop, reload, restart

8 years agoFix "bridge vlan add vid" setting failure.
anuradhak [Fri, 15 Jan 2016 23:33:05 +0000 (15:33 -0800)]
Fix "bridge vlan add vid" setting failure.

Ticket: CM-8845
Reviewed By: Roopa
Testing Done: vlan aware bridge SVI ifup/ifdown

Drop the vid_end parameter from IFLA_BRIDGE_VLAN_INFO attribute

8 years agonetworkinterfaces: dont fail if you don't find a sourced interfaces file
Roopa Prabhu [Thu, 24 Dec 2015 03:36:56 +0000 (19:36 -0800)]
networkinterfaces: dont fail if you don't find a sourced interfaces file

before this commit, an error in reading a sourced file would
result in an error. This commit converts it to a warning and continue

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoaddress: initialize newaddr
Roopa Prabhu [Thu, 24 Dec 2015 03:23:51 +0000 (19:23 -0800)]
address: initialize newaddr

Closes: CM-8558
Review: CCR-3921
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
[rp: cherrypick of commit 3af9e9ef535a]

8 years agodebian: remove systemd networking .service file
Roopa Prabhu [Wed, 23 Dec 2015 07:34:17 +0000 (23:34 -0800)]
debian: remove systemd networking .service file

This patch temporarily removes systemd networking service
script. This enables ifupdown2 native init script to run.
systemd networking init script will be re-enabled in the
future after we test and claim that it works.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdown: sync new path file names from debian upstream
Roopa Prabhu [Mon, 21 Dec 2015 07:03:05 +0000 (23:03 -0800)]
ifupdown: sync new path file names from debian upstream

pulls in some path related changes from upstream debian repo.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agodebian: sync debian files with from upstream debian repo
Roopa Prabhu [Tue, 15 Dec 2015 00:26:31 +0000 (16:26 -0800)]
debian: sync debian files with from upstream debian repo

These include changes that were done to move ifupdown2
to use pybuild and some debian policy fixes

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdownconfig: add missing config module ifupdownconfig.py
Roopa Prabhu [Mon, 21 Dec 2015 06:58:28 +0000 (22:58 -0800)]
ifupdownconfig: add missing config module ifupdownconfig.py

Add back missing ifupdown/ifupdownconfig.py.
fixes a cherry-pick error.

Fixes 0582f185edf0 ("ifupdown2: address: squash addr config and process
them on the youngest sibling")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
8 years agoifupdown2: modulebase: fix parse_glob arguments
Roopa Prabhu [Wed, 2 Dec 2015 07:27:21 +0000 (23:27 -0800)]
ifupdown2: modulebase: fix parse_glob arguments

Ticket: CM-8413
Reviewed By: trivial
Testing Done: Tested failing glob expression in the bug report

Fixes bcca6f753a25 ("ifupdown2: fix a few regex parsing error messages")

(cherry picked from commit 997b0438104bacf12e2db6bdc29c7ea1fec4d91b)

8 years agoRevert "ifupdown2: address: set addr_config_squash to 1 by default"
Roopa Prabhu [Mon, 30 Nov 2015 16:33:23 +0000 (08:33 -0800)]
Revert "ifupdown2: address: set addr_config_squash to 1 by default"

This reverts commit de57cf0ce90c15df37fc25589947bbaeadcadd3b.

(cherry picked from commit 1050514fca0a7101eefa1954610211ca0987e29a)

8 years agoifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard) in mstpctl
Sam Tannous [Mon, 30 Nov 2015 01:22:06 +0000 (20:22 -0500)]
ifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard)  in mstpctl

Ticket: CM-7756
Reviewed By: roopa
Testing Done: built powerpc and tested ifupdown2 as well as new tests

Once mstpctl-portbpdufilter or mstpctl-bpduguard is enabled for
an interface, removing the configuration in /etc/network/interfaces
does not toggle the mstpctl state back to no.

The root cause of this problem is that "ifreload" does not check default settings for MSTP configuration
for bridge ports and use a default when that setting is removed from the configuration.

This patch adds a check in the existing loop on attribute values.
If there is no configured value, we check to see if a default exists.
self._modinfo['attrs'][attrname]['default'] exists.
If it exists and it is different then the currently running value
we reset the attribute to its default. This is what a customer would expect if
they removed a configured value.

(also added test in cl-tests to check this functionality)

(cherry picked from commit 63d0f7082d44fedabe002aebbb658751dc655a46)

8 years agoifupdown2: main: call get dependents handler on all iface stanzas of an interface
Roopa Prabhu [Sun, 29 Nov 2015 02:30:12 +0000 (18:30 -0800)]
ifupdown2: main: call get dependents handler on all iface stanzas of an interface

Ticket: CM-8330
Reviewed By: balki
Testing Done: Tested with interfaces file in the bug

(cherry picked from commit 14570e6d442d1c9a3742f1dd989f7af673e3cc7f)

8 years agoifupdown2: mstpctl: check mstpd running just once during init of mstpctl modules
Roopa Prabhu [Sat, 28 Nov 2015 03:31:25 +0000 (19:31 -0800)]
ifupdown2: mstpctl: check mstpd running just once during init of mstpctl modules

Ticket: CM-8035
Reviewed By: wkok
Testing Done: Tested mstp commands in interfaces file

(cherry picked from commit 2c3471f2082c8adbdcc395cbd0066680f280b9e5)

8 years agoifupdown2: address: set addr_config_squash to 1 by default
Roopa Prabhu [Fri, 27 Nov 2015 04:16:55 +0000 (20:16 -0800)]
ifupdown2: address: set addr_config_squash to 1 by default

Ticket: CM-7917
Reviewed By: CCR-3845
Testing Done: Tested address config reloading/purging with multiple
iface stanzas

We have had enough cases with address purging with multiple interfaces,
so turning this on by default

(cherry picked from commit de57cf0ce90c15df37fc25589947bbaeadcadd3b)

8 years agoifupdown2: clagd: check clag service restart status and print warning if
Roopa Prabhu [Wed, 25 Nov 2015 22:12:14 +0000 (14:12 -0800)]
ifupdown2: clagd: check clag service restart status and print warning if
not running

Ticket: CM-8211
Reviewed By: CCR-3876
Testing Done: Tested clagd parameters change from ifupdown2

$ifquery bond10.4094
auto bond10.4094
iface bond10.4094
    address 169.254.0.27/24
    clagd-peer-ip 169.254.0.28
    clagd-sys-mac 44:38:39:ff:40:94
    clagd-backup-ip 172.27.28.1
    clagd-priority 4096
    clagd-args --peerTimeout 4o

$ifup -v  bond10.4094
info: Executing /usr/sbin/service clagd restart
info: executing /usr/sbin/service clagd status
[FAIL] clagd is not running ... failed!
warning: bond10.4094: clagd failed to start..Please check clagd log for
details

$tail -f /var/log/clagd.log
2015-11-25T22:14:44.014582+00:00 cel-redxp-06 clagd[30875]: Invoked
with: /usr/sbin/clagd --daemon 169.254.0.28 bond10.4094
44:38:39:ff:40:94 --priority 4096 --backupIp 172.27.28.1 --peerTimeout
4o
2015-11-25T22:14:44.020579+00:00 cel-redxp-06 clagd[30875]: There was an
error in the command line parameters.
2015-11-25T22:14:44.020609+00:00 cel-redxp-06 clagd[30875]: argument
--peerTimeout/-t: invalid int value: '4o'
2015-11-25T22:14:44.020618+00:00 cel-redxp-06 clagd[30875]: exit with
status -1

(cherry picked from commit ac4f4a129a9125eeaf17a48a200ad8ac44bf7ef6)

Conflicts:
packages/clag/ifupdown/clagd.py

8 years agoifupdown2: syntax-check: exit with 1 if syntax errors
Roopa Prabhu [Mon, 23 Nov 2015 00:26:14 +0000 (16:26 -0800)]
ifupdown2: syntax-check: exit with 1 if syntax errors

Ticket: CM-7995
Reviewed By: CCR-3850
Testing Done: Tested exit code on syntax errors

This patch adds members 'errors' and 'warns' to networkinterfaces.py
to track errors and warns during parsing interfaces file.

This patch also adds --syntax-check option to ifreload
given people seem to use ifreload more than ifup these days.

$ ifreload --syntax-check -a
error: /etc/network/interfaces: iface swp1.200: unsupported keyword (roopa-attr)
$ echo $?
1

(cherry picked from commit e643a136fcf5d387ff0f9a31cb6a6af4983e1012)

8 years agoifupdown2: bridge: try to interpret bridge port add rtnetlink return strings from
Roopa Prabhu [Sun, 22 Nov 2015 06:53:29 +0000 (22:53 -0800)]
ifupdown2: bridge: try to interpret bridge port add rtnetlink return strings from
iproute and print meaningful error

Ticket: CM-6278
Reviewed By: CCR-3851
Testing Done: Tested error cases for bridge with multiple vlans when
net.bridge.bridge-allow-multiple-vlans is zero

new error message with the patch:

$ifquery br-vlan0502
auto br-vlan0502
iface br-vlan0502
    bridge-ports swp2.502 swp3.12
    bridge-stp on
    mstpctl-portadminedge swp2.502=yes
    mstpctl-portbpdufilter swp2.502=yes
    address 3.50.2.1/24

$ifup br-vlan0502

<snip>
error: br-vlan0502: net.bridge.bridge-allow-multiple-vlans not set, multiple
vlans not allowed
error: br-vlan0502: failed to execute cmd 'ip -force -batch - [link set
dev swp3.12 master br-vlan0502
addr flush dev swp3.12
]'(RTNETLINK answers: Invalid argument
Command failed -:1)

(cherry picked from commit 3d06230cba47e8d8244439ea4d07dbdf05011067)

8 years agoifupdown2: bridge: fix bridge-pvid under bridge 'notfound' during ifquery --check
Roopa Prabhu [Tue, 17 Nov 2015 17:48:21 +0000 (09:48 -0800)]
ifupdown2: bridge: fix bridge-pvid under bridge 'notfound' during ifquery --check

Ticket:
Reviewed By:
Testing Done: Tested ifquery --check with bridge-pvid

bridge-pvid and bridge-vids on a bridge does
not correspond directly to a running config
on the bridge. They correspond to default
values for the bridge ports. And they are
already checked against running config of the
bridge port and reported against a bridge port.
So, This patch ignores these attributes under the bridge.
Uses '2' for ignore today. XXX: '2' will be
mapped to a defined value in subsequent patches.

Before:
auto bridge
iface bridge
[fail]
    bridge-vlan-aware yes                                       [pass]
    bridge-ports swp3 swp4                                      [pass]
    bridge-pvid notfound                                        [fail]

After:
auto bridge
iface bridge
[pass]
    bridge-vlan-aware yes                                       [pass]
    bridge-ports swp3 swp4                                      [pass]
    bridge-pvid 20

(cherry picked from commit 29e70abbf7920cf94c3ebd738dd757c2ca27b35c)

8 years agoifupdown2: address: squash addr config and process them on the youngest sibling
Roopa Prabhu [Tue, 17 Nov 2015 05:00:40 +0000 (21:00 -0800)]
ifupdown2: address: squash addr config and process them on the youngest sibling

Ticket: CM-7917
Reviewed By: CCR-3845
Testing Done: Tested changing address and ifreloading on multiple iface stanzas

In presence of multiple iface stanzas, current ifupdown2 does not purge
existing addresses.
Because each ifaceobject processing looks at only its stanzas and it is
afraid that it may purge running addresses that does not belong to
itself. Historically multiple iface stanzas are processed individually
than squashing them as a single interface. Squashing iface stanzas into
a single iface stanza has been a problem in the past and also does not
work well with iface stanzas that are supported by ifupdown (I dont have
a specific problem example right now...but)

This patch processes all address attributes when processing the first iface
object (or iface stanza). Unsure if this can be a surprise to existing
users. It should not but cant say sometimes people have weird things in
their pre-up/post-up commands. Hence this is controlled by a ifupdown2.conf
variable addr_config_squash=0 set to off by default. still debating if this
can be on by default.

When addr_config_squash=0 and existing addresses are not purged a
warning is displayed:
"warning: swp1: interface has multiple iface stanzas skip purging
existing addresses"

(cherry picked from commit 7aaa75674547392f2abb8273b18671f0795b3eaf)

8 years agoifupdown2: fix a few regex parsing error messages
Roopa Prabhu [Mon, 16 Nov 2015 05:27:07 +0000 (21:27 -0800)]
ifupdown2: fix a few regex parsing error messages

Ticket:
Reviewed By: CCR-3804
Testing Done: Tested regex parsing failures

This is mostly a cosmetic fix. we were failing with weird/unclear errors
on unable to parse regex expressions correctly.
This patch mainly adds the interface name to the message and plus adds
an info message showing the actual regex being used in searches.

example config:
{noformat}
auto br-roopa
iface br-roopa
  bridge-vlan-aware yes
  bridge-ports regex '(\\Aswp3\\Z|\\Aswp4\\Z)'
  bridge-pvid 20
{noformat}

before the patch:
warning: br-roopa: error getting dependent interfaces (unbalanced
parenthesis)

after the patch (not pretty but easier to debug)

info: br-roopa: evaluating port expr '['regex', "'(", 'Aswp3', 'Z|',
'Aswp4', "Z)'"]'
warning: br-roopa: error getting dependent interfaces (br-roopa: error
searching regex ''(' in swp38 (unbalanced parenthesis))

(cherry picked from commit bcca6f753a25494666d53f1f2f3c855ffa41d7f0)

8 years agoRevert "ifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard) in...
Sam Tannous [Wed, 18 Nov 2015 03:52:07 +0000 (22:52 -0500)]
Revert "ifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard)  in mstpctl"

This reverts commit bbd11771f5571c67c8f110c2b464817ce31155b9.

This introduced an error where if the config has old bridge driver
and configures port attributes on the bridge, the attributes are reset
to defaults after they are configured by the bridge settings.

(cherry picked from commit 651d1980de02fb108975900ed007087d9a79934c)

8 years agoRevert "Patch for errors warning "global name 'get_mod_subattr' is not defined"
Sam Tannous [Wed, 18 Nov 2015 03:51:52 +0000 (22:51 -0500)]
Revert "Patch for errors warning "global name 'get_mod_subattr' is not defined"

This reverts commit 5649f0a28422794081e6a6ba1dd889364760ccf0.

(cherry picked from commit bfbb33815ce0e5d0584ce0a10ed38f04234eb43d)

8 years agoVirtual interfaces for VRR bounced during ifreload -a
Sam Tannous [Tue, 17 Nov 2015 04:43:39 +0000 (23:43 -0500)]
Virtual interfaces for VRR bounced during ifreload -a

Ticket: CM-8143
Reviewed By: scotte, roopa
Testing Done: ssim and powerpc

This was first seen as a side issue with switchd terminating and not restarting (filed as CM-8109).

When ifreload -a is issued, all of the vrr interfaces were bounced, even though there were not any
configuration changes.

In keeping with the philosphy of making ifreload non-disruptive, this patch no longer
disrupts vrrs if the existing config has not changed.

8 years agoPatch for errors warning "global name 'get_mod_subattr' is not defined
Sam Tannous [Tue, 17 Nov 2015 03:22:44 +0000 (22:22 -0500)]
Patch for errors warning "global name 'get_mod_subattr' is not defined

Ticket: CM-8248
Reviewed By: Trivial
Testing Done: None

Fix for

On bootup and during service network restart these warning messages are thrown out.
root@cel-ken-01:/var/log# service networking restart
[....] Reconfiguring network interfaces...warning: global name 'get_mod_subattr' is not defined
warning: global name 'get_mod_subattr' is not defined
warning: global name 'get_mod_subattr' is not defined

warning messages in ifupdown2

8 years agoifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard) in mstpctl
Sam Tannous [Mon, 16 Nov 2015 19:25:56 +0000 (14:25 -0500)]
ifupdown not restoring mstpctl attributes (e.g. bpdufilter, bpduguard)  in mstpctl

Ticket: CM-7756
Reviewed By: roopa
Testing Done: Tested ssim and powerpc images

Once mstpctl-portbpdufilter or mstpctl-bpduguard is enabled for
an interface, removing the configuration in /etc/network/interfaces
does not toggle the mstpctl state back to no.

The root cause of this problem is that "ifreload" does not check default settings for MSTP configuration
for bridge ports and use a default when that setting is removed from the configuration.

This patch adds a check in the existing loop on attribute values.
If there is no configured value, we check to see if a default exists.
self._modinfo['attrs'][attrname]['default'] exists.
If it exists and it is different then the currently running value
we reset the attribute to its default. This is what a customer would expect if
they removed a configured value.

8 years agoifreload: --allow=class support
Roopa Prabhu [Fri, 13 Nov 2015 18:06:16 +0000 (10:06 -0800)]
ifreload: --allow=class support

Ticket: CM-7939
Reviewed By: CCR-3732
Testing Done: Tested ifreload --allow=class
this now

The ifreload classes already supported allow. This just opens up the
option in /sbin/ifupdown

example 1:
---------
auto swp1
iface swp1

allow-test swp2
iface swp2

allow-test swp3
iface swp3

/* should only act on swp2 and swp3 */

example 2:
---------
auto swp1
iface swp1

allow-test swp2
iface swp2

allow-test br1
iface br1
bridge-ports swp25 swp26

/* change  bridge name and do an ifreload */
auto swp1
iface swp1

allow-test swp2
iface swp2

allow-test br2
iface br2
bridge-ports swp25 swp26

should delete br1 and create br2

8 years agorework mstpctl attribute ordering problem with bridge stp processing
Roopa Prabhu [Sun, 8 Nov 2015 20:13:16 +0000 (12:13 -0800)]
rework mstpctl attribute ordering problem with bridge stp processing

Ticket: CM-6626
Reviewed By: CCR-3768
Testing Done: Tested with testcase specified in bug

There was an earlier implementation for this for 2.5.4 (CCR-3599 a quick
fix for 2.5.4).  This patch re-implements the fix.

This patch essentially handles stp set before and after the port is
processed. It replaces the below commit with the patch in this review

{noformat}
commit 3af351f0a005236e747913bb499c6165e3ec43a4
Author: Roopa Prabhu <roopa@cumulusnetworks.com>
Date:   Tue Sep 29 10:12:07 2015 -0700

    Fix mstp settings ordering issues when bridge stp is toggled on and
off
    (when mstp settings are specified under the port)

    Ticket: CM-6626
    Reviewed By: CCR-3599
    Testing Done: Tested the problem case mentioned in the bug (Plan to
    re-work the fix a bit for 2.5.5)
{noformat}

Example:
{noformat}

auto host1
iface host1
    mtu 9000
    bond-slaves glob swp[25-26]
    bond-mode 802.3ad
    bond-miimon 100
    bond-use-carrier 1
    bond-lacp-rate 1
    bond-min-links 1
    bond-xmit-hash-policy layer3+4
    clag-id 1
    mstpctl-portadminedge yes
    mstpctl-bpduguard yes

auto bridge
iface bridge
    mtu 9000
    bridge-vlan-aware yes
    bridge-ports peerlink host1
    bridge-stp on
    bridge-vids 1000-3000
    bridge-pvid 1

info log stmts:
--------------------
info: host1: ignoring mstpctl-portadminedge config (stp on bridge bridge
is not on yet)
info: host1: ignoring mstpctl-bpduguard config (stp on bridge bridge is
not on yet)
<snip>
info: bridge: processing bridge config for port host1
info: bridge: processing mstp config for port host1
info: executing /sbin/mstpctl showportdetail bridge host1
admin-edge-port
info: executing /sbin/mstpctl setportadminedge bridge host1 yes
info: executing /sbin/mstpctl showportdetail bridge host1
bpdu-guard-port
info: executing /sbin/mstpctl setbpduguard bridge host1 yes

{noformat}

8 years agoRevert "Fix mstp settings ordering issues when bridge stp is toggled on and off"
Roopa Prabhu [Fri, 6 Nov 2015 05:28:14 +0000 (21:28 -0800)]
Revert "Fix mstp settings ordering issues when bridge stp is toggled on and off"

This reverts commit 3af351f0a005236e747913bb499c6165e3ec43a4.

8 years agoifupdown: fixed bridge port pvid config on reboot
Wilson Kok [Tue, 10 Nov 2015 22:16:00 +0000 (14:16 -0800)]
ifupdown: fixed bridge port pvid config on reboot

Ticket: CM-8161
Reviewed By: Roopa
Testing Done:

With vlan-aware bridge, when replacing a port's pvid, the kernel leaves
the port in the original pvid and relies on user space to explicitly
delete the port from that vlan if it is no longer a member of that.

ifupdown does that correctly in ifup and ifreload cases, but missed
removing the port from the default pvid during system reboot.  This
patch fixes that by removing the PERFMODE check specifically for pvid
that causes ifupdown to skip checking running config on reboot which
leads to the bug.

(cherry picked from commit 0461a3f3cc82691cd32b9f6dbefaacf7b23eaeea)

8 years agoFix regression with ifreload when interface names change
Roopa Prabhu [Tue, 27 Oct 2015 20:00:56 +0000 (13:00 -0700)]
Fix regression with ifreload when interface names change

Ticket: CM-8003
Reviewed By: CCR-3664
Testing Done: Tested renaming interfaces + ifreload

8 years agoFix refcnt issue when multiple iface stanzas were presented for a white
Roopa Prabhu [Tue, 20 Oct 2015 21:30:53 +0000 (14:30 -0700)]
Fix refcnt issue when multiple iface stanzas were presented for a white
listed interface that had a blacklisted parent

Ticket: CM-7851
Reviewed By: CCR-3664
Testing Done: Tested with auto/non-auto dependent and non-dependent interfaces

example config from sam:

iface swp3.100

auto swp3
iface swp3

iface swp3
      address 66.66.66.66/24

8 years agoifupdown2 should allow speed setting even with duplicate iface stanzas
Sam Tannous [Tue, 20 Oct 2015 17:49:07 +0000 (13:49 -0400)]
ifupdown2 should allow speed setting even with duplicate iface stanzas

Ticket: CM-6740
Reviewed By: roopa
Testing Done: tested multiple ifreloads with various test cases

In the case of duplicate iface stanzas where one of the stanzas sets
the link attributes, ifupdown2 was confused because the absence
of link attributes forced it to reset them to default values
(when they existed).

This patch tracks link changes and prevents resetting to defaults
only if there are no explicit settings configured.  Furthermore,
only the last interface processed (from the duplicates) will take
care of resetting to defaults.

8 years agoFix a few more minor issues with auto and non-auto interfaces
Roopa Prabhu [Tue, 20 Oct 2015 15:45:20 +0000 (08:45 -0700)]
Fix a few more minor issues with auto and non-auto interfaces

Ticket: CM-7851
Reviewed By: CCR-3664
Testing Done: Tested with auto/non-auto dependent and non-dependent
interfaces

8 years agochange address on bridge and slave to an info message instead of a warn
Roopa Prabhu [Fri, 9 Oct 2015 23:32:02 +0000 (16:32 -0700)]
change address on bridge and slave to an info message instead of a warn

Ticket: CM-6106
Reviewed By: CCR-3637
Testing Done: Tested address under a bridge

We had shipped example files with addresses under bridges and slaves
in 2.5.3. With the warning introduced in 2.5.4, we will start emitting
warnings for existing customer files. And I have recently
learnt that users are relying on warnings to detect errors.

With this commit I am changing the warn to an info message
to avoid breaking existing users. We can change it back to a warn in
3.0.

changed:
"warning: interface bridge is enslaved or a vlan aware bridge and cannot
have an IP Address"

to:
"info: bridge: ignoring ip address. Interface is enslaved or a vlan
aware bridge and cannot have an IP Address"

(cherry picked from commit ecb20279e3d3c123537b9e6fddea4590c63a5013)

8 years agochange shipping default ifupdown2.conf disable_cli_interfacesfile to 0
Roopa Prabhu [Fri, 9 Oct 2015 23:09:10 +0000 (16:09 -0700)]
change shipping default ifupdown2.conf disable_cli_interfacesfile to 0
(ie to allow -i option)

Ticket: CM-7066
Reviewed By: CCR-3636
Testing Done: Tested ifupdown2 -i option

Administrators can protect from sudo users executing files with -i
by changing the disable_cli_interfacesfile=1 in ifupdown2.conf

I have uploaded the patch in CCR-3636. And checked with shm and nolan
before pushing this change in 2.5.4.

The default is being changed because of the fear of breaking existing
users of -i after an upgrade to 2.5.4.

The shipping default behaviour for -i will be revisited in 3.0
timeframe.

(cherry picked from commit 5dce566a94dafc99c441e66c412d8d66a083aa5e)

8 years agoFix the return value for auto interface checks
Roopa Prabhu [Fri, 9 Oct 2015 22:14:56 +0000 (15:14 -0700)]
Fix the return value for auto interface checks

Ticket: CM-7851
Reviewed By: CCR-3639
Testing Done: Tested a combination of auto and non-auto interfaces.

This fixes a regression introduced in 2.5.4 where ifreload was
picking up non-auto interfaces

This also fixes a minor issue with blacklisting interfaces introduced by
("450c679249b546dbc2cd97d81b49e011fec948bd remove blacklisted interfaces
only if they are upperifaces (ie root of the tree") when an interface
has multiple auto and non-auto stanzas (A rare case, but it was an easy
fix and around the same area).

example, the fix will now blacklist an interface only if all of its stanzas are
blacklisted. In the below example, swp4 is not blacklisted if user
specified auto because one of the iface stanzas is auto.

auto swp4
iface swp4

iface swp4
        address 10.0.14.2/24

(cherry picked from commit ad6d4567fdf9413c804a348c1712d8706934264a)

8 years agoFix stdin issues with missing config filename ifquery for disable_cli_interfacesfile
Sam Tannous [Fri, 9 Oct 2015 22:00:49 +0000 (18:00 -0400)]
Fix stdin issues with missing config filename ifquery for disable_cli_interfacesfile

Ticket: CM-7066
Reviewed By: roopa
Testing Done: unit tested and wrote new testcase in testifupdown2

Use case for ifquery where stdin used with -i breaks
because interfacesfileiobuf was not checked in addition to interfacesfilename.

Testcase like:

echo '[{"name": "swp1","auto": true,"config": {"address": "10.10.10.10/24"}}]' | ifquery -i - -t json swp1

would fail because while -i was given with stdin, the check for missing filename would produce an error.

It was also decided by consensus that the ifquery command does not need to have a check for
disable_cli_interfacesfile since a query "should" not pose a security check.

(I've also added some test cases for this in cl-tests).

(cherry picked from commit 4d37e932b43da87a9240a866be2d8b9508a9c7eb)

8 years agoremove blacklisted interfaces only if they are upperifaces (ie root of
Roopa Prabhu [Fri, 2 Oct 2015 20:18:03 +0000 (13:18 -0700)]
remove blacklisted interfaces only if they are upperifaces (ie root of
the tree)

Ticket: CM-7765
Reviewed By: CCR-3621
Testing Done: tested interface dependencies with auto and non-auto
interfaces

This commit fixes a change in behaviour introduced by "460906d0552d" ("skip adding
filtered or blacklisted interfaces in the dependency graph") that
skipped non-auto (or blacklisted) interfaces.

Turns out we have files out there that do have non-auto
dependents. This patch makes sure blacklisted interfaces who are
dependents of other interfaces are always picked up.

8 years agoIntroduce a lock file in non-persistent storage /run/network/ifstatelock
Roopa Prabhu [Fri, 2 Oct 2015 19:31:51 +0000 (12:31 -0700)]
Introduce a lock file in non-persistent storage /run/network/ifstatelock
to make sure the state file in persistent storage is cleaned up
correctly

Ticket: CM-7774
Reviewed By: CCR-3623
Testing Done: Tested statefile accross reboots

ifupdown2 state file was moved to /var/tmp because /var/tmp was tmpfs
and was large enough (100MB) for the state file. But it appears it has
changed (or is not consistent) across all platforms. We can move it
under /run, but /run again size varies on various platforms and it is
too small on some platforms.

This patch:
- continues to keep the ifupdown2 state file under /var/tmp (because it
needs the space)
- ntroduces a second level /run/network/ifstatelock file that stays on
non-persistant storage and is used to delete the state file at /boot up

9 years agoFix mstp settings ordering issues when bridge stp is toggled on and off
Roopa Prabhu [Tue, 29 Sep 2015 17:12:07 +0000 (10:12 -0700)]
Fix mstp settings ordering issues when bridge stp is toggled on and off
(when mstp settings are specified under the port)

Ticket: CM-6626
Reviewed By: CCR-3599
Testing Done: Tested the problem case mentioned in the bug (Plan to
re-work the fix a bit for 2.5.5)

problem:
    mstp parameters can be specified under the port or under the bridge
    When they are specified under the bridge, there should be no problem
(When you process the bridge, all things on the bridge port are set in
order)
    When they are specified under the port:
    we check if the bridge is up, if yes, and stp is already configured,
we process mstpctl settings
    This check today only checks running stp_state
    We should also check the user configured stp state for the bridge
    Note that the problem exists only if the bridge and ports are
already up and user executes ifup again and when we need to re-evaluate
the bridge port settings

solution:
    When the bridge port is being checked for mstp settings, not only
check running stp state, but also check user specified stp state and
correct bridge stp state before proceeding with mstp configuration

Few things to note with this patch:
    - If user changed stp state on bridge to 'on', and did `ifup
    <bridge_port>'`,
    though the user has not ifup'ed the bridge yet, the bridge stp state
    will be applied (very few people will run into this and practically this
    should not be a problem atall. But from correctness POV it is
    a voilation. ).

    - To avoid this, the other solution would have been to let the bridge
    port code be as is, but handle this during bringing up the bridge,
    but, this can confuse the user, because when processing the
    bridge_port, you will still throw warnings even if the port stp config
    is later reapplied when the bridge comes up

    - note that the patch only handles the case when stp state is not on and
    somebody turned it on.  For the case where stp state was on and somebody
    turned it off, this patch wont throw warnings for the mstpctl config. But
    it will not cause any issues because once stp is off things will be ok
    everywhere. I want to keep any changes here out of this patch. I will
    document this in the bug...and see if i can handle this in 2.5.5

9 years agoFix ifquery json output for --running and other options
Roopa Prabhu [Thu, 24 Sep 2015 20:00:38 +0000 (13:00 -0700)]
Fix ifquery json output for --running and other options

Ticket: CM-7635
Reviewed By: CCR-3575
Testing Done: Tested failing ifquery output in json format

This patch fixes a bug introduced by 0dea0cfeeec8b342ee2e2b767daa4071ac760f31
("Add support to display status (pass, fail) in ifquery --check json
output").

This patch separates the json encoders for iface objects with and
without status (ifaceJsonEncoder and ifaceJsonEncoderWithStatus) so
that they dont interfere with each other.

9 years agoAdd support to display status (pass, fail) in ifquery --check json output
Roopa Prabhu [Fri, 18 Sep 2015 04:57:06 +0000 (21:57 -0700)]
Add support to display status (pass, fail) in ifquery --check json output

Ticket: CM-7464
Reviewed By: CCR-3507
Testing Done: Tested ifquery check sanity

ifquery --check non-json output displays 'pass' and 'fail' for
each attribute on the same line (see below). This output is not json
friendly. For json, include status in 'config_status' a dictionary
whose keys are similar to the 'config' dictionary but values are status
for the corresponding keys in the 'config' dictionary (see example below)

auto bond4
iface bond4 inet static
[pass]
    bond-mode 802.3ad                                           [pass]
    bond-miimon 100                                             [pass]
    bond-use-carrier 1                                          [pass]
    bond-lacp-rate 1                                            [pass]
    bond-min-links 1                                            [pass]
    bond-xmit-hash-policy layer3+4                              [pass]
    bond-slaves swp3 swp4                                       [pass]

[
  {
    "name": "bond4",
    "addr_method": "static",
    "addr_family": "inet",
    "auto": true,
    "config": {
      "bond-use-carrier": "1",
      "bond-miimon": "100",
      "bond-lacp-rate": "1",
      "bond-min-links": "1",
      "bond-slaves": "swp3 swp4",
      "bond-mode": "802.3ad",
      "bond-xmit-hash-policy": "layer3+4"
    },
    "config_status": {
      "bond-use-carrier": "pass",
      "bond-miimon": "pass",
      "bond-lacp-rate": "pass",
      "bond-min-links": "pass",
      "bond-slaves": "pass",
      "bond-mode": "pass",
      "bond-xmit-hash-policy": "pass"
    },
    "status": "pass"
  }
]

9 years agoMake sure an interface is down (in the bond case, its slaves are also
Roopa Prabhu [Thu, 17 Sep 2015 18:26:56 +0000 (11:26 -0700)]
Make sure an interface is down (in the bond case, its slaves are also
down) when setting mac address

Ticket: CM-6982
Reviewed By: CCR-3516
Testing Done: Tested ifreload setting of mac on an already up bond

9 years agoFix batch_commit to reset vars if batch buffer is NULL.
Roopa Prabhu [Wed, 16 Sep 2015 19:49:24 +0000 (12:49 -0700)]
Fix batch_commit to reset vars if batch buffer is NULL.

Ticket: CM-6982
Reviewed By: trivial but imp
Testing Done:

This will make sure a stale batch.start() with no real batch commands
is ended cleanly.

9 years agoifupdown: vxlan-remoteip not getting applied when vxrd is not configured to run
Wilson Kok [Thu, 10 Sep 2015 20:57:14 +0000 (13:57 -0700)]
ifupdown: vxlan-remoteip not getting applied when vxrd is not configured to run

Ticket: CM-7410
Reviewed By: CCR-3470
Testing Done:

When vxrd is not enabled in /etc/default/vxrd, the 'service vxrd status'
command returns 0, causing the vxlan-remoteip to be not applied even
though it should have. Fix is to change to checking pidfile of vxrd.

9 years agoAdd a check to see if it is indeed a bridge port before applying mstpctl
Roopa Prabhu [Wed, 9 Sep 2015 18:43:19 +0000 (11:43 -0700)]
Add a check to see if it is indeed a bridge port before applying mstpctl
config

Ticket: CM-6965
Reviewed By: CCR-3472
Testing Done: Tested with interfaces file specified in the bug

9 years agofix errors in examples that were generate warnings
Roopa Prabhu [Wed, 9 Sep 2015 18:21:24 +0000 (11:21 -0700)]
fix errors in examples that were generate warnings

Ticket:
Reviewed By: trivial
Testing Done: Tested all example files with latest from 2.5.4

9 years agowarn on stale interfaces left as dependents + warn on reuse of bond
Roopa Prabhu [Fri, 4 Sep 2015 23:12:20 +0000 (16:12 -0700)]
warn on stale interfaces left as dependents + warn on reuse of bond
slaves under other interfaces

Ticket: CM-7322, CM-6772
Reviewed By: CCR-3464
Testing Done: Tested with faulty configs and checked for warnings

9 years agoifupdown2 changes for vxlan anycast_ip, head-end fdb entries, protodown
Balakrishnan Raman [Fri, 4 Sep 2015 07:32:15 +0000 (00:32 -0700)]
ifupdown2 changes for vxlan anycast_ip, head-end fdb entries, protodown

Ticket: CM-7087
Reviewed By: CCR-3379
Testing Done: unit testing with clag_vxlan_clos_spec/cfg.py

On clag pairing, clagd changes local address of vxlan device to anycast ip.
If user does ifreload now, ifupdown2 will overwrite local address with
individual ip contained in /etc/netwrok/interfaces. vxlan.py caches
anycast_ip configuration so that ifquery -c can skip it from flagging error
and ifreload skip overwriting vxlan device's local ip.

vxrd provisions head-end replication endpoints by adding bridge fdb entries.
If /etc/network/interfaces doesn't have remote-ip attribute, then on ifreload
ifupdown2 will delete all vxrd provisioned entries. ifupdown will check for
presence of vxrd service and skip add/delete bridge fdb entries for
head-end replication

On ifreload vxlan device are put in proto-down even if they are up and running.
Check for operstate and put it in proto-down only if operstate transitions from
down to up.

9 years agoFix ifupdown2 pre-up order
Balakrishnan Raman [Mon, 31 Aug 2015 23:22:12 +0000 (16:22 -0700)]
Fix ifupdown2 pre-up order

Ticket: CM-7313
Reviewed By: trivial
Testing Done: tested in active-active vxlan scale testbed

With recent change to ifupdown2 to create dummy devices (CM-3525), pre-up
sequence has been inadvertently changed to invoke clag before vxlan. This
causes protodown of vxlan device by clag addon to happen before vxlan device
gets added. Revert the pre-up order to have vxlan pre-up before clag's.

9 years agonew ifupdown2 link module to create dummy devices
Roopa Prabhu [Thu, 13 Aug 2015 06:30:55 +0000 (23:30 -0700)]
new ifupdown2 link module to create dummy devices

Ticket: CM-3525
Reviewed By: CCR-3326
Testing Done: Tested creating dummy devices using ifupdown2

This is modification to gospos loopback module. It solves the same
purpose ie using linux dummy device like a loopback device but there were
objections on calling it loopback so i have renamed it to link and i have changed it
into a generic module that can do any 'ip link'. Can be extended for
link args in the future.

below example creates a loopy device

$ifquery loopy
auto loopy
iface loopy
link-type dummy

$ifup loopy
$ifquery -c loopy
auto loopy
iface loopy [pass]
link-type dummy [pass]

(cherry picked from commit 1151420408a53c106d29183a1e0da5562c8b03a3)

9 years agoifupdown2 ethtool does not handle link-* settings on enslaved ports
Sam Tannous [Fri, 21 Aug 2015 03:12:26 +0000 (23:12 -0400)]
ifupdown2 ethtool does not handle link-* settings on enslaved ports

Ticket: CM-7128
Reviewed By: Trivial
Testing Done: unit tested on Ken's machine

The ifupdown2 ethtool addon module fails to set/check
the link-speed on bridge ports.
I removed excessive ifaceLinkKind checking since CM-6619
(03642a9a) added BRIDGE_PORT and BOND_SLAVE.  This is ok
since we now check to see if ports have defaults (only swp do)
before showing or changing settings).

9 years agoadd param in ifupdown2.conf to prevent fupdown2 users from specify interface config...
Sam Tannous [Fri, 21 Aug 2015 02:59:44 +0000 (22:59 -0400)]
add param in ifupdown2.conf to prevent fupdown2 users from specify interface config file on the CLI

Ticket: CM-7066
Reviewed By: scotte,roopa,olson
Testing Done: Unit testing and regression testing

This patch does two things:

1. It moves the interfaces config file name to the ifupdown2.conf file in /etc/network/ifupdown2.
This should allow administrators to specify a config file location different from the default and allow
subsets of users to use it without giving them access to specifying their own with the -i option in ifup/ifdown.

2. It also adds a new config setting called "disable_cli_interfacesfile" used to prevent users
from specifying their own interfaces file. This defaults to "1" (even if it is not configured).

Note: this new default takes away users ability to specify an interfaces file.

This should close the vulnerability where users could specify their own interfaces file
and add arbitrary user commands.

This leaves the shell=True option in the user commands add-on module since the ifup/ifdown/ifreload/ifquery
commands already require root access to run and the interfaces config file also requires root access to modify.

9 years agoifupdown: added bridge-allow-untagged bridge port option
Wilson Kok [Sat, 8 Aug 2015 03:45:12 +0000 (20:45 -0700)]
ifupdown: added bridge-allow-untagged bridge port option

Ticket: CM-6862
Reviewed By: CCR-3278
Testing Done:

Currently, ifupdown implicitly configures pvid on a bridge port
in case user doesn't configure it.  There is no way to configure
a bridge port to not accept untagged packets.  The new option
allows user to do that without changing the current default
behavior.

9 years agoifupdown: fixed warning when apply lacp attributes to non lacp bonds
Wilson Kok [Mon, 10 Aug 2015 21:17:46 +0000 (14:17 -0700)]
ifupdown: fixed warning when apply lacp attributes to non lacp bonds

Ticket: CM-6161
Reviewed By: Roopa
Testing Done:

Check bond mode when applying lacp attributes.

9 years agochange /bin/bridge path to /sbin/bridge to be same as upstream
Roopa Prabhu [Sun, 9 Aug 2015 06:14:55 +0000 (23:14 -0700)]
change /bin/bridge path to /sbin/bridge to be same as upstream

Ticket: CM-6519
Reviewed By:
Testing Done: sanity test

9 years agobreak down the bridge port batch add in ifupdown2
Satish Ashok [Thu, 30 Jul 2015 22:01:24 +0000 (15:01 -0700)]
break down the bridge port batch add in ifupdown2

Ticket:  CM-6496
Reviewed By: CCR-3196
Testing Done:

The "ip batch command to add a bridge port and flush the dev" command with 1k netdevices was taking 1.4G of memory. With 2k netdevices batch, this command was causing a OOM condition. To avoid this, commit the batch after 250 ports. Ideally we have to look at the internal batch implementation to see if there is an underlying issue.

9 years agoDocument --exclude option a little better for ifupdown2
Sam Tannous [Thu, 30 Jul 2015 15:15:17 +0000 (11:15 -0400)]
Document --exclude option a little better for ifupdown2

Ticket: CM-6587
Reviewed By: roopa
Testing Done: checked man paged

If we do an ifdown on all ports and try to exclude a bond or bridge port.
But we also have an iface defined for swp1 or swp4
(even if these are empty).
The lower interfaces will not be excluded. So if we
do an "ifdown -a -X bridge", swp ports in the bridge or bond
will go down effectively bringing a bond or bridge down.

This patch simply adds some documentation to the man pages.

ifupdown2 never follows dependents if the user has given an
interface list (unless explicitly requested with --with-depends
option which is available with some options).

9 years agoifupdown2 patch to properly remove address-virtual mac addresses
Sam Tannous [Thu, 23 Jul 2015 19:43:45 +0000 (15:43 -0400)]
ifupdown2 patch to properly remove address-virtual mac addresses

Ticket: CM-6702
Reviewed By: roopa
Testing Done: unit and smoke tested with ifupdown2 suite

When address-virtual mac adddress is modified, removed from an SVI, or the SVI is removed,
the permanent mac address is not removed.

This patch addresses all three cases but creating a global statemanager instance
and removing address-virtual FDB entries that were previously configured.

9 years agoifupdown2 fixes for svcnode, vxlan-ageing, bridge-vlan-aware
Balakrishnan Raman [Thu, 23 Jul 2015 19:15:16 +0000 (12:15 -0700)]
ifupdown2 fixes for svcnode, vxlan-ageing, bridge-vlan-aware

Ticket: CM-6815, CM-6816, CM-6817
Reviewed By: CCR-3234
Testing Done: unit testing

CM-6815 : ip link set syntax for svcnode has been changed. Absence of svcnode
will retain the existing values. svcnode 0.0.0.0 is needed to wipe out service
node addresses in vxlan device. Modified ifupdown2 to use svcnode 0.0.0.0 to
clean up service node address.

CM-6816: "bridge-clan-aware no" is not handled in query-check and hence ifquery
on bridge interface with "bridge-vlan-aware no" fails. Modified bridge's
query-check to take care of this.

CM-6817: With default ageing value (300), if query -c <vxlan device> was
failing. Set ageing to 300 if not specified and compare it with running config.

9 years agoDont up a vlan aware bridge during upper iface bringup (optimization)
Roopa Prabhu [Thu, 23 Jul 2015 17:17:02 +0000 (10:17 -0700)]
Dont up a vlan aware bridge during upper iface bringup (optimization)

Ticket: CM-6619
Reviewed By: CCR-3191
Testing Done:  Tested upperiface bringup for bridge and vlan devices

'up' on bridge was always done to add the newly created port to the bridge
in cases where the bridge is not part of the interfaces being brought
up. But This will try to re-apply bridge port attributes on all bridge
ports and that can take a while when there are large number of bridge
ports. This patch currently avoids the bridge up for only the vlan
aware bridge case.

9 years agoMerge branch 'CumulusLinux-2.5_br' of ssh://stash.cumulusnetworks.com:7999/ccmr/cumul...
Roopa Prabhu [Thu, 23 Jul 2015 17:15:43 +0000 (10:15 -0700)]
Merge branch 'CumulusLinux-2.5_br' of ssh://stash.cumulusnetworks.com:7999/ccmr/cumulus into CumulusLinux-2.5_br

9 years agoAllow customer set bond defaults for CL with ifupdown2
Sam Tannous [Wed, 22 Jul 2015 22:38:07 +0000 (18:38 -0400)]
Allow customer set bond defaults for CL with ifupdown2

Ticket: CM-6723
Reviewed By: roopa
Testing Done: unit tested and testifupdown2 test suite

This patch installs bond interface defaults in

     /etc/network/ifupdown2/policy.d/bond_defaults.json

and allows users to modify this file.   Users can then leave out these
bond attributes in their configs to save typing and space.

It also changes the ifenslave and ifenslaveutil module to bond and
bondutil, respectively to be consistent with other modules
(and also because customers think of "bond" interfaces not
"ifenslave" interfaces.)

For example, the default file installed looks like the following:

{
    "README": "This file is user generated and modifiable.",
    "bond": {
        "defaults": {
                "bond-mode": "802.3ad",
                "bond-miimon": "100",
                "bond-use-carrier": "1",
                "bond-lacp-rate": "0",
                "bond-min-links": "1",
                "bond-xmic-hash-policy": "layer3+4"
         }
    }
}
Please enter the commit message for your changes. Lines starting