summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* cumulus take-3cumulus-take-3Timo Teräs2016-03-3026-116/+1196
|
* lib: fix vrf_bitmap leak in zclient_free()David Lamparter2016-03-081-0/+10
| | | | | | | | | zclient_stop(), which is used as antagonist to zclient_init(), needs to undo the vrf_bitmap allocation. Otherwise zclient_init() will leak the allocated memory, for example when zclient_reset() is used. Reported-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: Check prefix length from zebra is sensiblePaul Jakma2016-03-081-17/+28
| | | | | | | | | | | | | * zclient.c: prefix length on router-id and interface address add messages not sanity checked. fix. * */*_zebra.c: Prefix length on zebra route read was not checked, and clients use it to write to storage. An evil zebra could overflow client structures by sending overly long prefixlen. Prompted by discussions with: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: zclient can overflow (struct interface) hw_addr if zebra is evilPaul Jakma2016-03-081-1/+1
| | | | | | | | | | | | | | | * lib/zclient.c: (zebra_interface_if_set_value) The hw_addr_len field is used as trusted input to read off the hw_addr and write to the INTERFACE_HWADDR_MAX sized hw_addr field. The read from the stream is bounds-checked by the stream abstraction, however the write out to the heap can not be. Tighten the supplied length to stream_get used to do the write. Impact: a malicious zebra can overflow the heap of clients using the ZServ IPC. Note that zebra is already fairly trusted within Quagga. Reported-by: Kostya Kortchinsky <kostyak@google.com>
* lib: Add CMD_RANGE_STR macro to command.hDonald Sharp2016-02-261-0/+11
| | | | | | | | | | Allow the auto-generation of a "<X-Y>" string for cli handline. Where X or Y can be a #define. CMD_RANGE_STR(LOW, HIGH) translates to: "<4-99>" Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: use an ifindex_t type, defined in lib/if.h, for ifindex valuesPaul Jakma2016-02-268-42/+44
|
* lib, zebra: unify link layer type and hardware address handlingTimo Teräs2016-02-263-16/+124
| | | | | | | | | | | | | | | | This removes the BSD specific usage of struct sockaddr_dl hardware address. This unifies to use explict hw_addr member for the address, and zebra specific enumeration for the link layer type. Additionally the zapi is updated to never send platform specific structures over the wire, but the ll_type along with hw_addr_len and hw_addr are now sent for all platforms. Based on initial work by Paul Jakma. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: support FIB override routesTimo Teräs2016-02-261-0/+1
| | | | | | | | | | | | | | | | FIB override routes are for routing protocols that establish shortcut routes, or establish point-to-point routes that should not be redistributed. Namely this is useful NHRP daemon to come. Zebra is extended to select two entries from RIB the "best" entry from routing protocols, and the FIB entry to install to kernel. FIB override routes are never selected as best entry, and thus are never adverticed to other routing daemons. The best FIB override, or if it does not exist the otherwise best RIB is selected as FIB entry to be installed. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, bgpd: Remove 'struct fifo' from lib/zebra.hDonald Sharp2016-02-263-40/+63
| | | | | | | The 'struct fifo' and it's accompanying #defines do not belong in lib/zebra.h. Move them into their own header. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd, lib, vtysh: hook up bgp ENCAP CLI nodeLou Berger2016-02-263-0/+10
| | | | | Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: encap: add attribute handlingLou Berger2016-02-261-0/+1
| | | | | Signed-off-by: Lou Berger <lberger@labn.net> Reviewed-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd, lib, vtysh: hook up bgp VPNv6 CLI nodeLou Berger2016-02-263-1/+6
| | | | | Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: add SAFI_ENCAP type, safi2str prefix utilityLou Berger2016-02-263-1/+19
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* lib: add facility to log all CLI commandsLou Berger2016-02-261-2/+36
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* lib: add "show commandtree" CLI commandLou Berger2016-02-261-0/+35
| | | | | Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: treat realloc of null pointer as alloc Now use zalloc rather than alloc ↵Lou Berger2016-02-261-0/+3
| | | | | | with null. Fixes issue seen in bgp check tests. Signed-off-by: Lou Berger <lberger@labn.net>
* lib: fix bookkeeping for libreadline malloc()sLou Berger2016-02-263-17/+30
| | | | | | | | | When libreadline is used, we mistakenly mix in strdup() done in libreadline with Quagga's lib/memory bookkeeping/counting, leading to counter underflows on MTYPE_TMP. Signed-off-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib, bgpd, tests: Refactor FILTER_X in zebra.hDonald Sharp2016-02-262-5/+5
| | | | | | | lib/zebra.h has FILTER_X #define's. These do not belong there. Put them in lib/filter.h where they belong. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, bgpd: Fixup afi_t to be an enum and cleanup zebra.hDonald Sharp2016-02-262-16/+10
| | | | | | | | | | 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>
* isisd, lib: Fix some more compiler warningsDonald Sharp2015-12-081-1/+1
| | | | | | | A couple compiler warnings snuck in from the last round of work being looked at. This cleans them up Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* isisd: add support to import routes from other protocolsChristian Franke2015-12-083-1/+14
| | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* lib: don't have log functions change errnoChristian Franke2015-12-081-0/+4
| | | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: add function to get precise remaining time of timer threadChristian Franke2015-12-082-0/+9
| | | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Collapse struct static_ipv[4|6] into struct static_routeDonald Sharp2015-12-081-2/+1
| | | | | | | | The 'struct static_ipv4' and 'struct static_ipv6' structures are essentially the same. Collapse them into one data structure 'struct static_route'. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: implement per-route mtu handlingTimo Teräs2015-12-082-0/+9
| | | | | | | | This commits allow overriding MTU using netlink attributes on per-route basis. This is useful for routing protocols that can advertice prefix specific MTUs between routers (e.g. NHRP). Signed-off-by: Timo Teräs <timo.teras@iki.fi>
* zebra: make ZEBRA_FLAG_CHANGED internal statusTimo Teräs2015-12-081-1/+0
| | | | | | | | | This flag is used internally in zebra only. And it makes no sense to expose it over the zclient API, as having it set from client could corrupt the internal state. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Memory reporting fails over 2GBDonald Sharp2015-12-081-28/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old style mallinfo() function uses an 'int' to report memory usage data to the program. Unfortunately modern architectures can chew through 2gb of memory like a buzz saw hitting some warm butter, especially in the case of a memory leak or memory fragmentation. When a daemon uses more than 2gb of memory, just indicate it's gotten large and we don't know anymore. Pre-change behavior: Robot-1# show memory System allocator statistics: Total heap allocated: 16777216 TiB Holding block headers: 1288 KiB Used small blocks: 0 bytes Used ordinary blocks: 535 MiB Free small blocks: 768 bytes Free ordinary blocks: 16777216 TiB Ordinary blocks: 266107 Small blocks: 24 Holding blocks: 2 Post-change behavior: Robot-1# show memory System allocator statistics: Total heap allocated: 1572 KiB Holding block headers: > 2GB Used small blocks: 0 bytes Used ordinary blocks: 1443 KiB Free small blocks: 32 bytes Free ordinary blocks: 129 KiB Ordinary blocks: 2 Small blocks: 1 Holding blocks: 2 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Add zlog_hexdump() for debuggingDaniel Walton2015-12-082-0/+44
| | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Lower the default OSPF spf timers to '0 50 5000'Daniel Walton2015-12-081-3/+3
| | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge 'patch-tracking/4/proposed/netdef-solaris' into acceptedPaul Jakma2015-10-286-11/+37
|\
| * lib: add getgrouplist() for SolarisDavid Lamparter2015-10-161-0/+35
| | | | | | | | | | | | Of course Solaris doesn't have getgrouplist()... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * build/solaris: drop duplicate __EXTENSION__ defineDavid Lamparter2015-10-161-1/+0
| | | | | | | | | | | | | | __EXTENSION__ is already defined in config.h by autoconf; drop the duplicate from zebra.h. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: make sure zebra.h is always included firstDavid Lamparter2015-10-164-10/+2
| | | | | | | | | | | | | | | | zebra.h pulls in config.h, which results in fiddling with things like __FILE_OFFSET_BITS. It must always be included first, in order to set flags that influence the compiler via <features.h>. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | bgpd, lib: memory cleanups for valgrind, plus debug changesLou Berger2015-10-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Description: We use valgrind memcheck quite a bit to spot leaks in our work with bgpd. In order to eliminate false positives, we added code in the exit path to release the remaining allocated memory. Bgpd startup log message now includes pid. Some little tweaks by Paul Jakma <paul.jakma@hpe.com>: * bgp_mplsvpn.c: (str2prefix_rd) do the cleanup in common code at the end and goto it.
* | lib: Fix duplicate variable name in smux.c and vty.cDonald Sharp2015-10-272-15/+15
| | | | | | | | | | | | | | | | | | | | Both smux.c and vty.c have the same: static struct thread_master *master; as global variables for the file. This can and will lead to confusion name the variables something appropriate for the file it is in. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | vtysh: Fix Quagga.conf file read in.Donald Sharp2015-10-272-17/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There exists a sequence of cli commands that are successfully read in by bgpd.conf, but not by a consolidated Quagga.conf. This issue stems from the fact that the consolidated config file attempts to match the current node + 1 node up the tree, while the individual config file searches for matches all the way up the tree. Quagga.conf read-in relies on vtysh_cmd.c command parsing which puts all nodes at CONFIG_NODE and if a match is found CMD_SUCCESS_DAEMON is returned. This signals to the parser to call the appropriate daemon with the comamnd. bgp as an example has three levels of config node's. If you are reading in a config node at the 3rd level(say address-family ipv6) then transition to another node under bgp it will not work in Quagga.conf because the code only looked up one node and was at CONFIG_BGP when it failed to find a match. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | lib: zclient.c remove extern struct thread_master *Donald Sharp2015-10-272-11/+13
|/ | | | | | | | | | | | zclient.c depended upon link time inclusion of a extern struct thread_master *master. This is a violation of the namespace of the calling daemon. If a library needs the pointer pass it in and save it for future use. This code change also makes the zclient code consistent with the other lib functions that need to schedule work on your behalf Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* vrf: add a runtime check before playing with netnsNicolas Dichtel2015-09-241-37/+58
| | | | | | | | | | This patch adds a runtime check to determine if netns are available. Some systems like OpenWRT have the system call setns() but don't have the kernel option CONFIG_NET_NS enabled. Reported-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Tested-by: Christian Franke <chris@opensourcerouting.org>
* lib: Remove unused 'show memory XXX' functionalityDonald Sharp2015-09-241-150/+4
| | | | | | | The 'show memory XXXX' functionality is not used at all. This removes the unused code Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Fix Free Pointer dereference in lib/filter.cDenil Vira2015-09-241-4/+4
| | | | | | Coverity Scan ID 23056. access is accessed after free in access_list_delete Signed-off-by: Denil Vira <denil@cumulusnetworks.com>
* lib/zclient: Consolidate error reporting for zclient_read_headerDonald Sharp2015-09-241-0/+7
| | | | | | | | All functions that call zclient_read_header immediately turn around and check to ensure that the version and marker fields are correct Move this code into zclient_read_header Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib/command: Fix optional arguments with description interactionsDonald Sharp2015-09-241-29/+45
| | | | | | | | | | | | | | | | | | | | | If you have a cli like this: "neighbor WORD interface {v6only}" When in the cli you hit ? after entering v6only you get this: tor-11(config-router)# neighbor swp1 interface v6only % There is no matched command. tor-11(config-router)# neighbor swp1 interface v6only With this fix we now see: tor-22(config-router)# neighbor swp1 interface v6only <cr> tor-22(config-router)# neighbor swp1 interface v6only This behavior is now consistent with non-optional last arguments. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib/workqueue: Add trivial work_queue_is_scheduled helperPaul Jakma2015-09-242-0/+8
|
* build/lib: Check for and include stdbool.h by defaultPaul Jakma2015-09-241-0/+3
| | | | | * stdbool.h should be widely supported by now, and the 'bool' type makes more semantic sense than an integer type for boolean values.
* ospfd: Fast OSPF convergenceMichael Rossberg2015-09-241-2/+2
| | | | | | | | | | | | When considering small networks that have extreme requirements on availability and thus convergence delay, the timers given in the OSPF RFC seem a little “conservative”, i.e., the delay between accepted LSAs and the rate at which LSAs are sent. Cisco introduced two commands 'timers throttle lsa all’ and 'timers lsa arrival’, which allow operators to tune these parameters. I have been writing a patch to also support 'timers lsa arrival’ fully and ‘timers throttle lsa all’ (without the throttling part) also in quagga.
* bgpd/pimd: fix zAPI parsingNicolas Dichtel2015-09-242-0/+22
| | | | | | | | | | | | | Commit c99f3481a598 has changed the API. Now, the vrfid has been added in the header, thus we must read it before parsing the rest of the message. To ease code maintenance, let's add a new function to read a zAPI header. Fixes: c99f3481a598 ("*: add VRF ID in the API message header") Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> Tested-by: Martin Winter <mwinter@opensourcerouting.org>
* pimd: add support for configuring multicast static routesJafar Al-Gharaibeh2015-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | Hi, This patch adds the ability to configure multicast static routes directly into pimd. Two source files are introduced to implement the new feature in addition to changes to existing files. Here is how it can be used the CLI: interface <incoming interface> ip mroute <outgoing interface> <group addr> # for asm or ip mroute <outgoing interface> <group addr> <source> # for ssm Please let me know if you have any questions or concerns, Regards, Jafar Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Quagga: Fix code to use srandom/randomDonald Sharp2015-06-211-1/+1
| | | | | | | | Quagga was using a mix of srand/rand and srandom/random. Consolidate to use srandom/random which are the POSIX versions of random number generators Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, stream: fix stream sanity checksWenjian Ma2015-06-211-1/+1
| | | | | | Because operator "!" has higher priority than "&&", So we put the "&&" expression in "()" to check both getp and endp. Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, vtysh: support multiple VRFs by using linux netnsFeng Lu2015-06-032-17/+229
| | | | | | | | | | | | | | | | | | | | | | | | | We realize VRFs with linux netns by default. The main job is to associate a VRF with a netns. Currently this is done by the configuration: [no] vrf N netns <netns-name> This command is also available in vtysh and goes to only zebra, because presently only zebra supports multiple VRF. A file descriptor is added to "struct vrf". This is for the associated netns file. Once the command "vrf N netns NAME" is executed, the specified file is opened and the file descriptor is stored in the VRF N. In this way the association is formed. In vrf_socket(), we first switch to the specified VRF by using the stored file descriptor, and then can allocate a socket which is working in the associated netns. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>