summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/kroute.c
AgeCommit message (Collapse)Author
2010-10-11bgpd needs to see all routing messages so set the ROUTE_TABLEFILTER toClaudio Jeker
RTABLE_ANY. OK henning@
2010-09-30Only 6 elements of mib are used so do allocate 6 not 7.Claudio Jeker
2010-09-02remove trailing spaces and tabs from source code; no binary changesIgor Sobrado
(verified by both sthen@ and me). ok sthen@; "just commit it" claudio@
2010-07-12Merge duplicate log messages into one log_warn().Alexander Bluhm
ok claudio@
2010-06-03Instead of doing a poor mans offsetof() implementation change the codeClaudio Jeker
to use an end pointer to compare against. Looks less scary and makes gcc4 happy. OK henning@
2010-05-19When installing MPLS VPN routes set the RTF_MPLS bit since those routesClaudio Jeker
have MPLS information connected to them and the kernel requires the flag now. OK michele@
2010-05-18Be more careful in ktable_update() and ktable_new() and the fib sync flag.Claudio Jeker
Only existing tables should keep their fib sync state, new ones should set the current fib sync flag to the configured one at the end of the config load. Found the hard way by sthen@, OK sthen@
2010-05-17Last bits of MPLS VPN support. Hook kernel routing tables and RIB together.Claudio Jeker
This adds a bit of new config to specify the mapping between an rdomain and the BGP MPLS VPN instance, example: rdomain 1 { descr "CUSTOMER1" rd 65003:1 import-target rt 65003:3 export-target rt 65003:1 depend on mpe0 network 192.168.224/24 } The "depend on mpe0" is a but ugly but for now this is the quickest way to figure out which interface bgp should use to insert the MPLS routes. A big side-effect of this diff is that networks are now internally distributed through kroute.c. This needs some kernel changes that will follow hopefully soon. OK henning@
2010-05-03Make it possible to load multiple routing tables at the same time and useClaudio Jeker
those for alternate RIBs. This allows to use "rde rib TESTIT rtable 1". NOTE: nexthop verification has changed for alternate tables. For now nexthop will only be verified against the main routing table (id 0). Because of this "nexthop qualify via bgp" may now compare the nexthops against bgpd routes from a different RIB. Tested by sthen@, OK to move on by henning@
2010-04-13Instead of passing AF specific struct kroutes over imsgs use a structClaudio Jeker
kroute_full structure that is AF independent and has all information in it. Simplifies the communication between processes and reduces the number of imsg types. This is another step to add FIB support to BGP MPLS VPNs.
2010-04-06Switch to a more address family independent nexthop imsg. Instead of passingClaudio Jeker
struct kroute or kroute6 pack the needed info into a struct bgpd_addr. No flames comming out of my and sthen@'s bgpd routers.
2010-02-26Fix some minor issues. 0 instead of NULL in one comparison. Set theClaudio Jeker
right flags when protecting the IPv6 loopback addr (instead of reassigning the IPv4 ones) and install the IPv4 loopback blocker as 127/8 and not as 127.0.0.1/8. First two found by Hiroki Sato hrs (at) allbsd org and I found the 127/8 issue all by myself.
2010-02-23Remove some extra ().Claudio Jeker
2009-12-01Use an artificial address family id in struct bgpd_addr and almost everywhereClaudio Jeker
else. Adds conversion functions to map AFI/SAFI and the Unix AF_ values from and into AID used in bgpd. This is needed to support things like MPLS VPN and other upcomming changes that need to play a lot with AFI/SAFI pairs. Mostly mechanical change, henning@ has no particular issues with this. Must go in so that I can continue working.
2009-07-23Send the used kroute along with the nexthop information. This allows usClaudio Jeker
to show all necessary information in bgpctl show next. OK henning@
2009-07-23knexthop_compare() failed to compare correctly and because of this it wasClaudio Jeker
possible to corrupt the nexthop RB tree. Use the same compare logic used in the kroute compare functions. Nice side effect is a nicely sorted list in bgpctl show next. OK sthen@ henning@
2009-07-20Include more info in the bgpctl show nexthop ctl message. Mainly add theClaudio Jeker
gateway used for non-connected routes. This info was missing all the time and often resulted in massive confusion when the nexthop selection choosed a bad nexthop.
2009-06-25Add missing RTM_VERSION checks. Bad me, no cockies.Claudio Jeker
Tested and OK sthen@, OK henning@
2009-06-12Move prefixlen2mask and inet6applymask to util.c so that we can kill theClaudio Jeker
copies in bgpctl.
2009-06-05rtm->rtm_hdrlen conversionChris Cappuccio
ok claudio@, henning@
2009-05-25In dispatch_rtmsg_addr() don't fatal on missing multipath deletes. Not 100%Claudio Jeker
sure why it happens but it is not a fatal condition. A warning should still be logged because it is not good to miss updates.
2009-02-11Because IPv6 fucked up and created a badly sized struct sockaddr_in6 we needClaudio Jeker
to add some pading on 64bit archs. Use a helper struct plus some ROUNDUP() magic to get the size correct. Tested on i386 and amd64 by Graeme Lee "graeme (at) omni (dot) net (dot) au" Some sort of OK by henning@ (he ignores the non-v4 code)
2009-02-09Correct function name in warning to avoid confusion. After a discussion onClaudio Jeker
misc@
2009-01-01Remove unneeded debug messages that made it into the tree.Claudio Jeker
2008-12-12Make bgpd route priority aware and while there sync in the basics to correctlyClaudio Jeker
track multipath routes. Code is mostly stolen from similar fixes to ospfd but a bit different as this kroute.c implementation is more complex because of additional task (nexthop verification for example). This change and the similar ospfd change were desperatly needed on larger complex network setups which tended to end up in situation where the kernel had a different oppinion about routing than the daemon. Now the situation should be a lot better. Tested and OK sthen@ gollo@
2008-11-21Track nexthops when the underlying route is changing. Until now true nexthopsClaudio Jeker
were only resolved when they were added. This calls for troubles if something like ospfd starts to change the underlying routes. Tested by gollo@, OK henning@
2008-05-09insert/delete routes with priority RTP_BGPHenning Brauer
this is mostly cosmetical for the moment, there are bigger changes required to make full use of the route priorities, but this is the first step to do. discussed with claudio
2008-05-08backout shit committed on accidentHenning Brauer
2008-05-08in timer_set, when figuring out the right position for the timer,Henning Brauer
wemust stop walking the list once werun into a stopped timer, or eventually all stopped timers will queue up at the very front (instead of at the tail)
2007-11-24Another missing RTM_VERSION check. This will remove the RB_INSERT warningsClaudio Jeker
seen on startup.
2007-11-24some spelling fixes from Martynas VenckusJason McIntyre
2007-10-04when inserting blackhole or reject routes, set the gateway address toHenning Brauer
127.0.0.1 / ::1 unconditioally, since RTF_BLACKHOLE/REJECT are not actually checked in the forwarding path and the gw doesn't matter otherwise. makes them work.. found teh hard way by me. claudio ok
2007-05-11Various spelling fixes from Stuart Henderson.Claudio Jeker
2007-04-19Use vectorized writes to send routing messages into the kernel instead ofClaudio Jeker
using a static message structure. This is more flexible and needed if multipath comes into play. looks good henning@
2007-02-22KNFHenning Brauer
2007-02-07remove a log_debug() that is no longer needed.Claudio Jeker
2006-11-28allow bgpd to work on alternate routing tables, claudio ok, jmc manpage helpHenning Brauer
2006-11-28mib we pass to sysctl when fetching the routing table has 7 entries now,Henning Brauer
not 6 any more (rtableid added). need to tell sysctl so.
2006-11-16for now, make bgpd work with routing table 0 (main one) and ignore routingHenning Brauer
messages for any other tables. real multi-table support is more adventurous (will come tho)
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