summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_rib.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'current' into dn42David Lamparter2010-02-051-40/+100
|\
| * zebra: rib: support blackhole kernel deletion notificationDavid Lamparter2010-02-051-0/+12
| | | | | | | | | | properly receive the deletion notify for blackhole routes and mark the rib entry.
| * zebra: consider all nexthops when looking for a gateway matchTom Goff2010-02-051-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | * zebra_rib.c: (rib_delete_ipv4 and rib_delete_ipv6) A route is not deleted unless the given gateway is first in the nexthop list. This can leave a route containing an invalid nexthop in the routing table which might later be used. Instead look at all nexthops to find a match. forward-ported to apply on top of Joakim Tjernlund's "don't delete too many routes" by David Lamparter. Signed-off-by: David Lamparter <equinox@diac24.net>
| * zebra: Don't delete too many routes.Joakim Tjernlund2010-02-051-30/+56
| | | | | | | | | | | | | | | | | | | | | | If there are two paralell PtP links to the same router: C * 192.168.101.112/32 is directly connected, p1-4-19-4-20 C>* 192.168.101.112/32 is directly connected, p1-4-17-4-18 and the cable is to one of the ppp links is pulled, Zebra deletes both routes instead of just the one that got yanked. This fixes it to only delete the route to the interface that got yanked. In fact, the whole delete route pattern matching expressions needed a total makeover.
| * zebra: netlink: grab blackhole list from kernelDavid Lamparter2010-02-051-1/+3
| | | | | | | | | | | | | | | | | | support processing of RTM_BLACKHOLE et al. from kernel and dump them into appropriate blackhole rib entries. this exhibits the deletion bug famously fixed by Joakim Tjernlund, if that patch isn't applied blackhole route deletion from kernel doesn't work...
| * zebra: cleanup blackhole supportDavid Lamparter2010-02-051-9/+23
| | | | | | | | | | | | | | | | blackhole support was horribly broken. cleanup by removing blackhole stuff from ZEBRA_FLAG_*, instead add a "zflags" field inside struct rib. introduces support for "prohibit" routes (Linux/netlink only) also clean up blackhole options on "ip route" vty commands.
* | Merge branch 'patches/smallones' into dn42David Lamparter2010-02-051-11/+32
|\ \
| * | zebra: rib update in background and recursive routesStephen Hemminger2010-02-051-11/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now Zebra doesn't support recursive routes correctly when the next hop is a dynamic protocol. Imagine the case where a static route was entered to destination X.X.X.X via Y.Y.Y.Y and a protocol created a route to Y.Y.Y.Y. Any change from that protocol to Y.Y.Y.Y would might require zebra to update it's recursive route. The RIB as is doesn't have the necessary state to do this quickly, and the rib_update() and the resulting meta-queue is slow (2N) with lots of routes. That combined with the incremental updates from protocols makes the whole process potentially N^2. When we enabled it for BGP, the feed to 30min to complete. The comprimise I took was to start a delayed thread when zebra receives an update from protocol. So only a limited number of scans are done. I know this conflicts with your cleanup; but this might provide additional help. The existing meta-queue stuff makes the rib update worse not better.
* | | Merge remote branch 'qpimd/pim' into merged/pimdDavid Lamparter2010-02-041-6/+96
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | Conflicts: configure.ac lib/zebra.h vtysh/vtysh.c
| * | [pim] Initial pim 0.155Everton Marques2009-10-021-6/+96
| | |
* | | zebra: accept "connected" routes from protocols other than ConnectedDavid Lamparter2010-02-031-1/+2
| | | | | | | | | | | | | | | OLSR injects a /32 route for each connected router. treat these routes as connected for route nexthop/interface resolution.
* | | rib: default distance value for new protocols (v2)David Lamparter2010-02-031-1/+5
| |/ |/| | | | | | | | | | | | | 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)
* | zebra: cleanup RIB meta queue codeStephen Hemminger2009-12-091-37/+10
| | | | | | | | | | | | | | * zebra/zebra_rib.c * rib_queue_add(): indent comments and simplify debug code * rib_queue_init(): remove unneeded assert() calls and extra return statements
* | zebra: fix more compiler warningsStephen Hemminger2009-12-081-40/+4
| | | | | | | | | | | | | | | | | | | | | | * 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
* | zebra: fix RIB debug message for IPv6David Ward2009-12-031-4/+4
|/ | | | | | | Apply changes from commit f304cb48f0d7d0ff8f36e7aca8293141a9fa9e60 to rib_queue_add. Also includes spelling fixes.
* [zebra] Silence noisy process_subqChris Caputo2009-07-211-0/+2
| | | | zebra_rib.c: process_subq(): #ifdef out debug code.
* zebra: Static route does not reach kernel.Joakim Tjernlund2009-06-241-2/+4
| | | | | | | | | | | | 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>
* [cleanup] Use correct buffer size for inet_ntop()Stephen Hemminger2009-06-181-17/+17
| | | | | Don't need big buffer 1024 to hold IPV4 (INET_ADDRSTRLEN) or IPv6 (INET6_ADDRSTRLEN) message.
* [zebra] remove incorrect debug messageStephen Hemminger2009-06-181-2/+0
|
* [zebra] Cleanup meta-queue codeStephen Hemminger2009-06-181-64/+70
| | | | | | | | 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.
* [cleanup] Convert XMALLOC/memset to XCALLOCStephen Hemminger2009-06-121-20/+10
| | | | Simple conversion of XMALLOC/memset to XCALLOC
* [zebra] trivia: static qualifiers for metaqStephen Hemminger2008-08-221-4/+5
| | | | | | | | | | 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>
* [zebra] make some data localStephen Hemminger2008-08-221-2/+2
| | | | | | | | 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>
* [zebra] ignore dead routes in RIB updateStephen Hemminger2008-08-221-17/+36
| | | | | | | | | | 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>
* + initial edition of meta-queue for RIB updates processing (bug #431)Denis Ovsienko2008-06-021-27/+133
|
* + fix bug#326 by rib_lookup_and_pushup()Denis Ovsienko2008-02-261-0/+56
|
* [link-detect] Static interface routes should behave properly with link-detect.Andrew J. Schorr2008-01-081-3/+3
| | | | | | | | 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.
* + rib_process() speedup for multi-nexthop route nodesDenis Ovsienko2007-10-041-2/+3
|
* + Minor bugfix: IPv6 prefixes were logged incorrectly in RIB debugging ↵Denis Ovsienko2007-10-031-10/+10
| | | | calls. Fixed.
* Merged own patch for bug #390 (rewrite ↵Denis Ovsienko2007-08-141-12/+17
| | | | zebra/zebra_rib.c:nexthop_active_update())
* Merged own patch for the bug #391 (debugging and comments mostly).Denis Ovsienko2007-08-131-5/+235
|
* [zebra] Add extra debug logging for RIB and RIB queueingPaul Jakma2007-08-061-19/+51
| | | | | | | 2007-08-06 Denis Ovsienko * zebra_rib.c: (general) Add extra debug logging for RIB and RIB queue.
* [zebra] rib loop check for RIB_ENTRY_REMOVED checks wrong varPaul Jakma2007-06-271-1/+1
| | | | | | | | | 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.
* [zebra] Routemap support on received routes, with 'set src' command (linux)Paul Jakma2007-05-021-10/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [zebra] Changes of nexthops of static routes didnt take effectPaul Jakma2006-12-081-10/+12
| | | | | | | | 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.
* [zebra] Bug #268, Fix race between add/delete of routes, sanitise rib queueingPaul Jakma2006-07-271-170/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [zebra] Add test rig code, for testing the zebra RIBPaul Jakma2006-07-271-0/+7
| | | | | | | | | | | | | | 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.
* [zebra] Connected routes must always be added to main tablePaul Jakma2006-07-271-0/+1
| | | | | | | | | | 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
* [zebra] Fix CID #104, check addr for null, and #18, check nexthop type argsPaul Jakma2006-07-021-0/+8
| | | | | | | | | 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.
* [zebra] Fix pauls zebra_rib/rib_process commit mistakes, again.paul2006-01-301-5/+7
| | | | | | | | | 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. ;)
* [zebra] Fix incorrect changes made in RIB metric selection patchquagga_0_99_3_releasepaul2006-01-251-4/+26
| | | | | | | | 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).
* [compiler] miscellaneous trivial compiler warning fixespaul2006-01-191-2/+2
| | | | | | | | | | | | | 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-18 Gunnar Stigen <gunnar.stigen@axxessit.no>paul2006-01-181-4/+17
| | | | * zebra_rib.c: Take interface metric into account.
* 2005-11-14 Paul Jakma <paul.jakma@sun.com>paul2005-11-141-6/+6
| | | | | | | | | * 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.
* * zebra_rib.c: Reduce the height of some staircases. Fixhasso2005-09-211-83/+59
| | | | | rib_delete_ipv6() to match routes in the RIB by their gateway as well as by destination.
* 2005-09-21 Paul Jakma <paul.jakma@sun.com>paul2005-09-211-2/+6
| | | | | | | | | * 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).
* * zebra_rib.c, rib.h: Add distance and metric arguments to thehasso2005-08-271-5/+4
| | | | | | | | | | 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-28 Paul Jakma <paul.jakma@sun.com>paul2005-06-281-42/+42
| | | | | | | * (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-28 Paul Jakma <paul.jakma@sun.com>paul2005-04-281-144/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-14 Paul Jakma <paul.jakma@sun.com>paul2005-03-141-1/+1
| | | | | | | | | | * (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.