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

540 Commits

Author SHA1 Message Date
Roopa Prabhu
90c6eab5f1 debian: move /sbin/start-networking to /usr/share/ifupdown2/sbin
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-19 16:00:35 -07:00
Roopa Prabhu
4934af352a addons: vrf: fix check in vrf map initialization when no running vrfs present
Ticket: CM-10178
Review: trivial
Testing: tested with failing testcase in the CM

This patch fixes a check in vrf map initialization code which did
not account for running vrfs correctly. This caused the case where
there were no running vrfs but stale map file to fail.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-19 15:32:32 -07:00
John Berezovik
7b2e838e95 Dry-run upgrade test 2016-04-19 14:37:39 -07:00
Julien Fortin
1927d237ee ifupdownaddons: mstpctlutil: changing log level to catch subprocess exception. 2016-04-19 15:18:35 +02:00
Julien Fortin
0605af50a3 ifupdownaddons: mstpctlutil: changing log level to catch subprocess exception. 2016-04-19 15:05:34 +02:00
Julien Fortin
83be0f8af8 ifupdownaddons: mstpctlutil: fixing 'UnboundLocalError: local variable referenced before assignment'. Also, now catching subprocess.CalledProcessError exception and general Exception.
Ticket: None
Reviewed By: Roopa
Testing Done: ifreload -a (vxlan interface file)
2016-04-19 02:36:15 +02:00
Julien Fortin
8e59521814 addons: vxlan: fixing error: _query_check_n_update_addresses() takes exactly 5 arguments (6 given)
Ticket: None
Reviewed By: Roopa
Testing Done: This error happened when running ifquery -c -a with

auto vx-42
iface vx-42
    vxlan-id 42
    vxlan-local-tunnelip 27.0.0.11
    mtu 1500
2016-04-18 16:53:44 +02:00
Roopa Prabhu
6369e77414 addons: vrf: move to vrf-helper for cgroup and default routes
Ticket: CM-10288
Reviewed By: dsa
Testing Done: Tested vrf and mgmt vrf sanity
2016-04-17 23:53:07 -07:00
Roopa Prabhu
3cf287b8e1 addons: dhcp: check if vrf device exists before calling dhclient with vrf exec
Ticket: CM-10292
Reviewed By:
Testing Done: Tested mgmt vrf and other sanity tests
2016-04-17 23:45:59 -07:00
Roopa Prabhu
f332cfbee8 debian: add /var/lib/ifupdown2/hooks dir
This can be used to execute third party scripts.
One such script /var/lib/ifupdown2/hooks/get_reserved_vlan_range.sh
if exists is used by the vlan module to get the reserved
vlan range on the system.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-16 20:39:58 -07:00
Roopa Prabhu
25e2386e43 addons: vrf: fix reuse of table id and misc fixes
Ticket: CM-10329 and others
Reviewed By: julien, nikhil
Testing Done: Tested vrf sanity and negative cases

- This patch also fixes duplicate rule additions (every reload
was causing ip rules to be added)
- This patch also adds support for vrf_helper which is commented
out due to some problems.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-16 20:12:56 -07:00
Roopa Prabhu
13e2253070 addons: address: disable reseting of mtu based on default mtu
Ticket: CM-10471
Reviewed By:
Testing Done: Tested with failing config in CM-10471

Recent commit "84f33af6e1f53d ("address.py: default value for mtu when
mtu attribute is removed") CM-9449" enabled setting of device mtu to default
mtu if mtu is not given in the interfaces file.

logical devices like bridges and vlan devices rely on mtu
from their lower devices. ie mtu travels from
lower devices to upper devices. For bonds mtu travels from
upper to lower devices. running mtu depends on upper and
lower device mtu. With all this implicit mtu
config by the kernel in play, it becomes almost impossible
to compare running mtu with the default mtu.
This commit disables this resetting of mtu based on default mtu.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-15 15:56:24 -07:00
Scott Emery
a7322fd960 ifupdown2: Allow lacp parameters to be set on 802.3ad bonds
Ticket: CM-10437
Reviewed By: CCR-4480
Testing Done: Created a bond and made sure it's lacp_rate could be set fast or
slow wioth or without specifying the mode.

