Age | Commit message (Collapse) | Author |
|
|
|
* draft-ietf-idr-as-pathlimit doesn't seem to have gone anywhere, and its
author does not think it will make progress in IDR. Remove all support
introduced for it, but leave stubs for the commands to avoid breaking
any configurations.
Basically reverts cecab5e9725792e60a5e4b473e238a14cd85815d.
(cherry picked from commit c8f3fe3063cb9ff193b13011cfbda3e605395340)
Conflicts:
bgpd/bgp_attr.c (caused by c8e7b895, resolved)
|
|
* bgp_attr.c: (bgp_attr_ext_communities) Certain extended-community attrs
can leave attr->flag indicating ext-community is present, even though no
extended-community object has been attached to the attr structure. Thus a
null-pointer dereference can occur later.
(bgp_attr_community) No bug fixed here, but tidy up flow so it has same
form as previous.
Problem and fix thanks to anonymous reporter.
(cherry picked from commit 0c46638122f10019a12ae9668aec91691cf2e017)
|
|
* bgpd/bgp_attr.c, bgpd/bgp_open.h, bgpd/bgp_route.c, lib/prefix.c,
lib/prefix.h: Various integer types were being used where, if we
had strict type checking, afi_t and safi_t would be required.
Signed-off-by: G.Balaji <balajig81@gmail.com>
(cherry picked from commit c8af35ffa2dc79ff7d7ff00b1b61f1f50a100ab6)
|
|
* bgpd/bgp_aspath.c
* assegments_parse(): add handling of AS4_PATH input, update bounds
checks, add check for AS segment type
* aspath_parse(): add handling of AS4_PATH input, expect
assegments_parse() to do length checking
* aspath_empty(): update for the new function prototype
* bgpd/bgp_aspath.h: ditto
* tests/aspath_test.c: ditto
* bgpd/bgp_attr.c
* bgp_attr_aspath(): add handling of AS4_PATH input, update flags
checks, change returned type
* bgp_attr_as4_path(): discard, superseded by bgp_attr_aspath()
* bgp_attr_parse(): update respectively
|
|
* bgp_attr.c: (bgp_mp_reach_parse) There are some interoperability issues
for MBGP (particularly IPv4 multicast NLRI) between different
implementations. In order to get some next hops to install correctly in
the BGP tables, it appears to be necessary to copy the multiprotocol next
hop into the base next hop field. This is related to differences in RFC
2283 and RFC 2858.
|
|
This patch implements BGP confederation error handling in Quagga as described
in RFC5065, paragraph 5.
* bgp_aspath.c: (aspath_confed_check, aspath_left_confed_check) new functions
* bgp_attr.c: (bgp_attr_aspath_check) apply previous and NOTIFY if there's
a problem.
|
|
I've spent the last several weeks working on stability fixes to bgpd.
These patches fix all of the numerous crashes, assertion failures, memory
leaks and memory stomping I could find. Valgrind was used extensively.
Added new function bgp_exit() to help catch problems. If "debug bgp" is
configured and bgpd exits with status of 0, statistics on remaining
lib/memory.c allocations are printed to stderr. It is my hope that other
developers will use this to stay on top of memory issues.
Example questionable exit:
bgpd: memstats: Current memory utilization in module LIB:
bgpd: memstats: Link List : 6
bgpd: memstats: Link Node : 5
bgpd: memstats: Hash : 8
bgpd: memstats: Hash Bucket : 2
bgpd: memstats: Hash Index : 8
bgpd: memstats: Work queue : 3
bgpd: memstats: Work queue item : 2
bgpd: memstats: Work queue name string : 3
bgpd: memstats: Current memory utilization in module BGP:
bgpd: memstats: BGP instance : 1
bgpd: memstats: BGP peer : 1
bgpd: memstats: BGP peer hostname : 1
bgpd: memstats: BGP attribute : 1
bgpd: memstats: BGP extra attributes : 1
bgpd: memstats: BGP aspath : 1
bgpd: memstats: BGP aspath str : 1
bgpd: memstats: BGP table : 24
bgpd: memstats: BGP node : 1
bgpd: memstats: BGP route : 1
bgpd: memstats: BGP synchronise : 8
bgpd: memstats: BGP Process queue : 1
bgpd: memstats: BGP node clear queue : 1
bgpd: memstats: NOTE: If configuration exists, utilization may be expected.
Example clean exit:
bgpd: memstats: No remaining tracked memory utilization.
This patch fixes bug #397: "Invalid free in bgp_announce_check()".
This patch fixes bug #492: "SIGBUS in bgpd/bgp_route.c:
bgp_clear_route_node()".
My apologies for not separating out these changes into individual patches.
The complexity of doing so boggled what is left of my brain. I hope this
is all still useful to the community.
This code has been production tested, in non-route-server-client mode, on
a linux 32-bit box and a 64-bit box.
Release/reset functions, used by bgp_exit(), added to:
bgpd/bgp_attr.c,h
bgpd/bgp_community.c,h
bgpd/bgp_dump.c,h
bgpd/bgp_ecommunity.c,h
bgpd/bgp_filter.c,h
bgpd/bgp_nexthop.c,h
bgpd/bgp_route.c,h
lib/routemap.c,h
File by file analysis:
* bgpd/bgp_aspath.c: Prevent re-use of ashash after it is released.
* bgpd/bgp_attr.c: #if removed uncalled cluster_dup().
* bgpd/bgp_clist.c,h: Allow community_list_terminate() to be called from
bgp_exit().
* bgpd/bgp_filter.c: Fix aslist->name use without allocation check, and
also fix memory leak.
* bgpd/bgp_main.c: Created bgp_exit() exit routine. This function frees
allocations made as part of bgpd initialization and, to some extent,
configuration. If "debug bgp" is configured, memory stats are printed
as described above.
* bgpd/bgp_nexthop.c: zclient_new() already allocates stream for
ibuf/obuf, so bgp_scan_init() shouldn't do it too. Also, made it so
zlookup is global so bgp_exit() can use it.
* bgpd/bgp_packet.c: bgp_capability_msg_parse() call to bgp_clear_route()
adjusted to use new BGP_CLEAR_ROUTE_NORMAL flag.
* bgpd/bgp_route.h: Correct reference counter "lock" to be signed.
bgp_clear_route() now accepts a bgp_clear_route_type of either
BGP_CLEAR_ROUTE_NORMAL or BGP_CLEAR_ROUTE_MY_RSCLIENT.
* bgpd/bgp_route.c:
- bgp_process_rsclient(): attr was being zero'ed and then
bgp_attr_extra_free() was being called with it, even though it was
never filled with valid data.
- bgp_process_rsclient(): Make sure rsclient->group is not NULL before
use.
- bgp_processq_del(): Add call to bgp_table_unlock().
- bgp_process(): Add call to bgp_table_lock().
- bgp_update_rsclient(): memset clearing of new_attr not needed since
declarationw with "= { 0 }" does it. memset was already commented
out.
- bgp_update_rsclient(): Fix screwed up misleading indentation.
- bgp_withdraw_rsclient(): Fix screwed up misleading indentation.
- bgp_clear_route_node(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT.
- bgp_clear_node_queue_del(): Add call to bgp_table_unlock() and also
free struct bgp_clear_node_queue used for work item.
- bgp_clear_node_complete(): Do peer_unlock() after BGP_EVENT_ADD() in
case peer is released by peer_unlock() call.
- bgp_clear_route_table(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT. Use
struct bgp_clear_node_queue to supply data to worker. Add call to
bgp_table_lock().
- bgp_clear_route(): Add support for BGP_CLEAR_ROUTE_NORMAL or
BGP_CLEAR_ROUTE_MY_RSCLIENT.
- bgp_clear_route_all(): Use BGP_CLEAR_ROUTE_NORMAL.
Bug 397 fixes:
- bgp_default_originate()
- bgp_announce_table()
* bgpd/bgp_table.h:
- struct bgp_table: Added reference count. Changed type of owner to be
"struct peer *" rather than "void *".
- struct bgp_node: Correct reference counter "lock" to be signed.
* bgpd/bgp_table.c:
- Added bgp_table reference counting.
- bgp_table_free(): Fixed cleanup code. Call peer_unlock() on owner if
set.
- bgp_unlock_node(): Added assertion.
- bgp_node_get(): Added call to bgp_lock_node() to code path that it was
missing from.
* bgpd/bgp_vty.c:
- peer_rsclient_set_vty(): Call peer_lock() as part of peer assignment
to owner. Handle failure gracefully.
- peer_rsclient_unset_vty(): Add call to bgp_clear_route() with
BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.
* bgpd/bgp_zebra.c: Made it so zclient is global so bgp_exit() can use it.
* bgpd/bgpd.c:
- peer_lock(): Allow to be called when status is "Deleted".
- peer_deactivate(): Supply BGP_CLEAR_ROUTE_NORMAL purpose to
bgp_clear_route() call.
- peer_delete(): Common variable listnode pn. Fix bug in which rsclient
was only dealt with if not part of a peer group. Call
bgp_clear_route() for rsclient, if appropriate, and do so with
BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.
- peer_group_get(): Use XSTRDUP() instead of strdup() for conf->host.
- peer_group_bind(): Call bgp_clear_route() for rsclient, and do so with
BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.
- bgp_create(): Use XSTRDUP() instead of strdup() for peer_self->host.
- bgp_delete(): Delete peers before groups, rather than after. And then
rather than deleting rsclients, verify that there are none at this
point.
- bgp_unlock(): Add assertion.
- bgp_free(): Call bgp_table_finish() rather than doing XFREE() itself.
* lib/command.c,h: Compiler warning fixes. Add cmd_terminate(). Fixed
massive leak in install_element() in which cmd_make_descvec() was being
called more than once for the same cmd->strvec/string/doc.
* lib/log.c: Make closezlog() check fp before calling fclose().
* lib/memory.c: Catch when alloc count goes negative by using signed
counts. Correct #endif comment. Add log_memstats_stderr().
* lib/memory.h: Add log_memstats_stderr().
* lib/thread.c: thread->funcname was being accessed in thread_call() after
it had been freed. Rearranged things so that thread_call() frees
funcname. Also made it so thread_master_free() cleans up cpu_record.
* lib/vty.c,h: Use global command_cr. Add vty_terminate().
* lib/zclient.c,h: Re-enable zclient_free().
|
|
Message lists can be read-only, and hash tables are local to this
code.
|
|
Use Ansi-C prototypes rather than old K&R method of declaring
function without arguments
|
|
Simple conversion of XMALLOC/memset to XCALLOC
|
|
* bgpd/bgp_aspath.c: (aspath_make_str_count) "assert (len < str_size)" was
getting hit under certain 4-byte ASN conditions. New realloc strategy.
* bgpd/bgp_aspath.c: (aspath_key_make) const warning fix.
"%d" -> "%u" 4-byte ASN corrections. Prevent negative number when ASN is
above 2^31.
|
|
2008-08-15 Paul Jakma <paul.jakma@sun.com>
* */*: Fix various problems flagged by Sun Studio compiler.
- '<qualifier> <storage>' obsolescent in declarations
- empty statements (';' after ALIAS definitions)
- implicit declarations (e.g printstack in lib/log.c)
- "\%" in printf string instead of "%%"
- loops that return on the first iteration (legitimately, but
compiler can't really know), e.g. bgp_routemap.c
- internal declarations which mask prototypes.
|
|
2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com>
* lib/hash.h: (struct hash) Hash comparator callback really
ought to treat storage behind arguments as constant - a compare
function with side-effects would be evil.
* */*.c: Adjust comparator functions similarly, thus fixing at least
a few compiler warnings about const qualifier being dropped.
Signed-off-by: Paul Jakma <paul@quagga.net>
|
|
2008-07-22 Paul Jakma <paul.jakma@sun.com>
* bgp_community.c: (community_str2com) assigns defaults to local
vars
* bgp_attr.c: (bgp_attr_parse) match format specifier to arg
* bgp_table.{c,h}: (bgp_table_top) can take a * to a const, quelling
warning in bgp_route.c
|
|
2008-06-07 Paul Jakma <paul@jakma.org>
* bgp_attr.{c,h}: (bgp_mp_{un,}reach_parse) export, for unit tests.
* bgp_attr.c: (bgp_mp_reach_parse) Add logging. Tighten length test
to bounds check against the attribute length rather than the
stream length..
|
|
2008-06-01 jfletche@gmail.com
* bgp_attr.c: (bgp_attr_aspathlimit) fix silly bug in flags check
that was causing BGP to drop sessions if it received a
aspath-limit with partial set. Fixes bug #419.
|
|
2008-03-13 Paul Jakma <paul.jakma@sun.com>
* (various) Remove 0 entries from struct message's, unneeded due to
recent improvements in mes_lookup/LOOKUP.
|
|
2007-12-22 Paul Jakma <paul.jakma@sun.com>
* Fix series of vulnerabilities reported by "Mu Security
Research Team", where bgpd can be made to crash by sending
malformed packets - requires that bgpd be configured with a
session to the peer.
* bgp_attr.c: (bgp_attr_as4_path) aspath_parse may fail, only
set the attribute flag indicating AS4_PATH if we actually managed
to parse one.
(bgp_attr_munge_as4_attrs) Assert was too general, it is possible
to receive AS4_AGGREGATOR before AGGREGATOR.
(bgp_attr_parse) Check that we have actually received the extra
byte of header for Extended-Length attributes.
* bgp_attr.h: Fix BGP_ATTR_MIN_LEN to account for the length byte.
* bgp_open.c: (cap_minsizes) Fix size of CAPABILITY_CODE_RESTART,
incorrect -2 left in place from a development version of as4-path
patch.
* bgp_packet.c: (bgp_route_refresh_receive) ORF length parameter
needs to be properly sanity checked.
* tests/bgp_capability_test.c: Test for empty capabilities.
|
|
2007-10-14 Paul Jakma <paul.jakma@sun.com>
* NEWS: Note that MRT dumps are now version 2
* (general) Merge in Juergen Kammer's AS4 patch.
2007-09-27 Paul Jakma <paul.jakma@sun.com>
* bgp_aspath.c: (assegment_normalise) remove duplicates from
from sets.
(aspath_reconcile_as4) disregard a broken part of the RFC around
error handling in path reconciliation.
* aspath_test.c: Test dupe-weeding from sets.
Test that reconciliation merges AS_PATH and AS4_PATH where
former is shorter than latter.
2007-09-26 Paul Jakma <paul.jakma@sun.com>
* aspath_test.c: Test AS4_PATH reconcilation where length
of AS_PATH and AS4_PATH is same.
2007-09-25 Paul Jakma <paul.jakma@sun.com>
* bgp_open.c: (peek_for_as4_capability) Fix to work.
* bgp_packet.c: (bgp_open_receive) Fix sanity check of as4.
* tests/bgp_capability_test.c: (general) Extend tests to validate
peek_for_as4_capability.
Add test of full OPEN Option block, with multiple capabilities,
both as a series of Option, and a single option.
Add some crap to beginning of stream, to prevent code depending
on getp == 0.
2007-09-18 Paul Jakma <paul.jakma@sun.com>
* bgp_open.c: (bgp_capability_as4) debug printf inline with others.
(peek_for_as4_capability) There's no need to signal failure, as
failure is better dealt with through full capability parser -
just return the AS4, simpler.
* bgp_packet.c: (bgp_open_receive) Update to match
peek_for_as4_capability change.
Allow use of BGP_AS_TRANS by 2b speakers.
Use NOTIFY_OPEN_ERR rather than CEASE for OPEN parsing errors.
(bgp_capability_msg_parse) missing argument to debug print
(bgp_capability_receive) missing return values.
* tests/bgp_capability_test.c: (parse_test) update for changes to
peek_for_as4_capability
2007-07-25 Paul Jakma <paul.jakma@sun.com>
* Remove 2-byte size macros, just make existing macros take
argument to indicate which size to use.
Adjust all users - typically they want '1'.
* bgp_aspath.c: (aspath_has_as4) New, return 1 if there are any
as4's in a path.
(aspath_put) Return the number of bytes actually written, to
fix the bug Juergen noted: Splitting of segments will change
the number of bytes written from that already written to the
AS_PATH header.
(aspath_snmp_pathseg) Pass 2-byte flag to aspath_put. SNMP
is still defined as 2b.
(aspath_aggregate) fix latent bug.
(aspath_reconcile_as4) AS_PATH+NEW_AS_PATH reconciliation
function.
(aspath_key_make) Hash the AS_PATH string, rather than
just taking the addition of assegment ASes as the hash value,
hopefully sligthly more collision resistant.
(bgp_attr_munge_as4_attrs) Collide the NEW_ attributes
together with the OLD 2-byte forms, code Juergen
had in bgp_attr_parse but re-organised a bit.
(bgp_attr_parse) Bunch of code from Juergen moves
to previous function.
(bgp_packet_attribute) Compact significantly by
just /always/ using extended-length attr header.
Fix bug Juergen noted, by using aspath_put's
(new) returned size value for the attr header rather
than the (guesstimate) of aspath_size() - the two could
differ when aspath_put had to split large segments, unlikely
this bug was ever hit in the 'wild'.
(bgp_dump_routes_attr) Always use extended-len and
use aspath_put return for header length. Output 4b ASN
for AS_PATH and AGGREGATOR.
* bgp_ecommunity.c: (ecommunity_{hash_make,cmp}) fix
hash callback declarations to match prototypes.
(ecommunity_gettoken) Updated for ECOMMUNITY_ENCODE_AS4,
complete rewrite of Juergen's changes (no asdot support)
* bgp_open.c: (bgp_capability_as4) New, does what it says
on the tin.
(peek_for_as4_capability) Rewritten to use streams and
bgp_capability_as4.
* bgp_packet.c: (bgp_open_send) minor edit
checked (in the abstract at least) with Juergen.
Changes are to be more accepting, e.g, allow AS_TRANS on
a 2-byte session.
* (general) Update all commands to use CMD_AS_RANGE.
* bgp_vty.c: (bgp_clear) Fix return vals to use CMD_..
Remove stuff replicated by VTY_GET_LONG
(bgp_clear_vty) Return bgp_clear directly to vty.
* tests/aspath_test.c: Exercise 32bit parsing. Test reconcile
function.
* tests/ecommunity_test.c: New, test AS4 ecommunity changes,
positive test only at this time, error cases not tested yet.
2007-07-25 Juergen Kammer <j.kammer@eurodata.de>
* (general) AS4 support.
* bgpd.h: as_t changes to 4-bytes.
* bgp_aspath.h: Add BGP_AS4_MAX and BGP_AS_TRANS defines.
* bgp_aspath.c: AS_VALUE_SIZE becomes 4-byte, AS16_VALUE_SIZE
added for 2-byte.
Add AS16 versions of length calc macros.
(aspath_count_numas) New, count number of ASes.
(aspath_has_as4) New, return 1 if there are any as4's in a
path.
(assegments_parse) Interpret assegment as 4 or 2 byte,
according to how the caller instructs us, with a new
argument.
(aspath_parse) Add use32bit argument to pass to
assegments_parse. Adjust all its callers to pass 1, unless
otherwise noted.
(assegment_data_put) Adjust to be able to write 2 or 4 byte
AS, according to new use32bit argument.
(aspath_put) Adjust to write 2 or 4.
(aspath_gettoken) Use a long for passed in asno.
* bgp_attr.c: (attr_str) Add BGP_ATTR_AS4_PATH and
BGP_ATTR_AS4_AGGREGATOR.
(bgp_attr_aspath) Call aspath_parse with right 2/4 arg, as
determined by received-capability flag.
(bgp_attr_aspath_check) New, code previously in attr_aspath
but moved to new func so it can be run after NEW_AS_PATH
reconciliation.
(bgp_attr_as4_path) New, handle NEW_AS_PATH.
(bgp_attr_aggregator) Adjust to cope with 2/4 byte ASes.
(bgp_attr_as4_aggregator) New, read NEW_AGGREGATOR.
(bgp_attr_parse) Add handoffs to previous parsers for the two
new AS4 NEW_ attributes.
Various checks added for NEW/OLD reconciliation.
(bgp_packet_attribute) Support 2/4 for AS_PATH and
AGGREGATOR, detect when NEW_ attrs need to be sent.
* bgp_debug.{c,h}: Add 'debug bgp as4'.
* bgp_dump.c: MRTv2 support, unconditionally enabled, which
supports AS4. Based on patches from Erik (RIPE?).
* bgp_ecommunity.c: (ecommunity_ecom2str) ECOMMUNITY_ENCODE_AS4
support.
* bgp_open.c: (peek_for_as4_capability) New, peek for AS4
capability prior to full capability parsing, so we know which
ASN to use for struct peer lookup.
(bgp_open_capability) Always send AS4 capability.
* bgp_packet.c: (bgp_open_send) AS4 handling for AS field
(bgp_open_receive) Peek for AS4 capability first, and figure
out which AS to believe.
* bgp_vty.c: (bgp_show_peer) Print AS4 cap
* tests/aspath_test.c: Support asn32 changes, call aspath_parse
with 16 bit.
* vtysh/extract.pl: AS4 compatibility for router bgp ASNUMBER
* vtysh/extract.pl.in: AS4 compatibility for router bgp ASNUMBER
* vtysh/vtysh.c: AS4 compatibility for router bgp ASNUMBER
|
|
2007-09-07 Paul Jakma <paul.jakma@sun.com>
* (general) bgpd can be made crash by remote peers if debug
bgp updates is set, due to NULL pointer dereference.
Reported by "Mu Security Research Team",
<security@musecurity.com>.
* bgp_attr.c: (bgp_attr_community) If community length is 0,
don't set the community-present attribute bit, just return
early.
* bgp_debug.c: (community_str,community_com2str) Check com
pointer before dereferencing.
|
|
2007-08-27 Paul Jakma <paul.jakma@sun.com>
* bgp_route.c: (bgp_announce_check) Fix bug #398, slight
modification of Vladimir Ivanov's suggested fix - to keep
memory alloc conditional.
(bgp_process_announce_selected) Don't take struct attr as
argument, none of the callers need it and it needlessly
distances allocation from use.
Free the extended attr, the attr itself is on the stack.
Fix bad indentation.
* bgp_attr.c: (bgp_packet_attribute) Remove incorrect assert,
and adjust conditional to test attr->extra, diagnosis by
Vladimir Ivanov in bug #398.
2007-08-27 Vladimir Ivanov <wawa@yandex-team.ru>
* bgp_route.c: (bgp_announce_check_rsclient) copy of
ri->attr is no longer deep enough, due to addition of
attr->extra. It should use bgp_attr_dup, as
bgp_announce_check() does.
|
|
2007-07-31 Paul Jakma <paul.jakma@sun.com>
* (general) Support for draft-ietf-idr-as-pathlimit-03.
* bgp_attr.h: (struct attr) Add pathlimit struct
bgp_attr.c: (attr_str) Add BGP_ATTR_AS_PATHLIMIT string.
(attrhash_key_make) tally pathlimit too
(attrhash_cmp) cmp pathlimit attr
(bgp_attr_aspathlimit) New, parse AS_PATHLIMIT attr.
(bgp_attr_parse) ditto
(bgp_packet_attribute) Write out AS_PATHLIMIT when set
(bgp_dump_routes_attr) ditto
* bgp_route.h: (struct bgp_static) Add TTL field
* bgp_route.c: (bgp_announce_check) Drop paths that are over
their hop-count TTL before sending via EBGP.
Mangle ASN in pathlimit for confeds/private as best we can.
(bgp_static_update_{rsclient,main}) Add any configure pathlimit
information.
(bgp_pathlimit_update_parents) New, update atomic-aggr setting for
parents of an aspathlimit'ed static.
(bgp_static_set) Add TTL argument, for all the 'bgp network'
commands.
Call previous for TTL changed statics.
(bgp_static_unset) Call pathlimit_update_parents.
(various bgp network commands) Add 'pathlimit <0-255>' qualifier
to all the various forms, bar route-map - which can set ttl
itself.
* bgp_routemap.c: (general) Add support for 'set pathlimit ttl' and
'match pathlimit as'.
* doc/bgpd.texi: Document 'network ... pathlimit <ttl>'
|
|
2007-05-03 Paul Jakma <paul.jakma@sun.com>
* bgp_route.h: (struct info) Move less frequently used
fields to a lazily allocated struct info_extra.
Export bgp_info_extra_get
* bgp_route.c: (bgp_info_extra_new) allocate extra
(bgp_info_extra_free) Free damp info and the info_extra.
(bgp_info_extra_get) Retrieve the info_extra of a struct
info, allocating as required.
(generally) adjust to use info->extra
* bgp_damp.c: (generally) use bgp_info_extra_get to access
dampinfo
* bgp_attr.h: Move rarely allocated attributes from struct attr
to a struct attr_extra, for a substantial saving in size of
struct attr.
* bgp_attr.c: (bgp_attr_extra_{new,free}), new, self-explanatory.
(bgp_attr_extra_get) Get the attr_extra for a given struct
attr, allocating it if needs be.
(bgp_attr_dup) Shallow copy the struct attr and its attr_extra.
(generally) adjust to know about attr->extra.
* bgp_debug.c: (bgp_dump_attr) ditto
* bgp_vty.c: (show_bgp_memory) print attr and info extra sizes.
* bgp_nexthop.c: (generally) adjust to know about attr->extra
and info->extra.
* bgp_{packet,routemap,snmp,zebra}.c: ditto
* lib/memtypes.c: Add MTYPE_ATTR_EXTRA and MTYPE_BGP_ROUTE_EXTRA
|
|
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-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-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 Paul Jakma <paul.jakma@sun.com>
* bgp_attr.c: (bgp_packet_attribute) Remove dead code, Coverity
CID #1
|
|
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-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 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.
|
|
* 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.
|
|
* (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.
|
|
* (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.
|
|
draft - ie. "neighbor version 4-" commands. Preserve dummy "neighbor
version" command as deprecated.
[merge from GNU Zebra]
|
|
* 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]
|
|
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)
|
|
* *.c: Change level of debug messages to LOG_DEBUG.
|
|
* {bgpd,bgp_attr}.c: size_t printf format should be ld.
|
|
(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.
|
|
* type mismatch fixes
|
|
|
|
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.
|
|
|