summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
AgeCommit message (Collapse)Author
2023-06-12Use attr_writebuf() instead of hand rolling a more complicated versionClaudio Jeker
for IMSG_CTL_SHOW_RIB_ATTR. Also drop the attr_optlen() usage in imsg_create() since it is not stricly needed. With this attr_optlen follows the path of the dodo. OK tb@
2023-06-12Use data != NULL to be more explicit. No functional change.Claudio Jeker
OK tb@
2023-06-01Check the F_NEXTHOP flag on the right kroute6 object.Claudio Jeker
On multipath routes the check ended up checking the wrong route for the nexthop update. This resulted in a use-after-free in kroute_detach_nexthop(). This only affects IPv6 in the IPv4 code path the right object was already used. Thanks to sthen@ for providing the debug information to track this down. OK sthen@ tb@
2023-05-25In session_process_msg() recheck the validity of the rbuf before movingClaudio Jeker
the remaining data around. There is an improbable case where a NOTIFICATION is received while also reaching the MSG_PROCESS_LIMIT. In this case rbuf is NULL when breaking out of the for loop and hitting this code. sthen@ is the (un)lucky person to hit that improbable case OK tb@ sthen@
2023-05-09Properly handle references for nexthops and labels in filterset_copy()Claudio Jeker
Up until recently filterset_copy() was only used in the parent process where none of those references exist but by using filterset_copy() in the RDE to populate per-peer output filters the code needs to handle such references. Without this rules like 'match to any set nexthop X' will cause internal corruption on config reloads and session resets. Bug report from Marko Cupac (marko.cupac (at) mimar.rs) OK tb@
2023-05-05Pass ASPA objects in reverse since this is what aspa_add_set() expects.Claudio Jeker
OK tb@
2023-05-05Limit the socket buffer size to 64k for all sessions. Long time agoClaudio Jeker
setting the size to 64k was increasing the size but now auto-scaling could grow the buffer size much more. The origianl idea was that sessions without protection had a small window size to make window attacks harder. This problem was fixed long time ago and is no longer relevant. Limiting the buffer size to a reasonable size ensures that not too many updates end up queued in the TCP stack. OK benno@ (some time ago)
2023-05-01Bump to 8.0Claudio Jeker
2023-04-28Add explicit default labels in switch() statements with error handling.Claudio Jeker
Right now these are not reachable. Should also clear some gcc warnings. OK tb@
2023-04-26Add prototypes for geticmptypebyname() and geticmpcodebyname().Claudio Jeker
Needed for bison.
2023-04-23Add the same AID filter to prefix_flowspec_dump() like in the otherClaudio Jeker
prefix/rib dump functions. OK tb@
2023-04-21Adjust ext community handling to support the generic transitive communitiesClaudio Jeker
introduced with flowspec. OK tb@
2023-04-21Missing space noticed by Pablo Mendez HernandezClaudio Jeker
2023-04-21Sync common code with bgpctl with the version from there.Claudio Jeker
OK tb@
2023-04-20Rework the way transit provider AID masks are built and sent to the RDE.Claudio Jeker
ASPA provider AS sets can include optional limitations to inet/inet6 these limits are represented in the TAS_AID bit masks (2bits per AS). Introduce a TAS_AID_SIZE() makro that returns the size in bytes of this bit mask (rounded to the next uint32_t). Without this change aspa objects with AID specific elements trigger a fatal error condition when the config is loaded. OK tb@ job@
2023-04-20Implement IMSG_CTL_SHOW_FLOWSPEC and IMSG_FLOWSPEC_FLUSH and add bits forClaudio Jeker
IMSG_FLOWSPEC_ADD and IMSG_FLOWSPEC_REMOVE received from bgpctl via SE. OK tb@
2023-04-20Document flowspec in bgpd.conf.5Claudio Jeker
Input and OK jmc@ tb@
2023-04-19Reshuffle the flowrule yacc rules to be in a more logical and alphabeticalClaudio Jeker
order.
2023-04-19Implement a way to announce flowspec rules without hitting Adj-RIB-InClaudio Jeker
and Loc-RIB. Flowspec objects are collected in a single flowrib RIB and then directly distributed into the various Adj-RIB-Outs. For this to work add a bypass in the filter logic (flowspec AFI/SAFI are currently accepted without any rule). The filter language lacks a way to allow prefixes based on AFI/SAFI which is the minimum needed. OK tb@
2023-04-19Remove usage of fatalx() in here. This code will be shared with bgpctl.Claudio Jeker
In flowspec_cmp() make sure a deterministic sort is possible. Most error cases are unreachable if flowspec NLRI are validated first (flowspec_valid). In flowspec_valid() replace the assert like check with an error return. OK tb@
2023-04-19Add minimal support for flowspec in the table-mp MRT format.Claudio Jeker
In general people should use table-v2 which handles flowspec just fine. OK tb@
2023-04-19Add handling for flowspec in the update path.Claudio Jeker
Flowspec has no nexthop so adjust up_prep_adjout() to handle a NULL nexthop. Add the MP_REACH encoding in up_generate_mp_reach for flowspec. OK tb@
2023-04-19Implement code to pass the flowspec config over to the RDE. The parentClaudio Jeker
process tracks which prefixes are added / removed and issues the corresponding imsg calls. Right now the RDE does nothing with the received information. OK tb@
2023-04-19Extend the pt_entry api to handle flowspec.Claudio Jeker
Introduce pt_get_flow() and pt_add_flow() to lookup and insert flowspec objects. Add pt_getflowspec() which works somewhat similar to pt_getaddr() to extract the flowspec NLRI from a pt_entry. Make pt_getaddr() to return the destination prefix of the flowspec rule and handle flowspec in pt_write(). OK tb@
2023-04-19bad indentsClaudio Jeker
2023-04-18Implement a basic flowspec print function. It is not 100% compatibleClaudio Jeker
with the parser but that is for a later time to fix. OK tb@
2023-04-18Rewrite some ugly for loopsTheo Buehler
This fixes a few KNF issues and ugly line wrapping by using a local version of nitems(); fix two bsearch() on top. ok claudio
2023-04-18Implement the parser bits to process flowspec rules. Heavily inspired byClaudio Jeker
pfctl, in bgpd flowspec rules are written like pf rules (with a few exceptions / extensions). As a result not all flowspec features are available but that is OK. OK tb@
2023-04-17Reverse the polarity of flowspec_cmp() so it works better with ourClaudio Jeker
RB trees. Mainly RB_FOREACH() walks form RB_MIN to RB_MAX so the most preferred entry should be at RB_MIN. OK tb@
2023-04-17Implement a basic API to work with flowspec NLRI.Claudio Jeker
Flowspec is excessivly flexible and large so there is no way to convert the flowspec data into a struct bgpd_addr and it is better to keep it in wireformat and add a few functions to validate and extract information from the NLRI encoding. OK tb@
2023-04-13Simplify how IMSG_CTL_SHOW_RIB_COMMUNITIES is constructed. This can justClaudio Jeker
call imsg_compose() and be done with it. OK tb@
2023-04-07Pass a pt_entry pointer to rib_get() and rib_add().Claudio Jeker
Add rib_get_addr() to behave like rib_get() did before. OK tb@
2023-04-05Refactor port definitions to also support service names like bgp.Claudio Jeker
OK tb@
2023-04-05Rename family with af to follow pfctl/parse.y a bit more.Claudio Jeker
OK tb@
2023-04-04Cleanup parse.y a bit. Move global defines a bit down. Move mrtdump andClaudio Jeker
network rules up into the grammar and switch the order of restricted to be more like the rest. OK tb@
2023-04-03Add first step of flowspec support. This adds the bits to establish aClaudio Jeker
connection with SAFI 133. Right now any sent UPDATE with SAFI 133 is simply ignored. At the moment SAFI 134 (flowspec for L3VPN) is unsupported. OK tb@
2023-03-30Refactor extract_prefix() to first do the length checks and only thenClaudio Jeker
copy the data out. OK tb@
2023-03-30Extra space in struct field definitions. NFCClaudio Jeker
2023-03-30Put the size of the pt_entry object into the struct itself.Claudio Jeker
Increase the refcnt to a 32bit int and while there reorder the vpn specific structs a bit so the IPv4 and IPv6 types are more equal. OK tb@
2023-03-29Mark the struct aid name as const char * since it points to static memory.Claudio Jeker
2023-03-29Switch prefix_adjout_get and new prefix_adjout_first to use a pt_entryClaudio Jeker
as argument instead of the bgpd_addr + prefixlen. Do the same with prefix_adjout_update but leave prefix_adjout_lookup and prefix_adjout_match since those are used by bgpctl code that does not use pt_entry structs. With this most of the update code no longer needs struct bgpd_addr and pt_getaddr(). OK tb@
2023-03-28In pt_fill set the refcnt to its maximum value to trigger an errorClaudio Jeker
if pt_ref is called on such a pt_entry. Set refcnt to 0 in pt_alloc since the value from pt_fill is copied over. OK tb@
2023-03-28Instead of exracting the prefix into a bgpd_addr and passing that toClaudio Jeker
prefix_write() rename prefix_write() to pt_write() and pass a pt_entry to the function. Removes an extra conversion step. OK tb@
2023-03-28More pt_entry cleanup, move structure definitions to rde_prefix.c andClaudio Jeker
by that make them private. Remove no longer used AID_PTSIZE define. OK tb@
2023-03-28Introduce a semaphore to protect intermediate state from different RTRClaudio Jeker
sessions to leak into the RDE via rtr_recalc. Only run rtr_recalc when the last or only RTR session is done with the update. Run a new timer along to ensure that the semaphore is not hold forever. The timeout is currently a very generous 60sec, no RTR cache should be that slow. OK tb@
2023-03-28Include the memory size usage of the prefix tree in rde_memstats.Claudio Jeker
OK tb@
2023-03-28Refactor mrt_dump_entry_v2() to use a dynamic buffer to hold the prefix.Claudio Jeker
Especially flowspec "prefixes" are variable size and so using a static buffer there is not going to work in the long run. OK tb@
2023-03-28Switch role logic in rde_aspa_validity() since this may need to be extended.Claudio Jeker
OK tb@ mbuhl@
2023-03-22Bump versionClaudio Jeker
2023-03-21Improve length checks for ATTR_MP_REACH_NLRI.Claudio Jeker
Based on a report by cjt (melissa_cjt at 163.com) OK tb@