summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/kroute.c
AgeCommit message (Collapse)Author
2006-08-03On startup in fetchtable() clean the routing table of all PROTO1 routes.Claudio Jeker
These may be leftovers from a crash or so and result in an strange behaving bgpd parent process additionally it causes huge CPU loads because of a linear list walk done on every insert. Code stolen from ospfd which does the same thing since a long time ago. This is a temporary fix until we have real routing priorities and all this PROTO1 flagging can be removed. PROTO1 is not exclusive to bgpd but for correct operation we currently need to enforce it. OK because it is only temporary henning@ Found and fix tested by Sylwester S. Biernacki
2006-04-12messages on the routing socket have different headers - rt_msghdr,Henning Brauer
if_msghdr, etc. they only share the first 3 fields, and then differ. this leads to a bug in RTM_IFINFO handling. We did abort on rtm->rtm_errno != 0, but if_msghdr has no errno, so we look at something in the data part instead. Surprising that this didn't bite us before! So we must only do these checks for RTM_ADD/CHANGE/DELETE that actually use rt_msghdr. found whiel checking strange behaviour tony sarendal <dualcyclone@gmail.com> saw, and then totally strange behaviour on my amd64 hackbox. claudio ok
2006-03-22Change the way bgpd selects nexthops. Up until now every route was consideredClaudio Jeker
when calculating the nexthop. Now only non BGP routes and not the default route are used unless forced with the new config options nexthop qualify via bgp nexthop qualify via default This change is required for complex setups e.g. where an additional IGP is running. OK henning@
2006-02-23Use the new rtm_fmask feature to reset blackhole and reject routes onClaudio Jeker
RTM_CHANGE. Until now it was not possible to get rid of these flags. Until now a fib decouple, fib couple combo was needed to get rid from blackholed routes. OK henning@
2006-01-31Dynamic routes (PMTU, etc) are not redistributable even for IPv6.Claudio Jeker
Sure henning@
2005-12-14Replace strlcpy() with memcpy() in the sockaddr_dl handling. sdl_data isClaudio Jeker
not a C string and strlcpy() only works on C strings -- returns length of the source. Found by tedu@ OK deraadt@ tedu@
2005-09-21when the route to a nexthop is a reject or blackhole route, the nexthopHenning Brauer
is invalid. add check for these flags. shows up with v6, many reject routes there. claudio ok
2005-07-01tab after spaceClaudio Jeker
2005-06-24Do not automaticaly announce routes that have RTF_DYNAMIC set. These routesClaudio Jeker
are e.g. created by the PMTU code and are removed after some time. OK henning@
2005-06-14Don't unref something that is used later. send_rtmsg() will callClaudio Jeker
rtlabel_id2name() so call rtlable_unref() after that. OK henning@
2005-06-13route label support, kroute part and ID allocator as well as the internalHenning Brauer
interface changes. support in the filter language and rde to come. claudio ok
2005-06-07Set the reject and blackhole flags for kernel routes too. This makes theClaudio Jeker
bgpctl show fib output more logical, especially for INET6 because many prfixes have the reject flag set. OK henning@
2005-06-07Fix the mask2prefixlen6() function once and for all. Netmasks are stored inClaudio Jeker
an own AF independent radix tree. So the passed sockaddrs are often smaller than the actual AF specific struct, especially sockaddr_in6. So the crap Henning saw in the mask was acctually the next struct sockaddr that was passed in the routing message. So pass the struct sockaddr_in6 and compare only the specified number of bytes (minus the offset of sin6_addr in the struct sockaddr_in6). Amazing!.. OK henning@
2005-06-06allow show fib to be limited to inet or inet6 families, claudio okHenning Brauer
2005-06-05on CTL_KROUTE requests, send back both v4 and v6 routesHenning Brauer
2005-06-05work around another disgusting ugliness in v6: the netmasks we get onHenning Brauer
the routing socket have crap in the lower bytes, so instead of using a straightforward and rather simple algorithm to convert them to prefix lengths we have to do quite some ugly manual fiddling... disgusting.
2005-06-02Cleanup recent kroute6 additions. OK henningChad Loder
2005-05-27bah, more kaesefondue (debugging cruft left in)Henning Brauer
2005-05-27don't need to fetch the kernel routing twice, once for v4 and once for v6,Henning Brauer
do it once and handle both families. claudio ok
2005-05-27will throw claudio in a big pot of kaesefondue for repeated whitespace fuckupsHenning Brauer
2005-05-27kroute6 support, at least partially. Get it in so that Henning can clean itClaudio Jeker
up more. OK henning@
2005-05-13The NET_RT_IFLIST sysctl returns RTM_IFINFO and RTM_NEWADDR messages inClaudio Jeker
the buffer. While RTM_IFINFO starts with a struct if_msghdr RTM_NEWADDR does not. In other words (struct sockaddr *)(next + sizeof(ifm)) is only correct for RTM_IFINFO and not for RTM_NEWADDR. So move the ifm_type check up else get_rtaddrs() would access memory outside of buf. OK henning@
2005-04-28Support for "network connected" and "network static" -- announce allClaudio Jeker
directly connected respectively all static routes. The list is auto- matically adjusted as soon as a route changes. OK henning@
2005-04-28Be more careful when copying ifname from the struct sockaddr_dl.Claudio Jeker
OK henning@
2005-04-18Set flag F_STATIC based on RTF_STATIC and not just because the route cameClaudio Jeker
from the kernel. That's what F_KERNEL is for. OK henning@
2005-04-08don't whine when we can't find interface with index 0Henning Brauer
(that is a rare corner case in that context, but still)
2005-03-30interface validation cleanup / fixesHenning Brauer
there's some nastiness in the interface validation. clean up by centralizing the checks in kif_validate(). claudio ok
2005-03-29explicitely check interface flags for IFF_UP in kroute_validateHenning Brauer
2005-03-28KNFHenning Brauer
2005-03-26inet_addr("127.0.0.1") -> htonl(INADDR_LOOPBACK)Claudio Jeker
Use IN_CLASSA_NET instead of hard coded 0xff000000 OK henning@
2005-03-15grow the receive buffer on the routing socket, pointed out by markus,Henning Brauer
ok markus claudio
2005-03-14send a kif structure describing the interface a route relies on alongHenning Brauer
with the "show nexthop" messages, claudio ok
2005-03-14"we notice when you plug the cable" - yeah, but we didn't notice when itHenning Brauer
was unplugged from the beginning on... correctly take interfaces' link state into account for nexthop verification in all cases. add a new function kroute_validate() that looks up the interface for a given kroute via the ifindex and check its link state. use it in all cases instead of hand-rolling the test. claudio ok
2005-03-13when fetching the initial table, inherit the ifindex regardless of af, notHenning Brauer
just for AF_LINK
2005-03-13explicitely initialize optHenning Brauer
2004-11-24if I would remember at what I looked when learning how to use our wonderfulHenning Brauer
RB_* macros I could fix the RB_HEAD calls there too... useless extra define, nothingthat hurts much. stumbled over while hacking on, eh, something new, claudio ok
2004-11-10"not reached" does not help LINT use NOTREACHED instead and use it only inClaudio Jeker
places where needed. OK henning@
2004-10-19allow neighbor definitions to depend on interface state.Henning Brauer
with this, if a neighbor is configured as dependent on carp0 for example, the neighbor will remain in state IDLE as long as carp0 is not master. once carp0 becomes master the session(s) depending on it immediately go to CONNECT (or ACTIVE, if they're configured passive), reducing failover time. claudio ok, with some input from ryan as well
2004-10-16oups, unrelated changes crept inHenning Brauer
2004-10-16prefixlen 0 is a special case for prefixlen2mask() as well, claudio okHenning Brauer
2004-08-19logic error: when there's changes affecting nexthop reachability,Henning Brauer
always notify the RDE and not only if the nexthop was previously unreachable, i.e. its validity changed. found the hard way by Arvid Grtting <arvidg@netfonds.no>, claudio ok
2004-08-05rename and move prefix_equal() to prefix_compare() which returns -1, 0, 1Claudio Jeker
similar to memcmp() and all other compare functions in bgpd. OK henning@
2004-08-03Make the code more portable by #ifdef-ing RTF_MPATH. OK henning@Claudio Jeker
2004-07-13fix some typosJared Yanovich
ok henning otto
2004-07-05implement "set nexthop blackhole" and "set nexthop reject"Henning Brauer
blackhole/reject routes will be entered to the kernel for matching ones. this is intended to be used with the Cymru Bogon Route Server Project (http://www.cymru.com/BGP/bogon-rs.html) and similar services, claudio ok
2004-07-05fix a few KNF falloutsHenning Brauer
2004-06-29little extra paranoia, ignore attempts to enter routes with a nexthopHenning Brauer
within 127/8. inspired by a very bad example for bogon filters at the cymru site, claudio ok
2004-06-25provide mask2prefixlen6() and prefixlen2mask6()Henning Brauer
2004-06-25after writing and deleting the kroute6 tree related functions for at least 5Henning Brauer
times I am getting this in now sow I don't do it a 7th time...
2004-06-22Make the RDE IPv6 ready missing is the message handling. The internalClaudio Jeker
prefix tree changed form a hash table to a per AF RB tree. OK henning@ some ideas are from Brent Graveland.