Age | Commit message (Collapse) | Author |
|
* bgpd.h: add a BGP_OPT_NO_LISTEN option for the master BGP configuration,
to prevent any listen socket being created automatically. Allows code
to be used outside of BGP daemon settings.
* bgpd.c: (bgp_get) honour above the flag, suppress auto-creation of listen
socket on first BGP instance if set.
(bgp_option_set) whitelist BGP_OPT_NO_LISTEN
|
|
* sockunion.h: Add back sockunion_str2su, its removal breaks things needlessly
(e.g. our own unit tests).
* sockunion.c: (sockunion_str2su) implement on top of str2sockunion.
|
|
This reverts commit 7621f336e2f346edee43227f0b1ef93fe769720b. See bug #727
|
|
This avoids memory heap fragmentation and imposses less load on the
system memory allocator.
* thread.h: FUNCNAME_LEN defined to 64 (ISO C99 says max 63)
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[changed FUNCNAME_LEN to a less arbitrary value]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
thread_trim_head() already checks that the list is not empty.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* thread.c: It's only temporarily used in thread_call() to calculate the
diffs. Saves 80 bytes per copy.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Reduce indirection for values that doesn't change in the loop.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[adjusted after dropping previous patch]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
If there were no aggregates configured this functions were allocating
and freeing a struct bgp_node for every call, and it's called for every
prefix received.
* bgp_route.c: Bail out early if the there are no aggregates configured.
Change from bgp_node_get() to bgp_node_lookup() that does not allocate
a new struct bgp_node if not found.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Avoids 3 checks per call.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* bgp_packet.c: (bgp_update_receive) for every update received we queue
an event just to cancel the holdtime timer, done in bgp_fsm_update().
Instead cancel the timer directly an avoid a scheduling pass.
This incidently fixes another problem found on a slow box, where thousands
of events threads were queued, and run, but never freed, because they are
moved to the unused list that grows without bounds.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
It's initialized below
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Try to use on stack structs for temporary uses.
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>
|
|
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>
|
|
ospfd was crashing some times on neighbour going down. The cause was that
ospf_nsm_event() was accessing already freed memory in ospf_nbr_delete()
call from ospf_nsm_event().
What happens is that since commit b5043aab (lib: fix incorrect thread
list...) now a thread can be on the event and ready lists but
thread_cancel_event() doesn't account for that.
* thread.c: (thread_cancel_event) loop on the ready list too to cancel
pending events.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* command.c: (cmd_ipv6_match) Drop IPv6 address recognition
heuristics and solely rely on inet_pton, because strings
like "abcd" were mistaken for IPv6 addresses.
This affects e.g. the command "neighbour WORD peer-group",
which won't work with words consisting of up to 4 characters
between 'a' and 'f' and digits.
From: Roman Hoog Antink <rha@open.ch>
[full delete instead of #if 0]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
let's ground the rtadv.h file if route advertisements are disabled. And
fix up the CLI for it, as well as move the "show ip mroute" to its
proper place.
* zebra/rtadv.h: #ifdef RTADV
* zebra/main.c: #ifdef RTADV
* zebra/zebra_vty.c: move "show ip mroute" out of #ifdef IPV6
From: Joachim Nilsson <troglobit@gmail.com>
[moved #ifdef RTADV to rtadv.h]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
The SAFI_MULTICAST RIB needs to contain Connected routes so that the
nexthop lookup does not fail and so that multicast routing daemons do
not need to sidestep and look into SAFI_UNICAST to be aware of connected
subnets.
* zebra/connected.c: add & delete connected in SAFI_MULTICAST
Signed-off-by: G.Balaji <balajig81@gmail.com>
[merged add/delete patches]
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
The memory is always written before sending. Clearing it before use
slows netlink_route_multipath() down considerably and it's pretty
noticeable in a full-internet table scenario loading.
* zebra/rt_netlink.c: subtract bulk buffer size from clear
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[reworded commit message]
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
* lib/sockunion.c,
* zebra/zebra_rib.c: replace ->sin.sin_addr.s_addr with sockunion2ip
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[reworded commit message]
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>
|
|
Use of this function is prone to memory leaks.
This fixes a memory accounting bug for vty denied connections.
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
|
|
* aspath_test.c: match changes in aspath_unintern. Fix printf size_t warning.
* bgp_capability_test.c: compile warnings.
* bgp_mp_attr_test.c: update for attr parser context struct
* ecommunity_test.c: ecommunity_free/ecommunity
* test-checksum.c: some unused vars and funcs without need of prototypes.
|
|
This reverts commit d78e2b8b562f8496aaf2977f7371415b71e82433. Next 2
commits fix it.
|
|
|
|
it doesn't compile currently; it'll be fixed after the 0.99.21 release.
* tests/bgp_mp_attr_test.c: wrap in #if 0 for now
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
* redhat/*.service: add systemd service file for each routing daemon
* redhat/quagga.sysconfig: add comment about watchquagga and systemd
* redhat/Makefile.am: add systemd service files to distribution
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Taken from Fedora packaging with additional fixes.
* redhat/*.init: make all initscripts LSB-compliant;
store the daemon configuration file location in $CONF_FILE,
and perform existence testing before starting the daemon
* redhat/babeld.init: add initscript for Babel routing engine
* redhat/quagga.sysconfig: add command-line options for babeld;
remove the daemon configuration file locations from $*_OPTS;
clarify directions for configuring watchquagga
* redhat/Makefile.am: add babeld.init to distribution
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Taken from Fedora packaging.
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David Lamparter <equinox@diac24.net>
|