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

19 Commits

Author SHA1 Message Date
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
3d58f6afc1 networkinterfaces: fix is_keyword to not match attribute names with keywords in them
Ticket: CM-8729
Reviewed By: Nikhil
Testing Done: Tested with vlan device with vlan-raw-device in interfaces
file

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

is_keyword was matching iface attribute 'vlan-raw-device' to the vlan
keyword and dropping it from ifaceobj config.
2016-02-29 23:04:08 -08:00
Roopa Prabhu
385107439c networkinterfaces: dont fail if you don't find a sourced interfaces file
before this commit, an error in reading a sourced file would
result in an error. This commit converts it to a warning and continue

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2015-12-23 19:41:21 -08: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
Sam Tannous
c28fc55eb9 Fix stdin issues with missing config filename ifquery for disable_cli_interfacesfile
Ticket: CM-7066
Reviewed By: roopa
Testing Done: unit tested and wrote new testcase in testifupdown2

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

Testcase like:

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

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

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

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

(cherry picked from commit 4d37e932b43da87a9240a866be2d8b9508a9c7eb)
2015-10-10 07:33:07 -07:00
Sam Tannous
1e6d7bd76c add param in ifupdown2.conf to prevent fupdown2 users from specify interface config file on the CLI
Ticket: CM-7066
Reviewed By: scotte,roopa,olson
Testing Done: Unit testing and regression testing

This patch does two things:

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

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

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

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

This leaves the shell=True option in the user commands add-on module since the ifup/ifdown/ifreload/ifquery
commands already require root access to run and the interfaces config file also requires root access to modify.
2015-08-20 22:59:44 -04:00
Roopa Prabhu
9432c6717e Catch the interface long error during parsing
Ticket: CM-5882
Reviewed By:
Testing Done:
2015-07-08 21:08:43 -07: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
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
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
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
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
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
Roopa Prabhu
84ca006f82 First phase checkin for new format for vlan aware bridge
Ticket: CM-3346
Reviewed By:
Testing Done: Sanity test + test new bridge format

There are a bunch of open issues with `vlan` interface handling.
Below is the format.

auto swp1
iface swp1
    bridge-access 300
    mstpctl-pathcost 0
    mstpctl-adminedge yes
    mstpctl-autoedge yes
    mstpctl-p2p yes
    mstpctl-bpduguard yes
    mstpctl-treeprio 64
    mstpctl-network yes
    mstpctl-bpdufilter yes

auto swp2
iface swp2
    bridge-vids 301
    bridge-pvid 302
    bridge-pathcost 10
    bridge-priority 10
    bridge-multicast-router 0
    bridge-multicast-fast-leave 1

auto br0
iface br0
    bridge-vlan-aware yes
    bridge-stp on
    bridge-ports swp1 swp2
    bridge-vids 2001

auto br0.2001
iface br0.2001
    address 10.0.14.2
    hwaddress 00:03:00:00:00:12
    address-virtual 00:00:5e:00:01:01 11.0.4.1/24

auto br0.2001
vlan br0.2001
    bridge-igmp-querier-src 172.16.101.1
2014-10-24 10:11:07 -07:00
Roopa Prabhu
679e656768 more support and fixes to support new format for vlan filtering bridge
Ticket: CM-3346
Reviewed By:
Testing Done: Tested with old and new formats

Details of the format are attached to the bug.
2014-10-09 12:58:16 -07:00
Roopa Prabhu
904908bc5f Documentation cleanup
Ticket:
Reviewed By:
Testing Done:

- these changes are mainly related to api doc generation using sphinx
2014-07-22 11:15:56 -07:00