summaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tests: add testcli reference in/out & do DejaGNUDavid Lamparter2016-06-035-1/+410
| | | | | | | | | This adds reference in & output for the previously added testcli tool, to check basic CLI parsing/help functions. Unlike "testcommands", this one doesn't depend on compile-time system details. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit d79668fb440ae2689b54f52c076dbd79a8689135)
* tests: add CLI dummy command-exec toolDavid Lamparter2016-06-035-1/+200
| | | | | | | | | | | | This adds some common CLI testtool code as well as a tool that has a bunch of commands to be poked for their correct processing. The tool doesn't work correctly from a script at stdin at this point because the vty code will throw away all buffered when it sees EOF, so the tail end of the input file is lost. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit db93eec18d8f1e840b32ba2cdf8baf2510f6e1a5)
* build: get rid of INCLUDES, use AM_CPPFLAGSDavid Lamparter2016-06-031-1/+1
| | | | | | | | | | | | | INCLUDES in configure.ac was not used at all, and INCLUDES in Makefile.am is supposed to be AM_CPPFLAGS these days. Reduces warnings spewed during bootstrap/autoreconf. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org> (cherry picked from commit 237aac56960575f6ad2451ba2796d94bd5ae4b33)
* tests: add more AS4 capability tests + little fixes for couple of GR test cases.Paul Jakma2016-05-261-4/+12
| | | | | Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit 321d4130a615445d0f49f41c909c92d5401fd5ff)
* tests: Fix warnings from test-stream.cDonald Sharp2016-05-261-3/+3
| | | | | | | test-stream is generating some compiler warnings Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> (cherry picked from commit 6169559976b33a5bf120c806135c76b1b6d943ee)
* tests: fix warningsDavid Lamparter2016-05-2613-48/+53
| | | | | | | | While I don't see -Werror being used on tests anytime soon, there's no reason to keep the warnings in tests unfixed. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit c313895dec3c176584d99f7b8684ddc3f9141d88)
* tests: remove --disable-ipv6David Lamparter2016-05-263-30/+10
| | | | | | | | | With --disable-ipv6 gone, the IPv6 detection logic in the tests is not needed anymore either. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Paul Jakma <paul@jakma.org> (cherry picked from commit 85c63b844df4a295a64f37573e0ba08a7cc63659)
* tests: fix tests for 1a211cb (missing well-known)David Lamparter2016-05-261-2/+5
| | | | | | | | | | | | Fix tests/aspathtest.c again, this time by including a NEXT_HOP attribute (which is out of correct order with AS_PATH, but that doesn't matter here.) This satisfies bgp_attr_check(), which after 1a211cb refuses updates without nexthop attribute. Fixes: 1a211cb ("one more fix for tightening of check for missing well-known attributes") Cc: Paul Jakma <paul@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 143637198e333f0c822766b38f9d8cfe75c04e21)
* tests: fix tests for 055086f (well-known attr check)David Lamparter2016-05-261-28/+48
| | | | | | | | | | | | | | Fix tests/aspathtest.c by including an ORIGIN attribute in the testcases. After 055086f "bgpd: well-known attr check only run for v4/uni, which could cause a crash," we're now checking for it and tests are failing due to that. Note that test #11 ("4b AS4_PATH w/o AS_PATH") is no longer accepted as OK since the function now checks for the existence of an AS_PATH attr. Fixes: 055086f ("bgpd: well-known attr check only run for v4/uni"...) Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit c68f6d9dbb9f910d3ee82e099655fff7c12ef856)
* Add missing GPL headers, and copyright claims that certainly apply.Paul Jakma2016-05-269-0/+185
| | | | | | | | | | | | | | | * Fix (a subset of)? files with non-trivial code that are missing GPL headers. * A few copyright claims added which I am certain apply, but which I had missed out on the original commits. NB: Copyright claims are not exclusive and the addition of any copyright claim should not be read as implying a lack of any further claims, or denying the validity of any other claims. All those with claims of copyright over any portion of Quagga are welcome to submit them, ideally as patches to update copyright strings in files. (cherry picked from commit 010ebbbca6396f272cc2d50d147dd922dda68213)
* build: Remove the old PIC/PIE patch, let libtool sort it outPaul Jakma2016-05-261-3/+0
| | | | | | | * Remove the old change from '08 to add in PIE arguments at automake level. Versions of libtool since then know how to deal with -fpie and do the right thing according to whether its building shared or executable objects. So just pass '-fpie' as CFLAG and let libtool do its thing.
* quagga: "set community x:y" needs bounds checkingDaniel Walton2016-04-141-57/+57
| | | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-10002 superm-redxp-05# conf t superm-redxp-05(config)# route-map FOO permit 10 superm-redxp-05(config-route-map)# set community ? AA:NN Community number in AA:NN format (where AA and NN are <0-65535>) or local-AS|no-advertise|no-export|internet or additive none No community attribute superm-redxp-05(config-route-map)# set community 2:2 superm-redxp-05(config-route-map)# set community 2:70000 % Malformed communities attribute superm-redxp-05(config-route-map)# set community 70000:2 % Malformed communities attribute superm-redxp-05(config-route-map)#
* tests: Fixup startup of tests so they don't coreDonald Sharp2016-03-183-2/+5
| | | | | | | | | Tests were not even compiling due to non updated API changes. Additionally tests were core'ing after compile issue because the vrf subsystem is being used now and it needs to be initialized. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* quagga: remove babelDaniel Walton2016-02-112-31/+24
| | | | | | | | Ticket: CM-9274 Reviewed By: sharpd@cumulusnetworks.com Testing Done: <DETAILED DESCRIPTION (REPLACE)>
* Quagga: make check is broken with addpath changesDaniel Walton2015-12-112-8/+5
| | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-8472 The first as-path is what the original as-path for the test, the second is what the as-path should look like once all confed SETs and SEQs have been removed. At the time the test was written quagga did not correctly remove confed SETs and SEQs but whoever wrote the test didn't notice this and assumed that the behavior they were seeing was correct so used that output to populate the second as-path. Now that we do correctly remove the confed parts these tests fail. So the fix is to update the second as-path for these two tests so that they no longer contain any confed SETs/SEQs.
* bgpd: Use actual MULTIPATH_NUM as the limitorDonald Sharp2015-12-081-4/+4
| | | | | | | BGP uses a second #define that is equal to MULTIPATH_NUM. There is no point in having a different #define. Just consolidate. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Quagga: prefix2str fixupDonald Sharp2015-11-231-2/+2
| | | | | | | During CR for nexthop upstream it was noticed that usage of prefix2str was not consistent. This fixes this problem Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: backout change of bm->master and masterDonald Sharp2015-10-131-1/+1
| | | | | | | Upstream does wanted the reverse of what was done in this patch. Back out the patch. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: fix using of two pointers for struct thread_masterDonald Sharp2015-09-241-1/+1
| | | | | | | | bgp is using both bm->master and master pointers interchangebly for thread manipulation. Since they are the same thing consolidate to one pointer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: zclient.c remove extern struct thread_master *Donald Sharp2015-09-231-1/+1
| | | | | | | | | | | | 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>
* AS_PATH comparison is broken if CONFED_AS_SEQ are presentDonald Sharp2015-05-201-1/+1
|
* BGP: Add dynamic update group supportDonald Sharp2015-05-205-0/+5
| | | | | | | | | | | | | | | | | | | | 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
* Multi-Instance OSPF SummaryDonald Sharp2015-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ——————————————------------- - etc/init.d/quagga is modified to support creating separate ospf daemon process for each instance. Each individual instance is monitored by watchquagga just like any protocol daemons.(requires initd-mi.patch). - Vtysh is modified to able to connect to multiple daemons of the same protocol (supported for OSPF only for now). - ospfd is modified to remember the Instance-ID that its invoked with. For the entire life of the process it caters to any command request that matches that instance-ID (unless its a non instance specific command). Routes/messages to zebra are tagged with instance-ID. - zebra route/redistribute mechanisms are modified to work with [protocol type + instance-id] - bgpd now has ability to have multiple instance specific redistribution for a protocol (OSPF only supported/tested for now). - zlog ability to display instance-id besides the protocol/daemon name. - Changes in other daemons are to because of the needed integration with some of the modified APIs/routines. (Didn’t prefer replicating too many separate instance specific APIs.) - config/show/debug commands are modified to take instance-id argument as appropriate. Guidelines to start using multi-instance ospf --------------------------------------------- The patch is backward compatible, i.e for any previous way of single ospf deamon(router ospf <cr>) will continue to work as is, including all the show commands etc. To enable multiple instances, do the following: 1. service quagga stop 2. Modify /etc/quagga/daemons to add instance-ids of each desired instance in the following format: ospfd=“yes" ospfd_instances="1,2,3" assuming you want to enable 3 instances with those instance ids. 3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf and ospfd-3.conf. 4. service quagga start/restart 5. Verify that the deamons are started as expected. You should see ospfd started with -n <instance-id> option. ps –ef | grep quagga With that /var/run/quagga/ should have ospfd-<instance-id>.pid and ospfd-<instance-id>/vty to each instance. 6. vtysh to work with instances as you would with any other deamons. 7. Overall most quagga semantics are the same working with the instance deamon, like it is for any other daemon. NOTE: To safeguard against errors leading to too many processes getting invoked, a hard limit on number of instance-ids is in place, currently its 5. Allowed instance-id range is <1-65535> Once daemons are up, show running from vtysh should show the instance-id of each daemon as 'router ospf <instance-id>’ (without needing explicit configuration) Instance-id can not be changed via vtysh, other router ospf configuration is allowed as before. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
* Overhual BGP debugsDonald Sharp2015-05-202-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of changes - added an option to enable keepalive debugs for a specific peer - added an option to enable inbound and/or outbound updates debugs for a specific peer - added an option to enable update debugs for a specific prefix - added an option to enable zebra debugs for a specific prefix - combined "deb bgp", "deb bgp events" and "deb bgp fsm" into "deb bgp neighbor-events". "deb bgp neighbor-events" can be enabled for a specific peer. - merged "deb bgp filters" into "deb bgp update" - moved the per-peer logging to one central log file. We now have the ability to filter all verbose debugs on a per-peer and per-prefix basis so we no longer need to keep log files per-peer. This simplifies troubleshooting by keeping all BGP logs in one location. The use r can then grep for the peer IP they are interested in if they wish to see the logs for a specific peer. - Changed "show debugging" in isis to "show debugging isis" to be consistent with all other protocols. This was very confusing for the user because they would type "show debug" and expect to see a list of debugs enabled across all protocols. - Removed "undebug" from the parser for BGP. Again this was to be consisten with all other protocols. - Removed the "all" keyword from the BGP debug parser. The user can now do "no debug bgp" to disable all BGP debugs, before you had to type "no deb all bgp" which was confusing. The new parse tree for BGP debugging is: deb bgp as4 deb bgp as4 segment deb bgp keepalives [A.B.C.D|WORD|X:X::X:X] deb bgp neighbor-events [A.B.C.D|WORD|X:X::X:X] deb bgp nht deb bgp updates [in|out] [A.B.C.D|WORD|X:X::X:X] deb bgp updates prefix [A.B.C.D/M|X:X::X:X/M] deb bgp zebra deb bgp zebra prefix [A.B.C.D/M|X:X::X:X/M]
* cluster-id length equality for multipathDonald Sharp2015-05-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A fat tree topology running IBGP gets into two issues with anycast address routing. Consider the following topology: R9 R10 x x R3 R4 R7 R8 x x R1 R2 R5 R6 | | | | 10/8 10/8 10/8 S Let's remind ourselves of BGP decision process steps: 1. Highest Local Preference 2. Shortest AS Path Length 3. Lowest Origin Type 4. Lowest MED (Multi-Exit Discriminator) 5. Prefer External to Internal 6. Closest Egress (Lowest IGP Distance) 7. Tie Breaking (Lowest-Router-ID) 8. Tie Breaking (Lowest-cluster-list length) 9. Tie Breaking (Lowest-neighbor-address) Without any policies, steps 1-6 will almost always evaluate identically for all paths received on any router in the above topology. Let's assume that the router-ids follow the following inequality: R1 < R2 < R5 < R6. Owing to the 7th step above, all routers will now choose R1's path as the best. This is undesirable. As an example, traffic from S to 10/8 will follow the path S -> R6 -> R7 -> R9 -> R4 -> R2 -> 10/8 instead of S -> R6 -> R7 -> R5 -> 10/8. Furthermore, once R7 (& R8) chooses R1's path as the best, it would withdraw its path learned through (R5, R6) from (R9, R10). This leads to inefficient load balancing - e.g. R9 can't do ECMP across all available egresses - (R1, R2, R5). The patch addresses these issues by noting that that cluster list is always carried along with the routes and its length is a good indicator of IBGP hops. It thus makes sense to compare that as an extension to metric after step 6. That automatically ensures correct multipath computation. Unfortunately a partial deployment of this in a generic topology (note: fat-tree/clos topologies work fine) may lead to potential loops. It needs to be looked into. Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
* tests/bgpd: don't hardcode error number (fix f57000c)David Lamparter2014-08-181-1/+1
| | | | | | | | | | | | f57000c ("bgpd: don't send NOTIFY twice for malformed attrs") introduces BGP_ATTR_PARSE_ERROR_NOTIFYPLS as additional error code that implies the caller should sent a NOTIFY and convert it to BGP_ATTR_PARSE_ERROR. Sadly, the latter was hardcoded in bgp_mp_attr_test.c, which now didn't consider the new value to be an error. Make the testcase treat all nonzero values as error without discern. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: nuke ^L (page feed)David Lamparter2014-06-043-5/+5
| | | | | | | | | | | | | | 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>
* tests: Add tests for timersChristian Franke2014-04-226-1/+313
| | | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ospfd/ospf_vty.c: use keyword cmd styleChristian Franke2014-04-012-0/+122
| | | | | | | | | | | Use the new keyword command style for: - default-information originate - distance ospf - redistribute Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/command.c: rewrite command matching/parsingChristian Franke2014-04-012-6/+2
| | | | | | | | | | Add support for keyword commands. Includes new documentation for DEFUN() in lib/command.h, for preexisting features as well as new keyword specification. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: fix build & disable testcommandsDavid Lamparter2014-04-013-2/+11
| | | | | | | | | | | The perils of having tests, the test wasn't tested thoroughly enough... Fixup various automake problems, and then disable it since it depends on configure parameters in its current version. For 0.99.24 we can ship a static copy of vtysh_cmd.c and have it reenabled. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: add a test program for lib/command.cChristian Franke2014-04-019-1/+1613
| | | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: fix backtraces broken by 837d16c...David Lamparter2014-03-213-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | | 837d16c ("*: use array_size() helper macro") accidentally changed one of the expressions in the backtrace code, which afterwards read: zlog_backtrace_sigsafe(): if (((size = backtrace(array,array_size(array)) <= 0) || which boils down to: (size = backtrace(...) <= 0). The braces were intended to go: (size = backtrace(...)) <= 0. All in all, this makes a nice textbook example of the original author being too clever (trying to save a single line by pulling the assignment into the condition) and the next person touching the code tripping over it... This code occurs another time in zlog_backtrace() where it is actually correct. Pulling out the assignment nonetheless. Also, new test program. Cc: Andrew J. Schorr <ajschorr@alumni.princeton.edu> Cc: Balaji.G <balajig81@gmail.com> Cc: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: fix tests/prng.h missing from distDavid Lamparter2013-10-221-0/+2
| | | | | | | broken by fa713d9... "zebra: rework recursive route resolution", and I forgot to squash the fix into that. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: rework recursive route resolutionChristian Franke2013-09-197-2/+421
| | | | | | | | | | | | | | | Change the datastructure for recursive routes. This brings the following benefits: By using struct nexthop also to store nexthops obtained by recursive resolution, we can get rid of quite a bit of code duplication in the fib management. (rt_netlink, rt_socket, ...) With the new datastructure we can make use of all available paths when recursive routes are resolved with multipath routes. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: don't build tests unless make check is runChristian Franke2013-07-151-1/+1
| | | | | | | Use check_PROGRAMS instead of noinst_PROGRAMS in tests/Makefile.am to build the tests only when make check is actually run. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* tests: fix Makefile.am so it works with BSD makeChristian Franke2013-07-091-1/+0
| | | | | | | | The export statement is specific to GNU make and breaks the build with BSD make. I couldn't observe any difference in behaviour between having the export present and absent, therefore, just remove it. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* tests: DejaGNU libzebraDavid Lamparter2013-04-146-2/+62
| | | | | | Wrap the few libzebra test programs we have up for DejaGNU. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: DejaGNU bgpdDavid Lamparter2013-04-148-3/+194
| | | | | | | this just wraps the existing test programs in expect wrappers that make their results usable to DejaGNU. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: add DejaGNU frameworkDavid Lamparter2013-04-144-0/+120
| | | | | | | | | DejaGNU seems to be the 'standard' GNU test framework (which by itself doesn't say much), but it seems relatively usable and the "remote system" capabilities might come in handy for virtualisation-based tests for kernel interactions or something. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: make --disable-bgpd kill bgpd tests tooDavid Lamparter2013-04-091-2/+8
| | | | | | | | bgpd tests don't compile or run with --disable-bgpd, let's catch this in the Makefile. Reported-by: Joachim Nilsson <troglobit@gmail.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: fix missing init in bgp_mp_attr_test.cDavid Lamparter2013-02-011-2/+2
| | | | | | | | turns out, bgp_mp_reach_parse really doesn't like getting garbage attribute input. In particular, attr->extra better be NULL or we merrily go trample random places (like our stack). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: update & extend AS_PATH testsDavid Lamparter2013-02-011-6/+34
| | | | | | | | | | | | NB: these tests test for current implementation state, not for RFC conformance. In particular, behaviour with confederations in AS4_PATH as well as reconcilation of short AS_PATH + AS4_PATH is currently NOT conforming to RFC 4893/6793. * tests/aspath_test.c: add capability to put both AS4_PATH & AS_PATH, add test for AS4_PATH w/o AS_PATH, update confederation test Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: update .gitignore for all test programsLeonid Rosenboim2013-01-161-5/+14
|
* tests: fix missing array_size() includeDavid Lamparter2012-11-031-0/+1
| | | | | | * tests/test-sig.c: add #include "lib/memory.h" to get array_size() Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: reorder libraries to address linker errorAvneesh Sachdev2012-11-021-5/+5
| | | | | | | | | | | | | | The linker on some systems (for example, Ubuntu 12.04 LTS x86_64) appears to be sensitive to the order in which libraries are specified. On these systems, if a library 'A' depends on a library 'B', it has to be specified before 'B' when linking an executable. * zebra/Makefile.am: Make sure LIBCAP comes after libzebra. * tests/Makefile.am: Ensure libm comes after libbgp. Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: use array_size() helper macroBalaji.G2012-10-251-1/+1
| | | | | | | | Use the array_size() helper macro. Replaces several instances of local macros with the same definition. Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/table: add route_table_get_next() and iteratorAvneesh Sachdev2012-09-263-1/+559
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/table.[ch] - Add a function (route_table_get_next()) to get the route_node in a tree that succeeds a given prefix in iteration order. This allows one to reliably walk nodes in a tree while allowing modifications, and is useful for achieving scale and performance. Other approaches are also possible -- the main plus point of this one is that it does not require any state about the walk to be maintained in the table data structures. - Add an iterator for walking the nodes in a tree. This introduces a new structure (route_table_iter_t) and the following main functions. route_table_iter_init() route_table_iter_pause() route_table_iter_next() route_table_iter_cleanup() The iterator normally uses node pointers and the existing route_next() function to walk nodes efficiently. When an iteration is 'paused' with route_table_iter_pause(), it stores the last prefix processed. The next call to route_table_iter_next() transparently invokes route_table_get_next() with the prefix to resume iteration. * bgpd/bgp_table.[ch] Add wrappers for the new table features described above. * tests/table_test.c Add tests for the new table code. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: allow configure and build in a separate directoryVincent Bernat2012-06-251-1/+1
| | | | | | | | | | | Some .h files in lib/ are autogenerated. The search path should include the build directory and the source directory. They usually match but sometimes, they may be different. For example: $ mkdir build $ cd build $ ../configure $ make
* tests: BGP unit tests to set BGP_OPT_NO_LISTEN so they can runPaul Jakma2012-06-194-1/+5
| | | | | | BGP tests had been broken by auto-creation of listen socket. This allows them to run at least, though at least 1 test seems to have other breakage, aspath_test.