Age | Commit message (Collapse) | Author |
|
Reduce memory heap fragmentation and pressure on the memory allocator.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
The call to bgp_attr_default_set() above creates the attr_extra struct,
but the attr.extra = NULL initialization was leaking it.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Reduce memory heap fragmentation and pressure on the memory allocator.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Reduce memory heap fragmentation and pressure on the memory allocator.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* bgp_attr.c: (bgp_attr_default_intern) bgp_attr_default_set() already
initializes the memory. Fixes a struct attr_extra leak.
* bgp_route.c: Remove useless on stack struct initializations.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* bgp_route.c: (bgp_info_cmp) Reduce indirections, precalculate some
values that are used several times, reduce conditionals.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
This change reduces loop count. Less jumps.
* bgp_community.c: One loop per community.
* bgp_ecommunity.c: One loop per ecommunity.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
peer_sort() it's called so much as to be annoying. In the assumption
that the 'sort' of the peer doesn't change during an established session,
I have changed all calls to peer_sort() in the 'fast-path' to only check
the 'sort'. All the calls from the vty and such still recalculate the sort
and store it in the peer.
There's a lot of other calls to peer_sort() that could be changed but some
maube tricky, someone more knowledgeable may try to reduce them.
This hits peer_sort() from 5th out of the stadium^H^H list on a full
internet table loading profiling session.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Just the first change pushes bgp_update_receive() from 6th to ~14th on a
full internet table load profiling session.
* bgp_debug.c: (bgp_update_receive) The attrstr initialization is expensive,
moved under the debug conditional where it is used and just initialize the
first char to NULL.
(bgp_update_default_send) Initialize attrstr needed for bgp_dump_attr().
Moved some buffers used for printing IP[4|6] addresses under the debug
conditionals that use them and reduced its size.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
This function scores 2nd, profiling a full internet table load. It's called
for every prefix received.
Instead of looping in the interface lists comparing addresses use a hash
to mantain them.
* bgpd.c: Init the own address hash.
* bgp_nexthop.c: Introduce methods to maintain an own address hash.
(bgp_connected_add) add addresses to the hash.
(bgp_connected_delete) delete addresses from the hash.
(bgp_nexthop_self) lookup addresses in the hash. Removed the unused afi_t
parameter.
* bgp_route.c: (bgp_update_main) Micro-optimization, rearranged condition to
not lookup the hash for bogus nexthops (0.0.0.0 or a class D/E address)
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* bgp_aspath.h: Add str_len to struct aspath.
* bgp_aspath.c: Save the aspath string representation length and use it
instead of strlen().
(aspath_make_str_count) assign the string buffer directly for
consistency with the string length and change the return type to void.
(aspath_dup) use str_len and copy the string instead of calling
aspath_make_str_count().
(assegment_data_new) change from XCALLOC to XMALLOC. All users initialize
the memory before use.
(assegment_data_free) unused, removed.
(aspath_intern) check that there's always a ->str pointer.
(aspath_hash_alloc) reuse assegments and string representation instead of
copying them.
(aspath_parse) now aspath_hash_alloc does not dupes memory, free the
temporary structures only if the aspath it is in the hash.
(aspath_cmp_left) remove useless NULL initialization.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
bgp_afi_node_get() expects a non-NULL prd for a SAFI_MPLS_VPN prefix.
* bgp_route.c: pass down the struct prefix_rd from bgp_soft_reconfig_in()
and bgp_soft_reconfig_rsclient().
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
sockunion_str2su() use is prone to memory leaks. Remove it's use all over
the code.
At least these commands leaked a sockunion union:
- show ip bgp vpnv4 ... routes
- show ip bgp ... received prefix-filter
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
A route-map with the mentioned statement causes a memory leak for every
prefix that matches.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
A route-map with a 'match peer local' statement it's shown like
'match peer (null)' on config output...
... and it's unparsable on daemon startup.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Metrics are unsigned values.
* bgpd/bgp_{debug,route,vty}.c,
* zebra/zebra_vty.c: replace %d with %u for metrics & distances
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[reworded commit message]
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
* bgp_attr.c: (bgp_attr_unknown) total should be initialised from the args.
|
|
* Separate out BGP socket initialisation from bgp_get, and make it an
explicit function. Allows unit tests to work again and probably also
benefits dry-run.
* bgpd.c: (bgp_get) move socket init out...
(bgp_socket_init) to here
* bgp_main.c: and call it after dry-run.
* bgpd.h: (bgp_socket_init) add prototype
|
|
the BGP multipath code was developed against a pre-f6f434b Quagga where
bgp_attr_unintern and ecommunity_free took single-star pointers. They
now take double-star pointers.
* bgpd/bgp_mpath.c: fix up bgp_attr_unintern & ecommunity_free calls.
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Vladimir Podobaev reported that the following commands crashed the
daemon.
router bgp 123
bgp dampening
no bgp dampening 1 2 3 4
no bgp dampening
The problem was that bgp_damp_info_clean() tried to dereference the
already freed reuse_list array in the second call to "no bgp dampening".
Fixed by checking in bgp_damp_disable() that the dampening it's
enabled before doing the cleanup.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
|
|
this merges a bgp capability negotiation fix where bgpd would fail if no
multiprotocol capability was present, but other capabilities were.
|
|
Conflicts:
bgpd/bgp_route.c
|
|
Address problem where bgpd would reject a session if a peer sent some
capabilities in its Open message, but did not include a Multiprotocol
extensions capability. Note that the session would come up if there
were no capabilities at all in the Open message.
* Add the 'mp_capability' out parameter to
bgp_capability_parse(). Set it to '1' if a Multiprotocol
extensions capability is encountered.
* Switch on 'mp_capability' instead of 'capability' in the calling
functions to determine if the peer indicated the set of AFI/SAFIs
it supports.
The net result is that when a peer does not send an MP capability,
it is assumed to support the AFI/SAFIs configured for it locally.
|
|
* bgpd/bgp_attr.c: (bgp_attr_flags_diagnose) debug code for error-handling
paths probably shouldn't assert, instead it should just log that there
was no problem.
|
|
* bgpd/bgp_attr.c: (bgp_attr_parse) the invalid flag check call to
bgp_attr_malformed is pretty useless if it doesn't actually allow
for the PROCEED non-error case.
|
|
* bgp_attr.c: (bgp_attr_flag_invalid) flags is meant to be masked
off with the mask variable...
|
|
* bgp_attr.c: (bgp_attr_malformed) When a malformed attribute error can be
ignored, and BGP message processing may still proceed, the stream getp
should be adjusted to the end of the attribute - the caller may not have
consumed all the attribute. Problem noted by Martin Winter in bug 678.
Also, rename the 'startp' local to 'notify_datap', for clarity.
|
|
|
|
* bgp_packet.c: (bgp_open_receive) Errors from bgp_open_option_parse are
detected, and the code will stop processing the OPEN and return. However
it does so without calling bgp_notify_send to send a NOTIFY - which means
the peer FSM doesn't get stopped, and bgp_read will be called again later.
Because it returns, it doesn't go through the code near the end of the
function that removes the current message from the peer input streaam.
Thus the next call to bgp_read will try to parse a half-parsed stream as
if it were a new BGP message, leading to an assert later in the code when
it tries to read stuff that isn't there. Add the required call to
bgp_notify_send before returning.
* bgp_open.c: (bgp_capability_as4) Be a bit stricter, check the length field
corresponds to the only value it can be, which is the amount we're going to
read off the stream. And make sure the capability flag gets set, so
callers can know this capability was read, regardless.
(peek_for_as4_capability) Let bgp_capability_as4 do the length check.
|
|
* bgp_attr.h: (struct bgp_attr_parser_args) Attribute parsing context,
containing common arguments.
* bgp_attr.c: (general) Move the bgp_attr_flag_invalid flag-check calls up,
out of each individual attr parser function, to be done once in attr_parse.
Similarly move the calculation of the 'total' attribute length field up
to attr_parse.
Bundle together common arguments to attr-parsing functions and helpers
into (struct bgp_attr_parser_args), so it can be passed by reference down
the stack & also de-clutter the argument lists & make it easier to
add/modify the context for attr-parsing - add local const aliases to avoid
modifying body of code too much. This also should help avoid cut & paste
errors, where calls to helpers with hard-coded attribute types are pasted
to other functions but the code isn't changed.
(bgp_attr_flags_diagnose) as above.
(bgp_attr_flag_invalid) as above.
(bgp_attr_{origin,aspath,as4_path,nexthop,med,local_pref,atomic}) as above.
(bgp_attr_{aggregator,as4_aggregator,community,originator_id}) as above
(bgp_attr_{cluster_list,ext_communities},bgp_mp_{un,}reach_parse) as above
(bgp_attr_unknown) as above.
(bgp_attr_malformed) as above. Also, startp and length have to be
special-cased, because whether or not to send attribute data depends
on the particular error - a separate length argument, distinct from
args->length, indicates whether or not the attribute data should be sent
in the NOTIFY.
(bgp_attr_aspath_check) Call to bgp_attr_malformed is wrong here, there is
no attribute parsing context - e.g. the 'flag' argument is unlikely to be
right, remove it. Explicitly handle the error instead.
(bgp_attr_munge_as4_attrs) Flag argument is pointless.
As the comment notes, the check here is pointless as AS_PATH presence
already checked elsewhere.
(bgp_attr_parse) Do bgp_attr_flag_invalid call here.
Use (struct bgp_attr_parser_args) for args to attr parser functions.
Remove out-of-context 'flag' argument to as4 checking functions.
|
|
* bgpd/bgp_attr.c: (attr_flags_values []) array of required flags for
attributes, EXTLEN & PARTIAL masked off as "dont care" as appropriate.
(bgp_attr_flag_invalid) check if flags may be invalid, according to
the above table & RFC rules.
(bgp_attr_*) Use bgp_attr_flag_invalid.
(bgp_attr_as4_aggregator) ditto, also take startp argument for the
NOTIFY data.
(bgp_attr_parse) pass startp to bgp_attr_as4_aggregator
|
|
The patch adds the ipv6 network command in the BGP multicast address
family mode.
|
|
This patch contains the following:
1. Addition of IPv6 SAFI_MULTICAST BGP routes into the BGP Multicast RIB.
2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.
|
|
This patch contains the following:
1. Addition of IPv4 SAFI_MULTICAST BGP routes into the BGP Multicast RIB.
2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.
|
|
* bgp_nexthop.c: The nexthop lookup cache has to return success for queried
nexthops if bgpd isn't connected to zebra, or else BGP without zebra doesn't
work.
|
|
|
|
* bgpd/bgp_attr.c: (bgp_attr_aspath) error message could be misleading,
clearly log what flag was incorrect.
(Problem noted in "bgpd: fix error message in bgp_attr_aspath()" in
Quagga-RE)
|
|
* bgp_attr.c
* attr_flag_str: new message list
* bgp_attr_flags_diagnose(): new function, implements previously added
error logging in a generic way
* bgp_attr_origin(): use bgp_attr_flags_diagnose()
* bgp_attr_nexthop(): ditto
* bgp_attr_med(): ditto
* bgp_attr_local_pref(): ditto
* bgp_attr_atomic(): ditto
* bgp_attr_originator_id(): ditto
* bgp_attr_cluster_list(): ditto
* bgp_mp_reach_parse(): ditto
* bgp_mp_unreach_parse(): ditto
|
|
* bgp_nexthop.c (show_ip_bgp_scan_tables): access proper structure field
in AF_INET6 case, handle ifindex NH type properly
|
|
bgp_nexthop_onlink(): zlookup is not used here at all
bgp_nexthop_lookup_ipv6(): rely on the detection performed by "query"
function (this also changes the fallback value to 0), reorder if-block
bgp_nexthop_lookup(): idem
|
|
* bgp_nexthop.c: (show_ip_bgp_scan) transform into
show_ip_bgp_scan_tables(), which uses inet_ntop() and can dump
nexthops on request; (show_ip_bgp_scan_detail_cmd) new function
|
|
bgp_nexthop_lookup_ipv6(): declare variables where they are actually
used, drop no-op initialization (the field is already 0)
bgp_nexthop_lookup(): ditto
bgp_nexthop_check_ebgp(): rename to bgp_nexthop_onlink()
bgp_nexthop_cache_changed(): rename to bgp_nexthop_cache_different()
|
|
* (general) Move functions in headers into files, to be compiled into
shared object files. Remove inline qualifier from functions. Let the
compiler do the work.
|
|
...otherwise 4294967295 is not a valid value on 32bit systems
|
|
* lib/prefix.h
* IPV4_CLASS_DE(): make consistent with counterpart macros
* bgp_packet.c
* bgp_open_receive(): test using macro instead of ">="
* bgp_route.c
* bgp_update_rsclient(): idem
* bgp_update_main(): idem
|
|
(This patch was modified to leave calls to stream_getl() in place, they
are necessary for the stream's internal pointer to advance to the
correct position. -- Denis)
Signed-off-by: Denis Ovsienko <infrastation@yandex.ru>
Fix gcc warnings about varables that are set but never used.
* bgpd/bgp_attr.c
* cluster_unintern(): ret
* transit_unintern(): ret
* bgp_attr_default_intern(): attre
* bgp_mp_reach_parse(): rd_high, rd_low
* bgpd/bgp_route.c
* bgp_announce_check_rsclient(): bgp
* bgpd/bgp_zebra.c
* zebra_read_ipv4(): ifindex
* zebra_read_ipv6(): ifindex
* bgpd/bgpd.c
* bgp_config_write_peer(): filter
* lib/distribute.c
* distribute_list_all(): dist
* distribute_list(): dist
* distribute_list_prefix_all(): dist
* distribute_list_prefix(): dist
* lib/if_rmap.c
* if_rmap(): if_rmap
* lib/vty.c
* vty_accept(): vty
* lib/zclient.c
* zclient_read(): ret
* zebra/irdp_interface.c
* if_group(): zi
* zebra/rt_netlink.c
* kernel_read(): ret, sock
|
|
This issue has been pointed out by Lou Berger and Tim Browski.
* bgp_packet.c
* bgp_route_refresh_receive(): restore if() condition, which was
broken by commit fdbc8e77c88f751924299d0bc752371d5cc31116
|