The current code assumes that for a bond to be in 802.3ad mode the "bond-mode"
parameter has to be specified in the list of bond attributes being set. Only
then will ifupdown2 allow the lacp_rate and lacp_bypass attributes to be set.
But since we have changed the default mode to be 802.3ad, the mode attribute no
longer needs to be specified for a bond to be in 802.3ad mode.

So, instead of doing a check for the configuration attributes to determine the
mode, the linkinfo cache is checked. And the cache is refreshed, just in case
the mode attribute has been specified and just previously been set. The order in
which the attributes are set is fixed for bonds, and the mode is always set
prior to the lacp_rate and lacp_bypass attributes.

Also, while testing this I noticed another assumption about the default value of
an attribute: min_links. A warning is displayed when min_links is not specified
or set to 0, and the mode is set to 802.3ad. Well, now that the default for
min_links is 1 it doesn't have to be specified, even if the mode is set to
802.3ad. So ifupdown2 checks the current state of min_links if it is not
specified as one of the attibutes. If it is 0, either by being specified as an
attribute or not being specified but having that value, and the mode is set to
802.3ad, a warning is displayed.

And there was this other little problem where if a bond already existed in the
linkcache it wouldn't be refreshed, even if the refresh=True parameter was
specified in the _bond_linkinfo_fill function.
2016-04-15 11:50:37 -07:00
Julien Fortin
84f33af6e1 address.py: default value for mtu when mtu attribute is removed
Ticket: CM-9449
Reviewed By: Roopa
Testing Done: Adding/removing mtu attribute to ifaces while doing ifup/ifdown/ifquery/ifreload
2016-04-15 10:16:53 +02:00
Roopa Prabhu
fc5e1735c0 ifupdown: add new ifupdownflags class to carry ifupdown flags
Ticket: cleanup
Reviewed By:
Testing Done: Tested ifupdown sanity

This gets rid of some ugly previous flag handling which was
passed through modules. This creates a global instance of
flags that all addon modules and helper modules can use.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-14 22:30:53 -07:00
Roopa Prabhu
96a71b65cb addons: bridge: re-visit bridge port vid settings when vlan filtering is toggled
Ticket: CM-9059
Reviewed By: julien, nikhil
Testing Done: Tested with test case in the bridge
2016-04-13 23:56:49 -07:00
Roopa Prabhu
39ee399b45 addons: vrf: change vrf default route metric to 8192
Ticket: CM-10386
Reviewed By: dsa, vivek
Testing Done: sanity test
2016-04-13 11:35:31 -07:00
Roopa Prabhu
717cee3187 addons: dhcp: add vrf awareness
Ticket: CM-10292, CM-10282
Reviewed By: dsa, nikhil, julien
Testing Done: Tested dhcp config on an vrf slave

- Add support for policy module_globals variable
  "vrf-exec-cmd-prefix". It is read into per module
  self.vrf_exec_cmd_prefix variable

- If self.vrf_exec_cmd_prefix is present and interface is a
  vrf slave, use ifupdown2 will call such command in vrf
  context using:
    "%s %s %s" %(<vrf-exec-cmd-prefix>, <vrfname>, <cmd>)

- This also fixes calling of dhcp refresh when a dhcp slave is
  removed from a vrf

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-12 23:13:41 -07:00
Nikhil
f50f16fa71 addons: vxlan: fix ifquery --check failure on vxlan-svcnodeip
Ticket: CM-10336
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-04-11 03:05:27 -07:00
Julien Fortin
a4a53f4b45 fixing: ifupdown2 (subprocesses) lives on after control-c + Parsing cmd string with shlex.split instead of string.split
Ticket: CM-9905
Reviewed By: CCR-4363
Testing Done: ^C ifupdown2 while ifreload-ing interfaces test files (~500ifaces) + smoke tests
2016-04-10 18:55:56 +02:00
Roopa Prabhu
74d8271b1f ifupdownaddons: iproute2: when you invalidate the cache, make sure the cache flag is reset
Ticket: CM-10302
Reviewed By: julien
Testing Done: Tested ifdown of an interface and make sure the addresses
are deleted

