summaryrefslogtreecommitdiffstats
path: root/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib: Turn off automatic debugging of Wheel code.Donald Sharp2016-12-221-1/+1
| | | | | | Turn off the automatic debugging of Timer wheel code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Add Timer Wheel functionalityDonald Sharp2016-12-223-2/+236
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, pimd: Modify writen to retry on certain failuresDonald Sharp2016-12-221-2/+7
| | | | | | | | When writen fails, allow itto retry on certain failures until it succeeds. Ticket: CM-12986 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, pimd, zebra: Allow pimd to ask the kernel about mroute infoDonald Sharp2016-12-222-0/+2
| | | | | | | When we need to lookup the mroute info for a route. Allow pimd to ask the kernel. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Fully decode mcast messagesDonald Sharp2016-12-221-0/+18
| | | | | | | | | | | Fully decode mcast messages from the kernel. We are not doing anything with this at the moment, but that will change. Additionally convert over to using lookup for displaying the route type. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Use single correct definition for prefix string buffervivek2016-12-221-7/+2
| | | | | | | | | Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reivewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-12262 Reviewed By: CCR-5065 Testing Done: Manual
* lib, pimd: Fix borked up prefix codeDonald Sharp2016-12-221-12/+8
| | | | | | | Fix the struct prefix to be an actual struct prefix_sg. This cleans up a bunch of code to make it look nicer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Setup prefix.h to allow it to store (s,g)Donald Sharp2016-12-221-0/+5
| | | | | | | | | We need the ability to store the (s,g) in a struct prefix. This will allow us to consolidate some duplicated code in pimd as well as set us up to switch from a link list to a table to store (s,g) state. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: add grammar_sandbox to .gitignoreQuentin Young2016-12-201-0/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: fix crash when tab-completing `do ...` commandsQuentin Young2016-12-181-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: parser: remove startnode & sentence_rootDavid Lamparter2016-12-161-22/+6
| | | | | | | | | | | | | This removes an artificial restriction for the first token in a command's graph to be a WORD_TKN. The intention seems to be to prohibit empty paths through a command, and to restrict "explosion" of choices in the root node. The better approach to the former is to check for an empty path after the definition is parsed. The latter will happen anyway, by duplication of the command, which just makes it worse... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: accept number-only word tokensDavid Lamparter2016-12-161-1/+1
| | | | | | | | There seems to be no reason why numbers don't work as plain word tokens; this is useful to have "number choices" or constants, e.g. <128|192|256> for bit encryption lengths. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: move allowrepeat to cmd_tokenDavid Lamparter2016-12-164-9/+10
| | | | | | | struct graph_node isn't quite the right place to control matcher behaviour. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: shuffle qobj_init()David Lamparter2016-12-161-1/+2
| | | | | | | bgp_master_init is called first thing in main(), so we need to wedge a qobj_init() call in there... this needs some improvement... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: reorder bison incarnationsDavid Lamparter2016-12-162-24/+26
| | | | | | | | | | | This shuffles the code blocks in command_parser.y to match file output order, then adjusts things to make the include handling less messy. (also dropped unused DECIMAL_STRLEN_MAX define.) This should hopefully fix the build on NetBSD 6. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: fix bison < 3.0 compatibilityDavid Lamparter2016-12-162-2/+2
| | | | | | | bison-2.7.x really wants "foo" for api.prefix while bison-3.0.x really wants {foo} ... great. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: fix SEGV when Tab hits non-WORD_TKNDavid Lamparter2016-12-161-0/+13
| | | | | | | | | | | | | If <Tab> processing finds that there is only 1 candidate, but that candidate is not a WORD_TKN that we can tab-complete on, the status would remain at CMD_COMPLETE_FULL_MATCH, but the resulting list of possible completions is empty. This then SEGVs in lib/vty.c where it tries to access the first element of the list, assuming FULL_MATCH always has 1 element there... Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Cc: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: parser: support keyword argumentsDavid Lamparter2016-12-153-20/+107
| | | | | | | | | | | This re-adds "{foo WORD|bar WORD}" keyword-argument support to the CLI parser. Note that token graphs may now contain loops for this purpose; therefore the matching functions retain a history of already-matched tokens. Each token can thus only be consumed once. And then LINE... gets its special treatment with allowrepeat. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: parser: refresh grammar_sandboxDavid Lamparter2016-12-153-93/+140
| | | | | | | This makes grammar_sandbox a workable tool again, updating it for the recent changes. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge branch 'dev/osr/vty_index'David Lamparter2016-12-158-35/+15
|\ | | | | Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * lib: remove vty->indexDavid Lamparter2016-12-096-34/+8
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * lib: make qobj NULL-safe/awareDavid Lamparter2016-12-093-4/+10
| | | | | | | | | | | | | | reserve qobj ID 0 for a NULL pointer. (No change is needed for lookups since looking up 0 will simply fail and return NULL.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | lib: Partial Revert of 4ecc09d and modify zclient connect behaviorDonald Sharp2016-12-141-19/+9
|/ | | | | | | | | | | | | | | | Commit 43cc09d has been shown to cause several issues with clients connecting. Partial revert, since I wanted to keep the debug logs added for that commit, as well remove the piece of code that stops attempting to connect to zebra. If we've failed a bunch of times, there is nothing wrong with continuing to do so once every 60 seconds. I've debug guarded the connect failure for those people running bgp without zebra. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* Merge branch 'fixes/command'David Lamparter2016-12-081-2/+1
|\ | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * lib: "write mem" should write to persistent configurationChristian Franke2016-12-051-2/+1
| | | | | | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* | Merge branch 'stable/2.0'David Lamparter2016-12-082-18/+18
|\ \ | | | | | | | | | | | | | | | | | | | | | Conflicts: bgpd/rfapi/bgp_rfapi_cfg.c bgpd/rfapi/vnc_debug.c Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * | *: always set SO_SNDBUF and SO_RCVBUF using a best effort approachRenato Westphal2016-12-082-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we fail to set any socket's buffer size, try again with a smaller value and keep going until it succeeds. This is better than just giving up or, even worse, abort the creation of a socket (ospf6d and ripd). Fix broken ospf6d on FreeBSD. Signed-off-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | | build: fix command_lex.h deps & gitignoreDavid Lamparter2016-12-081-1/+7
| | | | | | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | | lib, ripngd: clean up merge leftoversQuentin Young2016-12-061-86/+11
| | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | | Merge remote-tracking branch 'osr/master' into vtysh-grammarQuentin Young2016-12-0614-887/+377
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: lib/command_match.c
| * | | Revert "lib: Macroize CLI matcher tracing"David Lamparter2016-12-051-38/+33
| | | | | | | | | | | | | | | | This reverts commit 54c5dce6a5e46717ad52c80f2dc99fc36a372e28.
| * | | *: fix up DEFUNs without install_element callsDavid Lamparter2016-12-052-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | Merge branch 'queue/osr/vtysh-generic'David Lamparter2016-12-0514-217/+237
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WARNING: Merge contains nontrivial fixups in vrf_cmd handling. Conflicts: lib/if.c zebra/interface.c
| * \ \ \ Merge branch 'stable/2.0'David Lamparter2016-12-0513-851/+274
| |\ \ \ \ | | | |/ / | | |/| / | | |_|/ | |/| | | | | | | | | | | | | | | | | | Conflicts: bgpd/bgp_route.c lib/if.c ripd/rip_interface.c zebra/interface.c zebra/zebra_vty.c
| | * | lib: remove unused NS_BITMAP MTYPEDavid Lamparter2016-12-051-1/+0
| | | | | | | | | | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| | * | Merge branch '-rip' into stable/2.0David Lamparter2016-12-054-7/+22
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes up a lot of RIP/RIPng compliance tests that were still flagged up. Tested-by: Martin Winter <mwinter@opensourcerouting.org>
| | | * | *: create a helper function to set the IP_MULTICAST_LOOP sockoptionRenato Westphal2016-11-252-1/+16
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | ripd: fix the "neighbor" command.Renato Westphal2016-11-252-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | | Merge branch '-renato' into stable/2.0David Lamparter2016-12-0510-833/+236
| | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | * | | zebra/lib: remove redundant fields from zebra_vrfRenato Westphal2016-11-282-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no need to duplicate the 'vrf_id' and 'name' fields from the 'vrf' structure into the 'zebra_vrf' structure. Instead of that, add a back pointer in 'zebra_vrf' that should point to the associated 'vrf' structure. Additionally, modify the vrf callbacks to pass the whole vrf structure as a parameter. This allow us to make further simplifications in the code. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | lib/zebra: put vrf_get() on a dietRenato Westphal2016-11-282-168/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, for some reason we had two functions to search a VRF by its name: zebra_vrf_lookup_by_name() and zebra_vrf_list_lookup_by_name(). The first one would loop through vrf_table and the other one through vrf_list. This is not necessary anymore, so remove zebra_vrf_lookup_by_name() and rename zebra_vrf_list_lookup_by_name() to zebra_vrf_lookup_by_name(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | zebra: order VRFs by name on user outputRenato Westphal2016-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | lib/zebra: convert vrf_list to a red-black treeRenato Westphal2016-11-282-36/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we're already using a red-black tree to store VRFs sorted by their vrf_id's, create a new tree to store VRFs sorted by their names. The biggest advantage of doing this is that we reduce the time complexity of vrf_list_lookup_by_name() from O(n) to O(log n). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | *: rename two vrf functionsRenato Westphal2016-11-283-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since VRFs can be searched by vrf_id or name, make this explicit in the helper functions. s/vrf_lookup/vrf_lookup_by_id/ s/zebra_vrf_lookup/zebra_vrf_lookup_by_id/ Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | lib: convert vrf code to use red-black trees as wellRenato Westphal2016-11-283-228/+51
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | lib: convert namespace code to use red-black treesRenato Westphal2016-11-282-53/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We definitely need to stop abusing the route table data structure when it's not necessary. Convert the namespace code to use red-black trees instead. This greatly improves code readability. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | lib: fix creation of pre-provisioned VRFsRenato Westphal2016-11-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we configure a VRF that doesn't match any device in the kernel, we'll fall in the first case of the vrf_get() function. In this function, a vrf structure is callocated and it's vrf_id is never set explicitly, which means it's set to zero (the vrf-id of the default VRF). When this happens, commands like "router-id A.B.C.D vrf ..." will act on the default VRF and not on the pre-provisioned VRF. To fix this, always set the vrf_id of pre-provisioned VRFs to VRF_UNKNOWN. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | zebra/lib: move some code aroundRenato Westphal2016-11-284-70/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| | | * | | lib: remove unused ns codeRenato Westphal2016-11-282-284/+1
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| | | * | | zebra/lib: plug several memleaksRenato Westphal2016-11-284-2/+10
| | | |/ / | | | | | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>