summaryrefslogtreecommitdiff
path: root/usr.sbin/ospf6d
AgeCommit message (Collapse)Author
2009-06-08revert this change by eric@:David Gwynne
Make the imsg protocol network-safe. it might be network safe, but half the imsg based daemons on my firewalls dont run anymore.
2009-06-07Change the way fds passed over a socket are retreived on the receiving side.Eric Faurot
Currently the receiver fetches an imsg via imsg_get() and if he expects an fd, he then calls imsg_get_fd() to fetch the next fd queued on the imsgbuf from which the imsg came. This changes hides the fd queueing mechanism to the API user. When closing an imsg with an fd, the message is flagged so that the receiving end knows it must dequeue the fd in imsg_get() and return it with the imsg structure. This way there is no (less) possible screw up from imsg_get_fd() not being called directly after imsg_get() by the user. The retreived imsg is self-contained. ok pyr@, "I like that" henning@
2009-06-07Make the imsg protocol network-safe.Eric Faurot
ok pyr@
2009-06-06change the imsg header fields a bit to prepare for upcoming changes.Eric Faurot
add a flag field, use u_int32_t for pid_t and extend type to 32 bits for padding. ok pyr@
2009-06-06Get ready for including imsg.h from a lib, when it comes along.Pierre-Yves Ritschard
2009-06-06make ospf6ctl/ospf6d imsg-in-a-lib ready too.Eric Faurot
ospf6ctl is already broken in tree (not connected to build). ok pyr@
2009-06-05rtm->rtm_hdrlen conversionChris Cappuccio
ok claudio@, henning@
2009-05-31Remove redundant imsg_event_add calls; ok claudio@Jacek Masiulaniec
2009-05-31libevent handler fix to allow EV_READ and EV_WRITE to be set at the sameClaudio Jeker
time in the callback. Same diff that went into ospfd applied with some fuzz.
2009-04-09Update rt_calc() for OSPFv3. The Routing Information Base is beingStefan Sperling
populated. Intra-area routes only for now. "I see no obvious issues. Should go in so you can move forward" claudio@
2009-04-09Don't dereference NULL pointers. This crash wasn't found yet becauseStefan Sperling
we never entered this code path before. This is just a temporary fix. The kroute code desperately needs a sync to ospfd. "Looks sensible to me" jsing@, "Yes and yes" claudio@
2009-04-09Fix a naming inconsistency in struct lsa_intra_prefix (lsid -> ls_id).Stefan Sperling
"consistency is a good thing" jsing@, ok claudio@
2009-03-31Fixed memory leaks which would occur if the second of two memoryTobias Stoeckmann
allocations fails. looks right deraadt, krw ok henning
2009-03-29Update spf_calc() for OSPFv3.Stefan Sperling
This implements the first stage of the shortest path tree calculation (Dijkstra calculation) as outlined in rfc5340, with the exception that we do not yet treat multiple router LSAs originated by a single router as an agregate. For now, we only use the Router LSA with the lowest link state ID. For each destination, show the calculated set of nexthops in the debug log. We can stop doing this once spf tree calculation has been shown to be stable. "A lot of debug code but yes why not. commit it." claudio@
2009-03-29Update calc_nexthop() for OSPFv3, using helper functions added inStefan Sperling
last commit. Next hop IP addresses and outgoing interfaces can now be correctly determined, paving the way for SPF tree calculation. Arguments have changed, so update callers, too. ok claudio@
2009-03-29As a first step towards SPF tree calculation, prepare for properStefan Sperling
next-hop calculation. In OSPFv3, next-hop IP addresses are always link-local. The kernel will want to know which interface the link-local address belongs to, so we need an ifindex in struct v_nexthop in addition to the IP address. Because we cannot determine a link-local next hop IP address for transit networks, only the outgoing interface will be recorded. Update calc_nexthop_add() according to the above. Also add new helpers calc_nexthop_lladdr() and calc_nexthop_transit_nbr(), to figure out link-local addresses of nexthop neighbours. ok claudio@
2009-03-29Update linked() for OSPFv3.Stefan Sperling
A router vertex w has a point-to-point link back to a router vertex v if v's router ID occurs as neighbour ID in one of the point-to-point links described in w's router LSA. A router vertex w has a link back to a network vertex v if the router ID of v's advertising router (i.e. DR) occurs as neighbour ID in one of the transit links described in w's router LSA, and v's interface ID to the network matches the neighbour interface ID of that transit link. A network vertex w has a link back to a router vertex v if v's router ID occurs in the list of attached routers in w's network LSA. Also, get_rtr_link() and get_net_link() take an unsigned int now. "commit it" claudio@
2009-03-29Change get_net_link()'s idx argument to unsigned, and make itStefan Sperling
use less local variables. Makes it consistent with get_rtr_link(). ok claudio@
2009-03-29Because get_rtr_link() forgot to increment the buffer offsetStefan Sperling
it was always returning the first link in the LSA, no matter which link was requested. Fix this bug. Also, decrease the number of local variables while here, and convert the idx argument to unsigned int. Adjust one caller to pass an unsigned int, other callers will be handled in follow-up commits. ok claudio@
2009-03-29Remove lsa_find_net(), it isn't needed for OSPFv3.Stefan Sperling
pointed out by and ok claudio@
2009-03-29Add lsa_find_rtr() function, which finds among multiple routerStefan Sperling
LSAs originated by the same router the one with the lowest link state ID. ok claudio@
2009-03-29In lsa_num_links(), be more obvious about what parts of the LSAStefan Sperling
are subtracted from the total length. ok claudio@
2009-03-29Add log_rtr_id() function to log 32bit numbers in dot-quad notation.Stefan Sperling
Most obvious use is to log router IDs. To facilitate logging of multiple IDs within the same format string, we use NUM_LOGS static buffers, just like log_sockaddr() does. help and ok claudio@
2009-03-29Now that struct lsa_net represents just the options, orig_net_lsa()Stefan Sperling
can make use of it much better. No functional change. ok claudio@
2009-03-29Remove att_rtr field from struct lsa_net.Stefan Sperling
In Network-LSAs, the only thing sitting between the LSA header and the attached router list is the options field. We already have lsa_net_link to represent elements of the attached router list, so there's no need to have a single entry of this list in lsa_net. ok claudio@
2009-03-29For SPF calculation, we will need the source address specifiedStefan Sperling
in hello packets by next-hop neighbours. So when notifying the RDE of a new neighbour, send the source address, too. ok claudio@
2009-03-28Print the correct function name in log_debug().Michele Marchetto
ok stsp@
2009-03-12lsa_self() did too many things at once, and had too much logicStefan Sperling
buried inside of it that its caller relied on. So split it up as follows: lsa_self() Check whether an LSA is self-originated. lsa_flush() Flush an LSA from the LSDB. lsa_reflood() Prepare an LSA for reflooding (actual reflooding currently requires sending an imsg which must be done by the caller). ok claudio@
2009-03-10The linked() function had an identity crisis and referred to itselfStefan Sperling
as "spf_calc" in fatal error messages.
2009-03-10Revert previous, I committed the wrong file, should have been rde_spf.c.Stefan Sperling
2009-03-10The linked() function had an identity crisis and referred to itselfStefan Sperling
as "spf_calc" in fatal error messages.
2009-03-08Remove #ifdef'd code which had a TODO comment essentially askingStefan Sperling
"Do we need anything fancy to determine whether *-prefix-LSAs are self-originated?" The answer is "No, we don't, see section 4.6 of RFC5340." ok claudio@
2009-03-07Add lsa_find_tree() to allow searching for LSAs in a specific LSA tree.Stefan Sperling
We had code marked XXX searching an LSA tree manually using RB_FIND(), switch it over to lsa_find_tree(). Make lsa_find() use the new function, too, to avoid code duplication. ok claudio@
2009-02-25Fix an invalid pointer dereference in control_close(). If control_connbyfd()Claudio Jeker
fails -- which should never happen -- the function does not return and is accession the NULL set control pointer later on. Found by Matthew Haub. OK deraadt@
2009-02-19Use rde_router_id() instead of directly accessing rdeconf->rtr_id.s_addr.Stefan Sperling
"For sure!" claudio@
2009-02-19Enable origination of Intra-Area-Prefix LSAs in rde.Stefan Sperling
New Intra-Area-Prefix LSAs are originated when a neighbour becomes adjacent, or when a neighbour loses adjacency, or when an interface changes state. ok claudio@
2009-02-19Virtually re-implement origination of Intra-Area-Prefix LSAs.Stefan Sperling
We now comply with RFC5340 and move prefixes between the two ref-types of Intra-Area-Prefix LSAs (router and network). In case an LSA ends up having all of its prefixes moved to another one, the LSA is flushed from the LSDB by re-originating with MAX_AGE. (This does not yet work reliably. We end up having LSAs with zero prefixes in the LSDB in some cases. Should not affect SPF calculation, so not much harm done, but will need to be fixed.) This commit just adds the necessary code to do origination, but it is not being called yet. This will be done in a separate commit. "Looks good." claudio@
2009-02-19Remove origination of Intra-Area-Prefix LSAs from ospfe.Stefan Sperling
Will soon be done in rde instead. "Sure but don't wait too long before readding the code in rde" claudio@
2009-02-19Sync iface fsm state from ospfe to rde.Stefan Sperling
Also syncs other fields the ospfe is syncing to when getting iface updates from parent process. None of these fields are used by the rde yet, but state will be important soon, for proper origination of Intra-Area-Prefix LSAs. ok claudio@
2009-02-19In ospfe, originate new Router and Network LSAs before informing RDEStefan Sperling
about nbr state change. Intra-Area-Prefix LSAs refer to these LSAs. While not strictly necessary, it makes sense for these LSAs to be up-to-date in the LSDB before new Intra-Area-Prefix LSAs are originated. This change has no effect yet because Intra-Area-Prefix LSAs are currently originated during updates of LSA types it depends on, but origination will soon be synced to state changes in the iface and nbr state machines instead. ok claudio@
2009-02-19Make ospfe send correct nbr state to RDE.Stefan Sperling
ospfe was sending state from a local variable which does not always reflect the true state of the neighbour. The RDE would end up with an invalid nbr state of zero in some situations. Send state saved in nbr structure instead, this is always valid. ok claudio@
2009-02-12Make vertex_free() correctly free LSAs in per-interface LSA trees.Stefan Sperling
Save a pointer to the right LSA tree in new member v->lsa_tree. This saves us the hassle of finding the right tree in vertex_free(), we already know it at creation time so why not tuck it in there? This might cause problems if the ospfe side ever decides to call area_del() with a non-empty area->lsa_tree, without correctly initialising v->lsa_tree. But grep shows that the area's lsa_tree is currently just initialized on the ospfe side, but never modified. ospf6d daemons which crashed after about 1 min with malloc options FGJ are now happy. ok claudio@
2009-02-10Fix two obvious copy-paste errors in fatal error messages. We wereStefan Sperling
printing IFINFO while we are actually handling an IFDELETE imsg.
2009-02-03In Intra-Area-Prefix LSAs, set the LA-bit for all prefixes of 128-bitStefan Sperling
length, regardless of interface type. Allowed by RFC5340 and ok claudio@
2009-02-03We don't need anything other than link-local addresses andStefan Sperling
global-scope prefixes in iface->ifa_list. ok claudio@
2009-02-03Formatting fixes.Stefan Sperling
2009-01-31write point-to-point in a consistent way.Igor Sobrado
jmc@ has provided a complete list of manual pages to be fixed, and suggested using uppercase (i.e., Point-to-Point) when discussing the protocol, and lowercase (point-to-point) otherwise. ok jmc@
2009-01-29Correctly byte-swap the link state ID when building Intra-Area-PrefixStefan Sperling
LSAs which refer to Router LSAs. ok claudio@
2009-01-29Originate Intra-Area-Prefix LSAs which reference a router LSA.Stefan Sperling
Routers can now advertise prefixes with global scope throughout an area. This paves the way towards doing SPF calculations to generate routing tables for a single area. ok claudio@
2009-01-29In Link LSAs, #prefixes is a 32bit value.Stefan Sperling
But in Intra-Area-Prefix LSAs, #prefixes is a 16bit value. lsa_intra_a_pref_check() was failing on little-endian machines because it was trying to byte-swap a 32bit value. ok claudio@