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

525 Commits

Author SHA1 Message Date
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
Roopa Prabhu
097533507b addons: vrf: multiple fixes to vrf enslavement and auto handling
Ticket: CM-10005
Reviewed By:
Testing Done: Tested boot and ifreload after changes

- fix access to addr_method on an object which had no
address method defined. This was a recently introduced
regression that caused vrf enslavement to end per-matuarely.
- few fixes around vrf_table conversion between string
and integer
2016-03-23 00:08:34 -07:00
Roopa Prabhu
3f1811d949 addons: vrf: use full path to cgdelete
Ticket: CM-10018
Reviewed By: trivial
Testing Done: Tested ifdown of vrf device
2016-03-22 21:38:23 -07:00
Roopa Prabhu
b5c2f02ff7 scheduler: fix incorrect check of SCHED_STATUS
Ticket: CM-9993
Reviewed By: julien
Testing Done: Tested with interfaces file and steps described in the CM

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-22 14:11:23 -07:00
Sam Tannous
16e30aab93 ifquery --running should not display link attributes unless they are different then defaults.
Ticket: CM-9995
Reviewed By: julien
Testing Done: Tested on amd64 hardnode

Right now, ifquery -r shows link speed, duplex and autoneg current running values.
This patch changes the behavior to not show link attributes unless they
differ then the defaults for that interface.
2016-03-22 15:53:05 -04:00
Nikhil
c61672da44 addons: vrf: move ip -6 fib rule for local table
Ticket: CM-9968
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

patch to move ip -6 fib rule for local table after vrf rules

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-03-21 12:39:18 -07:00
Nikhil
e607276995 addons: vrf: Avoid adding duplicate fib6 rule
Ticket: CM-9975
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing deb file onto dell-s3000-02

Avoid adding duplicate ipv6 fib rule when one is missing for IPv4
2016-03-21 12:35:58 -07:00
Nikhil
4d3dc0f752 addons: addressvirtual: vrr virtual mac multicast bit check
Ticket: CM-8658
Reviewed By: Roopa Prabhu, Scott Emery
Testing Done: Yes, by installing ifupdown .deb file onto cel-e1031-01

This patch includes a check for multicast bit of vrr virtual mac
address and set an error

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-03-21 12:35:58 -07:00
Roopa Prabhu
3cdb161971 networkinterfaces: don't warn if sourced lines contain globs
Ticket: CM-9908
Reviewed By: julien
Testing Done: tested sourcing files with globs and non-globs

warn if sourced line has a glob ('*')
2016-03-19 19:45:33 -07:00
Roopa Prabhu
4d2c979814 addons: vrf: fix a few vrf enslavement and table id allocation corner cases
Ticket: CM-9957
Reviewed By: dsa, julien, nikhil
Testing Done: Tested vrf enslave/deslave + ifreload

This patch fixes a few corner cases:
- release dhcp on all new enslavement or change of enslavement
- fix a NoneType error on ifreload when a vrf enslavement was removed
- handle a corner case with auto table ids

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-18 21:25:09 -07:00
Roopa Prabhu
2009513fa2 ifupdownmain: scheduler: propagate sched error on interfaces to upper layers
Ticket: CM-7168
Reviewed By: julien, nikhil, stannous
Testing Done: Tested with errors in interfaces file

This patch changes a few errors to warns. and propagates errors
on ifaceobjects to upperlayers.

- any exception passed to upper layers (/sbin/ifupdown) results in
exit code of 1

- It uses a global SCHED flag to flag a scheduler error (maybe there is
  a better way). But traversing all the interfaces again to check status
is an overkill

- Changes a few errors to warns

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-18 11:45:54 -07:00
Roopa Prabhu
d54baa2232 addons: vrf: fix cases where auto was getting written to iproute2 vrf map
Ticket:
Reviewed By: trivial
Testing Done:

This also changes a few errors to warn

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-18 11:22:22 -07:00
Roopa Prabhu
aa4e30220a ifupdownmain: ifreload: log a message if no new interfaces found
Ticket:
Reviewed By: trivial
Testing Done:

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-17 16:23:40 -07:00
Roopa Prabhu
122ef35bf9 addons: vrf: release any dhcp leases before vrf slave enslavement
Ticket: CM-9929
Reviewed By:
Testing Done: Tested vrf dhcp slave enslavement on ifreload

algo:
- when a vrf slave enslavement changes, before performing the
  new master enslavement,
- check if vrf slave has dhcp configured
- if yes, release dhclient running on the vrf slave
2016-03-17 16:18:14 -07:00
Roopa Prabhu
05ca6f0140 addons: vrf: set metric 240 for vrf installed default unreachable routes
Ticket: CM-9934
Reviewed By: trivial
Testing Done: Tested vrf create and destroy
2016-03-17 12:34:56 -07:00
Roopa Prabhu
df53966d0d addons: vrf: handle auto table ids for dhcp slaves
Ticket: CM-9921
Reviewed By: trivial
Testing Done: Tested with table id auto for management vrf

I have recently added special handling for vrf slaves with dhcp.
And missed handling of vrf-table auto for such slaves.
This patch fixes auto when bringing up vrf masters for dhcp vrf
slaves

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-17 09:07:53 -07:00