summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* lib: do not allocate/free thread funcnamesJorge Boncompte [DTI2]2012-05-223-29/+16
| | | | | | | | | | | 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>
* lib: micro-op for thread_get()Jorge Boncompte [DTI2]2012-05-221-3/+2
| | | | | | | 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>
* lib: remove RUSAGE_T from struct threadJorge Boncompte [DTI2]2012-05-222-6/+7
| | | | | | | | * 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>
* micro-op bgp_node_[get|lookup]() and route_node_[get|lookup]()Jorge Boncompte [DTI2]2012-05-222-14/+22
| | | | | | | | 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>
* bgpd: optimize bgp_aggregate_[increment|decrement]()Jorge Boncompte [DTI2]2012-05-221-2/+20
| | | | | | | | | | | | | 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>
* bgpd: optimize bgp_update_main() in the soft_reconfig caseJorge Boncompte [DTI2]2012-05-221-2/+2
| | | | | | | Avoids 3 checks per call. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: optimize holdtime timer cancellingJorge Boncompte [DTI2]2012-05-221-2/+2
| | | | | | | | | | | | | * 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>
* bgpd: Remove useless initializationJorge Boncompte [DTI2]2012-05-221-1/+1
| | | | | | | It's initialized below Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: reduce struct attr_extra allocations/freeingJorge Boncompte [DTI2]2012-05-222-55/+52
| | | | | | | 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>
* bgpd: use on stack struct attr_extra in bgp_update_receive()Jorge Boncompte [DTI2]2012-05-221-7/+4
| | | | | | | 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>
* bgpd: fix struct attr_extra leak in bgp_default_originate()Jorge Boncompte [DTI2]2012-05-221-6/+2
| | | | | | | | 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>
* bgpd: use on stack struct attr_extra in bgp_attr_unintern()Jorge Boncompte [DTI2]2012-05-221-2/+2
| | | | | | | 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>
* bgpd: cleanup bgp_attr_unintern()Jorge Boncompte [DTI2]2012-05-221-11/+12
| | | | | Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: use on stack struct attr_extra on bgp_attr_aggregate_intern()Jorge Boncompte [DTI2]2012-05-221-10/+10
| | | | | | | 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>
* bgpd: reduce attrhash_make_key() indirectionsJorge Boncompte [DTI2]2012-05-221-16/+17
| | | | | Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: remove some useless initializationsJorge Boncompte [DTI2]2012-05-222-9/+6
| | | | | | | | | * 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>
* bgpd: optimize bgp_info_cmp()Jorge Boncompte [DTI2]2012-05-221-74/+77
| | | | | | | | * 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>
* bgpd: optimize loops on [e]community_hash_make()Jorge Boncompte [DTI2]2012-05-222-15/+25
| | | | | | | | | | 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>
* bgpd: remove calls to peer_sort() from fast-pathJorge Boncompte [DTI2]2012-05-229-96/+104
| | | | | | | | | | | | | | | | | 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>
* bgpd: debug buffers cleanup and optimizationJorge Boncompte [DTI2]2012-05-221-28/+44
| | | | | | | | | | | | | | | 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>
* bgpd: optimize bgp_nexthop_self()Jorge Boncompte [DTI2]2012-05-225-20/+97
| | | | | | | | | | | | | | | | | | | 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>
* bgpd: optimize aspath string representation and assegments handlingJorge Boncompte [DTI2]2012-05-222-66/+76
| | | | | | | | | | | | | | | | | | | | | | * 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>
* bgpd: fix crash with vpnv4 soft-reconfigurationJorge Boncompte [DTI2]2012-05-211-8/+28
| | | | | | | | | | 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>
* lib: fix thread_cancel_event()Jorge Boncompte [DTI2]2012-05-211-0/+18
| | | | | | | | | | | | | | | | 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>
* lib: drop heuristic IPv6 address recognitionRoman Hoog Antink2012-05-211-80/+1
| | | | | | | | | | | | | * 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>
* zebra: fix up compilation without rtadv/IPv6Joachim Nilsson2012-05-093-39/+41
| | | | | | | | | | | | | | 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>
* zebra: feed Connected routes into MRIBG.Balaji2012-05-021-0/+5
| | | | | | | | | | | | | 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>
* zebra: no need to clear memory of the netlink buffersJorge Boncompte [DTI2]2012-05-021-3/+3
| | | | | | | | | | | | 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>
* bgpd: cleanup, use correct buffer sizes for sockunion2str()Jorge Boncompte [DTI2]2012-05-022-3/+3
| | | | | Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: remove sockunion related unused definitionsJorge Boncompte [DTI2]2012-05-021-7/+0
| | | | | Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@diac24.net>
* lib, zebra: extend use of sockunion2ip macroJorge Boncompte [DTI2]2012-05-022-6/+6
| | | | | | | | | * 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>
* bgpd: Fix memory leak of some "show ip bgp neighbor" commandsJorge Boncompte [DTI2]2012-05-026-85/+59
| | | | | | | | | | | | 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>
* lib: remove last uses of sockunion_su2str()Jorge Boncompte [DTI2]2012-05-024-36/+12
| | | | | | | | | 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>
* bgpd: Fix memory leak with 'set ip next-hop peer-address'Jorge Boncompte [DTI2]2012-05-022-5/+4
| | | | | | | | 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>
* bgpd: fix for route-maps with "match peer local" statementsJorge Boncompte [DTI2]2012-05-021-2/+2
| | | | | | | | | | 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>
* bgpd, zebra: Fix format for some metric outputsJorge Boncompte [DTI2]2012-05-024-6/+6
| | | | | | | | | | | 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>
* bgpd: Fix regression in args consolidation, total should be inited from argsPaul Jakma2012-05-021-1/+1
| | | | * bgp_attr.c: (bgp_attr_unknown) total should be initialised from the args.
* bgpd: Make socket init separate, so unit tests work again.Paul Jakma2012-05-023-7/+16
| | | | | | | | | | * 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
* tests: Fix some compile errors and warningsPaul Jakma2012-05-025-30/+38
| | | | | | | | * 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.
* Revert "tests: disable broken tests/bgp_mp_attr_test.c"Paul Jakma2012-05-021-7/+0
| | | | | This reverts commit d78e2b8b562f8496aaf2977f7371415b71e82433. Next 2 commits fix it.
* release: 0.99.21quagga_0_99_21_releaseDavid Lamparter2012-05-012-1/+15
|
* tests: disable broken tests/bgp_mp_attr_test.cDavid Lamparter2012-05-011-0/+7
| | | | | | | | 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: add systemd service filesDavid Ward2012-05-0110-4/+123
| | | | | | | | | * 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>
* redhat: update initscriptsDavid Ward2012-05-0111-266/+407
| | | | | | | | | | | | | | | | 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>
* redhat: add logrotate configuration for babeld and isisdDavid Ward2012-05-011-0/+16
| | | | | Signed-off-by: David Ward <david.ward@ll.mit.edu> Signed-off-by: David Lamparter <equinox@diac24.net>
* doc: add ospfclient(8) and watchquagga(8) man pagesDavid Ward2012-05-013-2/+283
| | | | | | | Taken from Fedora packaging. Signed-off-by: David Ward <david.ward@ll.mit.edu> Signed-off-by: David Lamparter <equinox@diac24.net>
* doc: only package man pages for daemons that are builtDavid Ward2012-05-012-2/+47
| | | | | Signed-off-by: David Ward <david.ward@ll.mit.edu> Signed-off-by: David Lamparter <equinox@diac24.net>
* tools: use standard interpreter path in all Perl scriptsDavid Ward2012-04-303-3/+3
| | | | | | 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>
* bgpd: fix up multipath merge breakageDavid Lamparter2012-04-281-6/+6
| | | | | | | | | | 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>
* babeld: merge kernel_zebra.c into kernel.c.Juliusz Chroboczek2012-04-282-276/+239
| | | | | | | | | | | 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>