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

100 Commits

Author SHA1 Message Date
Julien Fortin
5abd95c024 addons may provide a list of ifupdown scripts to ignore
Ticket:
Reviewed By: Roopa, Nikhil G
Testing Done:

ifupdown2's python addons are replacing some/most of the old ifupdown shell
scripts. When addon_scripts_support is set to 1, ifupdown2 will execute every
scripts present in /etc/network/if-$ACTION.d/ if a script exists with a name
identical to an ifupdown2 addon, this script won't be executed.

Sometimes an ifupdown2 addons doesn't have the same name as the ifupdown script
it's supposed to replace. Or maybe one addon is replacing several scripts.
For example: bond.py is replacing /etc/network/if-*.d/ifenslave

Now each addon is able to provide a list of script to ignore.

[16:54:40] root:ifupdown2 # ifquery bond0
iface bond0
      bond-slaves tap0 tap1

[16:54:49] root:ifupdown2 # ifreload -a -d &> /tmp/ifreload.log
[16:54:54] root:ifupdown2 # cat /tmp/ifreload.log | grep ifenslave
debug: tap1: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: tap1: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: lo: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: lo: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: eth0: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: eth0: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
debug: tap0: pre-up : running script /etc/network/if-pre-up.d/ifenslave
info: executing /etc/network/if-pre-up.d/ifenslave
debug: tap0: up : running script /etc/network/if-up.d/ifenslave
info: executing /etc/network/if-up.d/ifenslave
[16:54:55] root:ifupdown2 #
...
apply patch
...
[16:55:16] root:ifupdown2 # ifreload -a -d &> /tmp/ifreload.log
[16:55:18] root:ifupdown2 # cat /tmp/ifreload.log | grep ifenslave
[16:55:19] root:ifupdown2 #

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-09-27 11:10:26 +02:00
Roopa Prabhu
1a72dc5af5 ifupdown: move IFACE_CLASS ifupdownmain flag to ifupdownflags.CLASS
This patch moves ifupdownmain flag IFACE_CLASS to
ifupdownflags.CLASS. ifupdownflags.CLASS is set to true
if the user is asking for a class of interfaces.
example: ifreload --allow=mgmt

By moving it to ifupdownflags, we make it visible
to add modules.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-07 12:41:30 -07:00
Roopa Prabhu
b61913b50e addons: vlan: fix checking of vlan device in query-running
Ticket: CM-11804
Reviewed By: julien, nikhil
Testing Done: Tested with failing config in the bug

