summaryrefslogtreecommitdiff
path: root/ospfd/ospf_interface.c
AgeCommit message (Collapse)Author
2012-07-25ospfd: Optimize and improve SPF nexthop calculationJoakim Tjernlund
Maintain router LSA positions in OSPF interface. Find the OSPF interface in nexthop_calculation using the position in the router LSA. This is possible because the only time nexthop_calculation needs to look up interfaces is when dealing with its own Router LSA. This has the following advantages: - Multiple PtP interfaces with the same IP address between two routers. - Use Unnumbered PtP on just one end of the link. - Faster OI lookup for the OSPF interface and only done once for PtoP links. *ospf_interface.h: (struct ospf_interface) Add storage for storing router LSA position. *ospf_interface.c: (ospf_if_lookup_by_lsa_pos) lookup OSPF I/F in an area using LSA position. *ospf_lsa.c: (router_lsa_link_set) record Router LSA position. *ospf_spf.c: (ospf_spf_next) Count and pass along lsa position. (ospf_nexthop_calculation) Add lsa position argument. call ospf_if_lookup_by_lsa_pos() for OSFP interface handle. Clean up and remove all calls ospf_if_is_configured() the rest. Adjust a few debug logs. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2010-12-08ospfd: Unify router and network LSA refresh logic with general refresherPaul Jakma
* (general) Get rid of the router and network LSA specific refresh timers and make the general refresher do this instead. Get rid of the twiddling of timers for router/network LSA that was spread across the code. This lays the foundations for future, general LSA refresh improvements, such as making sequence rollover work, and having generic LSA delays. * ospfd.h: (struct ospf) Bye bye to the router-lsa update timer thread pointer. (struct ospf_area) and to the router-lsa refresh timer. * ospf_interface.h: Remove the network_lsa_self timer thread pointer * ospf_lsa.h: (struct ospf_lsa) oi field should always be there, for benefit of type-2/network LSA processing. (ospf_{router,network}_lsa_{update_timer,timer_add}) no timers for these more (ospf_{router,network}_lsa_update) more generic functions to indicate that some router/network LSAs need updating (ospf_router_lsa_update_area) update router lsa in a particular area alone. (ospf_{summary,summary_asbr,network}_lsa_refresh) replaced by the general ospf_lsa_refresh function. (ospf_lsa_refresh) general LSA refresh function
2010-12-08ospfd: Remember network LSA sequence numbers across up/downs of an interfacePaul Jakma
* ospf_interface.h: (struct ospf_if_params) add field for saved network LSA seqnum * ospf_interfa.c: (ospf_new_if_params) init network_lsa_seqnum field to initial seqnum - doesnt matter though. * ospf_lsa.c: (ospf_network_lsa_new) check for any saved sequence number, and use if it exists. Save the result back. This should help avoid needless round of LSUpdate/LSRequests when a neighbour has to tell the originator "uhm, i have something newer than that already". * ospf_vty.c: (show_ip_ospf_interface_sub) Show the saved network LSA seqnum
2010-12-08ospfd: interface code should leave network_lsa_self alonePaul Jakma
* ospf_interface.c: (ospf_if_{new,cleanup}) don't touch the network_lsa_self, ISM and NSM take care of cleaning it up if needs be + we want to keep network_lsa_self around when possible for the the seqnum. This shouldn't really make much difference though, particularly as we have a separate sequence number memory mechanism.
2010-12-08ospfd: ospf_if_free can leave dangling references on ISM events - cancel themPaul Jakma
* ospf_interface.c: (ospf_if_free) events with dangling pointers left scheduled can be seriously bad for ospfd's health. Cancel the event.
2009-07-28ospfd: Make ospf_if_lookup_recv_if() find the right unnumbered i/fJoakim Tjernlund
This function will return the interface for the first matching remote address for PtP i/f's. That won't work for multiple unnumbered i/f's as these may all have the same address. Pass in the struct interface pointer, ifp, to find the correct set of oi's to search in. This also reduces the size of the search list, making it faster. * ospfd/ospf_interface.c: Add struct interface * param to ospf_if_lookup_recv_if() to select the right list to search in. * ospfd/ospf_interface.h: ditto. * ospfd/ospf_packet.c: Pass new ifp argument to ospf_if_lookup_recv_if()
2009-07-28ospfd: export ospf_if_table_lookup() and use it in ospf_network_run_interface()Joakim Tjernlund
Makes it possible to run OSPF on multiple PtP interfaces with the same remote address. * ospfd/ospf_interface.c: Export ospf_if_table_lookup(). * ospfd/ospf_interface.h: ditto. * ospfd/ospfd.c: (ospf_network_run_interface) Use ospf_if_table_lookup() to determine whether OSPF is already configured for a subnet and interface.
2009-06-12[cleanup] Convert XMALLOC/memset to XCALLOCStephen Hemminger
Simple conversion of XMALLOC/memset to XCALLOC
2007-09-18+ fix missing arg to zlog_warn()Denis Ovsienko
2007-08-21Bug #362 is fixed now.Denis Ovsienko
2007-04-21[ospfd] Fix bug in 'passive-interface default' behaviorAndrew J. Schorr
2007-04-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * ospf_interface.c: (ospf_if_set_multicast) Fix bug: was testing interface passive status improperly in light of the recent 'passive-interface default' patch. Now need to test OSPF_IF_PASSIVE_STATUS(oi) instead of OSPF_IF_PARAM(oi, passive_interface).
2006-12-12[PtP over ethernet] New peer flag allows much more addressing flexibilityAndrew J. Schorr
2006-12-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * if.h: (struct connected) Add new ZEBRA_IFA_PEER flag indicating whether a peer address has been configured. Comment now shows the new interpretation of the destination addr: if ZEBRA_IFA_PEER is set, then it must contain the destination address, otherwise it may contain the broadcast address or be NULL. (CONNECTED_DEST_HOST,CONNECTED_POINTOPOINT_HOST) Remove obsolete macros that were specific to IPv4 and not fully general. (CONNECTED_PEER) New macro to check ZEBRA_IFA_PEER flag. (CONNECTED_PREFIX) New macro giving the prefix to insert into the RIB: if CONNECTED_PEER, then use the destination (peer) address, else use the address field. (CONNECTED_ID) New macro to come up with an identifying address for the struct connected. * if.c: (if_lookup_address, connected_lookup_address) Streamline logic with new CONNECTED_PREFIX macro. * prefix.h: (PREFIX_COPY_IPV4, PREFIX_COPY_IPV6) New macros for better performance than the general prefix_copy function. * zclient.c: (zebra_interface_address_read) For non-null destination addresses, set prefixlen to equal the address prefixlen. This is needed to get the new CONNECTED_PREFIX macro to work properly. * connected.c: (connected_up_ipv4, connected_down_ipv4, connected_up_ipv6, connected_down_ipv6) Simplify logic using the new CONNECTED_PREFIX macro. (connected_add_ipv4) Set prefixlen in destination addresses (required by the CONNECTED_PREFIX macro). Use CONNECTED_PEER macro instead of testing for IFF_POINTOPOINT. Delete invalid warning message. Warn about cases where the ZEBRA_IFA_PEER is set but no destination address has been supplied (and turn off the flag). (connected_add_ipv6) Add new flags argument so callers may set the ZEBRA_IFA_PEER flag. If peer/broadcast address satisfies IN6_IS_ADDR_UNSPECIFIED, then reject it with a warning. Set prefixlen in destination address so CONNECTED_PREFIX will work. * connected.h: (connected_add_ipv6) Add new flags argument so callers may set the ZEBRA_IFA_PEER flag. * interface.c: (connected_dump_vty) Use CONNECTED_PEER macro to decide whether the destination address is a peer or broadcast address (instead of checking IFF_BROADCAST and IFF_POINTOPOINT). * if_ioctl.c: (if_getaddrs) Instead of setting a peer address only when the IFF_POINTOPOINT is set, we now accept a peer address whenever it is available and not the same as the local address. Otherwise (no peer address assigned), we check for a broadcast address (regardless of the IFF_BROADCAST flag). And must now pass a flags value of ZEBRA_IFA_PEER to connected_add_ipv4 when a peer address is assigned. The same new logic is used with the IPv6 code as well (and we pass the new flags argument to connected_add_ipv6). (if_get_addr) Do not bother to check IFF_POINTOPOINT: just issue the SIOCGIFDSTADDR ioctl and see if we get back a peer address not matching the local address (and set the ZEBRA_IFA_PEER in that case). If there's no peer address, try to grab SIOCGIFBRDADDR regardless of whether IFF_BROADCAST is set. * if_ioctl_solaris.c: (if_get_addr) Just try the SIOCGLIFDSTADDR ioctl without bothering to check the IFF_POINTOPOINT flag. And if no peer address was found, just try the SIOCGLIFBRDADDR ioctl without checking the IFF_BROADCAST flag. Call connected_add_ipv4 and connected_add_ipv6 with appropriate flags. * if_proc.c: (ifaddr_proc_ipv6) Must pass new flags argument to connected_add_ipv6. * kernel_socket.c: (ifam_read) Must pass new flags argument to connected_add_ipv6. * rt_netlink.c: (netlink_interface_addr) Copy logic from iproute2 to determine local and possible peer address (so there's no longer a test for IFF_POINTOPOINT). Set ZEBRA_IFA_PEER flag appropriately. Pass new flags argument to connected_add_ipv6. (netlink_address) Test !CONNECTED_PEER instead of if_is_broadcast to determine whether the connected destination address is a broadcast address. * bgp_nexthop.c: (bgp_connected_add, bgp_connected_delete) Simplify logic by using new CONNECTED_PREFIX macro. * ospf_interface.c: (ospf_if_is_configured, ospf_if_lookup_by_prefix, ospf_if_lookup_recv_if) Simplify logic using new CONNECTED_PREFIX macro. * ospf_lsa.c: (lsa_link_ptop_set) Using the new CONNECTED_PREFIX macro, both options collapse into the same code. * ospf_snmp.c: (ospf_snmp_if_update) Simplify logic using new CONNECTED_ID macro. (ospf_snmp_is_if_have_addr) Simplify logic using new CONNECTED_PREFIX macro. * ospf_vty.c: (show_ip_ospf_interface_sub) Use new CONNECTED_PEER macro instead of testing the IFF_POINTOPOINT flag. * ospfd.c: (ospf_network_match_iface) Use new CONNECTED_PEER macro instead of testing with if_is_pointopoint. And add commented-out code to implement alternative (in my opinion) more elegant behavior that has no special-case treatment for PtP addresses. (ospf_network_run) Use new CONNECTED_ID macro to simplify logic. * rip_interface.c: (rip_interface_multicast_set) Use new CONNECTED_ID macro to simplify logic. (rip_request_interface_send) Fix minor bug: ipv4_broadcast_addr does not give a useful result if prefixlen is 32 (we require a peer address in such cases). * ripd.c: (rip_update_interface) Fix same bug as above.
2006-10-22[ospfd] Add passive-interface default supportPaul Jakma
2006-10-22 Yar Tikhiy <yar@comp.chem.msu.su> * (general) Add support for passive-interface default (with minor edits by Paul Jakma). * ospf_interface.h: Add OSPF_IF_PASSIVE_STATUS macro, looking at configured value, or the global 'default' value, as required. * ospf_interface.c: (ospf_if_new_hook) Leave passive unconfigured per default, allowing global 'default' to take effect for unconfigured interfaces. * ospf_packet.c: (various) use OSPF_IF_PASSIVE_STATUS * ospf_vty.c: (ospf_passive_interface_default) new function, unset passive from all interfaces if default is enabled, as the per-iface settings become redundant. (ospf_passive_interface_update) new func, update passive setting taking global default into account. ({no,}ospf_passive_interface_addr_cmd) Add support for 'default' variant of command. (show_ip_ospf_interface_sub) Update to take global default into account when printing passive status. (ospf_config_write) ditto. * ospfd.c: (ospf_new) set global passive-interface default. * ospfd.h: (struct ospf) Add field for global passive-interface.
2006-07-26[ospfd] Allow ospf_lsa_unlock to NULL out callers' LSA pointers upon freePaul Jakma
2006-07-26 Paul Jakma <paul.jakma@sun.com> * ospf_lsa.{c,h}: (ospf_lsa_unlock) Change to take a double pointer to the LSA to be 'unlocked', so that, if the LSA is freed, the callers pointer to the LSA can be NULLed out, allowing any further use of that pointer to provoke a crash sooner rather than later. * ospf_*.c: (general) Adjust callers of ospf_lsa_unlock to match previous. Try annotate 'locking' somewhat to show which 'locks' are protecting what LSA reference, if not obvious. * ospf_opaque.c: (ospf_opaque_lsa_install) Trivial: remove useless goto, replace with return. * ospf_packet.c: (ospf_make_ls_ack) Trivial: merge two list loops, the dual-loop predated the delete-safe list-loop macro.
2006-06-15[ospfd] Fix multicast membership drop bugPaul Jakma
2006-06-15 Paul Jakma <paul.jakma@sun.com> * Reported by Milan Koci * ospf_interface.h: (struct ospf_if_info) Add reference counts for multicast group memberships. Add various macros to help manipulate/check membership state. * ospf_interface.c: (ospf_if_set_multicast) Maintain the ospf_if_info reference counts, and only actually drop memberships if it hits 0, to avoid losing membership when OSPF is disabled on an interface with multiple active OSPF interfaces. * ospf_packet.c: (ospf_{hello,read}) Use the new macros to check/set multicast membership. * ospf_vty.c: (show_ip_ospf_interface_sub) ditto.
2006-05-12[ospfd] CID #27, fix missing NULL return checkPaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * ospf_interface.c: (ospf_if_exists) Fix missing NULL return check on ospf_lookup, CID #27.
2006-05-04[ospfd] Fix SPF of virtual-linksPaul Jakma
2006-04-24 Paul Jakma <paul.jakma@sun.com> * (general) More Virtual-link fixes, again with much help in testing / debug from Juergen Kammer. Primarily in SPF. * ospf_spf.h: Add guard. ospf_interface.h will include this header. * ospf_interface.h: Modify ospf_vl_lookup definition to take struct ospf as argument, so as to allow for NULL area argument. (struct ospf_vl_data) Remove out_oi, instead add a struct vertex_nexthop, to use as initial nexthop for backbone paths through a vlink. * ospf_interface.c: (ospf_vl_lookup) Modified to allow NULL area to be passed to indicate "any" (first) area. Add extra debug. (ospf_vl_set_params) vl_oi -> nexthop. Add extra debug. (ospf_vl_up_check) Fix debug, inet_ntoa returns a static buffer.. * ospf_route.c: (ospf_intra_add_router) Vlinks dont go through backbone, don't bother checking. * ospf_spf.c: (static struct list vertex_list) Record vertices that will need to be freed. (cmp) Order network before router vertices, as required, wasn't implemented. (vertex_nexthop_free) Mild additional robustness check. (vertex_parent_free) Take void argument, as this function is passed as list deconstructor for vertex parent list. (ospf_vertex_new) More debug. Set deconstructor for parent list. Track allocated vertices on the vertex_list. (ospf_vertex_free) Get rid of the tricky recursive cleanup of vertices. Now frees only the given vertex. (ospf_vertex_add_parent) Fix assert. (ospf_nexthop_calculation) Fix calculation of nexthop for VLink vertices, lookup the vl_data and use its previously recorded nexthop information. (ospf_spf_calculate) Vertices are freed simply by deleting vertex_list nodes and letting ospf_vertex_free as deconstructor work per-node. (ospf_spf_calculate_timer) Trivial optimisation, leave backbone SPF calculation till last to reduce SPF churn on VLink updates. * ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup (no_ospf_area_vlink_cmd) ditto. (show_ip_ospf_interface_sub) For Vlinks, the peer address is more interesting than the output interface.
2006-04-03[ospfd] Fix virtual-link handling in nbrs route-table, exposed by bug#234 fixPaul Jakma
2006-04-03 Paul Jakma <paul.jakma@sun.com> * (general) Fix issues with handling of Vlinks and entries in the nbrs route-table which were highlighted by the nsm/nbr_self fixes from bug #234. Many thanks to Juergen Kammer for his help and efforts in testing out debug patches to pinpoint the issue. * ospf_interface.c: (ospf_vl_new) Add nbr_self for Vlink. * ospf_neighbor.c: (ospf_nbr_key) new static function, helper to create key in nbrs table for a given nbr. (ospf_nbr_delete) Use ospf_nbr_key. Add an assert() to document an expected state. (ospf_nbr_add_self) Ditto. (ospf_nbr_lookup_by_addr) Add an assert. * ospf_nsm.c: (nsm_kill_nbr) Can never kill the nbr_self psuedo-neighbour.
2006-03-30[ospfd] ignore loopbacks for received interface validationPaul Jakma
2006-03-25 Paul Jakma <paul.jakma@sun.com> * ospf_interface.c: (ospf_if_lookup_recv_if) Ignore loopbacks, we can never ever receive packets on those. Should fix case where CARP is run with address in same subnet as real interface. Problem report and diagnosis thanks to: Landon Fuller <landonf@opendarwin.org>. However, ospf_read() still can't deal deterministically with multiple interfaces in same subnet.
2006-01-11[ospfd] Bug #234. Fix nbr_self reinitialisation after down/up.paul
2006-01-10 Len Sorensen <lennartsorensen@ruggedcom.com> * (general) Bug #234, see also [quagga-dev 3902]. Fix problem with nbr_self not being properly reinitialised when an interface comes up, after having been down. Some re-arrangement done by Paul Jakma, any bugs introduced on top of Len's suggested changes are his. * ospf_neighbor.c: (ospf_nbr_add_self) centralise initialisation of nbr_self parameters here. * ospf_interface.c: (ospf_if_new) deleting initialisation of parameters of nbr_self, just rely on call to ospf_nbr_add_self. (ospf_if_cleanup) ditto. * ospfd.c: (ospf_network_run) ditto.
2005-10-212005-10-21 Paul Jakma <paul.jakma@sun.com>paul
* (general) OSPF fast, sub-second hello and 1s dead-interval support. A warning fix. Millisec support for ospf_timer_dump. Change auto-cost ref-bandwidth to add a comment to write out of config, rather than printing annoying messages to vty on startup. * ospf_dump.c: (ospf_timer_dump) Print out milliseconds too. Callers typically specify a length of 9, so most see millisecs unless they specify the additional length. * ospf_interface.h: (struct ospf_interface) new interface param, fast_hello. * ospf_interface.c: (ospf_if_table_lookup) add brackets, gcc warning fix. (ospf_new_if_params) Initialise fast_hello param. (ospf_free_if_params) Check whether fast_hello is configured. (ospf_if_new_hook) set fast_hello to default. * ospf_ism.h: Wrap OSPF_ISM_TIMER_ON inside do {} while (0) to prevent funny side-effects from its if statement when this macro is used conditionally by other macros. (OSPF_ISM_TIMER_MSEC_ON) new macro, set in milliseconds. (OSPF_HELLO_TIMER_ON) new macro to set hello timer according to whether fast_hello is set. * ospf_ism.c: Update all setting of the hello timer to use either OSPF_ISM_TIMER_MSEC_ON or OSPF_HELLO_TIMER_ON. The former is used when hello is to be sent immediately. * ospf_nsm.c: ditto * ospf_packet.c: (ospf_hello) hello-interval is not checked for mismatch if fast_hello is set. (ospf_read) Annoying nit, fix "no ospf_interface" to be debug rather than a warning, as it can be perfectly normal to receive packets when logical subnets are used. (ospf_make_hello) Set hello-interval to 0 if fast-hellos are configured. * ospf_vty.c: (ospf_auto_cost_reference_bandwidth) annoying nit, don't vty_out if this command is given, it gets tired quick. (show_ip_ospf_interface_sub) Print the hello-interval according to whether fast-hello is set or not. Print the extra 5 millisec characters from (ospf_timer_dump) if fast-hello is configured. (ospf_vty_dead_interval_set) new function, common to all forms of dead-interval command, to set dead-interval and fast-hello correctly. If a dead-interval is given, unset fast-hello, else if a hello-multiplier is set, set dead-interval to 1 and fast-hello to given multiplier. (ip_ospf_dead_interval_addr_cmd) use ospf_vty_dead_interval_set(). (ip_ospf_dead_interval_minimal_addr_cmd) ditto. (no_ip_ospf_dead_interval) Unset fast-hello. (no_ip_ospf_hello_interval) Bug-fix, unset of hello-interval should set it to OSPF_HELLO_INTERVAL_DEFAULT, not OSPF_ROUTER_DEAD_INTERVAL_DEFAULT. (config_write_interface) Write out fast-hello. (ospf_config_write) Write a comment about "auto-cost reference-bandwidth" having to be equal on all routers. Hopefully just as noticeable as old practice of writing to vty, but less annoying. (ospf_vty_if_init) install the two new dead-interval commands. * ospfd.h: Add defines for OSPF_ROUTER_DEAD_INTERVAL_MINIMAL and OSPF_FAST_HELLO_DEFAULT.
2005-10-182005-10-18 Paul Jakma <paul.jakma@sun.com>paul
* (general) SPF memory management cleanup and fix for rare double-free bug. * ospf_spf.h: (struct vertex_parent) New struct to hold parent specific data, eg the backlink and the parent vertex pointer, and point to the appropriate general struct vertex_nexthop. (struct vertex_nexthop) remove parent vertex pointer, so this struct can be shared across vertices. (struct vertex) rename list child to list children. Remove list of nexthops, replace with list of vertex_parents. * ospf_spf.c: (update_stat) trivial, remove cast from void *. (vertex_nexthop_new) remove init of parent - field is gone from struct vertex_nexthop. (ospf_canonical_nexthops_free) Remove the canonical vertex_nexthop memory objects. These are the vertex_nexthops attached to the first level of router vertices from the root. (vertex_parent_new) new function, create a vertex_parent. (vertex_parent_free) ditto, but free it. (ospf_vertex_new) Update to match changes to struct vertex. (ospf_vertex_free) Recursively free a struct vertex and its children. The parent list is used as a reference count. vertex_nexthops must be free seperately, if required. (ospf_vertex_dump) update to match struct vertex changes. Print out backlink of parents too. (ospf_vertex_add_parent) ditto. (ospf_lsa_has_link) update comment. (ospf_nexthop_add_unique) removed, not needed anymore. (ospf_nexthop_merge) ditto. (ospf_spf_consider_nexthop) renamed to ospf_spf_add_parent. Simplified to just create vertex_parent and add it. (ospf_spf_flush_parents) new function, flush out the parent list. (ospf_nexthop_calculation) Take the relevant route_lsa_link as an argument, which simplifies things and removes the need for the hack in ospf_nexthop_add_unique - ospf_spf_next already knew exactly which link the cost calculated was for. Update to match struct vertex changes too. (ospf_spf_next) Don't create a vertex for W unnecessarily, if it's there's a vertex already created for W, use it, and hence there's no need to free it either. Update some manipulation/comparisons of distance to match. Flush the parent list if a lower cost path is found. (ospf_spf_route_free) unused, removed. (ospf_spf_dump) match the struct vertex changes, and dump the ifname if possible. (ospf_spf_calculate) At end of SPF, free the canonical nexthops and call ospf_vertex_free on the root vertex to free the entire tree. * ospf_interface.c: (ospf_vl_set_params) match struct vertex changes. * ospf_route.c: (ospf_intra_route_add) ditto (ospf_route_copy_nexthops_from_vertex) ditto * memtypes.c: (memory_list_ospf) Add MTYPE_OSPF_VERTEX_PARENT.
2005-09-292005-09-29 Alain Ritoux <alain.ritoux@6wind.com>vincent
* ospfd/ospf_vty.c: forece default route LSA to be re_issued whenever cost is changed ( [no] ip ospf area XXX default-cost YYY) Support ignore-mtu option * ospfd/ospfd.h: define OSPF_MTU_IGNORE_DEFAULT * ospfd/ospf_packet.c: support ignore-mtu option * ospfd/ospf_interface.h: field added for skipping MTU check * ospfd/ospf_interface.c: fix memory leak in ospf_crypt_key_delete() Set mtu_ignore field to default value * ospfd/ospf_abr.[ch]: export ospf_abr_announce_network_to_area() * ospfd/ospf_ism.h: add MACRO to convert internal ISM status into SNMP correct values * ospfd/ospf_snmp.c: add sanity check on LSA type in lsdb_lookup_next() convert OSPFIFSTATE internal status into SNMP values
2005-05-182005-05-19 Paul Jakma <paul.jakma@sun.com>paul
* ospf_interface.c: (ospf_if_table_lookup) Fix a serious bug a less serious one. 1: this function is supposed to lookup entries in the oifs ospf_interface route_table and return either an existing oi or NULL to indicate not found, its caller depends on this, yet this function uses route_node_get which /always/ returns a route_node - one is created if none exists. Use route_node_lookup instead. This should fix root cause of the reports of the (ospf_add_to_if) assert being hit. 2: oi's are inserted into this table with prefixlength set to /32 (indeed, it should be a hash table, not a route_table), however prefixlength to lookup was not changed, if no valid entry can be inserted other than /32, then nothng but /32 should be looked up. This possibly only worked by fluke.. Fix confirmed by 2 reporters (one list, one IRC), definitely a backport candidate once it has been incubated in HEAD for a while. Thanks to Patrick Friedel and Ivan Warren for testing.
2005-05-062005-05-06 Paul Jakma <paul.jakma@sun.com>paul
* (general) extern and static qualifiers added. unspecified arguments in definitions fixed, typically they should be 'void'. function casts added for callbacks. Guards added to headers which lacked them. Proper headers included rather than relying on incomplete definitions. gcc noreturn function attribute where appropriate. * ospf_opaque.c: remove the private definition of ospf_lsa's ospf_lsa_refresh_delay. * ospf_lsa.h: export ospf_lsa_refresh_delay * ospf_packet.c: (ospf_make_md5_digest) make *auth_key const, correct thing to do - removes need for the casts later. * ospf_vty.c: Use vty.h's VTY_GET_INTEGER rather than ospf_vty's home-brewed versions, shuts up several warnings. * ospf_vty.h: remove VTY_GET_UINT32. VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX moved to lib/vty.h. * ospf_zebra.c: (ospf_distribute_list_update_timer) hacky overloading of the THREAD_ARG pointer should at least use uintptr_t.
2005-04-072005-04-07 Paul Jakma <paul.jakma@sun.com>paul
* (global): Fix up list loops to match changes in lib/linklist, and some basic auditing of usage. * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES * HACKING: Add notes about deprecating interfaces and commands. * lib/linklist.h: Add usage comments. Rename getdata macro to listgetdata. Rename nextnode to listnextnode and fix its odd behaviour to be less dangerous. Make listgetdata macro assert node is not null, NULL list entries should be bug condition. ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use with for loop, Suggested by Jim Carlson of Sun. Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the "safety" of previous macro. LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to distinguish from the similarly named functions, and reflect their effect better. Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section with the old defines which were modified above, for backwards compatibility - guarded to prevent Quagga using it.. * lib/linklist.c: fix up for linklist.h changes. * ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single scan of the area list, rather than scanning all areas first for INTER_ROUTER and then again for INTER_NETWORK. According to 16.2, the scan should be area specific anyway, and further ospf6d does not seem to implement 16.3 anyway.
2005-04-022005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* if.h: (if_lookup_by_name_len, if_get_by_name_len) New functions. * if.c: (if_lookup_by_name_len, if_get_by_name_len) New functions. (if_get_by_name) Tighten up code. (interface) Use new function if_get_by_name_len. * zclient.c: (zebra_interface_add_read) Use new if_get_by_name_len function. (zebra_interface_state_read) Use new if_lookup_by_name_len function. * kernel_socket.c: (ifm_read) Use new if_lookup_by_name_len function to save a memcpy. * if_ioctl_solaris.c: (interface_list_ioctl) Fix subtle bug with new if_get_by_name_len function. * ospf_interface.c: (ospf_vl_new) Use strnlen to fix call to if_create.
2005-03-292005-03-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* rt_netlink.c: (netlink_link_change) If the status of an operative interface changes (e.g. MTU changes), the client daemons should be notified by calling zebra_interface_up_update. Previously, the information was being updated in zebra's interface structure, but the clients were not notified of changes to an operative interface. * ospf_zebra.c: (ospf_interface_state_up) If the MTU of an operative interface changes, print a debug message and call ospf_if_reset() to simulate down/up on the interface. * ospf_interface.h: Declare new function ospf_if_reset(). * ospf_interface.c: (ospf_if_reset) New function to call ospf_if_down and ospf_if_up for all ospf interfaces attached to an interface.
2005-02-082005-02-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* ospf_interface.h: Improve passive_interface comment. Add new multicast_memberships bitmask to struct ospf_interface to track active multicast subscriptions. Declare new function ospf_if_set_multicast. * ospf_interface.c: (ospf_if_set_multicast) New function to configure multicast memberships properly based on the current multicast_memberships status and the current values of the ospf_interface state, type, and passive_interface status. (ospf_if_up) Remove call to ospf_if_add_allspfrouters (this is now handled by ism_change_state's call to ospf_if_set_multicast). (ospf_if_down) Remove call to ospf_if_drop_allspfrouters (now handled by ism_change_state). * ospf_ism.c: (ospf_dr_election) Remove logic to join or leave the DRouters multicast group (now handled by ism_change_state's call to ospf_if_set_multicast). (ism_change_state) Add call to ospf_if_set_multicast to change multicast memberships as necessary to reflect the new interface state. * ospf_packet.c: (ospf_hello) When a Hello packet is received on a passive interface: 1. Increase the severity of the error message from LOG_INFO to LOG_WARNING; 2. Add more information to the error message (packet destination address and interface address); and 3. If the packet was sent to ospf-all-routers, then try to fix the multicast group memberships. (ospf_read) When a packet is received on an interface whose state is ISM_Down, enhance the warning message to show the packet destination address, and try to update/fix the multicast group memberships if the packet was sent to a multicast address. When a packet is received for ospf-designated-routers, but the current interface state is not DR or BDR, then increase the severity level of the error message from LOG_INFO to LOG_WARNING, and try to fix the multicast group memberships. * ospf_vty.c: (ospf_passive_interface) Call ospf_if_set_multicast for any ospf interface that may have changed from active to passive. (no_ospf_passive_interface) Call ospf_if_set_multicast for any ospf interface that may have changed from passive to active. (show_ip_ospf_interface_sub) Show multicast group memberships.
2004-12-152004-12-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* ospf_interface.h: Declare new function ospf_default_iftype. * ospf_interface.c: (ospf_default_iftype) New function to centralize this logic in one place. * ospf_zebra.c: (ospf_interface_add) Use new function ospf_default_iftype. * ospf_vty.c: (no_ip_ospf_network,config_write_interface) Fix logic by using new function ospf_default_iftype.
2004-12-082004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* *.c: Change level of debug messages to LOG_DEBUG.
2004-10-19OK. Here it is - PtP patch from Andrew J. Schorr. No problems with ospfd,hasso
ripd might need some more testing though.
2004-09-23Remove usage of evil list and listnode typedefs.hasso
2004-08-31Assorted changes from work at BBN. Most are minor, and several are ingdt
support of more significant changes not in this commit. The last item in the ChangeLog below may be needed for p2mp to work correctly. 2004-08-31 David Wiggins <dwiggins@bbn.com> * hash.c (hash_iterate): Save next pointer before calling procedure, so that iteration works even if the called procedure deletes the hash backet. * linklist.h (listtail): new macro, not yet used. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_spf.c (ospf_spf_calculate): Many more comments and debug print statements. New function ospf_vertex_dump used in debugging. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_spf.h (struct vertex): Comments for flags and structure members. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_route.c: When finding an alternate route, log cost as well. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_interface.c (ospf_lookup_if_params): Initialize af in struct prefix allocated on stack. 2004-08-31 David Wiggins <dwiggins@bbn.com> * ospf_packet.c (ospf_ls_ack_send_delayed): In p2mp mode, send acks to AllSPFRouters, rather than All-DR.
2004-06-20Remove ifdef's HAVE_NSSA. NSSA support is stable enough.hasso
2004-05-052004-05-05 Paul Jakma <paul@dishone.st>paul
* ospf_interface.c: (ospf_vl_set_params) Catch changes of interface address for either end of a virtual-link, and hence potential cost changes.
2004-04-082004-04-08 Paul Jakma <paul@dishone.st>paul
* ospf_spf.h: Add backlink field to struct vertex * ospf_spf.h: (ospf_vertex_new) initialise backlink (ospf_lsa_has_link) return index of link back to vertex V from candidate vertex W, or -1 if no link exists. (ospf_spf_next) save backlink index for candidate vertex * ospf_interface.c: (ospf_vl_set_params) Use the backlink index to determine correct address for virtual-link peers. Fall back to older "pick first link" method if no backlink index exists.
2004-02-172004-02-17 Paul Jakma <paul@dishone.st>paul
* ospf_zebra.c: (ospf_interface_delete) Do not delete the interface params, nor the interface structure, if an interface delete message is received from zebra. * ospf_interface.c: (ospf_if_delete_hook) Delete the interface params and interface, ie that which was previously removed in (ospf_interface_delete) above.
2004-02-11Don't crash when attempting to read path->oi->ifp if oi doesn't exist anyhasso
more. I'm not sure if this read should be attempted at all, but I'm trying to keep code safe AND stable.
2003-11-102003-11-10 Claus Endres <claus@endresconsulting.com>paul
* ospfd/ospf_interface.c: (ospf_if_table_lookup) grab reference to rn->info /before/ calling route_unlock_node() as some systems may deliberately poison freed memory, eg FreeBSD 5.1. see [quagga-dev 417].
2003-10-152003-10-15 Paul Jakma <paul@dishone.st>paul
* ospfd/ospf_interface: (ospf_if_lookup_table) fix compile errors from previous patch. doh.
2003-10-152003-10-15 Paul Jakma <paul@dishone.st>paul
* ospfd/ospf_interface: (ospf_if_lookup_table) new function to lookup oi for a given prefix in a given interfaces table of oi's. (ospf_if_new) use ospf_if_lookup_table to deal with zebra reporting new interface multiple times. NB: This patch is a complete plaster-band of a hack. First, why is zebra reporting interface events multiple times? Second, why does ospfd maintain so many damn lists and tables relating to oi's - these should be reconciled into one or two tables.
2003-08-012003-08-01 Cougar <cougar@random.ee>paul
* lib/if.c: (if_cmp_func) new function, compare interface names in alphabetical order. (if_create) Take name as argument and add interface in sorted order. (if_get_by_name),(interface_cmd) fixup calls to if_create - see above. (if_init) register list comparison function. * lib/if.h: Add comparison function, modify if_create prototype. * lib/zclient.c: Modify call to if_create. * ospfd/ospf_interface.c: (ospf_vl_new) modify call to if_create. change sprintf to snprintf. * zebra/kernel_socket.c: (ifm_read) modify call to if_create.
2003-06-222003-06-19 "Suraev, Vadim" <vadim.suraev@terayon.com>paul
* ospf_interface.c (ospf_vl_set_params): new router LSA is not generated when the cost of the routing entry for the virtual link endpoint has changed. If the cost to reach the virtual link's endpoint has changed, add router LSA timer for the backbone area.
2003-06-062003-06-07 Paul Jakma <paul@dishone.st>paul
* Revert Cougar's sort interface names patch, causes problems with enabling of interfaces for OSPF in ospfd.
2003-06-05Patch from Cougar - sort iflist by name.hasso
2003-06-04From: kamatchi soundaram <kamatchi@tdd.sj.nec.com>paul
Subject: [zebra 19263] Another memory leak!! is zebra OSPF This memory leak gets into picture whenever any interface goes down. Problem found and desctription: Whenever the interface goes down, the "def_params" (member of ospf_if_info) structure memory is not freed. Fix made: added the following line to free the "def_params" memory of ospf_if_info before calling the "XFREE(MTYPE_OSPF_IF_INFO, ifp->info);" The added line is: ospf_del_if_params ((struct ospf_if_params *) IF_DEF_PARAMS (ifp));
2003-06-04From: kamatchi soundaram <kamatchi@tdd.sj.nec.com>paul
Subject: [zebra 19262] Re: Memory leak in OSPF Fix applied for Kamatchi's original report was to remove the auth_crypt initialisation from the wrong function. This should fix that.
2003-06-03From: kamatchi soundaram <kamatchi@tdd.sj.nec.com>paul
Subject: [zebra 19259] Memory leak in OSPF The detail of the memory leak follows: File name: ospf_interface.c Function name: ospf_if_new_hook(). Type of leak: Overwriting the already allocated memory. Problem found and description: The ospf_new_if_params() fn allocates a memory for "auth_crypt" which is overwritten, down in the fn (ospf_if_new_hook) by explicitely allocating a memory for the same "auth_crypt". Fix: remove allocation from ospf_new_if_params()
2003-05-24Fix missing bracket from previous commit.paul