summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_attr.c
AgeCommit message (Collapse)Author
2010-05-26Rename some imsg bits to make namespace collisions less likely buf toNicholas Marriott
ibuf, buf_read to ibuf_read, READ_BUF_SIZE to IBUF_READ_SIZE. ok henning gilles claudio jacekm deraadt
2010-05-17Implement two new filters, max-as-len and max-as-seq. The first is limitingClaudio Jeker
the length of an AS path (matches if the path is longer then the specified lenght) the second matches when a sequence of the same AS number is longer then the specified length). max-as-len is good to protect crappy comercial bgp boxes from other crappy comercial bgp boxes. max-as-seq was a feature request from SwissIX and maybe EuroIX to find and filter prepends. Additinal testing and OK sthen@
2010-03-29I'm going to need community_ext_conv() outside of rde_attr.c soon, so moveClaudio Jeker
the prototype to rde.h
2010-03-05Allow to filter for ext-community attributes. Currently only perfect matchesClaudio Jeker
work but that's already better then nothing. OK sthen@
2009-12-18Merge rde_filter_community() with community_match() and kill a uselessClaudio Jeker
indirection.
2009-12-16Implement "set ext-community [delete] subtype key:value" to set and deleteClaudio Jeker
extended communities as specified in RFC 4360. No matching implemented yet and stuff like * and neighbor-as are neither supported but will be soon. Looks good henning & sthen, manpage fixed by jmc
2009-03-19Implement a attr_writebuf() function that works on a struct buf instead ofClaudio Jeker
a pre allocated piece of memory. Will be used by newer mrt code. OK henning@
2009-02-17Fix aspath_prepend() in the case a AS-PATH has a sequence of 255 elementsClaudio Jeker
and we try to prepend. The result was a corrupt AS-PATH and a RDE fatal later on when some other operation was run on that path. Found the hard way by henning@ and sthen@. OK henning@, sthen@
2009-01-13Replace NEW_ASPATH/NEW_AGGREGATOR with the naming from RFC4893,Stuart Henderson
AS4_PATH/AS4_AGGREGATOR. No binary change. ok claudio
2008-05-08KNFHenning Brauer
2007-05-22Only try to merge a AS_SEQUENCE if there is a difference between the 4-byteClaudio Jeker
AS path and the 2-byte version. If both pathes have the same length don't try to merge them instead use the new path. Issue reported by Jon Morby and further analysed by Stuart Henderson. Tested by Stuart Henderson.
2007-05-11Various spelling fixes from Stuart Henderson.Claudio Jeker
2007-04-30Better error messages.Claudio Jeker
2007-04-30Fix a bad check in aspath_inflate() -- compare with the correct loop value.Claudio Jeker
2007-04-23Make bgpd 4-byte AS compatible. All internal representations of AS numbersClaudio Jeker
are now 4-byte instead of the old 2-byte numbers. The only exception are communities because they can not be switched. The RDE will inflate and deflate the ASPATH and AGGREGATOR attributes on demand and create the NEW_ASPATH and NEW_AGGREGATOR field whenever needed. Both old and new stile sessions are supported and can be mixed. Currently new stile sessions with the 4-byte AS number capability turned on are only enabled if one of the AS numbers involved is a 4-byte one. This is based on an initial diff by Geoff Huston gih (at) apnic (dot) net Cleanup, testing and bug-fixes by myself (via AS 3.10). Currently mrt table dumps are producing incompatible output this will be fixed afterwards -- this diff is already big enough. "get it in if you think it is ready" henning@
2007-03-06allow filtering on peer-as (leftmost AS in path), ok claudioHenning Brauer
2007-02-22KNFHenning Brauer
2006-12-21Check for overflow of others_len. This can not happen at the moment becauseClaudio Jeker
less than 255 attributes can be allocated at max. OK claudio@
2006-12-18avoid p = realloc(p idiom, ok claudio, spotted deraadtHenning Brauer
2006-05-27Unfuck community delete. The if () statement to match communities was FUBARClaudio Jeker
instead reverse logic and use the same if statement as in the match function. Issue found and debugged by Leen Besselink. Thanks.
2006-04-12It is no longer allowed to change attributes in place. This corrupts theClaudio Jeker
attribute cache. Instead remove attribute and readd it after beeing changed. This should fix the "att_diff: equal attributes encountered" error seen by Tony Sarendal. OK henning@
2006-03-15Fix a memory leak when communities are set or deleted. This seems to fixClaudio Jeker
Sylvain Coutant memory issues. A lot of patience and testing by Sylvain.
2006-02-09Implement "set community delete 65001:*" and friends. This will removeClaudio Jeker
communities from the path attributes. Useful to make sure that the ones you set later are set by a (evil) peer. OK henning@
2006-02-09When comparing community type, cast to u_int16_t. The same is done for theClaudio Jeker
AS. OK henning@
2006-02-09attr_free() should not modify others_len as it does not resize the othersClaudio Jeker
array. It just clears on entry by setting it to NULL and moving that NULL to the end of the array. With this it will be possible to remove attributes without readding them right afterwards. Because of this attr_diff() needs to be more careful because of passed NULL pointers. OK henning@
2006-01-20No need to calloc() others if others_len is 0. The 0 malloc() does not hurtClaudio Jeker
(we do not access it) but does not help either. Finally it reduces head scratching when debugging the RIB. OK henning@
2006-01-20Doh. > not < and attr_compare() starts to work correctly. OK henning@Claudio Jeker
2006-01-10The attributes cache broke the set community filterset because community_set()Claudio Jeker
modified the attribute data directly and corrupted the cache by doing it. It is no longer allowed to modify attributes via attr_optget() -> change attr->data. Instead remove the old attribute from the aspath and then add a new modifed one again. Included in this change is the removal of a "feature" that allowed only one community per AS. If you had problems to add multiple communities via filters then this was the problem. Looks good Henning.
2006-01-10In attr_diff() compare the attributes flags too. They may be different andClaudio Jeker
especially they are accounted in the hash. While there change a 0 to NULL.
2006-01-05Cache optional BGP attributes (mostly communities) and use a simpleClaudio Jeker
pointer plus a ref counter to link the attributes to the path object. Saves +/- 10M on 11 full feeds. Looks good Henning
2006-01-04Correctly count the number of allocated BGP attributes. Needs a own counter.Claudio Jeker
2006-01-03Track some (memory) statistics in the RDE. Accessible via bgpctl.Claudio Jeker
2006-01-03Move functions shared with bgpctl into new file util.c. Simplifies theClaudio Jeker
link between bgpctl and bgpd mostly because of rde_attr.c.
2005-12-30Remove unused attr_optlen()Claudio Jeker
2005-12-30Use sys/hash.h instead of own built functions that work similar.Claudio Jeker
While there reorder some structs to help with alignment.
2005-12-19Better English in comment.Claudio Jeker
2005-06-13realloc(3) correctly. Do not adjust the variable describing how much memoryClaudio Jeker
has been allocated until one knows the allocation has been successful.
2005-06-10Make sure that the ATTR_EXTLEN flag is unset if the attribute length isClaudio Jeker
smaller than 255 bytes.
2005-06-10Introduce attr_optlen() to get the total lenght of an optional attributeClaudio Jeker
plus header. Soon needed.
2005-04-16Simplify return codes of aspath_asprint().Claudio Jeker
Return -1 on error 0 on success and make sure that in case of an error *ret is set to NULL.
2005-04-15Fix memory leak in case aspath_snprint() returns an error (-1).Claudio Jeker
OK henning@
2004-11-10It is not needed to mask the value wit 0xff as it is < 255. OK henning@Claudio Jeker
2004-08-10style, use sizeof() instead of a hardcoded value.Claudio Jeker
2004-08-06Monster diff to get one step closer to IPv6 support.Claudio Jeker
Cleanup path attribute handling. First of all kill struct attr_flags, all those infos are now in struct rde_aspath. Second move attribute parser functions into rde.c, rde_attr.c is shared between bgpd and bgpctl. Third reimplementation of the nexthop handling. Make it IPv6 ready and fix some major bug relating to "set nexthop". henning@ OK if it breaks nothing
2004-08-05As usual cleanup on exit. OK henning@Claudio Jeker
2004-08-05Cleanup aspath specific functions and api. Mainly switch to a refcnt basedClaudio Jeker
allocation. This helps to save a bit of RAM. looks good henning@
2004-07-28The default localpreference is 100 and not 0. Found and ok henning@Claudio Jeker
2004-07-13fix some typosJared Yanovich
ok henning otto
2004-07-05The rde no longer needs to check if the nexthop is the loopback address.Claudio Jeker
This is now down in the parent. OK henning@
2004-07-05fix a few KNF falloutsHenning Brauer