summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
AgeCommit message (Collapse)Author
2012-05-02lib, zebra: extend use of sockunion2ip macroJorge Boncompte [DTI2]
* lib/sockunion.c, * zebra/zebra_rib.c: replace ->sin.sin_addr.s_addr with sockunion2ip Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> [reworded commit message] Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-20Revert "zebra: clean up client routes when client goes away"David Lamparter
This reverts commit af56d404cd56d94ad3b2ec3f159650eb72baef0a, which was accidentally duplicating functionality from commit 2ea1ab1 "zebra: ZEBRA_HELLO and mopping up routes (BZ#448)" Conflicts: zebra/zebra_rib.c Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-11Merge quagga mainline into the google ISIS code.Avneesh Sachdev
The steps were: $ git checkout google-is-is $ git merge quagga $ git checkout google-is-is -- isisd # Resolve conflicts in the following: lib/md5.h zebra/rt_netlink.c zebra/zebra_rib.c zebra/zserv.c Note that the content in the isisd directory is left unchanged in the merge. As a result, changes made to isisd as part of the following commits on the quagga mainline are dropped. # 8ced4e82 is the merge base, e96b3121 is the current quagga master $ git log --oneline --reverse 8ced4e82..e96b3121 -- isisd 5574999 isisd: fix crash on "no router isis" (BZ#536) 8998075 isisd: raise hello rate for DIS (BZ#539) 306ca83 isisd: include hash.h, not hash.c b82cdeb delete CVS keywords 2f65867 isisd: indent longopts array b511468 quagga: option "-z" ("--socket <path>") added 05e54ee build: delete .cvsignore files b4e45f6 fix zebra protocol after MP-BGP changes 7fd6cd8 isisd: fix circuit state machine 907fd95 isisd: send proper LSP after DIS election d034aa0 isisd: fix wrong next-hops from SPF c25eaff isisd: unexpected kernel routing table (BZ#544) e6b03b7 isisd: implement MD5 circuit authentication
2012-04-08zebra: clean up client routes when client goes awayJosh Bailey
* zebra/zebra_rib.c: Add code to clean up routes added by a client (as identfied by 'rib type'). * zebra/zserv.[ch]: Maintain the type of the routes added by a client on the 'zserv' structure -- assume that a given client uses a single route type for now. Clean up routes from a client when the client goes away (in zebra_client_close()). From: Josh Bailey <joshb@google.com> Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-07zebra: add more logs/asserts to rib work queue codeSubbaiah Venkata
* zebra/zebra_rib.c: (rib_queue_add, rib_queue_init) Add some more logs and asserts. From: Subbaiah Venkata <svenkata@google.com> Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-07zebra: read multipath routes and hw addr from netlinkJosh Bailey
* zebra/rt_netlink.c: - Pick up the hardware address of an interface when we receive a netlink link change message. Extract code for parsing the link-layer hardware address into a new function so we can reuse it. - netlink_routing_table(): Update to handle multipath routes. - netlink_route_change(): Update to handle multipath routes. Fix problem where the metric was not being read out. * zebra/zebra_rib.[ch]: Extern nexthop_ipv4_ifindex_add() -- it is now called from the netlink code. From: Josh Bailey <joshb@google.com> Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-03-25babeld: Initial import, for Babel routing protocol.Paul Jakma
* Initial import of the Babel routing protocol, ported to Quagga. * LICENCE: Update the original LICENCE file to include all known potentially applicable copyright claims. Ask that any future contributors to babeld/ grant MIT/X11 licence to their work. * *.{c,h}: Add GPL headers, in according with the SFLC guidance on dealing with potentially mixed GPL/other licensed work, at: https://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
2012-01-23zebra: IPv6 MP-BGP Routes addition and deletionG.Balaji
This patch contains the following: 1. Addition of IPv6 SAFI_MULTICAST BGP routes into the RTM's RIB. 2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the RTM's RIB.
2012-01-23zebra: IPv4 MP-BGP Routes addition and deletionG.Balaji
This patch contains the following: 1. Addition of IPv4 SAFI_MULTICAST BGP routes into the RTM's RIB. 2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the RTM's RIB.
2012-01-02zebra: fix ifindex test condition (BZ#487)Matthias Ferdinand
When the same ip address is used on several interfaces, and one of them gets deleted (or equivalent: set to down and then address removed), rib_delete_ipv[46] will also remove the connected route from other interfaces. rib_delete_ipv[46] is called twice when an interface is deleted: - for the "ifdown" event - for the address removal (note: this may be specific to the netlink interface of linux) The second call does not find the connected route to that same ifindex anymore, but deletes similar connected routes to any other ifindex instead. Reason: the ifindex check is on the same level as the check for ZEBRA_ROUTE_CONNECT/NEXTHOP_TYPE_IFINDEX. If everything matches except for the ifindex, the "else" part (intended for different route types) is executed, thus removing the route from the wrong interface. fix: move ifindex check inside the "then" part of the check for ZEBRA_ROUTE_CONNECT/NEXTHOP_TYPE_IFINDEX. Now connected routes to other ifindexes will not spill over to the "else" part for different route types anymore.
2012-01-02zebra: ZEBRA_HELLO and mopping up routes (BZ#448)Vyacheslav Trushkin
ZEBRA_HELLO message is used by routing daemons to inform zebra what type of routes daemon will be announcing to zebra. Also zebra uses route_type_oaths array to track which daemon announces which protocol. Zebra mops up routes if daemon didn't for some reason.
2011-12-13rib: default distance value for new protocols (v2)David Lamparter
adding protocols and forgetting to update zebra_rib.c currently causes a beyond end of array access for the default distance value. fix by making 150 the default distance for unknown routing protocols. 150 is higher than all other IGPs but lower than iBGP (200)
2009-12-09zebra: cleanup RIB meta queue codeStephen Hemminger
* zebra/zebra_rib.c * rib_queue_add(): indent comments and simplify debug code * rib_queue_init(): remove unneeded assert() calls and extra return statements
2009-12-08zebra: fix more compiler warningsStephen Hemminger
* zebra/zebra_rib.c * nexthop_active_update(): make local int vars unsigned * nexthop_active_check(): return unsigned for consistency * rib_dump(): cast time in printf format * vrf_free(): remove unused function * vrf_lookup_by_name(): idem * rib_if_up(): idem * rib_if_down(): idem
2009-12-03zebra: fix RIB debug message for IPv6David Ward
Apply changes from commit f304cb48f0d7d0ff8f36e7aca8293141a9fa9e60 to rib_queue_add. Also includes spelling fixes.
2009-07-21[zebra] Silence noisy process_subqChris Caputo
zebra_rib.c: process_subq(): #ifdef out debug code.
2009-06-24zebra: Static route does not reach kernel.Joakim Tjernlund
A static route like below: ip route 172.16.1.0/30 192.168.101.162 11 does not move properly to a new interface when the interface used goes down. Zebra reports that it have moved but kernel isn't informed so the route is lost. * zebra_rib.c: (nexthop_active_update) if ifindex has changed, then the route should be considered to have changed. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
2009-06-18[cleanup] Use correct buffer size for inet_ntop()Stephen Hemminger
Don't need big buffer 1024 to hold IPV4 (INET_ADDRSTRLEN) or IPv6 (INET6_ADDRSTRLEN) message.
2009-06-18[zebra] remove incorrect debug messageStephen Hemminger
2009-06-18[zebra] Cleanup meta-queue codeStephen Hemminger
Do some cleanup work on recently added meta-queue code: * use table rather than switch * indent with quagga standard indentation * since meta_queue_new is only used at initialization allocation failure should be fatal.
2009-06-12[cleanup] Convert XMALLOC/memset to XCALLOCStephen Hemminger
Simple conversion of XMALLOC/memset to XCALLOC
2008-08-22[zebra] trivia: static qualifiers for metaqStephen Hemminger
2008-08-17 Stephen Hemminger <stephen.hemminger@vyatta.com> * zebra_rib.c: (process_subq) mark static (rib_meta_queue_add) ditto (meta_queue_new) ditt Signed-off-by: Paul Jakma <paul@quagga.net>
2008-08-22[zebra] make some data localStephen Hemminger
2008-06-17 Stephen Hemminger <stephen.hemminger@vyatta.com> * zebra_rib.c: static qualifier on local data Signed-off-by: Paul Jakma <paul@quagga.net>
2008-08-22[zebra] ignore dead routes in RIB updateStephen Hemminger
2008-08-17 Stephen Hemminger <stephen.hemminger@vyatta.com> * zebra_rib.c: When doing a RIB update, routes in process of removal should be ignored. This fixes bugs where a route is removed but a recursive route is not changed. Signed-off-by: Paul Jakma <paul@quagga.net>
2008-06-02+ initial edition of meta-queue for RIB updates processing (bug #431)Denis Ovsienko
2008-02-26+ fix bug#326 by rib_lookup_and_pushup()Denis Ovsienko
2008-01-08[link-detect] Static interface routes should behave properly with link-detect.Andrew J. Schorr
2008-01-08 Michael Larson <mike@vyatta.com> * zebra_rib.c: (nexthop_active_check) Replace if_is_up with if_is_operative to solve problems with static interface routes not behaving properly with link-detect.
2007-10-04+ rib_process() speedup for multi-nexthop route nodesDenis Ovsienko
2007-10-03+ Minor bugfix: IPv6 prefixes were logged incorrectly in RIB debugging ↵Denis Ovsienko
calls. Fixed.
2007-08-14Merged own patch for bug #390 (rewrite ↵Denis Ovsienko
zebra/zebra_rib.c:nexthop_active_update())
2007-08-13Merged own patch for the bug #391 (debugging and comments mostly).Denis Ovsienko
2007-08-06[zebra] Add extra debug logging for RIB and RIB queueingPaul Jakma
2007-08-06 Denis Ovsienko * zebra_rib.c: (general) Add extra debug logging for RIB and RIB queue.
2007-06-27[zebra] rib loop check for RIB_ENTRY_REMOVED checks wrong varPaul Jakma
2007-06-25 Denis Ovsienko * zebra_rib.c: (rib_add_ipv4_multipath) Loop through RIB is using 'same' variable, but RIB_ENTRY_REMOVED check is testing the constant 'rib' variable, fix. Impact unknown at this point.
2007-05-02[zebra] Routemap support on received routes, with 'set src' command (linux)Paul Jakma
2007-05-01 David L Stevens <dlstevens@us.ibm.com> * (general) These changes collectively add route-map and prefix-list support to zebra and fix a bug in "show route-map" (with no argument). * doc/main.texi: added route-map, prefix-list, ip protocol and set src documentation * lib/command.h: added PROTOCOL_NODE type * lib/log.c: (proto_name2num) new function, protocol name to number translation. * lib/routemap.c: (vty_show_route_map) fixed "show route-map" without route-map name * lib/routemap.h: added RMAP_ZEBRA type * lib/zebra.h: added proto_name2num() prototype * vtysh/extract.pl.in: added VTYSH_ZEBRA flag for route-map and plist * vtysh/Makefile.am: added zebra_routemap.c * vtysh/vtysh.h: added VTYSH_ZEBRA flag to VTYSH_RMAP * zebra/connected.c: (connected_up_ipv4) added src preference argument to rib_add_ipv4() * zebra/kernel_socket.c: (rtm_read) ditto * zebra/main.c: added prefix list initialization * zebra/Makefile.am: added zebra_routemap.c source file * zebra/rib.h: added generic address union "g_addr" and use in existing places that had an explicit union. Added "src" to struct nexthop. Added preferred src arg to nexthop_ipv4_add and rib_add_ipv4. * zebra/rt_netlink.c: (netlink_routing_table) set preferred source on netlink messages. (netlink_route_change) ditto (netlink_route_multipath) ditto. * zebra/rtread_getmsg.c: (handle_route_entry) added (NULL) src to rib_add_ipv4() call. * zebra/rtread_proc.c: (proc_route_read) ditto * zebra/zebra_rib.c: (nexthop_ipv4_add) add src argument. (nexthop_ipv4_ifindex_add) ditto (rib_add_ipv4) ditto (nexthop_active_check) Add route-map processing. * zebra/zebra_routemap.c: new file for zebra route-map commands. * zebra/zebra_vty.c: (ip_protocol_cmd) Apply route-map to protocol (vty_show_ip_route_detail) added "src" printing (vty_show_ip_route) ditto (show_ip_protocol_cmd) new command, list routemaps. (config_write_protocol) write out routemap protocl config. (zebra_vty_init) Install the new routemap protocol commands. * zebra/zserv.c: (zread_ipv4_add) added (NULL) src arg (zebra_init) init zebra route-maps. * zebra/zserv.h: add zebra_route_map_init
2006-12-08[zebra] Changes of nexthops of static routes didnt take effectPaul Jakma
2006-12-08 Piotr Chytla <pch@packetconsulting.pl> * zebra_rib.c: (static_install_ipv{4,6}) Case where existing RIB is updated must explicitely rib_addqueue the route_node, to ensure the update actually takes effect.
2006-07-27[zebra] Bug #268, Fix race between add/delete of routes, sanitise rib queueingPaul Jakma
2006-07-27 Paul Jakma <paul.jakma@sun.com> * rib.h: (struct rib) Add a route_node rn_status flag field, this has to be copied every time head RIB of a route_node changes. Remove the rib lock field, not needed - see below. Add a status field for RIB-private flags. * zebra_rib.c: Add a global for the workqueue hold time, useful for testing. (general) Fix for bug #268. Problem originally detailed by Simon Bryden in [quagga-dev 4001]. Essentially, add/delete of a RIB must happen /before/ the queue. Best-path selection (ie rib_process) and reaping of freed RIBs can then be done after queueing. Only the route_node is queued - no important RIB state (i.e. whether a RIB is to be deleted) is queued. (struct zebra_queue_node_t) Disappears, no longer need to track multiple things on the queue, only the route_node. (rib_{lock,unlock}) removed, RIBs no longer need to be refcounted, no longer queued. (rib_queue_qnode_del) Removed, deleted RIBs no longer deleted via the queue. (rib_queue_add_qnode) deleted (rib_queue_add) Only the route_node is queued for best-path selection, we can check whether it is already queued or not and avoid queueing same node twice - struct rib * argument is not needed. (rib_link/unlink) (un)link RIB from route_node. (rib_{add,del}node) Front-end to updates of a RIB. (rib_process) Reap any deleted RIBs via rib_unlink. Unset the route_node 'QUEUED' flag. (General) Remove calls to rib_queue_add where add/del node was called - not needed, update calls where not. Ignore RIB_ENTRY_REMOVEd ribs in loops through route_nodes
2006-07-27[zebra] Add test rig code, for testing the zebra RIBPaul Jakma
2006-07-27 Paul Jakma <paul.jakma@sun.com> * {ioctl,kernel}_null.c: Dummy/Null kernel method implementations, useful for testing zebra code that calls such methods. * {redistribute,misc}_null.c: Dummy/Null methods, as above. But for zclient, and for various misc functions. * test_main.c: Test harness for zebra, currently just to test the RIB. * Makefile.am: Build testzebra using above. * zebra_rib.c: Add a global for the workqueue hold time, useful for testing.
2006-07-27[zebra] Connected routes must always be added to main tablePaul Jakma
2006-07-27 Rumen Svobodnikov <rumen@telecoms.bg> * connected.c: (connected_up_ipv4) interface connected routes always go to table main (or otherwise they cannot be used by linux as nexthops) * zserv.c: (zread_ipv4_add) send route to the correct routing table * zebra_rib.c (static_install_ipv4) set routing table
2006-07-02[zebra] Fix CID #104, check addr for null, and #18, check nexthop type argsPaul Jakma
2006-07-02 Paul Jakma <paul.jakma@sun.com> * rt_netlink.c: (netlink_interface_addr) Fix CID #104, can not proceed if addr is NULL. * zebra_rib.c: (static_add_ipv6) Fix CID #18, double check required arguments are supplied for the given nexthop type.
2006-01-30[zebra] Fix pauls zebra_rib/rib_process commit mistakes, again.paul
2006-01-30 Paul Jakma <paul.jakma@sun.com> * zebra_rib.c: (rib_process) Fourth time lucky on this jinxed commit, last commit had a hole that could allow connected route selection to escape beyond the connected route logic. This time I cross-checked with Gunnar first. ;)
2006-01-25[zebra] Fix incorrect changes made in RIB metric selection patchpaul
2006-01-25 Gunnar Stigen <gunnar.stigen@axxessit.no> * zebra_rib.c: (rib_process) Application of Gunnar's earlier metric selection RIB change included incorrect tidy-ups made by commiter. Fix. (NB: any errors here are again due to paul).
2006-01-19[compiler] miscellaneous trivial compiler warning fixespaul
2006-01-19 Paul Jakma <paul.jakma@sun.com> * (general) various miscellaneous compiler warning fixes. Remove redundant break statements from switch clauses which return. return from main, not exit, cause it annoys SOS. Remove stray semi-colons which cause empty-statement warnings. * zebra/main.c: (sighup) remove private declaration of external function.
2006-01-182006-01-18 Gunnar Stigen <gunnar.stigen@axxessit.no>paul
* zebra_rib.c: Take interface metric into account.
2005-11-142005-11-14 Paul Jakma <paul.jakma@sun.com>paul
* zebra_rib.c: (rib_process) convert to new workqueue specs and shut up gcc, which complains about cast from void via function parameters, for some dumb reason. Do the cast inside the function instead. (rib_queue_qnode_del) ditto. (rib_queue_init) no need for the casts anymore.
2005-09-21 * zebra_rib.c: Reduce the height of some staircases. Fixhasso
rib_delete_ipv6() to match routes in the RIB by their gateway as well as by destination.
2005-09-212005-09-21 Paul Jakma <paul.jakma@sun.com>paul
* zebra_rib.c: (static_uninstall_ipv{4,6}) Fix regression wrt removal of static routes with multiple-hops introduced with the workqueue conversion. We should free the relevant nexthop and then get rib_process to run, otherwise we just get same static route back again (with no way to unconfigure it, because its already deleted from configuration).
2005-08-27 * zebra_rib.c, rib.h: Add distance and metric arguments to thehasso
rib_add_ipv6() function so that IPv6 routes in RIB can have correct metric. No IPv6 routing daemon uses distance yet though. * zserv.c, connected.c, kernel_socket.c, rt_netlink.c, rtread_proc.c,zserv.c: Pass metric and distance info to the rib_add_ipv6(). Forwardport from stable branch.
2005-06-282005-06-28 Paul Jakma <paul.jakma@sun.com>paul
* (global) Extern and static'ification, with related fixups of declarations, ensuring files include their own headers, etc. if_ioctl.c: (interface_info_ioctl) fix obvious arg mis-order in list loop
2005-04-282005-04-28 Paul Jakma <paul.jakma@sun.com>paul
* rib.h: (struct rib) Add lock field for refcounting. * zserv.h: (struct zebra_t) Add a ribq workqueue to the zebra 'master' struct. * zserv.c: (zread_ipv4_add) XMALLOC then memset should be XCALLOC. * zebra_rib.c: Clean up refcounting of route_node, make struct rib refcounted and convert rib_process to work-queue. In general, rib's should be rib_addnode'd and delnode'd to route_nodes, and these symmetrical functions will manage the locking of referenced route_node and freeing of struct rib - rather than having users manage each seperately - with much scope for bugs.. (newrib_free) removed and replaced with rib_lock (rib_lock) new function, check state of lock and increment. (rib_unlock) new function, check lock state and decrement. Free struct rib if refcount hits 0, freeing struct nexthop's, as newrib_free did. (rib_addnode) Add RIB to route_node, locking both. (rib_delnode) Delete RIB from route_node, unlocking each. (rib_process) Converted to a work-queue work function. Functional changes are minimal, just arguments, comments and whitespace. (rib_queue_add_qnode) Helper function to setup a ribq item. (rib_queue_add) Helper function, same arguments as old rib_process, to replace in callers of rib_process. (rib_queue_qnode_del) ribq deconstructor. (rib_queue_init) Create the ribq. (rib_init) call rib_queue_init. (remainder) Sanitise refcounting of route_node's. Convert to rib_queue_add, rib_addnode and rib_delnode. Change XMALLOC/memset to XCALLOC. Remove calls to nexthop_delete and nexthop_free.
2005-03-142005-03-14 Paul Jakma <paul.jakma@sun.com>paul
* (global) update all c files to match the lib/vector.h rename of (struct vector).active to max, and vector_max macro to vector_active. * lib/vector.h: Rename to (struct vector).max to slightly less confusing active, for the number of active slots, distinct from allocated or active-and-not-empty. Rename vector_max to vector_active for same reason.