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

62 Commits

Author SHA1 Message Date
Sam Tannous
0a3bee28ca Don't allow IP addresses on ports enslaved in bonds or bridges
Ticket: CM-5146
Reviewed By: roopa,jtoppins
Testing Done: built new ifupdown package and ran testifupdown2 suite of tests

This patch prevents enslaved interfaces from having IP addresses.
(cherry picked from commit 0c00606fbc76db11557a8e946310e93a2b376aa7)
(cherry picked from commit dc30987acfc6af356b9e055db95d94ae45f0de9f)
2015-06-04 15:28:57 -04:00
Sam Tannous
3d44fbd0c9 Add default link parameter support for ethtool module
Ticket: CM-5254
Reviewed By: roopa
Testing Done: tested master and 2.5_br images with testifupdown2 suite and hand tested

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

Conflicts:
	packages/cl-utilities/usrlib/update-ports
(cherry picked from commit 21c9c10ab2fccaf60be9accb337e82541d497cc4)
2015-06-04 15:27:48 -04:00
Roopa Prabhu
26434da621 Dont down an interface during ifreload just because the number of iface
sections for that interface changed

Ticket: CM-5841
Reviewed By:
Testing Done: tested ifreload with new iface section

<email_notes>
problem stmt:
if the user adds a new section for an existing interface, I mark the
interface for down.
Basically the below:

               if len(newifaceobjlist) != len(lastifaceobjlist):
                    ifacedownlist.append(ifname)
                    continue

You rarely need to add a new section to the interfaces file. It is not
recommended even by the user guide.
sankaran was trying to add a new address. Which he could have added to
the same iface section.

But, looking at his trivial example, i am thinking of not marking an
interface for down if the user merely tried to add a new section to an
existing interface
</email_notes>
2015-04-27 21:18:14 -07:00
Roopa Prabhu
e308cb8280 add new ifupdown2.conf option ifreload_down_changed to control ifreload
ifdown behaviour.

Ticket: CM-5819
Reviewed By: CCR-2846
Testing Done: tested ifreload evo test case

ifreload_down_changed is 0 by default which will make
sure ifreload will not execute down on changed interfaces
but only on deleted interfaces making it non-disruptive.

some notes from CCR:

ifreload was designed to be an optimization for 'service networking
restart' or 'ifdown -a + ifup -a'.
essentially it is a combination of 'ifdown + ifup' with some smarts in
which interfaces it will execute ifdown on.

By default it does the below:
ifdown all interfaces that were deleted from the interfaces file
ifdown all interfaces that were changed from the last time they were
ifup'ed
ifup -a (execute ifup on all interfaces marked auto)

Did not realize people will use ifreload as much as they do today. Also,
they may execute it on a production box when changes are made. ifdown on a production box can be
disruptive because if the ifdown which is part of the ifreload.

To have a non-disruptive option to ifreload, 2.5 added a new option -c
that only executed 'ifup' on all interfaces. Thus reloading all auto +
any other interfaces that were once brought up on the box (essentially
all interfaces present in the saved state file). This by default did not
do anything to the interfaces that got deleted from the file. But had an
ifupdown2.conf toggle to do so.

Looking at the evo use case, they do want to use a single command that
modifies, adds, deletes with
minimum disruption. we can achieve maybe what they want with multiple
commands (But there is also a case of a bug in the build evo is running
which makes it not so easy ).

This patch fixes the bug and also tries to change the default ifreload
behaviour controllable via a variable in ifupdown2.conf.
when ifreload_down_changed=0 in ifupdown2.conf, ifreload will only
ifdown interfaces that were deleted
from the file but not the ones that changed. subsequent ifup as part of
ifreload on the interfaces
that changed will apply the delta. And ifreload_down_changed default
value is '0'.

WIth the patch, ifreload by default will do the below (going back to the
previous default is just a toggle in the ifupdown.conf file):
ifdown all interfaces that were deleted from the interfaces file
ifup -a (execute ifup on all interfaces marked auto)

It sounds like a big change of behaviour for a hotfix release, but
essentially the patch just moves a few things around. And the change in
behaviour is so subtle that it is not very visible.
It just makes it non-disruptive.
(cherry picked from commit 2f7977834d4912a69159d27e54ba201f58a321d8)
2015-04-25 19:12:16 -07:00
Sam Tannous
4c773918da ifupdown2 loses interfaces on second down of swp port
Ticket: CM-5693
Reviewed By: roopa
Testing Done: tested bridge and bonds with interfaces with configs