cache_invalidate can be called when an interface gets deleted
or on any other deletion event (this is because we dont really
know, what other things have been implicitly deleted by the kernel).
on ifdown, the cache can get invalidated. But if we dont
reset the cache flag, the fill cache functions can still think
the cache is valid and can return None for any queries.
This was happening to address queries, which resulted in
leaving behind configured addresses. because ifdown
thought that there were no running addresses on the interface.
2016-04-06 08:19:10 -07:00
Roopa Prabhu
f7551dcbe7 ifupdownmain: check upperfaceobj role before printing the warning
Ticket: found during other testing
Reviewed By: trivial
Testing Done: Tested ifreload with dependency errors and dependencies
with upperiface being a master and also vlan device

This patch avoids false positives when set role is called twice
for an interface which is a vrf slave but also has a vlan device on
top of it.
2016-04-04 13:51:21 -07:00
Nikhil
bafcc12d84 addons: vrf: ifquery fixes for vrf
Ticket: CM-10175
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb onto dell-s3000-02

This patch is a git revert of commit 934c4c49c0e77289e7d56349c44d14ca2c307621.
In addition to that, order of _addr_filter() function call arguments are
changed to match the function definition.

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-04-04 02:20:44 -07:00
Nikhil
586535e8db addons: vrf: ifquery fixes for vrf
Ticket: CM-10175
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb onto dell-s3000-02

This patch fixes inappropriate ifquery fails.
This patch also include a review comment update for addressvirtual.py
[CCR-4310], ticket: [CM-8658]
Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-04-04 02:20:44 -07:00
Roopa Prabhu
557a54af8c ifupdown2: rtnetlink_api: fix api log message to contain commands in iproute2 format
Ticket: trivial
Reviewed By: wkok
Testing Done: Tested ifupdown2 sanity and checked log messages from rtnetlink api

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>

This is cherry-pick of commit 269ff43d09ca4 from cumulus2.5
2016-04-03 19:35:51 -07:00
Roopa Prabhu
afb367d954 ifupdownmain: bridgevlan: dont squash vlan iface_types with ifaces of
the same name

Ticket: CM-10051
Reviewed By: julien, nikhil
Testing Done: tested that bridge vlan attributes get applied correctly + ran ssim test testifupdown2.py

This was introduced by a patch that squashed multiple iface objects
into a single object.

That led to the below interfaces getting squashed into one. Which is not
the right thing to do:

{noformat}
auto Newbr.325
iface Newbr.325
        address 24.0.0.22/30
        address 3101🔤bcad:1::3/64

auto Newbr.325
vlan Newbr.325
        bridge-igmp-querier-src 194.31.10.45
{noformat}

The 'vlan Newbr.325' ifaceobject needs to be kept separately and it is
of type BRIDGE_VLAN. so, this patch just makes sure these interfaces are
kept separately in the squash function.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-03 19:20:44 -07:00
Roopa Prabhu
d49a18d1b9 ifupdownaddons: iproute2: add optional refresh flag to addr get api
Ticket:
Reviewed By: trivial
Testing Done: tested address gets with refresh flag + ran ssim test testifupdown2.py

- also fixes refresh flag handling in cache _addr_fill function
- this api can be used to get addresses from the cache by first
refreshing the cache. So the caller gets fresh running addresses.
(its not used right now but came up during the need to re-apply
addresses for ipv6 vrf slaves since their addresses may disappear)
2016-04-03 19:20:44 -07:00
Roopa Prabhu
87907576b7 debian: Add new SKIP_DOWN_AT_SYSRESET /etc/init.d/networking config option to skip deconfiguring interfaces
Ticket: CM-5900
Reviewed By: CCR-2921
Testing Done: Tested 'service networking stop' during system reboot and shutdown

this is cherry-pick of cumulus-3.2.y commit ac231e966a04eb78153d9b53f0d236a149c7bba5
2016-04-03 10:29:33 -07:00
Nikhil
050838834b Revert "addons: vrf: ifquery fixes for vrf"
This reverts commit 934c4c49c0e77289e7d56349c44d14ca2c307621.

    Ticket: CM-10175
    Reviewed By: Roopa Prabhu
    Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

default addr fix for vrf check is deleting lo addrs accidentally
info: rtnetlink: setting link lo up
info: executing ip addr del ::1/128 dev lo
info: executing ip addr del 127.0.0.1/8 dev lo
info: eth0: running ops ...

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-04-01 21:33:16 -07:00
Roopa Prabhu
3aff1d83a4 addons: bridge: make sure bridge port enslavement is done by the bridge
when it is non-vlan filtering bridge