This patch makes sure macvlan devices are ignored by ifquery -ra

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-08-07 12:41:30 -07:00
Julien Fortin
2c592263a4 ifupdown: valivals keyword: remove <auto> and renaming <ipaddr> to <ip>
Ticket: None
Reviewed By: Daniel Walton
Testing Done:

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

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

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

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

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

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-08-01 09:28:16 +02:00
Roopa Prabhu
60dfcbdf9c ifupdown: fixes to make addon scripts work via special config options
ifupdown2 can invoke scripts under /etc/network/if-*.d/*
in the required order with the required environment variables.
This patch includes fixes to execute these scripts.

The following attributes in /etc/network/ifupdown2/ifupdown.conf
can influence the execution behaviour of python-addon modules
and /etc/network/if-*.d/*

<ifupdown.conf>
addon_syntax_check=0

addon_scripts_support=1

addon_python_modules_support=1
</ifupdown.conf>

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-07-13 15:39:06 -07:00
Roopa Prabhu
f27710fe96 ifupdown: disable template execution by default
User will have to enable it by enabling it in
/etc/network/ifupdown2.conf template_enable=1

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-07-13 15:39:06 -07:00
Roopa Prabhu
b54179d2ae addon: handle unsupported modules
Example: If /sbin/ethtool is not installed dont run the
ethtool addon module.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-07-13 15:39:06 -07:00
Julien Fortin
eb377c6ca2 addons may implement syntax_check method to perform specific syntax checks
and validation

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

The goal of this commit is to provide the addons a new way to perform their
own specific syntax checks. By implementing `syntax_check` method.

The addons will have to make sure the provided ifaceobj is valid.
e.g. vxlan.py:syntax_check(ifaceobj) should check:
self._is_vxlan_device(ifaceobj)

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-07-12 16:31:29 +01:00
Julien Fortin
55d9fae146 ifupdownmain: fixing too many argument for format string
Ticket: None
Reviewed By:
Testing Done:

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
2016-06-16 03:37:34 +01:00
Roopa Prabhu
4e07a2d530 ifreload: --currently-up fixes
Ticket:
Review: julien, nikhil
Testing: tested reloading currently up interfaces

simplify code:
interfaces-to-reload = saved-interfaces - interfaces-not-present-in-interfaces-file

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-16 17:00:39 -07:00
Roopa Prabhu
666c614171 ifupdownmain: return proper error code on syntax check errors
Ticket: CM-7168
Reviewed By: julien
Testing Done: Tested ifupdown2 negative testcases and ran ifupdown2 smoke

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-15 14:17:56 -07:00
Roopa Prabhu
d2b357167d addons: vrf: vrf_slave: up vrf dev only when all interfaces are being
brought up

Ticket: CM-10954, CM-10953
Reviewed By: julien
Testing Done: ran ifupdown2 smoke and vrf ifup/ifdown testing

- vrf master if not around is brought up when the first slave is brought up
by design (because we want the slaves to be
enslaved to a vrf master before addresses are configured).
and master is not brought up by first because interfaces
are brought up down to top in the dependency tree.

- This patch makes sure a slave brings up a vrf master only
when all interfaces are specified. When an individual interface
is brought up, skip master bring up and throw an error.

- Since the addon modules also need to use the ALL and WITH_DEPENDS
  flags, this patch moves them to the existing global ifupdownflags
  class

- vrf module uses the ifupdownflags.ALL flag to not bring up the master
when only the slave is being brought up

example:
ifup <vrf>     			# brings up the vrf device
ifup <vrf> --with-depends 	# brings up the vrf dev and
				# its slaves
ifup <vrf_slave>		# if vrf master is not around,
				# an error is thrown
ifup <vrf_slave> --with-depends # will still not bring up the vrf master

ifdown <vrf>			# deletes vrf dev and flushes the
				# addresses on vrf slaves
ifup <vrf>			# brings up vrf dev and does not
				# up the adresses on the slaves
ifup <vrf> --with-depends	# will bring up vrf and reapply config
				# on slaves (including addresses)

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-13 23:42:28 -07:00
Roopa Prabhu
f57b980458 ifupdownmain: cosmetic fixes to deprecated warning message
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-07 19:31:16 -07:00
Roopa Prabhu
7ef04d1b2e ifupdownmain: fix error check when an iface is removed but still exists as a dependency
Ticket: CM-8095
Reviewed By: julien, nikhil
Testing Done: Tested ifupdown2 sanity and unclean removal of interfaces from the
interfaces file

example: for the below interfaces file,
{noformat}
auto bond2
iface bond2 inet static
    address 100.0.0.2/16
    bond-slaves swp3 swp4

auto bridge
iface bridge
        bridge-vlan-aware yes
        bridge-ports swp1 swp2 bond2
        bridge-vids 12 505
        bridge-stp on

auto swp1
iface swp1
       mtu 9000

{noformat}

when iface sections for bond2 and swp1 are removed from the interfaces file
but left as dependents of bridge, on an ifreload:

prior to this patch:
===================
- ifreload would throw a warning for both bond2 and swp1
warning: bond2: misconfig ? removed but still exists as a dependency of
['bridge']
warning: swp1: misconfig ? removed but still exists as a dependency of
['bridge']

after the patch:
================
- ifreload  will now correctly throw a warning only for bond2
warning: bond2: misconfig ? removed but still exists as a dependency of
['bridge']

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-07 19:11:17 -07:00
Julien Fortin
24aa45e5a3 bridge: display warning when (in vlan unware bridge) an untagged bridge is not configured
Ticket: CM-8173
Reviewed By: Roopa
Testing Done: smoke + vlan aware and non-aware bridges with untagged bridge without untagged bridge.
2016-04-29 21:22:52 +02:00
Roopa Prabhu
8a360f1b98 ifreload: enable CACHE flag during up of interfaces
Ticket: CM-10273
Reviewed By: julien
Testing Done: Tested with scale config in the bug
2016-04-25 22:54:20 -07:00
Roopa Prabhu
634764bd88 ifquery: support for --with-defaults in the base output
Ticket: CM-7840
Reviewed By: julien, nikhil
Testing Done: Tested ifquery with and without --with-defaults option

commit "6e16e5ae90f2" introduced --with-defaults for ifquery --check
output. But the base ifquery --with-defaults should also include
the default policy attributes we support. This patch adds infrastructure
to query default attributes --with-defaults in base ifquery output.

example:
{noformat}
$ifquery br0
auto br0
iface br0 inet static
	bridge-ports swp1 swp2

$ifquery br0 --with-defaults
auto br0
iface br0 inet static
	bridge-ports swp1 swp2
	bridge-stp yes

{noformat}
2016-04-24 17:34:44 -07:00
Julien Fortin
ea9e3c0f15 addons: bridge: disabling ipv6 on bridge if any VXLAN port
Ticket: CM-7594
Reviewed By: Roopa
Testing Done: Creating a bridge with and without vxlan
2016-04-25 00:32:59 +02:00
Roopa Prabhu
c8a3b44e94 addons: vrf: fix check for max vrf dev count
Ticket: CM-10465
Reviewed By: julien, nikhil
Testing Done: Tested creating more than 64 vrf devices

example config:
{noformat}
%for v in range(1, 66):
auto vrf${v}
iface vrf${v}
        vrf-table auto
%endfor
{noformat}

also, since vrf module already does a link up on vrf dev, remove
link up of vrf dev from ifupdownmain scheduler callback
2016-04-23 23:21:50 -07:00
Nikhil
6e16e5ae90 addons,ifupdown,sbin: adding ifquery --with-defaults option
Ticket: CM-7840
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

This patch adds a new argument '--with-defaults' to 'ifquery'
when 'ifquery --with-defaults' is executed, running states of all interface
attributes are compared against respective configured attributes from
/etc/network/interfaces file, if configured. Otherwise, compared against
default attributes from policy file

This patch also: (1) fixes ifquery check failure for bridge-* stp attributes.
(2) removes vrf-default-route and vrf-cgroup attributes from ifupdown2 policy
and just have the vrf-helper attribute

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-04-22 12:01:51 -07:00
Roopa Prabhu
669b422add 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>

addons,ifupdown,sbin: adding ifquery --with-defaults option

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

This patch adds a new argument '--with-defaults' to 'ifquery'
when 'ifquery --with-defaults' is executed, running states of all interface
attributes are compared against respective configured attributes from
/etc/network/interfaces file, if configured. Otherwise, compared against
default attributes from policy file

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
2016-04-22 11:44:04 -07:00
Roopa Prabhu
4c56a7c1a7 ifupdown2: fix ifquery --list
Ticket:
Reviewed By: julien
Testing Done: Tested ifquery -l and checked that it is compatible with
ifupdown

ifquery list lists all matching interfaces. By default that is all auto
interfaces:
example:

{noformat}
$cat /etc/network/interfaces
auto lo
iface lo inet loopback

allow-mgmt eth0
iface eth0 inet dhcp
     vrf mgmt

allow-mgmt mgmt
iface mgmt
     address 127.0.0.1/8
     vrf-table auto

$ifquery  -l --allow=mgmt
eth0
mgmt

$ifquery -a -l
lo
{noformat}

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-04-21 12:51:35 -07: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
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
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
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
c47acd7902 ifupdownmain: Reverting commit 25f41c2ab3
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
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
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
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
2ddd65c587 ifupdownmain: squash multiple iface stanzas for the same interface by
default

Ticket:
Reviewed By: CCR-4268 (previous review)
Testing Done: Tested ifup/ifdown/ifreload/ifquery of multiple iface stanzas for
same interface

This patch is an extension to previous commit 99ce689411.
The previous commit squashes both external (ifquery) and internal
(ifup/ifdown/ifreload) representation of multiple iface stanzas into
one and it is off by default.

What we really want is internal representation to be squashed by
default. To that effect this patch introduces a new config flag
ifaceobj_squash_internal to only squash internal representation which is
used by ifup/ifdown/ifreload. ifquery forces this flag to off so that
external representations remain unsquashed and user does not see any
difference. This flag is on by default.

User can still get a squashed external representation if he sets
ifaceobj_squash=1 in ifupdown2.conf

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-16 18:50:06 -07:00
Roopa Prabhu
99ce689411 ifupdownmain: squash multiple iface stanzas for the same interface
Ticket:
Reviewed By: CCR-4268
Testing Done: Tested squashing of interfaces with multiple iface stanzas

This is controlled by ifaceobj_squash config variable in
/etc/network/ifupdown2/ifupdown2.conf.

With ifaceobj_squash=1, ifquery and all commands will
output squashed interfaces.

$cat /etc/network/interfaces
auto swp3
iface swp3
    mtu 9000

auto swp3
iface swp3 inet static
    address 10.0.17.3/24

auto swp3
iface swp3 inet static
    address 10.0.18.3/24
    address 2000:1000:1000:1000:3::5/128

$ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto swp3
iface swp3
        mtu 9000
        address 10.0.17.3/24
        address 10.0.18.3/24
        address 2000:1000:1000:1000:3::5/128

When and why do we need this ?
- If we preserve multiple ifaceobjects for the same iface,
it gets tricky in some cases to set default policy
values because the addon module run methods are called
on each ifaceobject.
- Each ifaceobject belonging to the same interface
is treated as a separate interface. It is difficult
to remember things accross addon module run methods
- we have a few hacks in place which we would like to
get rid of

Why not turn it on by default ?
- still debating about it. Dont want to break existing
scripts with change of output. Will get some feedback before
I switch the default to squash.
2016-03-09 13:20:51 -08:00
Roopa Prabhu
62f2caa46b ifreload: catch errors on dependency graph generation from saved state and proceed
We dont need to fail on saved state dependency graph generation errors.
Also dont check for shared dependents during dependency graph generation
on saved state (optimization)

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-03-08 08:20:19 -08:00
Roopa Prabhu
1553a88121 addons: bond: replace bond-ad-sys-priority and bond-ad-sys-mac-addr with equivalent upstream attributes
Ticket: CM-9677
Reviewed By: nikhil
Testing Done: Tested with bond config file in CM-9677

This patch replaces the following attributes:
bond-ad-sys-priority with bond-ad-actor-sys-prio
bond-ad-sys-mac-addr with bond-ad-actor-system

The new attributes correspond to the new sysfs files below:
/sys/class/net/sidelink/bonding/ad_actor_sys_prio
/sys/class/net/sidelink/bonding/ad_actor_system

Old values will be accepted with a deprecated warning:
warning: attribute bond-ad-sys-priority is deprecated. Use bond-ad-actor-sys-prio instead
warning: attribute bond-ad-sys-mac-addr is deprecated. Use bond-ad-actor-system instead
2016-03-03 16:44:33 -08:00
Roopa Prabhu
ccbeedcdf5 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.
2016-02-29 22:28:58 -08:00
Roopa Prabhu
768b4ec52f 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>
2016-02-26 15:42:42 -08:00
Roopa Prabhu
4cc2df04d1 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>
2016-02-26 15:41:43 -08:00
Roopa Prabhu
dbc018d39d 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.
2016-02-26 15:41:35 -08:00
Roopa Prabhu
1642c64bbd 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>
2015-12-20 23:06:17 -08:00
Roopa Prabhu
2d8b307bac 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)
2015-12-09 14:02:18 -05:00
Roopa Prabhu
cfa06db648 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)
2015-12-09 13:53:55 -05:00
Roopa Prabhu
307e06bb2c 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)
2015-12-09 13:53:30 -05:00
Roopa Prabhu
0582f185ed 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)
2015-12-09 13:53:20 -05:00
Roopa Prabhu
93b399fb8b Fix regression with ifreload when interface names change
Ticket: CM-8003
Reviewed By: CCR-3664
Testing Done: Tested renaming interfaces + ifreload
2015-10-27 13:02:21 -07:00
Roopa Prabhu
397214a54a 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
2015-10-20 14:30:53 -07:00
Sam Tannous
7444feea6d 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.
2015-10-20 13:49:07 -04:00