summaryrefslogtreecommitdiff
path: root/lib/plist.c
AgeCommit message (Collapse)Author
2017-02-01lib: plug leak in prefix_list_delete()David Lamparter
prefix_list_delete wasn't releasing chained trie entries, only the main one. Just call the proper trie_del. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-13frr: Remove HAVE_IPV6 from code baseDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-11-18lib: Fix `ipv6 access-list...` and `ipv6 prefix-list...`Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
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-07*: Consolidate all double VIEW_NODE and ENABLE_NODE'sDonald Sharp
If a command is put into the VIEW_NODE, it is going into the ENABLE_NODE as well. This is especially true for show commands. As such if a command is in both consolidate it down to VIEW_NODE. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-09-29Merge remote-tracking branch 'origin/cmaster' into cmaster-nextDonald Sharp
2016-09-30all: 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-28use JSON_C_TO_STRING_PRETTY for json_object_to_json_stringDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-27bgpd, etc: changed .LINE to LINE...Daniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23lib: lib compilesQuentin Young
Signed-off-by: Quentin Young <qlyoung@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-23ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebraDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23lib: argv update for filter.c, if_rmap.c keychain.c and plist.cDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-22Revert "lib: Fixup plist.c"Daniel Walton
This reverts commit c65a0fe1c664b5438a13aa1d756c121ff2fb7a80.
2016-09-20lib: Fixup plist.cDonald Sharp
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-12lib: apply mask to prefix in prefix-listDon Slice
A crash occurred if a prefix was defined in a prefix-list that contained bits in the prefix but a /0 mask. Resolving that crash and improving usability by applying the mask to the supplied prefix and notifying the user if the prefix was modified. Ticket: CM-12744 Signed-off-by: Don Slice Reviewed_By: Testing Done: Manual testing attached to the ticket, bgp-min, bgp-smoke ospf-min, and ospf-smoke all completed before commit
2016-09-03lib: add AF_ETHERNET/AFI_ETHERLou Berger
2016-06-06lib, bgpd: Fixup afi_t to be an enum and cleanup zebra.hDonald Sharp
This code change does two things: 1) Removes ZEBRA_AFI_XXX #defines since they were redundant information 2) Switches afi_t to an enumerated type so that the compiler can do a bit more compile time checking. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit f3cfc46450cccc5ac035a5a97c5a1a5484205705) Conflicts: bgpd/bgp_open.c bgpd/bgp_open.h bgpd/bgp_routemap.c
2016-05-26lib/plist: Add some required parentheses, according to clang-analyzerPaul Jakma
(cherry picked from commit 18f420e9f99e7f6557cf5877673cd6e71ac32192)
2016-04-04lib: plist should not CMD_WARNING when command has already been enteredDonald Sharp
When you startup zebra and apply a prefix list command, and then at a later point in time start up additional daemons and then attempt to apply the integrated-config, the prefix-list command will stop processing after zebra. This is because when zebra attempted to process the command, it would notice that it already had that cli handled and print a vty warning and then it would return CMD_WARNING. This caused the loop over all the commands to stop and as such the command would not be sent to all the individual daemons. This behavior is exactly the same as it is in the 2.5.X( hell it's upstream behavior to! ). Modify the plist command to return CMD_SUCCESS in this case. Ticket: CM-10248 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-03-02ip/ipv6 prefix-list seq number range needs to be fixed - wraps around toDaniel Walton
negative value Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-8023
2016-03-01lib: Fix crash when deleting multiple statementsDonald Sharp
When deciding if we should delete a table we were only looking at the part of the data structures associated with the table to see if it was empty. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-11-06Quagga crash in prefix_list_applyDaniel Walton
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-8130
2015-11-03lib: optimise prefix list setupDavid Lamparter
- duplicate prefix check can use the trie structure - appending with a seq# beyond the end of the list can shortcut Configuration load is now bottlenecked by cmd_element_match() and strcmp(). For a real-world routeserver prefix list configuration (38668 lines of config for multiple prefix lists): before: 4.73s after: 1.92s x 2.46 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2015-11-03lib: use trie structure for prefix list matchingDavid Lamparter
Prefix lists were implemented with a simple linear list that is scanned sequentially. This is, of course, extremely inefficient as it scales by O(n). This patch adds a trie-ish data structure that allows quickly descending based on the prefix. Note that the trie structure used here is designed for real-world use, hence it uses a relatively crude fixed-size bytewise table instead of some fancy balancing scheme. It is quite cacheline efficient. Using real-world routeserver prefix lists, matching against a fulltable dump: entries before after factor 9103 63.8s .0124s 5142x 772 4.52s .0101s 445.3x 86 .445s .0098s 45.51x 7 .0379s .0099s 3.834x 2 .0136s .0095s 1.440x 1 .0084s .0095s .879x This buys CPU with memory. Memory usage on an IXP setup with 100k prefix list entries is an additional 4 MB on top of the 9.5 MB that it was before.
2015-11-03lib: straighten out ORF prefix list supportDavid Lamparter
BGP ORF prefix lists are in a separate namespace; this was previously hooked up with a special-purpose AFI value. This is a little kludgy for extension, hence this splits it off. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2015-11-03lib: hide internal prefix list structuresDavid Lamparter
These are about to be touched and there's no point in other code touching into prefix list's internas. Add some isolation. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2015-08-12Added json formating support to show-...-neighbors-... bgp commands.Morgan Stewart
Ticket: CM-6789 Reviewed By: CCR-3263 Testing Done: Manual Testing and smoke tests Whenever some sort of output is encountered, added a json version with proper logic as well.
2015-05-19BGP: Add dynamic update group supportDonald Sharp
This patch implements the 'update-groups' functionality in BGP. This is a function that can significantly improve BGP performance for Update generation and resultant network convergence. BGP Updates are formed for "groups" of peers and then replicated and sent out to each peer rather than being formed for each peer. Thus major BGP operations related to outbound policy application, adj-out maintenance and actual Update packet formation are optimized. BGP update-groups dynamically groups peers together based on configuration as well as run-time criteria. Thus, it is more flexible than update-formation based on peer-groups, which relies on operator configuration. [Note that peer-group based update formation has been introduced into BGP by Cumulus but is currently intended only for specific releases.] From 11098af65b2b8f9535484703e7f40330a71cbae4 Mon Sep 17 00:00:00 2001 Subject: [PATCH] updgrp commits
2015-05-19bgpd: bgpd-event-driven-route-map-updates.patchDonald Sharp
BGP: Reprocess the trigger points when an attached route map changes Currently, modifications to route maps do not affect already processed routes; they only affect new route updates. This patch addresses this limitation. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2014-06-04*: nuke ^L (page feed)David Lamparter
Quagga sources have inherited a slew of Page Feed (^L, \xC) characters from ancient history. Among other things, these break patchwork's XML-RPC API because \xC is not a valid character in XML documents. Nuke them from high orbit. Patches can be adapted simply by: sed -e 's%^L%%' -i filename.patch (you can type page feeds in some environments with Ctrl-V Ctrl-L) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2009-06-12[cleanup] Make command nodes staticStephen Hemminger
The cmd_nodes used to configure vty, can mostly be static so (basic data hiding 101).
2008-08-22[warnings] Fix various SOS warningsPaul Jakma
2008-08-15 Paul Jakma <paul.jakma@sun.com> * */*: Fix various problems flagged by Sun Studio compiler. - '<qualifier> <storage>' obsolescent in declarations - empty statements (';' after ALIAS definitions) - implicit declarations (e.g printstack in lib/log.c) - "\%" in printf string instead of "%%" - loops that return on the first iteration (legitimately, but compiler can't really know), e.g. bgp_routemap.c - internal declarations which mask prototypes.
2006-05-12[lib] CID #3, fix forward-null errors in vty_prefix_list_uninstallPaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * plist.c: (vty_prefix_list_uninstall) Fix potential NULL deref of prefix and typestr strings, Coverity CID #3.
2005-09-292005-09-29 Alain Ritoux <alain.ritoux@6wind.com>vincent
* lib/filer.c: show protocol name in filter_show() * lib/plist.c: show protocol name in vty_show_prefix_entry() * routemap.c: show protocol name in vty_show_route_map_entry() * lib/vty.c: in vty_command(), show protocol name if command unknown * zebra/zserv.c: Always provide distance fo route add * ripd/rip_snmp.c: rip2IfConfReceive() sends values in conformance with RFC. Also PeerDomain is now set to a STRING type. * ripd/ripd.h: rip_redistribute_add() API includes metric and distance * ripd/ripd.c: rip_redistribute_add() API i.e. stores metric and distance Now allows a RIP-route to overcome a redistributed route coming from a protocol with worse (higher) administrative distance Metrics from redistribution are shown in show ip rip * ripd/rip_zebra.c: adapt to the rip_redistribute_add() API, i.e. provide distance and metric * ripd/rip_interface.c: adapt to the rip_redistribute_add() API * ripd/rip_routemap.c: no RMAP_COMPILE_ERROR on (metric > 16) usage rather a CMD_WARNING, because set metric ius shared with other protocols using larger values (such as OSPF) The match metric action takes first external metric if present (from redistribution) then RIP metric.
2005-05-062005-05-06 Paul Jakma <paul@dishone.st>paul
* (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
2005-01-292005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* buffer.h: Fix comment on buffer_getstr to reflect that it now uses XMALLOC. * buffer.c: (buffer_getstr) Use XMALLOC(MTYPE_TMP) instead of malloc. * filter.c: (access_list_remark,ipv6_access_list_remark) Use argv_concat instead of buffer_getstr. * if.c: (interface_desc) Use argv_concat instead of buffer_getstr. * plist.c: (ip_prefix_list_description,ipv6_prefix_list_description) Use argv_concat instead of buffer_getstr. * bgp_filter.c: (ip_as_path,no_ip_as_path) Use argv_concat instead of buffer_getstr. * bgp_route.c: (bgp_show_regexp) Fix memory leak: need to free string returned by buffer_getstr. (bgp_show_community) Must use XFREE instead of free on string returned by buffer_getstr. * bgp_routemap.c: (set_community) Must use XFREE instead of free on string returned by buffer_getstr. * bgp_vty.c: (neighbor_description) Use argv_concat instead of buffer_getstr.
2004-10-102004-10-10 Paul Jakma <paul@dishone.st>paul
* version.h.in: (pid_output*) add const qualifier. * command.h: Change DEFUN func to take const char *[] rather than char **, to begin process of fixing compile warnings in lib/. Nearly all other changes in this commit follow from this change. * buffer.{c,h}: (buffer_write) pointer-arithmetic is gccism, take const void * and cast an automatic const char *p to it. (buffer_putstr) add const * command.c: (zencrypt) const qualifier (cmd_execute_command_real) ditto (cmd_execute_command_strict) ditto (config_log_file) ditto. Fix leak of getcwd() returned string. * memory.{c,h}: Add MTYPE_DISTRIBUTE_IFNAME for struct dist ifname. * distribute.{c,h}: Update with const qualifier. (distribute_free) use MTYPE_DISTRIBUTE_IFNAME (distribute_lookup) Cast to char *, note that it's ok. (distribute_hash_alloc) use MTYPE_DISTRIBUTE_IFNAME. (distribute_get) Cast to char *, note that it's ok. * filter.c: Update with const qualifier. * if.{c,h}: ditto. * if_rmap.{c,h}: ditto. (if_rmap_lookup) Cast to char *, note that it's ok. (if_rmap_get) ditto. * log.{c,h}: Update with const qualifier. * plist.{c,h}: ditto. * routemap.{c,h}: ditto. * smux.{c,h}: ditto. Fix some signed/unsigned comparisons. * sockopt.c: (getsockopt_cmsg_data) add return for error case. * vty.c: Update with const qualifier.
2004-10-05Number of warnings is down to 3 again in lib directory. A lot of const'shasso
added to strings and a lot of int -> unsigned int changes.
2004-06-112004-06-11 Sowmini Varadhan <sowmini.varadhan@sun.com>paul
* filter.c: (access_list_remark_cmd) buffer_putstr doesnt need cast to u_char. (ipv6_access_list_remark_cmd) ditto. if.c: ditto * network.c: (readn/writen) pointer arg should be type u_char. * plist.c: needs to include stream.h, not declare stream functions internally. (various) Add static qualifier to internal functions. (prefix_list_type_str) extraneous breaks in switch statement. (ip_prefix_list_description_cmd) buffer_putstr doesnt need cast * stream.h: depends on plist.h and export stream_put_prefix * vty.c: (vty_<telnet option build functions>) should use unsigned char, telnet options are 0 -> 255. * zclient.c: various u_char<->char type cleanups. * zebra.h: Having to define CMSG_* can apply to more than just BSDI_NRL. * ripd.c: (rip_distribute_update_all) distribute list hook function pointer prototype requires struct prefix_list * arg. (rip_distribute_update_all_wrapper) update to pass required arg, NULL.
2002-12-13Initial revisionpaul