summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_rib.c
Commit message (Collapse)AuthorAgeFilesLines
...
| * Last fixes from 6Wind patch.hasso2003-05-251-1/+7
| |
| * Route (reject|blackhole) support from 6Wind patch.hasso2003-05-251-35/+11
| |
| * From: Gilad Arnold <gilad.arnold@terayon.com>paul2003-05-161-3/+3
| | | | | | | | | | | | | | | | | | Subject: [zebra 19084] Re: suspected memory leakage upon static route I believe this is a more complete patch, it also addresses allocating/freeing of nexthop->ifname string buffer (1) using XSTRDUP/XFREE macros (thus correctly updating memory statistics), and (2) for all nexthop->type cases that carry an ifname string.
| * From: Gilad Arnold <gilad arnold at terayon com>paul2003-05-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Subject: [zebra 19080] suspected memory leakage upon static route deletion upon deletion of a static route entry, at the end of zebra/zebra_rib.c/static_delete_ipv4(), there's a call to XFREE to deallocate the 'struct static_ipv4'. However, in the case of a static with ifname as nexthop (type==STATIC_IPV4_IFNAME), this struct holds a pointer to a dynamically allocated ifname string buffer (si->gate.ifname, see its allocation within static_add_ipv4() using XSTRDUP). IMO, the attached patch is required. Notes: the same applies to IPv6 statics as well (fix included in patch); and, I admit I haven't yet tested that, but it seems simple enough to be working... ;->
| * Matthew Grant <grantma@anathoth.gen.nz>patch_z17290_ifupstaticfixpaul2003-01-221-1/+19
| | | | | | | | | | | | Subject: [zebra 17290] [PATCHES] - Fixes for problems in 0.93b Added ifupstaticfix
| * Initial revisionpaul2002-12-131-0/+2199
|
* Fix management of route changesStephen Hemminger2008-07-241-27/+45
| | | | | | | | Earlier changes to route management caused any route change to cause the whole RIB to marked as changed. This then causes route flapping. Fix by being more selective about what changes get flagged. Bugfix 3488
* Only set ifindex on set passStephen Hemminger2008-07-231-2/+2
| | | | This makes code work like comments and probable original design.
* Remove routes from FIB.Stephen Hemminger2008-07-171-17/+37
| | | | | | | | Earlier commit for Bug 3434 caused removed routes not to be marked as SELECTED. This caused them not to be removed. Fix is to always check both flags. Bugfix 3479
* Handle state transistions when there are multiple nexthopsStephen Hemminger2008-07-171-63/+53
| | | | | When multipath is being used, the state of one nexthop maybe down, but another one may be up.
* Update recursive route when nexthop changesStephen Hemminger2008-07-161-4/+7
| | | | | | | | This includes two fixes. First entries that are marked for removal should not be used (clear SELECTED flag). Also, when recursive route changes, the CHANGED flag needs to be set to force update. Bugfix 3434
* Update RIB/FIB on recursive route state changesStephen Hemminger2008-07-151-37/+50
| | | | | | | | If a link state change event causes a different nexthop, then the RIB (and FIB) need to be updated. Solved by forcing the CHANGED flag. This code could be rearranged to be cleaner in future. Bugfix 3434
* Rescan for next hops after static route changeStephen Hemminger2008-07-091-0/+9
| | | | | Bugfix 3433, 3434 Need to rescan for recursive routes after any change to static route.
* active static route changes for ipv6Stephen Hemminger2008-07-071-11/+17
| | | | | This is the IPV6 analog to earlier changes to IPV4 static route management.
* Correctly identify/manage all connected static routesStephen Hemminger2008-07-051-10/+17
| | | | | | | Need to handle all the different flavors of connected routes in linkstate management Bugfix: 2904, 3416
* Make some rib data structures privateStephen Hemminger2008-07-051-2/+2
| | | | | The route_info table can be static const, and the vrf_table can be static.
* Fix compiler warningsStephen Hemminger2008-05-281-3/+8
| | | | | | | | To eliminate compiler warnings * comment out unused code * fix printf formats * remove always true expression * initialize variables
* Manage link state on non-connected static routesStephen Hemminger2008-05-131-1/+2
| | | | | | | For static routes, go through same logic to check the state of the nexthop to see if the route should be activated or not. Bug fix for 2708
* Merge branch 'glendale' into hollisterStephen Hemminger2008-04-291-2/+45
|\
| * Check nexthop statusStephen Hemminger2008-04-281-20/+20
| | | | | | | | | | | | Need to check if next hop is interface and if so then only mark route active is interface is active. This addresses some of the problems with static routes when interface goes down.
| * Check nexthop for internal routesStephen Hemminger2008-04-261-0/+22
| | | | | | | | | | | | Check if nexthop is active when doing RIB update. This should fix issues with static routes staying active after link going down.
| * mark static routes as inactive when link is downStephen Hemminger2008-04-241-2/+23
| | | | | | | | | | | | When link becomes unavailable, unselect any routes that use that link as the next hop. This keeps routing protocols from propogating routes these routes and greating black holes.
* | Merge branch 'upstream' into hollywoodTom Grennan2008-04-101-0/+56
|\ \ | |/ |/| | | | | | | | | Conflicts: ChangeLog zebra/zebra_rib.c
| * + fix bug#326 by rib_lookup_and_pushup()pilot2008-02-261-0/+56
| |
| * [link-detect] Static interface routes should behave properly with link-detect.ajs2008-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.
* | fix for static interface and static nexthop routes for quagga. Now respects ↵Michael Larson2008-01-041-3/+3
|/ | | | | | cable pull (IFF_RUNNING) events and admin (IFF_UP) events. On false for either event pulls routes from rib, and on true reinserts these back into kernel fib.
* + rib_process() speedup for multi-nexthop route nodespilot2007-10-041-2/+3
|
* + Minor bugfix: IPv6 prefixes were logged incorrectly in RIB debugging ↵pilot2007-10-031-10/+10
| | | | calls. Fixed.
* Merged own patch for bug #390 (rewrite ↵pilot2007-08-141-12/+17
| | | | zebra/zebra_rib.c:nexthop_active_update())
* Merged own patch for the bug #391 (debugging and comments mostly).pilot2007-08-131-5/+235
|
* [zebra] Add extra debug logging for RIB and RIB queueingpaul2007-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 varpaul2007-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)paul2007-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 effectpaul2006-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 queueingpaul2006-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 RIBpaul2006-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 tablepaul2006-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 argspaul2006-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.
* 2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-12-071-9/+9
| | | | * *.c: Change level of debug messages to LOG_DEBUG.