summaryrefslogtreecommitdiff
path: root/lib/if.c
AgeCommit message (Collapse)Author
2017-06-29*: use vty_outlnQuentin Young
Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29bgpd, lib, zebra: Fix if_update function to represent what it doesDonald Sharp
The if_update function was taking the interface name as input and reapplying it, using strncpy to reapply the name. This has several issues. strncpy should not be used to copy memory in place. The second issue is that the interface name is not actually changing when we update interface to be in the new vrf. Since every usage of if_update was just reapplying the same name the interface actually had, just remove that part of the function and rename it to if_update_to_new_vrf to represent what it is actually doing. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15lib: cli: autocomplete variablesDavid Lamparter
Shows known values in the appropriate naming domain when the user hits <?> or <Tab>. This patch only works in the telnet CLI, the next patch adds vtysh support. Included completions: - interface names - route-map names - prefix-list names Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-15bgpd, lib, zebra: Rename if_update_vrf -> if_updateDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15bgpd, lib, zebra: Refactor ifname2ifindex to be VRF awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15*: Refactor ifindex2ifname to be VRF awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15lib: Refactor if_get_by_name_len to be VRF awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15*: Refactor if_get_by_name to be VRF awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15*: Refactor if_lookup_by_name to be VRF awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15lib, ospf6d: Refactor if_lookup_prefixDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15lib, ospfd: Refactor if_lookup_by_name_lenDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15lib, ospfd, ripd: Convert if_lookup_address to be vrf awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15lib, pimd, zebra: Convert if_lookup_exact_address to VRF onlyDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15lib, ospfd, pimd: Convert to using VRF based interface creationDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15*: Remove non-vrf based ifindex lookupDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-08*: get rid of zlog(*, LOG_LEVEL, ...)David Lamparter
Result of running the following Coccinelle patch + fixups: <<EOF /* long-forms: zlog(NULL, <level>, ...) * => zlog_level(...) */ @@ expression list args; @@ - zlog(NULL, LOG_DEBUG, args) + zlog_debug(args) @@ expression list args; @@ - zlog(NULL, LOG_NOTICE, args) + zlog_notice(args) @@ expression list args; @@ - zlog(NULL, LOG_INFO, args) + zlog_info(args) @@ expression list args; @@ - zlog(NULL, LOG_WARNING, args) + zlog_warn(args) @@ expression list args; @@ - zlog(NULL, LOG_ERR, args) + zlog_err(args) /* long-forms: zlog(base->log, <level>, ...) * => zlog_level(...) */ @@ expression base; expression list args; @@ - zlog(base->log, LOG_DEBUG, args) + zlog_debug(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_NOTICE, args) + zlog_notice(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_INFO, args) + zlog_info(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_WARNING, args) + zlog_warn(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_ERR, args) + zlog_err(args) EOF Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-01lib: Treat v6 address as a v6 addressDonald Sharp
The code was making the correct assumption that the v4 and v6 addresses start in the same spot in memory and since we were looking at a v6 prefix it would just work. This causes distress in SA systems, so let's just make it happy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-13frr: Remove HAVE_IPV6 from code baseDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-05Rationalize Link Parameters flagsOlivier Dugeon
* lib/if.h: Remove LP_TE as Link Parameters is set if different from 0 See IS_LINK_PARAMS_SET macro and use LP_TE_METRIC to determine if TE metric is set or not * lib/if.c: replace LP_TE by LP_TE_METRIC in default LP status * zebra/interface.c: replace LP_TE by LP_TE_METRIC and check if TE metric is equal to standard metric or not * ospfd/ospf_te.c: replace LP_TE by LP_TE_METRIC * isisd/isis_te.c: replace LP_TE by LP_TE_METRIC Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2016-12-09lib: remove vty->indexDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-05*: fix up DEFUNs without install_element callsDavid Lamparter
These now generate warnings which will break the build with -Werror. Note this may have enabled commands that should be disabled, or the other way around... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-05Merge branch 'queue/osr/vtysh-generic'David Lamparter
WARNING: Merge contains nontrivial fixups in vrf_cmd handling. Conflicts: lib/if.c zebra/interface.c
2016-12-05Merge branch 'stable/2.0'David Lamparter
Conflicts: bgpd/bgp_route.c lib/if.c ripd/rip_interface.c zebra/interface.c zebra/zebra_vty.c
2016-12-05Merge branch '-rip' into stable/2.0David Lamparter
This fixes up a lot of RIP/RIPng compliance tests that were still flagged up. Tested-by: Martin Winter <mwinter@opensourcerouting.org>
2016-12-05Merge branch '-renato' into stable/2.0David Lamparter
This contains bgp memory leak fixes as well as cleanups to VRF/namespace handling and has been run through extended testing in Cumulus' testbed: Tested-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-05lib, zebra: Minimize display of link-params sub dataDonald Sharp
When link-params is configured it auto starts displaying 6000-02# conf t dell-s6000-02(config)# int swp1 dell-s6000-02(config-if)# link-params dell-s6000-02(config-link-params)# admin-grp 0x12345678 dell-s6000-02(config-link-params)# end dell-s6000-02# show run interface swp1 link-params enable metric 0 <----Remove the bw lines max-bw 1.25e+06 max-rsv-bw 1.25e+06 unrsv-bw 0 1.25e+06 unrsv-bw 1 1.25e+06 unrsv-bw 2 1.25e+06 unrsv-bw 3 1.25e+06 unrsv-bw 4 1.25e+06 unrsv-bw 5 1.25e+06 unrsv-bw 6 1.25e+06 unrsv-bw 7 1.25e+06 admin-grp 305419896 exit-link-params ! I'd like to reduce this to: interface enp0s3 ip igmp ip pim sm link-params enable admin-grp 0x12345678 <----- Fix this to be what we entered exit-link-params ! Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01*: make DEFUN installations file-localDavid Lamparter
This moves all install_element calls into the file where the DEFUNs are located. This fixes several small related bugs: - ospf6d wasn't installing a "no interface FOO" command - zebra had a useless copy of "interface FOO" - pimd's copy of "interface FOO" was not setting qobj_index, which means "description LINE" commands would fail with an error The next commit will do the actual act of making "foo_cmd" static. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28zebra: order VRFs by name on user outputRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28lib: convert vrf code to use red-black trees as wellRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28zebra/lib: move some code aroundRenato Westphal
* move netlink code from zebra_nc.c to kernel_netlink.c; * move vrf CLI commands from if.c/interface.c to vrf.c/zebra_vrf.c; * move declaration of the 'ns' structure to a header file. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28Merge branch 'vtysh-grammar'David Lamparter
Conflicts: isisd/isisd.c lib/Makefile.am lib/thread.c Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-25ripd: fix the "neighbor" command.Renato Westphal
We can't use if_lookup_prefix() in rip_update_process() because this function uses prefix_cmp() internally to try matching an interface address to a static neighbor's address. Since prefix_cmp() tries to match exact prefixes, if_lookup_prefix() was always returning NULL. What we really need here is to use prefix_match(), which checks if one prefix includes the other (e.g. one /24 interface including a /32 static neighbor's address). The fix then is to replace the call to if_lookup_prefix() and use if_lookup_address() instead, which uses prefix_match() internally. Fixes IxANVL RIP test 17.1 Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-15lib: replace strlcpy & strlcat with glibc versionsDavid Lamparter
It seems these two were at some point copied in from rsync; replace with more recent versions that will hopefully become available in glibc as well. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-15build: massively remove needless checksDavid Lamparter
Since we have autoconf results from a wide swath of target platforms, we can go remove checks that have the same result on all systems. This also removes several "fallback" implementations of functions that, at some point in the history, weren't available on all target platforms. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-10-17Merge branch 'cmaster-next' into vtysh-grammarQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: bgpd/bgp_route.c bgpd/bgp_routemap.c bgpd/bgp_vty.c isisd/isis_redist.c isisd/isis_routemap.c isisd/isis_vty.c isisd/isisd.c lib/command.c lib/distribute.c lib/if.c lib/keychain.c lib/routemap.c lib/routemap.h ospf6d/ospf6_asbr.c ospf6d/ospf6_interface.c ospf6d/ospf6_neighbor.c ospf6d/ospf6_top.c ospf6d/ospf6_zebra.c ospf6d/ospf6d.c ospfd/ospf_routemap.c ospfd/ospf_vty.c ripd/rip_routemap.c ripngd/ripng_routemap.c vtysh/extract.pl.in vtysh/vtysh.c zebra/interface.c zebra/irdp_interface.c zebra/rt_netlink.c zebra/rtadv.c zebra/test_main.c zebra/zebra_routemap.c zebra/zebra_vty.c
2016-10-07lib: use qobj for vty->index context positionDavid Lamparter
Prepares the library CLI functions for concurrent config access. Note the vty->index pointer is still kept functional for the daemons to use. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-10-07lib: qobj: register ifaces, routemaps & keychainsDavid Lamparter
This places the appropriate calls so library objects can be used with qobj "pointers", especially in the CLI. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-09-30all: scrubbed some argc CHECK MEsDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29all: scrubbed some argc CHECK MEsDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29all: added CHECK ME for DEFUNs that look at argcDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25Expand #defines in command stringsDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25Expand #defines in command stringsDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23lib: add 'int idx_foo' argv index variablesDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23convert <1-255> to (1-255), ()s to <>s, etcDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-22lib: argv update for if.cQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-22Revert "lib, zebra: Fixup if.c to work in the new regime"Daniel Walton
This reverts commit 2511cb40e6b0e88620f26b3506b2a454a773c93d.
2016-09-20lib, zebra: Fixup if.c to work in the new regimeDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-09-19*: split & distribute memtypes and stop (re|ab)using lib/ MTYPEsDavid Lamparter
This is a rather large mechanical commit that splits up the memory types defined in lib/memtypes.c and distributes them into *_memory.[ch] files in the individual daemons. The zebra change is slightly annoying because there is no nice place to put the #include "zebra_memory.h" statement. bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the library for its own use. This is bad practice and would break when the memtype are made static. Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> [CF: rebased for cmaster-next] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-03Update Traffic Engineering Support for OSPFDOlivier Dugeon
NOTE: I am squashing several commits together because they do not independently compile and we need this ability to do any type of sane testing on the patches. Since this series builds together I am doing this. -DBS This new structure is the basis to get new link parameters for Traffic Engineering from Zebra/interface layer to OSPFD and ISISD for the support of Traffic Engineering * lib/if.[c,h]: link parameters struture and get/set functions * lib/command.[c,h]: creation of a new link-node * lib/zclient.[c,h]: modification to the ZBUS message to convey the link parameters structure * lib/zebra.h: New ZBUS message Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support for IEEE 754 format * lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to safely convert between big-endian IEEE-754 single and double binary format, as used in IETF RFCs, and C99. Implementation depends on host using __STDC_IEC_559__, which should be everything we care about. Should correctly error out otherwise. * lib/network.[c,h]: Add ntohf and htonf converter * lib/memtypes.c: Add new memeory type for Traffic Engineering support Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add link parameters support to Zebra * zebra/interface.c: - Add new link-params CLI commands - Add new functions to set/get link parameters for interface * zebra/redistribute.[c,h]: Add new function to propagate link parameters to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering. * zebra/redistribute_null.c: Add new function zebra_interface_parameters_update() * zebra/zserv.[c,h]: Add new functions to send link parameters Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support of new link-params CLI to vtysh In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue to use the ordered version for adding line i.e. config_add_line_uniq() to print Interface CLI commands as it completely break the new LINK_PARAMS_NODE. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Update Traffic Engineering support for OSPFD These patches update original code to RFC3630 (OSPF-TE) and add support of RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support of RFC6827 (ASON - GMPLS). * ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering * ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392 * ospfd/ospf_packet.c: Update checking of OSPF_OPTION * ospfd/ospf_vty.[c,h]: Update ospf_str2area_id * ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get Link Parameters information from the interface to populate Traffic Engineering metrics * ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN) * ospfd/ospf_te.[c,h]: Major modifications to update the code to new link parameters structure and new RFCs Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> tmp