summaryrefslogtreecommitdiffstats
path: root/lib/if_rmap.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib: hashing functions should take const argumentsQuentin Young2019-05-141-1/+1
| | | | | | | | | | It doesn't make much sense for a hash function to modify its argument, so const the hash input. BGP does it in a couple places, those cast away the const. Not great but not any worse than it was. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ripd: unlink if-rmap container from global list before removing itRenato Westphal2019-04-191-0/+1
| | | | | | | | | | | | | This solves a crash that happens if the "route-map" command is used after "router rip" + "no router rip" + "router rip". Once interface route-maps are converted to the new northbound model, we'll be able to remove the if_rmap_ctx_list global list (which is an ugly hack to make things work right now). Bug found by the CLI fuzzer. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: reduce exported var symbolsQuentin Young2019-04-031-1/+1
| | | | | | Don't need these in our DSO tables Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge pull request #3869 from qlyoung/cocci-fixesDavid Lamparter2019-03-061-16/+7
|\ | | | | Assorted Coccinelle fixes
| * *: remove null check before XFREEQuentin Young2019-02-261-16/+7
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | Merge pull request #3606 from pguibert6WIND/if_rmap_containerDonald Sharp2019-03-011-29/+66
|\ \ | |/ |/| lib, rip, ripng, eigrp: rework if_rmap context
| * eigrp, rip, ripng, lib: unlink if_rmap from vrfPhilippe Guibert2019-02-191-2/+8
| | | | | | | | | | | | | | | | | | an interface rmap context can be created from a custom name string, instead of a vrf. This ability permits to handle several instances of interface route map in the same vrf. The naming convention will be transparent on what the name is for in the daemon code. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
| * lib, rip, ripng, eigrp: rework if_rmap contextPhilippe Guibert2019-02-191-29/+60
| | | | | | | | | | | | | | | | | | | | so as to handle ri/ripng/eigrp multiple instances, the need is to encapsulate if_rmap hash table into a container context self to each instance. This work then reviews the if_rmap api, mainly by adding a if_rmap_ctx context, that is passed for each exchange between library and the daemon. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | *: Rename backet to bucketTim Bray2019-02-251-1/+1
|/ | | | | | Presume typo from original author Signed-off-by: Tim Bray <tim@kooky.org>
* Treewide: use ANSI function definitionsRuben Kerkhof2019-01-241-1/+1
| | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* *: Replace hash_cmp function return value to a boolDonald Sharp2018-10-191-1/+1
| | | | | | | | | The ->hash_cmp and linked list ->cmp functions were sometimes being used interchangeably and this really is not a good thing. So let's modify the hash_cmp function pointer to return a boolean and convert everything to use the new syntax. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-3/+1
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* lib: Hash creation cleanupDonald Sharp2017-09-051-1/+4
| | | | | | | | | | | | | | | 1) Some hash key functions where converting pointers directly to a 32 bit value via downcasting. Pointers are 64 bit on a majority of our platforms. 2) Some hashes were being created with 256 entries, downsize the hash creation size to more appropriate values. 3) Add hash names to hash creation so we can watch the hash via 'show debugging hashtable' Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-210/+188
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge remote-tracking branch 'frr/master' into newline-reduxDavid Lamparter2017-07-141-3/+3
|\ | | | | | | | | | | Lots of conflicts from CMD_WARNING_CONFIG_FAILED... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * vtysh: return non-zero for configuration failuresDaniel Walton2017-07-131-3/+3
| | | | | | | | | | | | | | 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.
* | *: ditch vty_outln(), part 1 of 2David Lamparter2017-07-131-5/+5
|/ | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: update hash_create(), hash_create_size()Quentin Young2017-07-021-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use vty_outlnQuentin Young2017-06-291-9/+7
| | | | | | Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | 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>
* lib: lib compilesQuentin Young2016-09-231-24/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: add 'int idx_foo' argv index variablesDaniel Walton2016-09-231-8/+14
| | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* convert <1-255> to (1-255), ()s to <>s, etcDaniel Walton2016-09-231-2/+2
| | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebraDaniel Walton2016-09-231-19/+21
| | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* lib: argv update for filter.c, if_rmap.c keychain.c and plist.cDaniel Walton2016-09-231-6/+6
| | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* Revert "lib: Fixup more files"Daniel Walton2016-09-221-6/+6
| | | | This reverts commit f68cec764abf50b35945b907a2e005bc50c50831.
* lib: Fixup more filesDonald Sharp2016-09-211-6/+6
|
* *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEsDavid Lamparter2016-09-191-0/+3
| | | | | | | | | | | | | | | | | | | 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>
* lib: Fixup of NULL calls to XSTRDUPDonald Sharp2015-11-231-3/+6
| | | | | | | | | | | There are a few situations where XSTRDUP can be called with a NULL This fix makes this impossible to happen Ticket: CM-8039 Reviewed-by: CCR-3849 Testing: Rip no longer crashes Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: lib-warnings.patchDonald Sharp2015-05-201-4/+10
| | | | | | Remove compile warnings for the lib directory Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by:
* *: nuke ^L (page feed)David Lamparter2014-06-041-3/+3
| | | | | | | | | | | | | | 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>
* fix set never used warningsStephen Hemminger2011-12-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (This patch was modified to leave calls to stream_getl() in place, they are necessary for the stream's internal pointer to advance to the correct position. -- Denis) Signed-off-by: Denis Ovsienko <infrastation@yandex.ru> Fix gcc warnings about varables that are set but never used. * bgpd/bgp_attr.c * cluster_unintern(): ret * transit_unintern(): ret * bgp_attr_default_intern(): attre * bgp_mp_reach_parse(): rd_high, rd_low * bgpd/bgp_route.c * bgp_announce_check_rsclient(): bgp * bgpd/bgp_zebra.c * zebra_read_ipv4(): ifindex * zebra_read_ipv6(): ifindex * bgpd/bgpd.c * bgp_config_write_peer(): filter * lib/distribute.c * distribute_list_all(): dist * distribute_list(): dist * distribute_list_prefix_all(): dist * distribute_list_prefix(): dist * lib/if_rmap.c * if_rmap(): if_rmap * lib/vty.c * vty_accept(): vty * lib/zclient.c * zclient_read(): ret * zebra/irdp_interface.c * if_group(): zi * zebra/rt_netlink.c * kernel_read(): ret, sock
* lib: Better hashing of string values using Bernstein hashStephen Hemminger2011-03-211-7/+2
| | | | | | | | | * hash.{h,c}: (string_hash_make) Hash optimised for strings, current implementation using Bernstein hash, which offers a good compromise between distribution and performance. * distribute.c: (distribute_hash_make) use previous instead of additive string hash. * if_rmap.c: (if_rmap_hash_make) ditto
* [lib] hash compare function arguments ought to be const qualifiedStephen Hemminger2008-08-221-6/+5
| | | | | | | | | | | | 2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com> * lib/hash.h: (struct hash) Hash comparator callback really ought to treat storage behind arguments as constant - a compare function with side-effects would be evil. * */*.c: Adjust comparator functions similarly, thus fixing at least a few compiler warnings about const qualifier being dropped. Signed-off-by: Paul Jakma <paul@quagga.net>
* 2005-10-26 Paul Jakma <paul.jakma@sun.com>paul2005-10-261-10/+12
| | | | | | | | | | * (general) Cleanup a some calls to XFREE,strdup, etc. to use the memory.h macros. * memtypes.c: Add MTYPE_IF_RMAP_NAME, MTYPE_PQUEUE, MTYPE_PQUEUE_DATA and MTYPE_HOST. * memtypes.h: update auto-built file. * if_rmap.c: Use MTYPE_IF_RMAP_NAME. * pqueue.c: Use the two MTYPE_PQUEUE mtypes for allocations.
* 2005-05-06 Paul Jakma <paul@dishone.st>paul2005-05-061-15/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | * (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
* 2004-10-10 Paul Jakma <paul@dishone.st>paul2004-10-101-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Number of warnings is down to 3 again in lib directory. A lot of const'shasso2004-10-051-3/+2
| | | | added to strings and a lot of int -> unsigned int changes.
* RIP has now "route-map x [in|out] <interface>" as well.hasso2003-05-251-4/+26
|
* Revert my http://hasso.linux.ee/zebra/ht-ifrmap-14042003.patch patch. Usedhasso2003-05-241-0/+306
| | | | | same idea as in lib/distribute.c to allow extract.pl to pick up commands for vtysh.
* Hasso Tepperpaul2003-04-191-305/+0
| | | | | | | http://hasso.linux.ee/zebra/ht-ifrmap-14042003.patch Allows to extract.pl to pickup "route-map xxx in/out dev" commands for vtysh (ripngd). As lib/if_rmap.[c|h] are used in ripngd only, I moved them to the ripngd/ directory.
* Initial revisionpaul2002-12-131-0/+305