summaryrefslogtreecommitdiff
path: root/lib/plist.c
AgeCommit message (Collapse)Author
2020-02-04*: remove null check before XFREEQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-03*: don't null after XFREE; XFREE does this itselfQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-12-03lib: fix heap buf overflow when adding prefix orfQuentin Young
Don't lose your way Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-08-06*: fix ctype (isalpha & co.) castsDavid Lamparter
The correct cast for these is (unsigned char), because "char" could be signed and thus have some negative value. isalpha & co. expect an int arg that is positive, i.e. 0-255. So we need to cast to (unsigned char) when calling any of these. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-20lib: Keep proper count of prefix-list hit-count when usedVisakha Erina
When a prefix-list is applied to a BGP neighbor to deny the learning of specific routes, the hit count is showing 0 for BGP even though the routes are being filtered correctly due to the configured prefix-list. Before fix: c1# show ip prefix-list nag seq 10 ZEBRA: seq 10 permit any (hit count: 0, refcount: 0) BGP: seq 10 permit any (hit count: 0, refcount: 0) c1# show ip prefix-list nag seq 5 ZEBRA: seq 5 deny 1.0.1.0/24 (hit count: 0, refcount: 0) BGP: seq 5 deny 1.0.1.0/24 (hit count: 0, refcount: 0) Fix: Increment the prefix-list's hit count whenever a rule match occurs. After Fix: c1# show ip prefix-list nag seq 10 ZEBRA: seq 10 permit any (hit count: 0, refcount: 0) BGP: seq 10 permit any (hit count: 6, refcount: 0) c1# show ip prefix-list nag seq 5 ZEBRA: seq 5 deny 1.0.1.0/24 (hit count: 0, refcount: 0) BGP: seq 5 deny 1.0.1.0/24 (hit count: 1, refcount: 0) Signed-off-by: Visakha Erina visakha.erina@broadcom.com
2019-06-07lib, pimd, sharpd: Various output string cleanupsDonald Sharp
Various compilers in our CI system were complaining about various auto-conversions. Let's get these cleaned up a bit more. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-25plist: Delete prefix-list by sequence numberDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-02-25*: remove null check before XFREEQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-01-24Treewide: use ANSI function definitionsRuben Kerkhof
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2018-09-13bgpd lib ospf6d pbrd tests zebra: shadowing fixesF. Aragon
This fixes all remaining local variable shadowing cases Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-06*: style for flog_warn conversionsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06lib: Modify zlog_warn to vty_outDonald Sharp
The vty_prefix_list_install function was modifying the prefix to match the specified prefix length and warning in the log file. Modify code to use zlog_info as that a warn implies that something has gone terribly wrong. Additionally display to the terminal as well so that user can get immediate feedback from something that they can correct. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-01Merge pull request #2945 from dslicenc/bgp-ospf-jsonDavid Lamparter
bgpd/ospfd: make bgp and ospf json response a bit more consistent
2018-08-31plist: Add safety check to avoid going over 4294967295 for prefix-listDonatas Abraitis
2018-08-30bgpd/ospfd: make bgp and ospf json response a bit more consistentDon Slice
Problem reported that some bgp and ospf json commands did not return any json output at all if the bgp/ospf instance did not exist. Additionally, some bgp and ospf json commands did not return any json output if the instance existed but no neighbors were defined. This fix makes these commands more consistent in returning empty braces for json output and issue a message if not using json output. Additionally, made the flag "use_json" a bool to make it consistent since previously, it had been defined as an int, char, u_char, and bool at various places. Ticket: CM-21040 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-07-23libs, daemons: use const in route-map applyMark Stapp
Use 'const prefix *' in route-map apply apis; led to some corresponding changes in several daemons. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-06-21ldpd lib: null check (Coverity 1452287 + 20 alike)paco
Coverity issues fixed with this commit: 1452287 1452291 1452307 1452310 1452317 1452321 1452327 1452330 1452331 1452336 1452337 1452340 1452352 1452354 1452358 (originated at ldpd/ldpd_vty_cmds_clippy.c) 1448388 1448390 1448392 1448397 1448404 1448408 (originated at lib/plist_clippy.c) Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-13lib: out-of-bounds access (Coverity 1457145)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-04-29lib: Convert internal sequence number to int64_tDonald Sharp
With the usage of a 32 bit number as a integer, but storing non-signed values in it, we have cases where numbers greater than 2 billion are being read in and stored and used before lower value numbers, which of course is awful and mean. Fixes: #2126 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-29lib: convert plist data structures to using a boolDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2017-12-04*: make clippy usage more consistentRenato Westphal
Fixes #1511. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-11-28lib: Fix prefix-list where le is == prefixlenDonald Sharp
This should be allowed: robot(config)# ip prefix-list outbound_asp_routes seq 33 permit 1.1.1.0/24 le 24 % Invalid prefix range for 1.1.1.0/24, make sure: len < ge-value <= le-value This commit fixes the issue: robot(config)# ip prefix-list outbound_asp_routes seq 33 permit 1.1.1.0/24 le 23 % Invalid prefix range for 1.1.1.0/24, make sure: len < ge-value <= le-value robot(config)# ip prefix-list outbound_asp_routes seq 33 permit 1.1.1.0/24 le 24 robot(config)# ip prefix-list outbound_asp_routes seq 33 permit 1.1.1.0/24 le 25 robot(config)# Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-07lib: Only apply prefix's to the same familyDonald Sharp
When we have a v4 or v6 prefix list, only apply it via a match when the address families are the same. Fixes: #1339 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-31lib: Modify prefix_list_apply to allow retrieval of prefixDonald Sharp
Create a new function prefix_list_apply_which_prefix which will return a pointer to the matching prefix that caused the acceptance/denial. This change will be used in future commits. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24ospf6d: properly update prefix list referencesDavid Lamparter
Register add/delete hooks with the prefix list code to properly change ospf6_area's prefix list in/out pointers. There are 2 other uncached uses of prefix lists in the ASBR route-map code and the interface code; these should probably be cached too. (To be fixed another day...) Fixes: #453 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-11lib: fix prefix list trie corruptionDavid Lamparter
The specific code here needs to establish an absolute order of more specific to less specific possible matches in a prefix list. This is indirectly checked by an assert on insertion, because the "next best" entry is required to be consistent even when joining multiple chains of candidates. Unfortunately, trie_install_fn() would insert entries too far ahead in the chain if another entry with higher sequence number was seen. This breaks the trie and (rightfully) triggers the assertion failure on insert. Fixes: #937 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22Revert "*: reindent pt. 2"David Lamparter
This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17*: reindent pt. 2whitespace / reindent
w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14Merge remote-tracking branch 'frr/master' into newline-reduxDavid Lamparter
Lots of conflicts from CMD_WARNING_CONFIG_FAILED... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 2 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 1 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13vtysh: return non-zero for configuration failuresDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> This allows frr-reload.py (or anything else that scripts via vtysh) to know if the vtysh command worked or hit an error.
2017-07-13*: ditch vty_outln(), part 1 of 2David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-05*: fix excess docstringQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: vty_outln (vty, "") --> vty_out (vty, VTYNL)Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: s/VTY_NEWLINE/VTYNL/gQuentin Young
Should be able to fit more vty_out onto one line now Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: use vty_outlnQuentin Young
Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-14lib: use DEFPY() for plist.cDavid Lamparter
Shorten lib/plist.c by combining the various command variants... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18lib: detangle protocol name/instance from loggingDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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-08lib: hide away logging internalsDavid Lamparter
... no need to have struct zlog generally-exposed. A few files get to include log_int.h because they use zlog/vzlog. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08lib: simplify protocol/log namingDavid Lamparter
The protocols enum serves no purpose other than adding potential for bugs and making it complicated to add a new protocol... nuke. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-02lib: add stream.h, vty.h, zebra.h to plist.hQuentin Young
Since `afi_t` and `struct vty` are used in plist.h, the appropriate headers for them should be included. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-02-14lib: replace AFI_ETHER reference with AFI_L2VPNPhilippe Guibert
The introduction of AFI_L2VPN prefix makes usage of AFI_ETHER deprecated and is of no usage currently. The latter define is linked to AFI_L2VPN. For that, the prefix enumerate has the AFI_ETHER value removed. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-08lib: fix some coverity NULL check warningsDavid Lamparter
Reported-by: Coverity Scan Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-02Merge remote-tracking branch 'origin/stable/2.0'Donald Sharp