summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-01-14bgpd: fix error response to invalid BGP version numberLeonid Rosenboim
BGP4-ANVL 20.1 ANVL tries to open BGP with version 5 and expects correct notification in response. Quagga sends notification, but with incorrect information in it. The data needs to be a 2-byte value, and for now we respond with 0004 for any peer version other than 4. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-14bgpd: fix a bug in bgp_attr_dupChristian Franke
Commit 558d1fec11749d3257e improved bgp_attr_dup so it would be possible for the caller to provide attr_extra, allowing to use the stack instead of the heap for operations requiring only a short lived attr. However, this commit introduced a bug where bgp_attr_dup wouldn't copy attr_extra at all (but provide a reference to the original) if the caller provided attr_extra. Cc: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-14bgpd: fix a memleak on "set community none"Christian Franke
Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-14zebra: don't overrun afi/safi array boundariesLeonid Rosenboim
zebra was not checking afi/safi values. This was leading to crashes where these values were coming directly from some protocol's on-wire fields. Safeguarding them in zebra is a good start. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-14bgpd: store "no neighbor activate" for IPv4 unicastChristian Franke
If a neighbor was in a peer group for any AFI/SAFI, bgpd would never write a "no neighbor activate" line for IPv4 unicast, so a valid setup like following could be configured, but not saved: router bgp 64600 bgp router-id 198.51.100.1 network 198.51.100.0/24 neighbor peers peer-group neighbor 2001:db8::2 remote-as 64601 no neighbor 2001:db8::2 activate ! address-family ipv6 network 2001:db8:1::/48 neighbor peers activate neighbor peers soft-reconfiguration inbound neighbor 2001:db8::2 peer-group peers exit-address-family ! Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-14bgpd: avoid heap fragmentation in bgp_clear_route_tableJorge Boncompte [DTI2]
In bgp_clear_route_table, moved cleanup code before the allocation of the work queue items. This returns the memory to the system allocator before allocating new and might therefore help avoiding heap fragmentation. * bgp_route.c: (bgp_clear_route_table) moved code blocks. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Reviewed-by: Leonid Rosenboim <Leonid.Rosenboim@windriver.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-14bgpd: fix for leaked struct bgp_adj_[in|out] on peer shutdownJorge Boncompte [DTI2]
If a peer with soft-reconfiguration configured is cleared, the function bgp_clear_route_table() doesn't free the bgp_adj_in and bgp_adj_out structures of route nodes that for some reason, ej. denied by a filter, don't have routes attached "rn->info == NULL". Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Reviewed-by: Leonid Rosenboim <Leonid.Rosenboim@windriver.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-11lib: remove ALL_LIST_ELEMENTS dead code branchDavid Lamparter
ALL_LIST_ELEMENTS is checking node == NULL twice, which is causing a whole slew of false positives in Coverity. In this particular case, addressing this in the code is reasonable; being a macro, this appears all over the place without easy remedy. Acked-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-11zebra: fix netlink NL_PKT_BUF_SIZE高鹏
Change default value of variable NL_PKT_BUF_SIZE to 8192UL. Cf. NLMSG_GOODSIZE definition of linux in include/linux/netlink.h for detail. Previously, on platforms with a page size greater than 8192, if you had added too many interfaces, zebra would not have enough buffer space to get the entire interface list. This resulted in an incomplete interface list. From: 高鹏 <gpstrive@gmail.com> [updated to apply after FPM patches] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-11build: Fix build for systems with no /bin/trueHasso Tepper
There are systems with no /bin/true - it might have different path (/usr/bin/true) or even a shell builtin. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-11build: MacOSX needs BSD struct ip_mreq hack tooHasso Tepper
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-11testzebra: pragma weak: detect systems with weak alias and provide alternativeDoug VanLeuven
LLVM clang does not support #pragma weak (bug 3679) on OS X. There are other systems where the #pragma weak has varying syntax. Added m4 file from the autoconf archives: http://www.gnu.org/software/autoconf-archive/ax_sys_weak_alias.html Fix up zebra/*_null.c files to use #pragma weak alias or stub functions if not available. It's incomplete in that the different format #pragma enable easier fixes on need. Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit) using gcc & clang. Tested on linux 64bit. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-11Merge remote-tracking branch 'savannah/sf/ospfd'David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-07ospfd: Remove dup MaxAge LSA floodDinesh G Dutt
Stop additional, unnecessary flooding of MaxAge LSAs. When a MaxAge LSA is installed, if the LSA is prematurely aged or the LSA is not self-originated, the LSA is flushed. This results in a the LSA being flooded a second time and in some cases flooded back to the receiver (unless the receiver is also the advertising router). A MaxAge'd LSA has already been flooded in ospf_flood() as part of the LSA receive processing (ospf_ls_upd). A self-originated LSA will be flooded from the originate/refresh routine. Thus, in the install routine, a MaxAge'd LSA only needs to be added to the MaxAge LSA list. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospfd: Corrected ospfd Type-4/Type-5 ls update handlingVishal Kumar
This fix is for Type-4 LS updates handling at a ABR router where ospf daemon is not distributing Type-4 LS updates with correct LS-Age after learning about a ASBR router in a ospf network. Because of this Type-5 LS updates are not learnt in ospf network. Testing Scenario: This can be re-produced by restarting the ospfd daemon on DUT (mentioned in figure below)before the Hello time interval expires for area 0.0.0.1. ____ _______ ____ _________ | | area: 0.0.0.1 | | area: 0.0.0.0 | | area: 0.0.0.2 | | | R1 |---------------------|DUT/ABR|---------------------| R2 |------------------| R3/ASBR | |____| x.x.x.0/24 |_______| y.y.y.0/64 |____| z.z.z.0/24 |_________| In the above setup when ospfd is restarted (imp:before the Hello interval at R1 expires) and DUT learns about ASBR router R3 (Type-4) in the network from R2, but this ls-update is not propagates in area 0.0.0.1. So R1 never comes to know about the ASBR router in the network, so all the type-5 LS updates coming from R3 are not learnt by R1. Further if we again restart ospfd daemon it starts working fine. With the fix given this issue can be resolved. More Discussion on this is available at: http://www.gossamer-threads.com/lists/quagga/dev/23892 Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospfd: compile warning cleanupsAndrew Certain
A set of patches to clarify some comments as well as cleanup code that was causing warnings. After these patches, the code can be compiled with -Wall -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcast-qual -Wextra -Wno-unused-parameter -Wno-missing-field-initializers (what is current in trunk plus -Wextra -Wno-unused-parameter -Wno-missing-field-initializers). Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospfd: Update nsm_change_state to static scope, as it is not called from ↵Andrew Certain
elsewhere Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospfd: Changed TE instance check to remove -Wtype-limits warningAndrew Certain
Since LEGAL_TE_INSTANCE_RANGE() was being passed an unsigned int, a warning was being thrown due to the compare against >= 0. Since this macro was used only in one place, I removed the macro for an explict compare against a constant for the MAX. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07lib: Changes to VTY string-parsing macros to remove warningsAndrew Certain
The VTY_GET_INTEGER_RANGE macro was being used also just to check the range on a variable that wasn't used (for the "no" version of a VTY command), so I split the macro into two. Also, since the variable is unsigned, if MIN is zero, you get a warning about comparing an unsigned number against 0, giving rise to slightly convoluted logic. Note that the previous two patches were found by the -Wtype-limits and -Wunused-variables warnings. Without the changes to these macros, these warnings are triggered erroneously, making it harder to find the real problems. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospfd: Update comments to be more clear in packet processingAndrew Certain
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospfd: Fixed signed/unsigned masking of negative metricsAndrew Certain
In the original code, negative metrics would be converted successfully by atoi() and then converted to an unsigned int that would always compare successfully against >= 0, leaving a large positive metric in the route map. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospfd: Fixed typo bug in ospf_vty.h:ospf_neighborAndrew Certain
Typo bug. ospf_nbr_nbma_poll_interval_set() was being sent priority instead of interval. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospfd: fix argument parsing for distribute-listChristian Franke
Use the correct argument for the protocol lookup in ospf distribute-list commands. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospf: fix apiserver enableDavid Lamparter
The ospf_apiserver_enable flag was being cleared _after_ the "-a" command-line option set it to 1. Move up the initialisation, so enabling the OSPF API is actually possible. Reported-by: Rosario Mattera <rosmattera@gmail.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospf: Fix type-4 network mask to 0 per RFCLeonard Tracy
The OSPF RFC (2328) states that the network mask field of a type 4 LSA "is not meaningful and must be zero". OSPFD has been setting the mask as /32. This patch changes OSPFD to set the mask to 0 per the RFC Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospf: Reduce MaxAge log levelAyan Banerjee
Reduce the log level for the MaxAge LSA reception when such an LSA does not exist in the database. Signed-off-by: Ayan Banerjee <ayan@cumulusnetworks.com> Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com> Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com> Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospf: Convert MAX_AGE LSA list to treeDinesh Dutt
Store the MaxAge LSA list in a tree instead of a linked list for efficient access. Walking the list can be quite inefficient in some large systems and under certain tests. ospfd maintains the list of LSA's that have been MaxAge'd out in a separate linked list for removal by a remover/walker thread. When a new LSA is to be installed, the old LSA is ejected and when it is ejected, the MaxAge LSA list is traversed to ensure that the old LSA is also removed from this list if it exists on this list. When a large number (> 5K) MaxAge LSAs are bombarding the system, walking this list takes a significant time causing timers to fire and actions to be taken such as expiring neighbors due to expiry of DeadInterval (especially when timer is really low, <= 12s), creating a spiral of instability. By making this MaxAge LSA list be a tree, this problem is mitigated. Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Ayan Banerjee <ayan@cumulusnetworks.com> Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com> Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com> Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospf: forward ref. of areas for "max-metric router-lsa administrative" cmdAyan Banerjee
In the event areas are created at a later point of time with respect to the playback of the "max-metric router-lsa administrative" command, those areas do not get into indefinite max-metric mode. This patch is inteneded to store the configuration and apply it to all future areas that may be created. In the process, some other bugs that were there with respect to restart etc are fixed up. Tested locally to see that the fix works across multiple areas and across multiple restarts. Signed-off-by: Ayan Banerjee <ayan@cumulusnetworks.com> Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com> Reviewed-by: JR Rivers <jrrivers@cumulusnetworks.com> Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07ospf: suppress delete using replacementAyan Banerjee
After a SPF run, OSPF deletes routes that have changed in terms of any metric, type, and/or next-hops and re-adds them. Given that the Zebra-RIB already support replacement semantics, we suppress deletes for routes that will be added back again. This has the following advantages. It reduces the number of IPC messages between OSPF/Zebra. Also, in the current flow, a batch of route deletes were followed by a batch of adds even for say a metric change. With the change, routes are sent as "add" when they are modified. Zebra already implicitly deletes older routes. Signed-off-by: Ayan Banerjee <ayan@cumulusnetworks.com> Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com> Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com> Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2012-12-13build: check for .git in configure.acDavid Lamparter
Don't error out when someone tries using --with-pkg-git-version on something that isn't actually a git checkout (like a dist tarball). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-13build: fix dist tarballDavid Lamparter
automake file lists haven't quite kept up with recent changes, time to fix them up so the dist tarball actually works... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-13build: update ICC warning CFLAGSDavid Lamparter
Intel's icc doesn't accept "-wd <number>" anymore, it's "-wd<number>" these days. But, anyhow, the warnings disabled in Quagga's configure.ac don't seem to appear anywhere at all, so let's just remove the option completely. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-12isisd: fix ipv6 metric endiannessNick Hilliard
the isis ipv6 reachability metric is transmitted in big endian / network format, but isis_spf_process_lsp() does not convert this into host endian format when mucking around with local cost + received metric. This patch fixes this problem and makes received ipv6 metrics work properly on little-endian machines. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-12isisd: verify metrics on metric-style transitionChristian Franke
When switching to metric-style transition, circuit metrics should also be verified to be in the narrow range 0..63. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-12isisd: fix metrics check for metric-style narrowChristian Franke
When switching to narrow metric style, all configured circuits are verified to have a valid narrow style metric. Check te_metric instead of metric_default as the latter is only 8bit wide and may overflow for wide style metrics. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-12isisd: address Coverity warningsDavid Lamparter
this fixes a bunch of issues found by Coverity SCAN and flagged as "high" impact -- although, they're all rather minute issues. * isisd/isis_adjacency.c: one superfluous check, one possible NULL deref * isisd/isis_circuit.c: two prefix memory leaks * isisd/isis_csm.c: one missing break * isisd/isis_lsp.c: one possible NULL deref * isisd/isis_pfpacket.c: one error-case fd leak * isisd/isis_route.c: one isis_route_info memory leak * isisd/isis_routemap.c: one... fnord * isisd/isis_tlv.c: one infinite loop Reported-by: Coverity SCAN Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-12isisd: always join all IS-IS multicast groupsDavid Lamparter
The socket is only created once when an interface is brought up, and the multicast groups were joined according to configuration at that point. This breaks when later switching an interface to another IS-IS level. Since, for a separate conformance issue (ANVL ISIS-6.4), we should be inspecting the destination address anyway, the simplest fix here is to just join all groups unconditionally. There shouldn't be much traffic on these anyway, worst case we might be picking up some unrelated multicast groups due to NIC filter aliasing though... Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Tested-by: Martin Winter <mwinter@opensourcerouting.org>
2012-12-12isisd: save metric-style narrowChristian Franke
isisd defaults to wide metric style. So if narrow metric style is configured, a matching setting should be written to the configuration, allowing a narrow metric-style setting to be saved. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-12isisd: fix spftree_area_del typo causing SEGVDavid Lamparter
spftree_area_del didn't clear the IPv6 L2 spftree due to a simple typo, leading to a SEGV on shutdown when the still-armed timer would try to run an IPv6 L2 SPF calculation with its data free'd already. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-12isisd: drop hellos without supported protocol listDavid Lamparter
isisd should not form adjacencies on receiving an IS-IS Hello without a list of supported protocols (cf. RFC 1195 s4.4 p32 "Maintaining Router Adjacencies") Also fixes memleaks in these error cases. * isisd/isis_pdu.c: improve TLVFLAG_NLPID handling Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Tested-by: Martin Winter <mwinter@opensourcerouting.org>
2012-12-12isisd: refuse adjacencies with our own system IDDavid Lamparter
isisd would form an adjacency with another router despite the system IDs being identical. This would later cause an assertion failure like this: assertion=0x555555596db8 "isis_find_vertex (spftree->paths, id, vtype) == ((void *)0)", file=0x555555596c60 "isis_spf.c", line=515, function=0x555555597900 "isis_spf_add2tent") at log.c:619 which is caused by trying to add a path expected to not exist, but suddenly colliding due to the duplicate system ID. * isis_pdu.c: check for system ID collision on receiving Hello Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-12-12isisd: do not add >63 IP addresses to helloDavid Lamparter
RFC1195 s4.2 "Multiple IP Addresses per Interface" explicitly forbids us from adding multiple tuples of IP addresses, putting a hard cutoff at 63 IP addresses. * isisd/isis_tlv.c: cut off (and return success) at 63 addrs. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Tested-by: Martin Winter <mwinter@opensourcerouting.org>
2012-12-12build: include git infoDavid Lamparter
If enabled with --with-pkg-gitversion on ./configure, this will append git version strings and branch information at the following places: - overall version number: 0.99.21-g0123456 - login motd and show version: tag information + git id + branches Sample output: Hello, this is Quagga (version 0.99.21-g14b49ad-dirty). Copyright 1996-2005 Kunihiro Ishiguro, et al. This is a git build of quagga_0_99_21_release-106-g14b49ad-dirty Associated branch(es): local:master [v2]: fix build without gitinfo (add "else" branch) [v2]: fix for repos without any tags (different git describe output) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-11-30zebra: include intf when sending IPv4 nexthop to FPMAvneesh Sachdev
* zebra/zebra_fpm_netlink.c Change the zebra FPM code to include an interface index when encoding a nexthop even if the protocol only provided a gateway address (e.g, NEXTHOP_TYPE_IPV4). Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-11-30doc: add blurbs on zebra FPM interface and commandsAvneesh Sachdev
Update documentation with some text on the zebra interface to the optional Forwarding Path Manager component, and the related cli commands. Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-11-30zebra: add module to communicate routes to FPMAvneesh Sachdev
Enhance zebra to send routes to the (optional) Forwarding Path Manager component using the interface defined by fpm/fpm.h. * configure.ac - Add --enable-fpm flag. The FPM-related code in zebra is activated only if the build is configured with '--enable-fpm'. - Add HAVE_NETLINK automake conditional. This allows us to conditionally build netlink-dependent C code. * zebra/{rib.h,zebra_rib.c} - Add the 'fpm_q_entries' field to the rib_dest_t structure. This allows dests to be placed on the fpm queue. - Define a couple new rib_dest_t flags that hold FPM-related state. - Invoke the zfpm_trigger_update() function for a route_node whenever the information to be sent to the FPM changes. - rib_can_delete_dest(): Return FALSE if we have to update the FPM about the given dest. This ensures that the dest is not deleted even if there are no ribs hanging off of it. * zebra/zebra_fpm.c This file holds most of the code for interacting with the FPM. - If quagga was configured with '--enable-fpm', periodically try to connect to the FPM. - When the connection comes up, enqueue all relevent dests to the FPM queue. - When the FPM socket is readable, dequeue the next rib_dest_t from the FPM queue, encode it in to a message and send the message to the FPM. - When the connection to the FPM goes down, remove all dests from the FPM queue, and then start trying to connect to the FPM again. - Expose the following new operational commands: show zebra fpm stats clear zebra fpm stats * zebra/zebra_fpm_netlink.c - zfpm_netlink_encode_route(): Function to encode information about a rib_dest_t in netlink format. * zebra/zebra_fpm_private.h Private header file for the zebra FPM module. * zebra/zebra_fpm.h Header file exported by zebra FPM module to the rest of zebra. * zebra/debug.c Add the 'debug zebra fpm' command. * zebra/main.c Initialize the zebra-FPM code on startup. * zebra/misc_null.c Add stub for zfpm_trigger_update(). * zebra/Makefile.am - Include new file zebra_fpm.c in build. - Include zebra_fpm_netlink.c in build if HAVE_NETLINK is defined. * vtysh/Makefile.am Include zebra_fpm.c in list of files that define cli commands. Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-11-30fpm: Add public header for Forwarding Plane ManagerAvneesh Sachdev
The Forwarding Plane Manager (FPM) is an optional component that may be used in scenarios where the router has a forwarding path that is distinct from the kernel, commonly a hardware-based fast path. It is responsible for programming forwarding information (such as routes and nexthops) in the fast path. In Quagga, the Routing Information Base is maintained in the 'zebra' infrastructure daemon. Routing protocols communicate their best routes to zebra, and zebra computes the best route across protocols for each prefix. This latter information comprises the bulk of the Forwarding Information Base. The new header file added by this patch, 'fpm/fpm.h', defines a point-to-point interface using which zebra can update the FPM about changes in routes. The communication takes place over a stream socket. The FPM listens on a well-known TCP port, and zebra initiates the connection. All messages sent over the connection start with a short 'FPM header'. In the case of route add/delete messages, the header is followed by a netlink message. Zebra should send a complete copy of the forwarding table(s) to the FPM, including routes that it may have picked up from the kernel. The FPM interface uses replace semantics. That is, if a 'route add' message for a prefix is followed by another 'route add' message, the information in the second message is complete by itself, and replaces the information sent in the first message. If the connection to the FPM goes down for some reason, the client (zebra) should send the FPM a complete copy of the forwarding table(s) when it reconnects. Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-11-30lib: bring in sys/queue.h from FreeBSD treeAvneesh Sachdev
Bring in sys/queue.h from the FreeBSD tree as lib/queue.h. This header implements lists of various flavors using inline linkages. The imported file corresponds to SVN revision 221843 (url below) and is available under the terms of the New BSD license (3-clause). http://svnweb.freebsd.org/base/head/sys/sys/queue.h?revision=221843 Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-11-30zebra: extern/extract some functions from rt_netlink.cAvneesh Sachdev
* zebra/{rib.h,zebra_rib.c} Add nexthop_type_to_str(), which returns a human-readable string corresponding to a nexthop type. * zebra/rt_netlink.[hc] - Add new header file that exposes some existing and new netlink-related functions from rt_netlink.c to the rest of zebra. addattr32 addattr_l rta_addattr_l nl_msg_type_to_str (new) nl_rtproto_to_str (new) - Use nexthop_type_to_str() instead of the static array 'nexthop_types_desc'. Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-11-30zebra: add iterator for walking all tables in RIBAvneesh Sachdev
* lib/zebra.h Add macro ZEBRA_NUM_OF, which returns the number of elements in a static array. * zebra/rib.h Add the rib_tables_iter_t structure and associated functions, which allow one to walk all tables in the rib. * zebra/zebra_rib.c - Add vrf_id_get_next() to retrieve the first VRF id (if any) that is greater than a given VRF id. - Add rib_tables_iter_next(). Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>