Ticket: CM-10083
Reviewed By: nikhil, julien
Testing Done: Tested ifreload testcase with CM-10083

Without this patch a bridge port could enslave itself to the bridge
when it finds that the bridge is around. This is a required feature
for vlan filtering bridge because vlan filtering bridge port attributes
are specified under the bridge port and the bridge port needs the power
to enslave to the bridge and apply bridge port attrs.

For the non-vlan filtering bridge, a few bridge port combinations are
not allowed by default (eg, mixing different vlans under the same bridge).
The bridge has the understanding of which ports are allowed. so only it
should have the power to enslave bridge ports. This patch enforces that
power. With this patch the sequence of deleting and enslaving bridge
ports is done at the bridge with deletes followed by adds.

example verbose snippent from ifreload output:
ip -force -batch - [link set dev swp49s0 nomaster
link set dev swp49s1 nomaster
link set dev swp49s0.300 master Oldbr
addr flush dev swp49s0.300
link set dev sidelink.300 master Oldbr
addr flush dev sidelink.300
link set dev swp49s1.300 master Oldbr
addr flush dev swp49s1.300
link set dev swp4 master Oldbr
addr flush dev swp4]

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-31 21:58:09 -07:00
Roopa Prabhu
05ac52f075 addons: vrf: redo iproute2 vrf interface map handling
Ticket: CM-10188, CM-10061
Reviewed By: dsa, nikhil, julien
Testing Done: Tested static routes with vrf names for tables

This patch does the following:
- if a single vrf device is present in the config,
builds the vrf map by reading vrf interfaces from the kernel (with
existing link cache. Builds a shadow vrf only attribute cache)
- reads existing table map and adjusts it if required
- main change is the iproute2 map file on disk is updated
immediately on vrf creation, so that static routes used along with the
vrf slaves can use the vrf name for the table. This also helps dhclient dns
hook script which may use mgmt table name directly.
- cleans up default routes on down

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-31 21:56:39 -07:00
Roopa Prabhu
0ba04b3803 addons: vrf: more fixes and cleanups for mgmt and data vrf handling
Ticket: CM-10188, CM-9881
Reviewed By: nikhil, julien, dsa, daniel
Testing Done: Tested mgmt vrf bringup, teardown, static routes at boot
etc

This patch fixes a few things:
- kill existing ssh clients on enslavement change for mgmt vrf (original patch by NikhilG)
- bring vrf master up first during vrf slave enslavement if
master does not exist. This was originally done only for
vrf dhcp slaves. With this patch we do it for all vrf slaves.
needed for static routes on vrf slaves (CM-10188).
- cleanup: reorganize code and a few cleanups and corner case handling

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Nikhil Gajendrakumar <nikhil@cumulusnetworks.com>
2016-03-30 23:49:51 -07:00
Roopa Prabhu
858a230f91 ifupdownmain: redo shared dependent checks
Ticket: CM-10027
Reviewed By: julien, nikhil
Testing Done: Tested with an interfaces file with shared dependents

In the process of fixing this saw a few more issues with link kind
handing. Its better to separate kind from interface private flags
like bond slave and bridge port. this patch cleans up all that handling.

Example errors:
error: misconfig..? swp5.2 vrfslave  is enslaved to multiple interfaces
['vrf1012', 'br2']
error: misconfig..? swp5.2 bridgeport  is enslaved to multiple
interfaces ['vrf1012', 'br2']
2016-03-30 23:44:48 -07:00
Roopa Prabhu
9219cef3d6 ifupdownmain: don't down vrf master in sched callback ops
This was bringing down vrf master earlier than required
leading to ssh session hangs in case of management vrf

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-30 23:44:48 -07:00
Nikhil
934c4c49c0 addons: vrf: ifquery fixes for vrf
Ticket: CM-10175
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb onto dell-s3000-02

