summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
AgeCommit message (Collapse)Author
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.
2004-12-072004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* *.c: Change level of debug messages to LOG_DEBUG.
2004-10-12Some compiler warnings fixes and fix for bugzilla #119.hasso
2004-10-07Fix warnings. Didn't even look at files not compiled in Linux though.hasso
2003-12-23Merge isisd into the Quagga's framework:jardin
- add privs support - use misc quagga's definitions - make it compile"able" - fix segfault cases related to hostname() - add debug isis xxx command This patch has been approved by Paul Jakma.
2003-11-022003-11-02 Krzysztof Oledzki <oleq@ans.pl>paul
* zebra/zebra_rib.c: Revert patch (dating from zebra.org) which caused zebra to read all routes in all tables, rather than just the main table. See [quagga-dev 280].
2003-10-282003-10-27 Gilad Arnold <gilad.arnold@terayon.com>paul
* zebra/zebra_rib.c: (nexthop_active_update) Check for multipath limit when setting changed flag to avoid spurious changes. (static_install_ipv{4,6}) dont uninstall by default, might not be required - avoid spurious uninstalls. (static_uninstall_ipv{4,6}) only uninstall the route if its actually FIB route.
2003-09-292003-09-29 Gilad Arnold <gilad.arnold@terayon.com>paul
* zebra/zebra_rib.c: Fix possible dangling reference to rib route_nodes - unlock it the appropriate number of times. (twice, because of the implicit lock). see [quagga-dev 251].
2003-07-152003-07-15 Paul Jakma <paul@dishone.st>paul
* lib/version.h: add ZEBRA_URL (unused for now) * lib/vty.c: CMD_ERR_NOTHING_TODO when reading conf file should not be fatal. slight reformating. * ospfd/ospf_zebra.c: ignore reject/blackhole routes if zebra sends these type of routes. probably should be a new type of route to allow daemons to more easily choose whether to redistribute them - rathen than just a flag (eg for reject/blackhole). reorder the is_prefix_default test for ZEBRA_IPV4_ROUTE_DELETE to avoid the inverted test - slightly more readable. * redhat/zebra.spec.in: Add ospfapi port to services file, if with_ospfapi. * zebra/rib.h: Change nexthop types to an enum. * zebra/rt_netlink.c: run it through indent -nut. Add nexthop_types_desc[] descriptive array for nexthop types. (netlink_route_multipath) debug statements indicate which branch they are in and print out nexthop type. * zebra/zebra_rib.c: slight reformatting. * zebra/zebra_vty.c: Pass ZEBRA_FLAG_BLACKHOLE flag to static_add_ipv4() if Null0 route is configured. print out Null0 if STATIC_IPV4_BLACKHOLE route, and ignore flags (shouldnt be possible to set flags from vty) for config and show route.
2003-06-192003-06-19 Vladimir Ivaschenko <hazard@francoudi.com>paul
* zebra/rt_netlink.c: Debug statements added to netlink_route_multipath() * zebra/zebra_rib.c: If route has a gateway, delete only existing route with that specified gateway.