summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
AgeCommit message (Collapse)Author
2019-02-11spelling and Xr fixes;Jason McIntyre
2019-02-11The definition of VPNs in bgpd was never super elegant. The 'depend onClaudio Jeker
mpeX' config was a bit redundant. Also to make it more flexible (e.g. having more than one mpeX interface per rdomain the syntax was changed. To make this possible especially the network distribution logic had to be adjusted and cleaned up. This should in general make network statements well defined and conflicts between 'network A.B.C.D/N' and e.g. 'network static' are handled in a well defined way ('network A.B.C.D/N' has preference). With and OK dlg@, OK denis@
2019-02-04spelling;Jason McIntyre
2019-02-04Implement as-override, a feature where the neighbor AS is replaced by theClaudio Jeker
local AS in AS paths. This is sometimes needed in bigger transport networks where private AS numbers are used in multiple locations. The implementation is done using a filterset which modifies the AS path - somewhat inspired by the set attribute code. Setting as-override yes will add match from <neighbor> set { as-override } to the start of the filter rules. Since this is filters the Adj-RIB-In still holds the original path and so reloads changing the setting just work. With and OK markus@
2019-01-21Use Adj-RIB-Out to push UPDATE messages to peers instead of having anotherClaudio Jeker
set of RB trees of prefixes and atribute. Refactor most of the update code which removes some strange buffer handling. By building the output queue directly in the Adj-RIB-Out the top memory usage during startup is greatly reduced which should help busy server. Tested by phessler@ and myself
2019-01-20Support group descriptions in control messages that accept a neighborClaudio Jeker
description. With this it is possible to show rib a group of peers, to show or signal a group of peers all at once. OK sthen@ benno@
2019-01-20explicitly check if the session engine exited by comparing the pidBrent Cook
ok claudio@
2019-01-18Don't store the mpe information in struct ktable but instead pass theClaudio Jeker
ifindex from the RDE over. This will allow to import prefixes to multiple mpe interfaces in one rdomain. OK dlg@
2019-01-05Correctly account for the memory allocated when creating a set.Claudio Jeker
Should hopefully fix the error seen on systems after a few reloads where the size became negative. OK benno@
2018-12-31unbreak tree; found the hard way by ottoFlorian Obser
2018-12-30add support for IPv6 VPN routesdenis
The kernel bits are missing as of now. With input from claudio@ and kn@ OK claudio@
2018-12-30remove unused F_ANN_DYNAMIC/F_PREFIX_ANNOUNCED handling in network_delete()Sebastian Benoit
ok claudio@
2018-12-28move kroute_find() call laterdenis
No need to scan the list if we return early. OK claudio@
2018-12-28set conf.capabilities.mp to 0 by defaultdenis
OK claudio@
2018-12-28report right function name in error messagedenis
2018-12-27Check if a control socket or address is already in use befor using it.remi
If it is used abort startup or let a reload fail. Sockets are now not unlinked anymore on regular shutdown. This helps a lot when one tries to do a config check without -n. Inputs and OK claudio@
2018-12-26unbreak VPN routes installation into FIBdenis
OK claudio@
2018-12-22bgpctl can cause bgpd to do a lot of work (e.g. dumping all of the RIB)Claudio Jeker
but then bgpctl can quickly exit and bgpd still has to do all the work. Instead introduce a terminate imsg to stop such long running commands if bgpctl closes the connection before the run is over. OK benno@, sthen@, deraadt@
2018-12-19Fold ext-communities into filter_community so that bgpd can matchClaudio Jeker
multiple ext-communities at the same time as well. Additionally this fixes parsing some of the ext-community types. Now all communities are handled by one common struct. OK benno@ plus some input from denis@
2018-12-17path_empty() is not a function and does not need a prototype.Claudio Jeker
2018-12-11Refactor aspath code a bit. Move cached source_as (for origin validation)Claudio Jeker
into struct aspath and pass that struct to aspath_match(). OK denis@
2018-12-06Be more strict when converting a netmask to prefixlen in mask2prefixlen6.Claudio Jeker
Make sure we never return a value bigger than 128. OK remi@
2018-12-06Implement a simple ruleset optimizer. All it does is merge filter rules thatClaudio Jeker
only differ in the filter sets. Since this is still rather common it is able to reduce the number of rules by 5% on an autogenerated config. OK job@
2018-12-04Since a while announcements added by bgpctl will overwrite the ones fromClaudio Jeker
the config and no longer live next to each other. Because of this step 13 in the decision process is no longer needed. OK benno@
2018-11-29In peer_down() we have to flush the Adj-RIB-Out. As soon as the peer stateClaudio Jeker
is PEER_DOWN no updates will be processed anymore and quick flush can be made. Fixes a memory leak and a use-after-free of the peer id in a bgpctl code path. OK job@
2018-11-29community_ext_delete_non_trans() allocates new memory in all cases whereClaudio Jeker
nlen > 0. So in those cases it is important to free() that memory after use in all cases. OK phessler@
2018-11-28Start reworking community handling. Merge standard communities and largeClaudio Jeker
communities into one filter_community struct and allow it that more then one community can be used in filter rules (currently up to 3). Also rework the code handling bgpctl show rib commands. The special IMSG types for the various filters are gone and the code is in general simpler. OK job@, phessler@
2018-11-25malloc(n) + bzero is better done as calloc(1,n)Theo de Raadt
2018-11-18Use correct name when printing the error message that a network prefix-setClaudio Jeker
is not found. Fixes crash reported by Tom Smyth.
2018-11-14Plug memory leak in host()'s error code pathRicardo Mestre
OK claudio@
2018-11-14Remove an unneeded union wrapping the skipsteps pointer.Claudio Jeker
OK phessler@
2018-11-14Adjust comment.Claudio Jeker
2018-11-10fix error message when querying a non-existent tabledenis
OK claudio@
2018-11-08Introduce rde_update_queue_pending() similar to rib_dump_pending() it checksClaudio Jeker
if there are any neighbors that have pending updates. If so the timeout of the poll loop is set to 0 so that the work is completet ASAP. The regress test was not working because of this. The RDE was stuck in poll() instead of sending the updates out. Tested and OK denis@
2018-11-08Committed wrong version. Check the flags against the fib flags from theClaudio Jeker
config and not the old flags. Needed so that changing flags and rtableid at the same time works.
2018-11-08Only whack the RIB and recreate it if the the FIB distribution flags changedClaudio Jeker
or the rtableid changed and there is a FIB. In the NOFIB case changing the rtableid has no effect. Fixes a problem introduced with keeping the default ribs alive and Adj-RIB-In/Out. Probelm found, tested and OK denis@
2018-11-05F_RIB_HASNOFIB is defined, let's use itdenis
OK claudio@
2018-11-04Graceful BGP Session Shutdown is a real RFC, add it to the list.Claudio Jeker
OK job@, benno@
2018-11-04Introduce a real Adj-RIB-Out. At the same time remove the update_ribClaudio Jeker
introduced before 6.4 because it now can be replaced with the real RIB. Main changes are: - simplified 'show rib' handling since everything is now a real RIB - path_update() is now returning if a prefix was not modified, added or moved - softreconfig out case is simpler since path_update does all the magic now - Adjust shutdown code to work with the Adj-RIB-Out Tested and OK denis@, benno@
2018-11-01- odd condition/test in PF lexerAlexandr Nedvedicky
(and other lexers too) This commit rectifies earlier change: in the lex... even inside quotes, a \ followed by space or tab should expand to space or tab, and a \ followed by newline should be ignored (as a line continuation). compatible with the needs of hoststated (which has the most strict quoted string requirements), and ifstated (where one commonly does line continuations in strings). OK deraadt@, OK millert@
2018-10-31Remove tail queues which link peer, aspath and prefix together. TheseClaudio Jeker
lists are no longer needed and make it possible to share rde_aspath between peers & prefixes. Instead of the lists the rde_aspath is now reference counted. With this struct prefix is now the central place where everything is connected to making the RIB a bit easier to handle. With input and OK denis@
2018-10-31Never remove the default RIBs from the RDE.Claudio Jeker
OK denis@
2018-10-29Replace some walkers using the aspath/prefix lists with a rib_dump walker.Claudio Jeker
network_flush() is now using rib_dump_new to walk the Adj-RIB-In and remove all dynamically added announcements. peer_flush() got generalized and is now used also in peer_down(). It also uses a walker to remove all prefixes of a peer but does it in a synchronous way for now. OK benno@
2018-10-29Fix route-collector mode by allowing the RDE to disable the decision processClaudio Jeker
on reload but after that not allowing it to be re-enabled. So now it is possible to enable route-collector mode again but it is still not possible to turn it of via reload. Problem reported by Aaron A. Glenn. OK benno@
2018-10-26Track the amount of memory used for sets and tries (aka anything-set)Claudio Jeker
OK deraadt@
2018-10-26Use proper type in sizeof()Claudio Jeker
OK phessler@
2018-10-26When walking the list of ribs use continue instead of break after theClaudio Jeker
rib_valid() check. The list of ribs can have holes. OK benno@
2018-10-25Calculate ASPATH_HEADER_SIZE correctly by using offsetof() instead of theClaudio Jeker
sizeof calculation that did not respect possible padding bytes. OK sthen@ denis@
2018-10-24Major refactoring of the RIB handling code. Mainly change how the RIB isClaudio Jeker
walked. rib_dump_r() is now an internal function and instead the code gets an additional callback for throttling the rib_dump code. This removes a lot of similar code used to make sure the RDE is not walking to fast and replaces it with simpler callbacks. The other big change is the removal of struct rib pointers in other data structures. The rib pointers are not stable because of a realloc() call happening when extending the array so instead use the RIB ID as a reference. Tested and OK denis@ and benno@
2018-10-24Pass down the right nexthop to rde_dump_rib_as() so that dumping theClaudio Jeker
Adj-RIB-Out prints the right (modified) nexthop. Found by Marko Cupac. OK benno@