Both bridge and mstpctl modules set priv_flags on interfaces
that have configs (like link-speed) even when used as bridge-ports.
And this collision causes statemanager.ifaceobj_sync() to never get called
because ifaceobj.priv_flags is 1 (we return immediately):
The fix was to create a new iface module_flags array to carry module info.
2015-04-23 20:27:44 -04:00
Roopa Prabhu
1cda1e437b rework error message
Ticket: CM-5373
Reviewed By:
Testing Done: tested interfaces file with shared dependents
2015-04-03 22:33:53 -07:00
Roopa Prabhu
45ca0b6d42 Add check for shared dependents during building dependency list
Ticket: CM-5373
Reviewed By: sam
Testing Done: Tested with shared slaves in bridge and bonds
2015-04-03 22:18:32 -07:00
Roopa Prabhu
a4912b996e Dont follow dependents during down of interfaces as part of ifreload
Ticket: CM-5571
Reviewed By:
Testing Done: tested ifreload with example in the bug

ifdown of the bridge svi was following the lowerdev and downing the
bridge. kernel implicitly deletes all svi's on bridge down.
ifup of the bridge usually handles it, but a change done in 2.5.1
was causing it not to. Thinking about this some more, its safe
to not follow dependents on down during a ifreload. This patch does
just that.
2015-04-03 20:47:06 -07:00
Roopa Prabhu
acf9264497 Add config len check to iface compare
Ticket: CM-5253
Reviewed By: sam
Testing Done: Tested ifreload with steps in the bug
2015-04-03 20:33:28 -07:00
Sam Tannous
fa714fa248 Correct error message for unsupported ifupdown2 attributes
Ticket: CM-5349
Reviewed By: Trivial
Testing Done: Tested on cel box

Corrected a minor error in how we handle unsupported config attributes.
Instead of

     error: not enough arguments for format string

we will now print this:

     warning: peerlink.4000: unsupported attribute 'clagd-foobar'
(cherry picked from commit 44c6004a33d59ee234f8ee3d5f450e158c9e5bdc)
2015-03-10 16:54:41 -04:00
Roopa Prabhu
c65c2ccde1 Wrong initialization of iface link kind (still puzzled how i had it this
way)

Ticket:
Reviewed By: trivial
Testing Done: Tested interface upperiface bring up

