summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-05-22lib: remove RUSAGE_T from struct threadJorge Boncompte [DTI2]
* 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>
2012-05-22micro-op bgp_node_[get|lookup]() and route_node_[get|lookup]()Jorge Boncompte [DTI2]
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>
2012-05-22bgpd: optimize bgp_aggregate_[increment|decrement]()Jorge Boncompte [DTI2]
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>
2012-05-22bgpd: optimize bgp_update_main() in the soft_reconfig caseJorge Boncompte [DTI2]
Avoids 3 checks per call. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22bgpd: optimize holdtime timer cancellingJorge Boncompte [DTI2]
* 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>
2012-05-22bgpd: Remove useless initializationJorge Boncompte [DTI2]
It's initialized below Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22bgpd: reduce struct attr_extra allocations/freeingJorge Boncompte [DTI2]
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>
2012-05-22bgpd: use on stack struct attr_extra in bgp_update_receive()Jorge Boncompte [DTI2]
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>
2012-05-22bgpd: fix struct attr_extra leak in bgp_default_originate()Jorge Boncompte [DTI2]
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>
2012-05-22bgpd: use on stack struct attr_extra in bgp_attr_unintern()Jorge Boncompte [DTI2]
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>
2012-05-22bgpd: cleanup bgp_attr_unintern()Jorge Boncompte [DTI2]
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22bgpd: use on stack struct attr_extra on bgp_attr_aggregate_intern()Jorge Boncompte [DTI2]
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>
2012-05-22bgpd: reduce attrhash_make_key() indirectionsJorge Boncompte [DTI2]
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22bgpd: remove some useless initializationsJorge Boncompte [DTI2]
* 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>
2012-05-22bgpd: optimize bgp_info_cmp()Jorge Boncompte [DTI2]
* 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>
2012-05-22bgpd: optimize loops on [e]community_hash_make()Jorge Boncompte [DTI2]
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>
2012-05-22bgpd: remove calls to peer_sort() from fast-pathJorge Boncompte [DTI2]
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>
2012-05-22bgpd: debug buffers cleanup and optimizationJorge Boncompte [DTI2]
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>
2012-05-22bgpd: optimize bgp_nexthop_self()Jorge Boncompte [DTI2]
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>
2012-05-22bgpd: optimize aspath string representation and assegments handlingJorge Boncompte [DTI2]
* 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>
2012-05-21bgpd: fix crash with vpnv4 soft-reconfigurationJorge Boncompte [DTI2]
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>
2012-05-21lib: fix thread_cancel_event()Jorge Boncompte [DTI2]
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>
2012-05-21lib: drop heuristic IPv6 address recognitionRoman Hoog Antink
* 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>
2012-05-09zebra: fix up compilation without rtadv/IPv6Joachim Nilsson
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>
2012-05-02zebra: feed Connected routes into MRIBG.Balaji
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>
2012-05-02zebra: no need to clear memory of the netlink buffersJorge Boncompte [DTI2]
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>
2012-05-02bgpd: cleanup, use correct buffer sizes for sockunion2str()Jorge Boncompte [DTI2]
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-05-02lib: remove sockunion related unused definitionsJorge Boncompte [DTI2]
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-05-02lib, zebra: extend use of sockunion2ip macroJorge Boncompte [DTI2]
* 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>
2012-05-02bgpd: Fix memory leak of some "show ip bgp neighbor" commandsJorge Boncompte [DTI2]
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>
2012-05-02lib: remove last uses of sockunion_su2str()Jorge Boncompte [DTI2]
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>
2012-05-02bgpd: Fix memory leak with 'set ip next-hop peer-address'Jorge Boncompte [DTI2]
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>
2012-05-02bgpd: fix for route-maps with "match peer local" statementsJorge Boncompte [DTI2]
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>
2012-05-02bgpd, zebra: Fix format for some metric outputsJorge Boncompte [DTI2]
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>
2012-05-02bgpd: Fix regression in args consolidation, total should be inited from argsPaul Jakma
* bgp_attr.c: (bgp_attr_unknown) total should be initialised from the args.
2012-05-02bgpd: Make socket init separate, so unit tests work again.Paul Jakma
* 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
2012-05-02tests: Fix some compile errors and warningsPaul Jakma
* 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.
2012-05-02Revert "tests: disable broken tests/bgp_mp_attr_test.c"Paul Jakma
This reverts commit d78e2b8b562f8496aaf2977f7371415b71e82433. Next 2 commits fix it.
2012-05-01release: 0.99.21David Lamparter
2012-05-01tests: disable broken tests/bgp_mp_attr_test.cDavid Lamparter
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>
2012-05-01redhat: add systemd service filesDavid Ward
* 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>
2012-05-01redhat: update initscriptsDavid Ward
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>
2012-05-01redhat: add logrotate configuration for babeld and isisdDavid Ward
Signed-off-by: David Ward <david.ward@ll.mit.edu> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-05-01doc: add ospfclient(8) and watchquagga(8) man pagesDavid Ward
Taken from Fedora packaging. Signed-off-by: David Ward <david.ward@ll.mit.edu> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-05-01doc: only package man pages for daemons that are builtDavid Ward
Signed-off-by: David Ward <david.ward@ll.mit.edu> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-30tools: use standard interpreter path in all Perl scriptsDavid Ward
Signed-off-by: David Ward <david.ward@ll.mit.edu> [changed /usr/bin/perl to /usr/bin/env perl] Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-28bgpd: fix up multipath merge breakageDavid Lamparter
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>
2012-04-28babeld: merge kernel_zebra.c into kernel.c.Juliusz Chroboczek
In upstream babel, we include different kernel_foo files depending on the platform we compile for. In Quagga, this is not needed, and it avoids tricky autotools issues. (All autotools issues are tricky.) [David: without this commit, build breaks.] From: Juliusz Chroboczek <jch@pps.jussieu.fr> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-28babeld: Include babel_main.h in noinst_HEADERS.Denis Ovsienko
babeld wouldn't build in a dist tarball without this. From: Denis Ovsienko <infrastation@yandex.ru> Signed-off-by: Juliusz Chroboczek <jch@pps.jussieu.fr> [fixed up git message] Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-20lib: bump ZSERV_VERSION to 2David Lamparter
continually changing the zserv protocol without bumping up the version number has made it impossible to talk to zebra without knowing the exact version. in reality, increasing the version number more often guards against inadvertedly running incompatible versions of a daemon and zebra as well as aids external development. * lib/zclient.h: #define ZSERV_VERSION 2 Signed-off-by: David Lamparter <equinox@diac24.net>