This patch fixes inappropriate ifquery fails.
This patch also include a review comment update for addressvirtual.py
[CCR-4310], ticket: [CM-8658]
Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-03-30 19:13:58 -07:00
Julien Fortin
4ab0c044cb addons/bridge.py: fixing potential None type issue 2016-03-29 04:29:24 +02:00
Julien Fortin
0c79210304 sbin/ifupdown2: cleanup unreachable code and refactor update_ifupdown2_argparser to update_common_argparser
Ticket: CM-8564

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-03-29 01:50:47 +02:00
Julien Fortin
3da42c983c addons/bridge.py: warn and ignore bridge-ports duplicate lines
Ticket: CM-8744
Reviewed By: CCR-4321

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-03-29 00:47:03 +02:00
Julien Fortin
041ac313a5 sbin/ifupdown2: Adding -V/--version argument to display current ifupdown2 version
Ticket: CM-8564
Reviewed By: CCR-4369

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-03-28 21:23:03 +02:00
Nikhil
c47acd7902 ifupdownmain: Reverting commit 25f41c2ab3c3daeee81d7ed371b8c4ca29091011
Ticket: CM-10112
Reviewed By: Shrijeet Mukherjee, Natarajan Sankaran
Testing Done: yes, by installing ifupdown .deb file onto act-5712-09

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-03-25 18:51:57 -07:00
Roopa Prabhu
60fa92039e addons: vrf: temporarily disable kill_ssh
Ticket: CM-10094
Reviewed By:
Testing Done:

It is killing ifupdown2 and setsid is not working as expected
2016-03-25 08:25:44 -07:00
Nikhil
32f6e6ca40 addons: vrf: drop ssh connections over eth0 on enable or disable
Ticket: CM-9881
Reviewed By: Roopa Prabhu
Testing Done: yes

This patch is the second version of drop ssh sessions
changes:
    added try catch around os.setsid()

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-03-25 00:45:24 -07:00
Roopa Prabhu
aa36221f34 addons: vrf: more ordering fixes for management vrf and dhcp vrf slaves
fixes the following:
- if the vrf slave had a master but is no longer a slave
according to ifaceobj, look at running state and
undo vrf enslavement
- add support to cl-vrf service disable <vrf>

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-24 21:59:54 -07:00
Roopa Prabhu
25f41c2ab3 ifupdownmain: don't down vrf master in sched callback ops
This was bringing down vrf master earlier than required
leading to ssh session hangs in case of management vrf

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-24 21:55:58 -07:00
Nikhil
5c5a7b93cd addons: vrf: drop ssh connections over eth0 on enable or disable
Ticket: CM-9881
Reviewed By: Roopa Prabhu
Testing Done: yes

***initial version ***
SSH clients will be closed to avoid the connection hang
when management VRF is enabled or disabled using a login through eth0
Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-03-24 17:55:47 -07:00
Roopa Prabhu
f825610ec6 addons: vrf: down the slave after unslaving during down
Ticket: CM-10050
Reviewed By:
Testing Done: tested with bridge testcase described in the bug
2016-03-23 23:51:11 -07:00
Roopa Prabhu
892c495ea8 scheduler: do not propagate upperiface bring up error state
Ticket: CM-10016
Reviewed By:
Testing Done: Tested with the upperiface bring up case described in
CM-10016

upperiface bringup is best effort and does not imply that the current
interface bring up has an error. It only means that the upperiface may
be in an incomplete state. Hence this patch resets scheduler error state
before returning from upperiface bringup.
2016-03-23 22:24:30 -07:00
Roopa Prabhu
f1c9248267 addons: vrf: delete rules before deleting the vrf interface on down
Ticket: CM-10057
Reviewed By: trivial
Testing Done: Tested ifdown of a vrf interface
2016-03-23 21:12:47 -07:00
Roopa Prabhu
fd8c6caf7f addons: vrf: enforce reserved table id range 1001-5000
Ticket:
Reviewed By:
Testing Done: Tested vrf-table id with valid and invalid table ids

currently the reserved table id range is set to 1001-5000
and it comes from a policy file /var/lib/ifupdown2/policy.d/vrf.json
2016-03-23 19:33:16 -07:00
Roopa Prabhu
c4be54818e addons: vrf: during down of a vrf device make sure to refresh dhcp slaves
Ticket: CM-10049
Reviewed By:
Testing Done: Tested disabling management vrf
2016-03-23 19:04:59 -07:00