summaryrefslogtreecommitdiff
path: root/sys/net/route.c
AgeCommit message (Collapse)Author
2009-11-03rtables are stacked on rdomains (it is possible to have multiple routingClaudio Jeker
tables on top of a rdomain) but until now our code was a crazy mix so that it was impossible to correctly use rtables in that case. Additionally pf(4) only knows about rtables and not about rdomains. This is especially bad when tracking (possibly conflicting) states in various domains. This diff fixes all or most of these issues. It adds a lookup function to get the rdomain id based on a rtable id. Makes pf understand rdomains and allows pf to move packets between rdomains (it is similar to NAT). Because pf states now track the rdomain id as well it is necessary to modify the pfsync wire format. So old and new systems will not sync up. A lot of help by dlg@, tested by sthen@, jsg@ and probably more OK dlg@, mpf@, deraadt@
2009-10-26Replace pool_get() + bzero() with pool_get(..., PR_ZERO).Michael Knudsen
`OK' claudio
2009-10-10fix mbuf leak in rtinit()Dariusz Swiderski
the mbuf got leaked when detaching an interface, spotted by theo. fixed by me, diff refined by theo eyeballed by claudio@ 'go ahead, commit this' by theo@
2009-09-01Make rtinit() cope when there is a more specific route available thenClaudio Jeker
the one planned to remove. Do this by going through the dupedkey list looking for the right ifa. Problem found by and OK dlg, OK henning
2009-07-28Plug a memory leak when calling rtable_add(0) multiple times. Fixing thisClaudio Jeker
even though adding an already existing routing table is not allowed. Leak found by blambert@, fix by myself. OK blambert@
2009-06-05Initial support for routing domains. This allows to bind interfaces toClaudio Jeker
alternate routing table and separate them from other interfaces in distinct routing tables. The same network can now be used in any doamin at the same time without causing conflicts. This diff is mostly mechanical and adds the necessary rdomain checks accross net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6. input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@
2009-05-31Reenable interface state tracking now that I found and fixed the cause ofClaudio Jeker
the rtfree panic seen by some people.
2009-05-26inherit the route label on cloned routesReyk Floeter
ok claudio@
2009-05-18The routing table index rtableid has type unsigned int in the routingAlexander Bluhm
code. In pf rtableid == -1 means don't change the rtableid because of this rule. So it has to be signed int there. Before the value is passed from pf to route it is always checked to be >= 0. Change the type to int in pf and to u_int in netinet and netinet6 to make the checks work. Otherwise -1 may be used as an array index and the kernel crashes. ok henning@
2009-03-15Introduce splsoftassert(), similar to splassert() but for soft interruptMiod Vallat
levels. This will allow for platforms where soft interrupt levels do not map to real hardware interrupt levels to have soft ipl values overlapping hard ipl values without breaking spl asserts.
2009-02-27Do not check the link state when installing a route. This bit was missing inClaudio Jeker
the backout/disabling of the route link state tracking done a few days ago. OK deraadt@
2009-02-03Use our own flags to set the operations and not RTF_PROTOX.Michele Marchetto
Switch the padding field into a MPLS one in rt_msghdr to store relevant informations. OK claudio@ laurent@
2009-01-28Get rid of the ugly rtentry hack.Michele Marchetto
We can now act as edge node and allow ipv4 packets to enter a Label Switched Path and not just forwarding MPLS packets. OK claudio@
2009-01-08Fix sockaddr_mpls structure.Michele Marchetto
Now it contains just the label as it must be. This introduces a ugly hack in rtentry that will be removed as soon as possible. OK claudio@
2008-12-12Introduce a if_priority that will be added to RTP_STATIC when routes areClaudio Jeker
added without an expilict priority. This allows to specify less prefered interfaces that will only take over if the primary interface loses link. OK deraadt@
2008-11-24Implement link-state tracking on the routing table. Routes to interfacesClaudio Jeker
which are considered down will no be marked ~RTF_UP and so multipath routing will start to work as expected and not pump 50% of the traffic to nirvana. Most of the magic happens in rn_mpath_reprio() which fiddles with the routing table internals. The rest is more straight forward. get it in deraadt@
2008-11-21Change rn_mpath_next() to be able to walk over the full multipath listClaudio Jeker
not only over routes of the same prio. This makes it possible to modify rt_mpath_matchgate() so that if only gateway is specified without a specific priority it will scan the full list and not only the first routes. This is also needed for upcoming link state tracking.
2008-09-10Convert timeout_add() calls using multiples of hz to timeout_add_sec()Bret Lambert
Really just the low-hanging fruit of (hopefully) forthcoming timeout conversions. ok art@, krw@
2008-08-07Remove workaround used for the 4.4 release. More route prio stuff is commingClaudio Jeker
soon.
2008-08-01force route priority to RTP_DEFAULT unconditionally, effectively disablingHenning Brauer
route prios. playing safe for 4.4-release, as not all parts of the system deal correctly with route prios yet. ok claudio
2008-07-28Fix the tracking of RTF_MPATH. Until now the magic happend on the first routeClaudio Jeker
and not on the routes with the right prio. So pick up the correct route by calling rn_mpath_prio() first. OK henning@
2008-06-08First minimal cleanup of routing code, kill rtrequest() it got replaced withClaudio Jeker
rtrequest1() everywhere now. OK henning@
2008-05-09replace rtrequest() with corresponding rtrequest1() replacement.Claudio Jeker
OK henning@
2008-05-09when cloning, copy the priority from the parent to the cloned route,Henning Brauer
claudio ok
2008-05-07Implement routing priorities. Every route inserted has a priority assignedClaudio Jeker
and the one route with the lowest number wins. This will be used by the routing daemons to resolve the synchronisations issue in case of conflicts. The nasty bits of this are in the multipath code. If no priority is specified the kernel will choose an appropriate priority. Looked at by a few people at n2k8 code is much older
2008-05-07Redo rev 1.8 but this time with an additional fix to solve the dhclient crashesClaudio Jeker
seen by krw. This is a prerequisite for upcomming routing priorities: Always compare the nexthop if one is specified even if it is a non-multipath route. This mostly affects "route delete" and it will not remove the last route if previous delete is redone. OK henning@
2008-05-05in rt_gettable, we unfortunately have to check for rt_tables[id] != NULLHenning Brauer
before returning rt_tables[id][af2rtafidx[af]. when you created tables and left a hole (0 and 2 exist, 1 does not) it is possible to hit that case. issue found & ok claudio
2008-01-05make sure all callers of rtlabel_id2name check for a null return value.Henning Brauer
all the original ones did, the recently added ones for labels per interface didn't. no cookie for reyk ;( ok deraadt
2007-09-17Do not take wild guesses at how if_enc's internal works, includePierre-Yves Ritschard
net/if_enc.h instead. ok todd@ and probably claudio who's in the train.
2007-09-15malloc sweep:Henning Brauer
-remove useless casts -MALLOC/FREE -> malloc/free -use M_ZERO where appropriate instead of seperate bzero feedback & ok krw, hshoexer
2007-06-14Add a new "rtlabel" option to ifconfig. It allows to specify a route labelReyk Floeter
which will be used for new interface routes. For example, ifconfig em0 10.1.1.0 255.255.255.0 rtlabel RING_1 will set the new interface address and attach the route label RING_1 to the corresponding route. manpage bits from jmc@ ok claudio@ henning@
2007-05-08wildcard is nowhere used anymore. Figured out by deraadt@Claudio Jeker
2007-05-08rtalloc2() and rtalloc_noclone() inside NPF > 0Theo de Raadt
2006-06-19Unbreak the tree. The code to set and unset the RTF_MPATH bit on all multipathClaudio Jeker
routes did not carefully check if the route lookup succeded or not and so rn_mpath_next(rn) blowed up because rn was NULL. Check if rnh_lookup succeded before touching rn in anyway. OK norby@ initial diff by hshoexer@
2006-06-17When multipath routes are inserted, ensure that RTF_MPATH is set for anyChristopher Pascoe
previous route that may not have been inserted with the -mpath flag. Similarly, when removing a multipath route and leaving only one route, clear the RTF_MPATH flag so this is clear. ok claudio@
2006-06-16adjust functions dealing with the routing table to take a table ID asHenning Brauer
parameter so they can work on alternate tables. table 0 hardcoded for many callers yet, that will be adapted step by step. input + ok claudio norby hshoexer
2006-06-15put the multiple routing tables support back in, fixed.Henning Brauer
problem before: with this, we are no longer using the address family as array index directly, since only 3 of 31 address fanilies actually attach a table, but we're using an address family to array index translation (just another array). there, 0 meant "does not attach a table", thus rt_gettable has to return a null pointer. unfortunately we were using array index 0 for whatever af attaches first, and since the list is backwards,, that used to be ipsec - execpt on ipsec-less ramdisks, where it was inet6, and since route show blindly iterates over all address families, and all those without a table pointed to index 0, we got 28 or 29 copies of the v6 table. i had that right initally, and then i borked it later... re-spotted by claudio. ok norby hshoexer claudio
2006-06-06back out multiple routing table diffs (3 of 'em) because this makesTheo de Raadt
'route show' dump out repeated copies of the v6 routing table on ramdisks. on some architectures it spins forever doing this, on others it just goes for a long time printing the v6 routes over and over before terminating. spotted by jmc and krw, backout diff tested by beck.
2006-06-01use the table ID as array index directly, faster in the forwarding pathHenning Brauer
we trade higher memory consumption if the user doesn't use continous table IDs, but in the worst case (table IDs 0 and 255, 64bit machine) that is 2KB ok claudio ryan
2006-05-31add comment indictation that rtable_add must be called at splsoftnetHenning Brauer
2006-05-31move us to multiple routing table heads.Henning Brauer
-instead of staticaly declaring the heads, allocate memory for them -add second dimension to the routing table head array, table ID -space saver: do not use the AF as array index directly, but have an AF->index translation array and only account for AFs actually attaching a routing table note that whil ethat allows for multiple routing table heads, nothing uses taht yet. tested by many, ok claudio reyk norby mcbride
2006-05-20don't panic if the address familiy is not found in the rt_tablesReyk Floeter
ok henning@
2006-04-26Missed the goto in the error path. This resulted in an access to a NULLClaudio Jeker
pointer and a panic later on. Be more careful Claudio! OK henning@
2006-04-22Routes announced via rt_missmsg() do not have rtm_index set. While in mostClaudio Jeker
cases harmless it is used by the IPv6 code. The result is that bgpd is unable to assigning link local addresses to the correct interface. OK henning@ Fix for PR 5063.
2006-03-22prevent anything outside rote.c from accessing the routing table headsHenning Brauer
directly. rather provide a rt_lookup function for regular lookups, and a rt_gettable for those that need access to the head for some reason. the latter cases should be revisted later probably so that nothing outside the routing core code accesses the heads at all... tested claudio jolan me, ok claudio markus
2006-03-20introduce rt_if_remove which takes care of routing table updates for anHenning Brauer
interface that is removed. use that from if.c and if_tun.c instead of re-implementing in the latter case. ok claudio
2006-03-06get rid of questionable macro gore.Henning Brauer
a 200+ lines diff, but no binary change.
2006-03-06change a questionable multi-level foo ? a : b construct into readableHenning Brauer
code. no binary change.
2006-03-06more cleanup, again no binary change.Henning Brauer
as the previous changes from a train ride to frankfurt a bit over a week ago
2006-03-06cvhange a KASSERT into a if() .. panic() construct so the binary doesn'tHenning Brauer
change every time a line is added or removed. no functional change.