summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr.c
AgeCommit message (Collapse)Author
2007-04-29[bgpd] Use defines for default weightPaul Jakma
2007-04-22 Sebastien Tandel <sebastien@tandel.be> * bgp_attr.h : Definition of BGP_ATTR_DEFAULT_WEIGHT. * bgp_attr.c : (bgp_attr_default_intern) now uses bgp_attr_default_set instead of duplicating the same code. (general) Use of BGP_ATTR_DEFAULT_WEIGHT. Replace two 16 by IPV6_MAX_BYTELEN.
2007-04-29[bgpd] Fix warnings: hash callbacks should match hash API declarationsPaul Jakma
2007-04-22 Sebastien Tandel <sebastien@tandel.be> * bgp_advertise.c : (baa_hash_alloc, baa_hash_key, baa_hash_cmp) conforms to quagga hash API. Defines _hash_[alloc|key|cmp] with void * arguments as defined by the API. * bgp_aspath.c,h : (aspath_key_make) conforms to quagga hash API. Defines _hash_[alloc|key|cmp] with void * arguments as defined by the API. * bgp_attr.c,h : (cluster_hash_alloc, cluster_hash_key_make, cluster_hash_cmp, transit_hash_alloc, transit_hash_key_make, transit_hash_cmp, attrhash_key_make, attrhash_cmp, bgp_attr_hash_alloc) conforms to quagga hash API. Defines _hash_[alloc|key|cmp] with void * arguments as defined by the API.
2007-04-10[bgpd] Bug #354: Take care to keep reads of MP_(UN)REACH_NLRI in boundsPaul Jakma
2007-04-08 Paul Jakma <paul.jakma@sun.com> * bgp_attr.c: (general) Bug #354: parsing of MP_REACH_NLRI and MP_UNREACH_NLRI does not take sufficient care to ensure reads from stream buffer stay in-bounds. Hence bgpd may attempt to read beyond end of stream, if given a crafted packet. As it uses the stream access methods to do so, this will typically result in assert() being hit in stream.c. Where code is compiled without assert() enabled, result is unknown. (struct message attr_str) should be static. (bgp_mp_reach_parse) Carefully check length remaining in stream against amount desired to read from stream, prior to each read, particularly where lengths are conditional on data obtained from stream - using STREAM_READABLE. Remove code to parse SNPA-number, it's a defunct field and changed to a fixed size in latest BGP MP update RFC - log warning if SNPA-number is not 0. (bgp_mp_unreach_parse) Check withdraw_length carefully against STREAM_READABLE. (bgp_attr_parse) If attribute-parser function returns error, log warning. Log attribute type on mismatch.
2006-05-12[bgpd] Remove dead code in ORIGINATOR_ID packet forming codePaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * bgp_attr.c: (bgp_packet_attribute) Remove dead code, Coverity CID #1
2006-05-04[bgpd] bug #210: Enable crucial VPNv4 code which was disabledPaul Jakma
2006-05-04 Paul Jakma <paul.jakma@sun.com> * (general) VPNv4 fixes. Certain VPNv4 code was not enabled. See bug #210. * bgp_attr.{c,h}: (bgp_packet_{withdraw,attribute}) Tag should be u_char really. * bgp_packet.c: (bgp_{update,withdraw}_packet) Enable some VPNv4 code which inexplicably was ifdef'd out. comments from a tester on IRC suggest this fixes bug #210.
2006-03-30[bgpd] rearrange some structs for less padding, stats for table/attrs.Paul Jakma
2006-03-12 Paul Jakma <paul.jakma@sun.com> * bgp_attr.h: (struct attr) rearrange fields to avoid wasted padding between them as much as possible. (attr_count,attr_unknown_count) export new functions to return number of counts of cached attributes. * bgp_attr.c: (attr_count,attr_unknown_count) new functions to return number of counts of cached attributes. * bgp_route.h: (struct bgp_info) rearrange fields to avoid wasted padding. * bgp_table.h: (struct bgp_table) Add a count field, of number of nodes in the table. (struct bgp_node) rearrange fields to avoid wasted padding between them, though I don't think there was any in this case. * bgp_table.c: (bgp_node_{delete,get}) Maintain the table node count. (bgp_table_count) new function to access the table count.
2006-01-19[compiler] miscellaneous trivial compiler warning fixespaul
2006-01-19 Paul Jakma <paul.jakma@sun.com> * (general) various miscellaneous compiler warning fixes. Remove redundant break statements from switch clauses which return. return from main, not exit, cause it annoys SOS. Remove stray semi-colons which cause empty-statement warnings. * zebra/main.c: (sighup) remove private declaration of external function.
2005-09-102005-09-10 Paul Jakma <paul.jakma@sun.com>paul
* Makefile.am: bgpd shouldn't list libgp's sources as its own. Use LDADD. * bgp_aspath.h: (struct assegment) New struct, abstract representation of a list of AS_PATH segments and the contained ASNs. (struct aspath) Remove the raw-data related fields, reference the abstract struct assegment instead. Remove several other computed fields, it's just a headache to maintain them and they're cheap to compute from struct assegment. (aspath_parse) parse a stream, not a pointer to raw data. (aspath_count_{hops,confeds,size}) helpers to access information formerly directly contained in struct aspath. (aspath_snmp_pathseg) Helper for SNMP, BGP MIB wants to be able to output hex representation of raw data. * bgp_aspath.c: (general) partial-rewrite. Store aspath data as an abstract singly-linked list of abstract segments, rather than storing the raw data, and parsing it each and every time. Remove several count/size fields which are cheap to compute from the abstract segment structure. (global) Include stream.h, needed for aspath_parse, and others. Couple of helper macros added. (struct assegment_header) Just the header, and only the header. (assegment_data_{new,free}) convenience functions for AS_SEG_DATA allocation, the dynamic, per-segment array of ASNs. (assegment_{new,free,free_all,dup,dup_all}) convenience functions for creating struct assegments. The _all forms will follow the entire chain of segments from the given segment. (assegment_prepend_asns) new function, prepend an ASN N times to segment. (assegment_append_asns) Append a list (array) of ASNs to segment. (int_cmp) convenience function for the aspath hash. (assegment_normalise) new function. Normalise the given segment chain to meet expectations of Quagga, and to eliminate differing raw representations of the same paths. Merge 'runs' of SEQUENCEs into one segment as our internal segment is not limited by the protocol AS_PATH segment length. Sort ASNs in SETs. (aspath_new) Take void argument to quell warnings. Use the assegment convenience functions. (assegment_count_{asns,confeds,hops}) new functions to compute at runtime values previously held in struct aspath. (aspath_size) ditto. (aspath_make_str_count) rewritten to stringify new representation, and to be slightly easier to understand hopefully. (aspath_str_update) convenience function, update the aspath str. Should investigate removing maintained string from struct aspath, just run-time compute it, as per other fields. It's just a maintenance headache, would save noticeable amount of RAM with possibly not much extra run-time cost. (aspath_dup) use the assegment dup functions. (aspath_hash_alloc) Take void * argument to satisfy gcc. Use the proper helper functions to dup data. (assegments_parse) new function. parse raw AS_PATH data into struct assegments. Normalise and return the head of the list. (aspath_parse) Parse a stream, not pointer to raw data and use assegments_parse to do it. (assegment_data_put) Write out a single segment data in protocol form to stream. (assegment_header_put) ditto but for segment header. (aspath_put) new function. As per previous but for an entire struct aspath. (aspath_snmp_pathseg) wrapper around aspath_put for bgp_snmp.c. Uses a static buffer sadly. (aspath_aggregate_as_set_add) rewritten to use assegments. (aspath_aggregate) ditto (aspath_{firstas,loop,private_as}_check) ditto (aspath_{merge,prepend,add_one_as}) ditto (aspath_cmp_left{_confed}) ditto (aspath_delete_confed_seq) ditto, plus fixed to properly delete all leading confed segments. (aspath_as_add) Just use assegment_append_asns. (aspath_segment_add) updated to use assegments. (enum as_token) Add values for confeds (aspath_gettoken) Add support for confeds (aspath_str2aspath) ditto (aspath_key_make) updated to use as_segments. Also, add segment type into the hash value as appropriate. (aspath_cmp) updated to use as_segments. (aspath_print) don't segfault on NULL argument. * bgp_attr.c: (bgp_attr_aspath) aspath_parse wants the stream now. No need for manual forwarding of stream. (bgp_packet_attribute) empty aspath is now denoted by NULL segment field, length is gone. Use aspath_size() to determine size. (bgp_attr_init) Fix declaration, explicitely specify void arg. (bgp_dump_routes_attr) Use aspath_size() to determine size. * bgp_route.c: (bgp_info_cmp) use the aspath_count_* functions. (bgp_rib_withdraw) remove unused variable. Use aspath_count_hops. * bgp_snmp.c: (bgp4PathAttrTable) raw data is gone, use aspath_snmp_pathseg to get the representation.
2005-06-282005-06-28 Paul Jakma <paul.jakma@sun.com>paul
* (global) The great bgpd extern and static'ification. * bgp_routemap.c: remove unused ROUTE_MATCH_ASPATH_OLD code (route_set_metric_compile) fix u_int32_t to ULONG_MAX comparison warnings. * bgp_route.h: (bgp_process, bgp_withdraw, bgp_update) export these used by various files which had their own private declarations, in the case of mplsvpn - incorrect.
2005-02-092005-02-09 Paul Jakma <paul.jakma@sun.com>paul
* (global) Update code to match stream.h changes. stream_get_putp effectively replaced with stream_get_endp. stream_forward renamed to stream_forward_getp. stream_forward_endp introduced to replace some previous setting/manual twiddling of putp by daemons. * lib/stream.h: Remove putp. Update reference to putp with endp. Add stream_forward_endp, which daemons were doing manually. Rename stream_forward to stream_forward_getp. lib/stream.c: Remove/update references to putp. introduce stream_forward_endp.
2005-02-01 * bgp_attr.c, bgp_snmp.c, bgp_vty.c, bgpd.[ch]: Remove support for oldhasso
draft - ie. "neighbor version 4-" commands. Preserve dummy "neighbor version" command as deprecated. [merge from GNU Zebra]
2005-02-01 * bgp_nexthop.c: Improve debug.hasso
* bgpd.[ch], bgp_nexthop.c, bgp_snmp.c: Remove useless bgp_get_master() function. * bgp_packet.c: MP AFI_IP update and withdraw parsing. * bgp_fsm.c: Reset peer synctime in bgp_stop(). bgp_fsm_change_status() is better place to log about peer status change than bgp_event(). Log in bgp_connect_success(). * bgp_vty.c: Fix typo in comment. * bgp_attr.c: Better log about unknown attribute. [merge from GNU Zebra]
2004-12-09Add comments with warnings obtained on NetBSD/i386. Both are due togdt
size_t being used for streams. Perhaps cast to unsigned long before printf? Surely that's big enough even if size_t could be larger in theory. (no changelog, since only comment changes)
2004-12-082004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* *.c: Change level of debug messages to LOG_DEBUG.
2004-10-312004-10-31 Paul Jakma <paul@dishone.st>paul
* {bgpd,bgp_attr}.c: size_t printf format should be ld.
2004-09-132004-09-13 Jose Luis Rubio <jrubio@dit.upm.es>paul
(at Technical University of Madrid as part of Euro6ix Project) Enhanced Route Server functionality and Route-Maps: * bgpd/bgpd.h: Modified 'struct peer' and 'struct bgp_filter' to support rs-clients. A 'struct bgp_table *rib' has been added to the first (to mantain a separated RIB for each rs-client) and two new route-maps have been added to the last (for import/export policies). Added the following #defines: RMAP_{IN|OUT|IMPORT|EXPORT|MAX}, PEER_RMAP_TYPE_{IMPORT|EXPORT} and BGP_CLEAR_SOFT_RSCLIENT. * bgpd/bgpd.c: Modified the functions that create/delete/etc peers in order to consider the new fields included in 'struct peer' for supporting rs-clients, i.e. the import/export route-maps and the 'struct bgp_table'. * bgpd/bgp_route.{ch}: Modified several functions related with receiving/sending announces in order to support the new Route Server capabilities. Function 'bgp_process' has been reorganized, creating an auxiliar function for best path selection ('bgp_best_selection'). Modified 'bgp_show' and 'bgp_show_route' for displaying information about any RIB (and not only the main bgp RIB). Added commands for displaying information about RS-clients RIBs: 'show bgp rsclient (A.B.C.D|X:X::X:X)', 'show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M', etc * bgpd/bgp_table.{ch}: The structure 'struct bgp_table' now has two new fields: type (which can take the values BGP_TABLE_{MAIN|RSCLIENT}) and 'void *owner' which points to 'struct bgp' or 'struct peer' which owns the table. When creating a new bgp_table by default 'type=BGP_TABLE_MAIN' is set. * bgpd/bgp_vty.c: The commands 'neighbor ... route-server-client' and 'no neighbor ... route-server-client' now not only set/unset the flag PEER_FLAG_RSERVER_CLIENT, but they create/destroy the 'struct bgp_table' of the peer. Special actions are taken for peer_groups. Command 'neighbor ... route-map WORD (in|out)' now also supports two new kinds of route-map: 'import' and 'export'. Added commands 'clear bgp * rsclient', etc. These commands allow a new kind of soft_reconfig which affects only the RIB of the specified RS-client. Added commands 'show bgp rsclient summary', etc which display a summary of the rs-clients configured for the corresponding address family. * bgpd/bgp_routemap.c: A new match statement is available, 'match peer (A.B.C.D|X:X::X:X)'. This statement can only be used in import/export route-maps, and it matches when the peer who announces (when used in an import route-map) or is going to receive (when used in an export route-map) the route is the same than the one specified in the statement. For peer-groups the statement matches if the specified peer is member of the peer-group. A special version of the command, 'match peer local', matches with routes originated by the Route Server (defined with 'network ...', redistributed routes and default-originate). * lib/routemap.{ch}: Added a new clause 'call NAME' for use in route-maps. It jumps into the specified route-map and when it returns the first route-map ends if the called RM returns DENY_MATCH, or continues in other case.
2004-06-042004-06-04 Paul Jakma <paul@dishone.st>paul
* type mismatch fixes
2004-05-20Merge bgpd changeset 1184 from Zebra repository by Rivo Nurges.hasso
2003-10-182003-10-18 Lorenzo Colitti <lorenzo@ripe.net>paul
2003-10-18 Lorenzo Colitti <lorenzo@ripe.net> * bgpd/bgp_attr.c: (bgp_dump_routes_attr) Dont dump IPv4 nexthop for IP. Dump MP_NLRI attr with IPv6 next-hop for AF_INET6 address family prefixes. Accept prefix as argument. * bgpd/bgp_attr.c: modify bgp_dump_routes_attr declaration. * bgpd/bgp_dump.c: (bgp_dump_routes_entry) Modify calls to bgp_dump_routes_attr. (bgp_dump_common) Go by the family of the peering socket, not configured address family when dumping peering information. Add HAVE_IPV6 conditionals, eg missing from previous bgp interval patch.
2002-12-13Initial revisionpaul