This was causing the auto upperiface bringup to pick all upperifaces on
malliks setup. This is a large number in a 500 svi setup.
2015-02-26 14:26:58 -08:00
Roopa Prabhu
3fc16f816d Merge branch 'CumulusLinux-2.5_br' of ssh://dev.cumulusnetworks.com/home/trac/cumulus into CumulusLinux-2.5_br 2015-02-18 12:32:05 -08:00
Roopa Prabhu
5b65654f85 Call mako renderer before rendering backslashes ('\')
Ticket: CM-5104
Reviewed By:
Testing Done: Tested with interfaces file listed in the bug
2015-02-18 12:28:50 -08:00
Sam Tannous
b6c1f5513a ifupdown2 must handle JSON input that is non-list
Ticket: CM-4417
Reviewed By: roopa
Testing Done: Build powerpc image and tested alternate json format

ifupdown2 was patched to handle nonlist JSON input since this
is a valid format.
(cherry picked from commit 2597194f6f34344495f3a2b44bfe1d05887e1e77)
2015-02-11 11:41:16 -05:00
Roopa Prabhu
496745cdc0 Add checks for BRIDGE_VLAN interfaces during link up/down
Ticket: CM-4718
Reviewed By:
Testing Done: tested ifup/ifdown of vlan interfaces
2015-02-10 11:28:53 -08:00
Roopa Prabhu
7bbc934097 Handle blank lines correctly in addons.conf
Ticket: (Reported by gospo)
Reviewed By:
Testing Done: Tested with blank lines in the file
2015-01-22 12:56:56 -08:00
Roopa Prabhu
f3b69969e3 Fix link_type flag for objects read from state file + fix link_type
initializations in a few other places

Ticket: CM-4610
Reviewed By:
Testing Done: Tested with the failing sequence of events described in
the bug
2014-12-31 14:10:45 -08:00
Roopa Prabhu
cebe79c93a Move link_master_slave flag overrides to /sbin/ifupdown + log a msg to
indicate link_master_slave flag status

Ticket:
Reviewed By:
Testing Done: ifupdown2 sanity tests with link_master_slave feature on/off
2014-12-29 22:10:36 -08:00
Roopa Prabhu
61c4d72447 Suppress 'Network down' warnings when link_master_slave feature is on
Ticket: CM-4462
Reviewed By:
Testing Done: Tested with interfaces file given in the bug.

The 'network down' msg from the kernel is when the lower device is not
'admin up'. In CM-4462 it is seen when the vlan interface on the bond
is 'admin up' when the bond is still in 'admin down' state.
The bond is also a bridge port so, bond will be 'admin up' when
the bridge it belongs to is brought up.

As link_master_slave feature is on only when all network interfaces
are brought up/down, the states of all interfaces will eventually
converge to 'admin up', so ignoring such transient 'network down' messages.
2014-12-26 09:57:08 -08:00
Roopa Prabhu
1f87118e33 Fix error msg strings from rtnetlink module
Ticket:
Reviewed By:
Testing Done:
2014-12-26 09:56:49 -08:00
Roopa Prabhu
7e2e64fbe9 Fix a bug with disabling of config option link_master_slave + turn off
link master slave feature when '-a' is not specified.

Ticket: CM-4408
Reviewed By:
Testing Done: Tested with ifupdown2.conf link_master_slave on/off

This will make the behaviour change mostly invisible to users

Conflicts:
	packages/ifupdown2/ifupdown/ifupdownmain.py
2014-12-26 09:56:39 -08:00
Roopa Prabhu
d52f59043c Add rtnetlink api's for 'bridge vlan' and modify 'bridge vlan' commands
in vlan module to use rtnetlink api

Ticket: CM-4173
Reviewed By:
Testing Done: Tested new bridge driver svi up/down

This does not move all 'bridge vlan' commands to rtnetlink yet.
2014-12-26 09:54:00 -08:00
Roopa Prabhu
a9ab1b4f10 Rework bridge upperiface handling (to fix some problems with the new
bridge driver and svi config)

Ticket: CM-3346
Reviewed By:
Testing Done: Tested upper interface handling during ifup of
bonds/bridges/svis
2014-12-26 09:53:51 -08:00
John Berezovik
97f4cff80c Merge branch 'release-2.5' into CumulusLinux-2.5_br
Conflicts:
	build-config/make/local-pkgs.make
	packages/cafe/clobjects.py
	packages/cafe/clobjects_l3_quagga.py
	packages/cl-basefiles/etc/cumulus/datapath/traffic.conf
	packages/cl-utilities/etc/monit/monitrc.d/cumulus
	packages/clag/ifupdown/clagd.py
	packages/ifupdown2/addons/bridge.py
	packages/ifupdown2/addons/ifenslave.py
	packages/ifupdown2/ifupdown/iface.py
	packages/ifupdown2/ifupdown/ifupdownmain.py
	packages/ifupdown2/ifupdown/scheduler.py
	packages/portwd/portwd
	patches/bcm-sdk/series
	patches/iproute/bridge-increase-netlink-rcv-buf-size.patch
	patches/iproute/series
	patches/kernel/driver-support-sff-8436-eeprom.patch
	patches/kernel/network-bridge-dont-install-local-mac.patch
	patches/kernel/series
	patches/lldpd/series
	patches/mstpd/clag_port_fsm_reset.patch
	patches/mstpd/mstpd_init_system.patch
	patches/mstpd/series
	patches/quagga/series
	rootconf/default/etc/default/cron
	switchd/hal.c
	switchd/hal_bcm.c
	switchd/hal_bcm_config.c
	switchd/hal_bcm_config.h
	switchd/hal_config.c
	switchd/hal_config.h
	switchd/hal_int.h
	switchd/sync.c
	tests/tests/l3/bgp_alpm_test.py
	tests/tests/l3/bgp_path_hunting.py
	tests/tests/l3/bgp_smoke_test.py
	tests/tests/l3/l3_node.py
	tests/tests/l3/mc_snoop_test.py
	tests/tests/lib/decorators.py
	tests/tests/smoke/testifupdown2.py
	utilities/ci/pretest.yml
	utilities/distro-cmd
	utilities/packages/ssim2/setup.py
	utilities/packages/ssim2/ssim2/simlib.py
2014-12-24 12:20:53 -08:00
Roopa Prabhu
a070c90ec3 Multiple fixes and cleanup
Ticket: CM-3346
Reviewed By:
Testing Done: Tested ifupdown2 sanity

- moved 'admin up' delays that we introduced recently to be
configurable via two ifupdown2.conf attributes
    # Let link master (bridges, bonds) own the link state of slaves
    link_master_slave=1

    # Delay admin state change till the end
    delay_admin_state_change=0

- reduced some redundant traversal of dependency trees

- fixed a few bugs in query check
2014-12-17 12:39:38 -08:00
Roopa Prabhu
73c275920a Fix hex flags representation (this was causing wrong evaluation of & and
| on flags)

Ticket:
Reviewed By:
Testing Done:

Problem seen with ifquery skipping some interfaces because of wrong
evaluation of iface flags
2014-12-11 16:13:25 -08:00
Roopa Prabhu
40ed8c4d30 Add a few more trt/except blocks to warn and proceed
Ticket:
Reviewed By:
Testing Done:

<DETAILED DESCRIPTION (REPLACE)>
(cherry picked from commit da446f09f0c723852f20ba1c666abcc80b5fe764)
2014-12-10 22:07:40 -08:00
Roopa Prabhu
3980661f16 Add a few more trt/except blocks to warn and proceed
Ticket:
Reviewed By:
Testing Done:

<DETAILED DESCRIPTION (REPLACE)>
2014-12-10 21:30:39 -08:00
Roopa Prabhu
5be7399dc9 Fix if condition when propagating link_type (old flags check left over from my previous
commit)

Ticket: CM-4408
Reviewed By:
Testing Done: Tested with old bridge driver config (bug reported by
satish)
(cherry picked from commit 11e6ae96aae85591e8d32e1062d979e51de9e424)
2014-12-09 14:24:06 -08:00
Roopa Prabhu
c416da6adc Move LINK_MASTER/LINK_SLAVE to a new field link_type (purna hit some
issues with having it in flags) + add check for bond slave being already up

Ticket: CM-4408
Reviewed By:
Testing Done: some bond sanity test
(cherry picked from commit 346b62a41fbf4521008cd8a9b0fa227e75a5d994)
2014-12-09 14:24:05 -08:00
Roopa Prabhu
b48ff1a983 This patch moves bond slave link ownership to the bond module and makes
sure that slaves can never be brought admin up on their own when they
are not in the bond

Ticket: CM-4408
Reviewed By: CCR-2323
Testing Done: Tested ifup/ifdown of bond slaves and bond interface

This patch introduces:
- introduces 2 interface flags, LINK_MASTER and LINK_SLAVE.
- The bond module will set LINK_MASTER on the bond iface object
indicating that the bond module owns the link.
- Which means that all lower devices /slaves of the bond get their
link when the bond (aka LINK_MASTER) is processed in the bond module
- The module that queries dependencies propagates the LINK_SLAVE flags
on the dependents of LINK_MASTER.
- The scheduler now acts on the LINK_SLAVE flag. If LINK_SLAVE is set,
it skips setting admin 'up' on that interface. It also makes sure the
interface is not already in the bond.
    ie if an interface is a LINK_SLAVE (bond slave in this case), admin
up will not be executed when the interface is not inside the bond.
(cherry picked from commit 84b5a07a4f7685c7ae2eac5892889d6c0e08b2eb)
2014-12-09 14:24:05 -08:00
Roopa Prabhu
33a2e9e9bf Fix if condition when propagating link_type (old flags check left over from my previous
commit)

Ticket: CM-4408
Reviewed By:
Testing Done: Tested with old bridge driver config (bug reported by
satish)
2014-12-09 12:56:45 -08:00
Roopa Prabhu
c9bba7539d Move LINK_MASTER/LINK_SLAVE to a new field link_type (purna hit some
issues with having it in flags) + add check for bond slave being already up

Ticket: CM-4408
Reviewed By:
Testing Done: some bond sanity test
2014-12-08 22:59:41 -08:00
Roopa Prabhu
7f045fd868 This patch moves bond slave link ownership to the bond module and makes
sure that slaves can never be brought admin up on their own when they
are not in the bond

Ticket: CM-4408
Reviewed By: CCR-2323
Testing Done: Tested ifup/ifdown of bond slaves and bond interface

This patch introduces:
- introduces 2 interface flags, LINK_MASTER and LINK_SLAVE.
- The bond module will set LINK_MASTER on the bond iface object
indicating that the bond module owns the link.
- Which means that all lower devices /slaves of the bond get their
link when the bond (aka LINK_MASTER) is processed in the bond module
- The module that queries dependencies propagates the LINK_SLAVE flags
on the dependents of LINK_MASTER.
- The scheduler now acts on the LINK_SLAVE flag. If LINK_SLAVE is set,
it skips setting admin 'up' on that interface. It also makes sure the
interface is not already in the bond.
    ie if an interface is a LINK_SLAVE (bond slave in this case), admin
up will not be executed when the interface is not inside the bond.
2014-12-08 17:15:57 -08:00
Roopa Prabhu
5b4d304406 Fix formatting for ifquery check (cosmetic. only fixes prints)
Ticket: CM-3346
Reviewed By:
Testing Done: ifupdown2 sanity + ifquery check tests
(cherry picked from commit ba81bde56d04a8f90a6f5d548518605fd1e5ae5f)
2014-12-01 23:24:08 -08:00
Roopa Prabhu
0212f53ccb Fix formatting for ifquery check (cosmetic. only fixes prints)
Ticket: CM-3346
Reviewed By:
Testing Done: ifupdown2 sanity + ifquery check tests
2014-12-01 23:19:48 -08:00
Roopa Prabhu
cf5dcafa07 continue passing the object to other modules if one of the modules fails
Ticket: CM-4336
Reviewed By:
Testing Done: Tested with the missing port testcase from CM-4336
(cherry picked from commit 82a976ada6ba208bde089805d613413a5b016f8d)
2014-12-01 15:15:19 -08:00
Roopa Prabhu
3e6ea735cc continue passing the object to other modules if one of the modules fails
Ticket: CM-4336
Reviewed By:
Testing Done: Tested with the missing port testcase from CM-4336
2014-12-01 14:54:12 -08:00
Roopa Prabhu
ef892cccd9 Check for unexpected characters (specifically the ones which look like
variable names) + also fix a condition that looks incorrect

Ticket:
Reviewed By: wkok
Testing Done: Tested with the failing

This was seen in a case where mako is unable to render the template
or incorrectly renders it due to user template
errors, leaving interface names with
mako variables in them. There is no easy way to
recognize and warn about these. This patch tries to warn the user
of such cases by looking for variable patterns ('$') in interface names.
(cherry picked from commit fc0d45a794a61f7e6a3fd2c2ebce3d621bf0c7b2)
2014-11-30 21:48:56 -08:00
Roopa Prabhu
41d1ada659 Check for unexpected characters (specifically the ones which look like
variable names) + also fix a condition that looks incorrect

Ticket:
Reviewed By: wkok
Testing Done: Tested with the failing

This was seen in a case where mako is unable to render the template
or incorrectly renders it due to user template
errors, leaving interface names with
mako variables in them. There is no easy way to
recognize and warn about these. This patch tries to warn the user
of such cases by looking for variable patterns ('$') in interface names.
2014-11-30 21:44:46 -08:00
Roopa Prabhu
ad25e7bb98 Misc fixes. Add a --skip-upperifaces option to ifup (given the confusion
over ifup handling of upperifaces by default) + some fixes in the
reserved vlan check

Ticket: CM-3346
Reviewed By:
Testing Done: Tested ifupdown sanity.
2014-11-25 10:19:35 -08:00
Roopa Prabhu
aa5751ba27 Change "source" inclusion errors to warns.
Ticket: CM-3346
Reviewed By:
Testing Done: tested sanity
2014-11-21 11:07:11 -08:00
Roopa Prabhu
2b5635d457 Fix 'source' file error handling
Ticket:
Reviewed By:
Testing Done:
2014-11-19 17:48:02 -08:00
Roopa Prabhu
16d854b461 Fix a few minor ifquery check failures
Ticket: CM-3346
Reviewed By:
Testing Done: Tested ifupdown2 sanity and query check failures.
2014-11-19 17:25:26 -08:00
Roopa Prabhu
fac4138bfe Change defaults result strings in ifquery check output
Ticket: CM-3810
Reviewed By:
Testing Done: tested ifquery check

defaults from /etc/network/ifupdown2/ifupdown2.conf
ifquery_check_success_str=(OK)
ifquery_check_error_str=(FAIL)
ifquery_check_unknown_str=
2014-11-15 23:34:02 -08:00
Roopa Prabhu
d8e3554dde minor fixes for ifquery and stp handling
Ticket: CM-3346
Reviewed By:
Testing Done: Tested ifupdown2 sanity
2014-11-15 15:42:52 -08:00
Roopa Prabhu
97382e8841 Fix auto flag handling during reload
Ticket: CM-4204
Reviewed By:
Testing Done: Tested ifreload with interfaces file in the bug

My last checkin moved the auto flag around causing the breakage
2014-11-12 22:43:24 -08:00
Roopa Prabhu
2da58137d8 Misc fixes + ifreload new option + cleanups + more ifquery support etc
Ticket: CM-3346, CM-3784, CM-3841
Reviewed By:
Testing Done: various ifupdown2 tests
2014-11-11 21:58:12 -08:00
Roopa Prabhu
8e113d6319 misc query and fdb/vlan add fixes
Ticket: CM-3346
Reviewed By:
Testing Done: ifupdown2 sanity
2014-11-03 17:55:51 -08:00
Roopa Prabhu
9e012f9e8a some more ifquery support (for vxlan devices etc)
Ticket: CM-3784
Reviewed By:
Testing Done: Tested ifquery check/running and sanity
2014-10-31 11:28:07 -07:00