summaryrefslogtreecommitdiffstats
path: root/bgpd
Commit message (Collapse)AuthorAgeFilesLines
...
* bgpd: Do not allow a timers connect of 0, this can hammer the CPUDaniel Walton2015-12-081-2/+2
| | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Remove BGP's asorig timer, it is no longer usedDaniel Walton2015-12-084-24/+2
| | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Lower the default 'timers connect' in BGP to 10 secondsDaniel Walton2015-12-081-1/+1
| | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge 'patch-tracking/4/proposed/netdef-solaris' into acceptedPaul Jakma2015-10-282-2/+2
|\
| * *: fix in_addr initialisersDavid Lamparter2015-10-162-2/+2
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | bgpd, lib: memory cleanups for valgrind, plus debug changesLou Berger2015-10-277-42/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Description: We use valgrind memcheck quite a bit to spot leaks in our work with bgpd. In order to eliminate false positives, we added code in the exit path to release the remaining allocated memory. Bgpd startup log message now includes pid. Some little tweaks by Paul Jakma <paul.jakma@hpe.com>: * bgp_mplsvpn.c: (str2prefix_rd) do the cleanup in common code at the end and goto it.
* | bgpd: fix using of two pointers for struct thread_master *Donald Sharp2015-10-278-34/+26
| | | | | | | | | | | | | | | | bgp is using both bm->master and master pointers interchangebly for thread manipulation. Since they are the same thing consolidate to one pointer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | quagga: Additional centos 6 -enable-werror fixesDonald Sharp2015-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | This commit fixes these warnings: 1) bgpd/bgp_nexthop.c - dereferencing pointer 'X' does break strict-aliasing rules 2) pimd/pim_igmp_join.c - dereferencing pointer 'X' does break strict-aliasing rules 3) ripd/ripd.c - 'ifaddr.prefixlen' may be used uninitialized in this function Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | lib: zclient.c remove extern struct thread_master *Donald Sharp2015-10-274-5/+5
|/ | | | | | | | | | | | zclient.c depended upon link time inclusion of a extern struct thread_master *master. This is a violation of the namespace of the calling daemon. If a library needs the pointer pass it in and save it for future use. This code change also makes the zclient code consistent with the other lib functions that need to schedule work on your behalf Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: 'set comm-list delete' stops as soon as it hits a community-list entry ↵Daniel Walton2015-09-243-76/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with a deny 'set comm-list delete' stops as soon as it hits a community-list entry with a deny Reviewed By: sharpd@cumulusnetworks.com Testing Done: 'set comm-list FOO delete' stops evaluating the community-list as soon as we hit the first "delete" statement. This makes it impossible to use community-lists where you deny some subset of communities to delete and then permit all of the others. This patch changes the behavior so that we no longer exit the community-list at the first delete statement. Here is our baseline, we are receiving multiple communities from 10.1.1.2 for the 10.1.3.0/24 prefix. qct-ly6-04# show ip bgp 10.1.3.0/24 BGP routing table entry for 10.1.3.0/24 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer Local 10.1.1.2 (metric 20) from 10.1.1.2 (10.1.1.2) Origin IGP, metric 0, localpref 100, valid, internal, best Community: 1:1 1:2 1:3 20:1 20:2 20:3 99:1 Last update: Wed Mar 4 13:50:36 2015 qct-ly6-04# We apply the following FOO route-map inbound to this peer and soft clear the peer ! ip community-list expanded BAD_COMMS permit 99:.* ip community-list expanded BAD_COMMS deny 1:.* ip community-list expanded BAD_COMMS permit 20.* ! route-map FOO permit 10 set comm-list BAD_COMMS delete ! router bgp 10 neighbor 10.1.1.2 route-map FOO in ! qct-ly6-04# clear ip bgp * soft in qct-ly6-04# show ip bgp 10.1.3.0/24 BGP routing table entry for 10.1.3.0/24 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer Local 10.1.1.2 (metric 20) from 10.1.1.2 (10.1.1.2) Origin IGP, metric 0, localpref 100, valid, internal, best Community: 1:1 1:2 1:3 Last update: Wed Mar 4 13:51:12 2015 qct-ly6-04# qct-ly6-04# We deleted all communities flagged as "permit" by the BAD_COMMS community-list while leaving the ones matched by "deny 1:.*" alone. #endif /* _QUAGGA_BGP_COMMUNITY_H */ 'set comm-list delete' stops as soon as it hits a community-list entry with a deny Ticket: CM-3513 Reviewed By: sharpd@cumulusnetworks.com Testing Done: 'set comm-list FOO delete' stops evaluating the community-list as soon as we hit the first "delete" statement. This makes it impossible to use community-lists where you deny some subset of communities to delete and then permit all of the others. This patch changes the behavior so that we no longer exit the community-list at the first delete statement. Here is our baseline, we are receiving multiple communities from 10.1.1.2 for the 10.1.3.0/24 prefix. qct-ly6-04# show ip bgp 10.1.3.0/24 BGP routing table entry for 10.1.3.0/24 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer Local 10.1.1.2 (metric 20) from 10.1.1.2 (10.1.1.2) Origin IGP, metric 0, localpref 100, valid, internal, best Community: 1:1 1:2 1:3 20:1 20:2 20:3 99:1 Last update: Wed Mar 4 13:50:36 2015 qct-ly6-04# We apply the following FOO route-map inbound to this peer and soft clear the peer ! ip community-list expanded BAD_COMMS permit 99:.* ip community-list expanded BAD_COMMS deny 1:.* ip community-list expanded BAD_COMMS permit 20.* ! route-map FOO permit 10 set comm-list BAD_COMMS delete ! router bgp 10 neighbor 10.1.1.2 route-map FOO in ! qct-ly6-04# clear ip bgp * soft in qct-ly6-04# show ip bgp 10.1.3.0/24 BGP routing table entry for 10.1.3.0/24 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer Local 10.1.1.2 (metric 20) from 10.1.1.2 (10.1.1.2) Origin IGP, metric 0, localpref 100, valid, internal, best Community: 1:1 1:2 1:3 Last update: Wed Mar 4 13:51:12 2015 qct-ly6-04# qct-ly6-04# We deleted all communities flagged as "permit" by the BAD_COMMS community-list while leaving the ones matched by "deny 1:.*" alone.
* bgpd: If route-map does not exist DENY for redistribute statementsDaniel Walton2015-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upon usage of a route-map statement in bgp, if the route-map does not exist it turns into a implicit ALLOW, this causes issues in a wide variety of scenarios. Without this fix: ! router bgp 100 bgp router-id 10.0.2.15 redistribute static route-map FOOEY ! ip route 33.33.33.33/32 eth1 ip route 44.44.44.44/32 eth1 ! Now look at show ip bgp: show ip bgp: Network Next Hop Metric LocPrf Weight Path *> 33.33.33.33/32 0.0.0.0 0 32768 ? *> 44.44.44.44/32 0.0.0.0 0 32768 ? With this fix: show ip bgp: Network Next Hop Metric LocPrf Weight Path Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com
* lib/zclient: Consolidate error reporting for zclient_read_headerDonald Sharp2015-09-241-21/+3
| | | | | | | | All functions that call zclient_read_header immediately turn around and check to ensure that the version and marker fields are correct Move this code into zclient_read_header Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Fix 'struct peer' memory leaksDonald Sharp2015-09-241-2/+0
| | | | | | | | | | peer_delete has been written to handle the peer->group pointer and to remove the peer from the peer group if it exists upon deletion being called. Shutdown/deletion Code was intentionally setting the peer-group to NULL prior to calling peer_delete. This leaked the memory associated with the peer->group because of refcnt accounting. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Add some peer_lock/unlock debug codeDonald Sharp2015-09-242-18/+23
| | | | | | | | Finding memory leaks associated with the peer data structure is incredibly hard, add some code to allow you to find this leaked code when needed. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Warn user that bgp is setting maximum-paths larger than MULTIPATH_NUMDonald Sharp2015-09-242-1/+11
| | | | | | | | | | | | | | | | In cases where a distribution has compiled zebra with a MULTIPATH_NUM that is less than what the user is setting the maximum-paths in bgp, warn them that some of the nexthops will not make it into zebra and by extension the kernel for routing. The command is still accepted. dell-s6000-02(config)# router bgp 100 dell-s6000-02(config-router)# maximum-paths 3 % Warning: maximum-paths set to 3 is greater than 2 that zebra is compiled to support dell-s6000-02(config-router)# maximum-paths ibgp 44 % Warning: maximum-paths set to 44 is greater than 2 that zebra is compiled to support dell-s6000-02(config-router)# Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Fix small memory leak in str2prefix_rdDonald Sharp2015-09-241-0/+1
| | | | | | str2prefix_rd has a memory leak. This commit fixes that issue Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Remove unnecessary stream_dup callsDonald Sharp2015-09-241-26/+6
| | | | | | | | | BGP packet handling creates a stream to handle data for an outgoing packet. In some cases the code would create a new stream, add data, then duplicate the stream and then free the original stream. This change removes the unnecessary duplication, which entails a malloc and memcpy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Fix memory leak in bgpd/bgp_route.cDenil Vira2015-09-241-0/+7
| | | | | | | | In function bgp_aggregate_add, variables 'aspath' and 'community' are malloced but not guaranteed to be freed before the function returns. Signed-off-by: Denil Vira <denil@cumulusnetworks.com>
* bgpd: Variable reuse in bgpd/bgpd.cDenil Vira2015-09-241-3/+3
| | | | | | | | In bgp_delete(), variables 'node' and 'next' are overwritten in the nested for loop. Signed-off-by: Denil Vira <denil@cumulusnetworks.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Fix useless call in bgpd/bgp_mplsvpn.cDenil Vira2015-09-241-3/+0
| | | | | | | Coverity scan ID : 1302528. Calling "decode_label(pnt)" is only useful for its return value, which is ignored. Removed the call. Signed-off-by: Denil Vira <denil@cumulusnetworks.com>
* bgpd: Addition of "show ip bgp dampening" command treeBalaji2015-09-241-0/+136
| | | | | | | | | | This patch addresses David's comments and contains: 1.Addition of show ip bgp dampening command tree 2.Addition of show ip bgp dampening parameters to display BGP dampening parameters. Signed-off-by: Balaji.G <balajig81@gmail.com>
* bgpd: Make bgp_info_cmp robust to paths that do not have su_remote infoTimo Teräs2015-09-241-1/+6
| | | | | | | | | My original su_remote == NULL check is not correct. It seems that * bgp_route.c: (bgp_info_cmp) Some bgp_info is compared with su_remote=NULL and it's supposed to be perfectly legal. E.g. configured subnet announces ("network a.b.c.d/n"). Ensure bgp_info_cmp is robust if such a path gets as far as the neighbour address comparison step.
* bgpd: Compile fix for clearing-completion FSM fix, using workqueue helper.Paul Jakma2015-09-241-1/+2
|
* bgpd: Fix race in clearing completionDonald Sharp2015-09-242-23/+27
| | | | | | | | | | | | | | | | | | When a peer that is Established goes down, it is moved into the Clearing state to facilitate clearing of the routes received from the peer - remove from the RIB, reselect best path, update/delete from Zebra and to other peers etc. At the end of this, a Clearing_Completed event is generated to the FSM which will allow the peer to move out of Clearing to Idle. The issue in the code is that there is a possibility of multiple Clearing Completed events being generated for a peer, one per AFI/SAFI. Upon the first such event, the peer would move to Idle. If other events happened (e.g., new connection got established) before the last Clearing_Completed event is received, bad things can happen. Fix to ensure only one Clearing_Completed event is generated. Signed-off-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
* bgpd: Only use routes from Established peers for best path selectionDinesh G Dutt2015-09-241-0/+14
| | | | | | | | | | | | | | Ensure that routes from a peer are not considered for best path comparison if the peer is not in an Established state. There can be a window between a peer being deleted and the background thread that actually clears the routes (marks them as "removed") runs during which best path may run. If this path selection compared two prefixes all the way down to peer IP addresses and one of these two peers had just been deleted, that peer would not have its sockunion structures, especially su_remote, resulting in a BGPD exception. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
* bgpd: Ignore stale entry candidates during bestpath selection.vivek2015-09-241-1/+13
| | | | | | | | | | During best path selection, if one of the candidates is a stale entry, do not perform the neighbor address comparison as that information is invalid for the stale entry. Attempting to perform the comparison results in a bgpd exception. Signed-off-by: Vivek Venkataraman <vivek@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
* bgpd/pimd: fix zAPI parsingNicolas Dichtel2015-09-241-41/+27
| | | | | | | | | | | | | Commit c99f3481a598 has changed the API. Now, the vrfid has been added in the header, thus we must read it before parsing the rest of the message. To ease code maintenance, let's add a new function to read a zAPI header. Fixes: c99f3481a598 ("*: add VRF ID in the API message header") Reported-by: Martin Winter <mwinter@opensourcerouting.org> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> Tested-by: Martin Winter <mwinter@opensourcerouting.org>
* build: Remove the old PIC/PIE patch, let libtool sort it outPaul Jakma2015-09-031-2/+1
| | | | | | | * Remove the old change from '08 to add in PIE arguments at automake level. Versions of libtool since then know how to deal with -fpie and do the right thing according to whether its building shared or executable objects. So just pass '-fpie' as CFLAG and let libtool do its thing.
* Quagga: Fix code to use srandom/randomDonald Sharp2015-06-213-14/+3
| | | | | | | | Quagga was using a mix of srand/rand and srandom/random. Consolidate to use srandom/random which are the POSIX versions of random number generators Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: peer_uptime overflows after 1 yearPaul Jakma2015-06-211-3/+8
| | | | | | | | | * bgpd.c: (peer_uptime) Wraps after 1 year, and doesn't indicate years. Fix. Assume a year is 365 days, for an easy life. Fixes: Bug #836 Reported-by: Rolf Hanßen Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: add VRF ID in the API message headerFeng Lu2015-06-032-26/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API messages are used by zebra to exchange the interfaces, addresses, routes and router-id information with its clients. To distinguish which VRF the information belongs to, a new field "VRF ID" is added in the message header. And hence the message version is increased to 3. * The new field "VRF ID" in the message header: Length (2 bytes) Marker (1 byte) Version (1 byte) VRF ID (2 bytes, newly added) Command (2 bytes) - Client side: - zclient_create_header() adds the VRF ID in the message header. - zclient_read() extracts and validates the VRF ID from the header, and passes the VRF ID to the callback functions registered to the API messages. - All relative functions are appended with a new parameter "vrf_id", including all the callback functions. - "vrf_id" is also added to "struct zapi_ipv4" and "struct zapi_ipv6". Clients need to correctly set the VRF ID when using the API functions zapi_ipv4_route() and zapi_ipv6_route(). - Till now all messages sent from a client have the default VRF ID "0" in the header. - The HELLO message is special, which is used as the heart-beat of a client, and has no relation with VRF. The VRF ID in the HELLO message header will always be 0 and ignored by zebra. - Zebra side: - zserv_create_header() adds the VRF ID in the message header. - zebra_client_read() extracts and validates the VRF ID from the header, and passes the VRF ID to the functions which process the received messages. - All relative functions are appended with a new parameter "vrf_id". * Suppress the messages in a VRF which a client does not care: Some clients may not care about the information in the VRF X, and zebra should not send the messages in the VRF X to those clients. Extra flags are used to indicate which VRF is registered by a client, and a new message ZEBRA_VRF_UNREGISTER is introduced to let a client can unregister a VRF when it does not need any information in that VRF. A client sends any message other than ZEBRA_VRF_UNREGISTER in a VRF will automatically register to that VRF. - lib/vrf: A new utility "VRF bit-map" is provided to manage the flags for VRFs, one bit per VRF ID. - Use vrf_bitmap_init()/vrf_bitmap_free() to initialize/free a bit-map; - Use vrf_bitmap_set()/vrf_bitmap_unset() to set/unset a flag in the given bit-map, corresponding to the given VRF ID; - Use vrf_bitmap_check() to test whether the flag, in the given bit-map and for the given VRF ID, is set. - Client side: - In "struct zclient", the following flags are changed from "u_char" to "vrf_bitmap_t": redist[ZEBRA_ROUTE_MAX] default_information These flags are extended for each VRF, and controlled by the clients themselves (or with the help of zclient_redistribute() and zclient_redistribute_default()). - Zebra side: - In "struct zserv", the following flags are changed from "u_char" to "vrf_bitmap_t": redist[ZEBRA_ROUTE_MAX] redist_default ifinfo ridinfo These flags are extended for each VRF, as the VRF registration flags. They are maintained on receiving a ZEBRA_XXX_ADD or ZEBRA_XXX_DELETE message. When sending an interface/address/route/router-id message in a VRF to a client, if the corresponding VRF registration flag is not set, this message will not be dropped by zebra. - A new function zread_vrf_unregister() is introduced to process the new command ZEBRA_VRF_UNREGISTER. All the VRF registration flags are cleared for the requested VRF. Those clients, who support only the default VRF, will never receive a message in a non-default VRF, thanks to the filter in zebra. * New callback for the event of successful connection to zebra: - zclient_start() is splitted, keeping only the code of connecting to zebra. - Now zclient_init()=>zclient_connect()=>zclient_start() operations are purely dealing with the connection to zbera. - Once zebra is successfully connected, at the end of zclient_start(), a new callback is used to inform the client about connection. - Till now, in the callback of connect-to-zebra event, all clients send messages to zebra to request the router-id/interface/routes information in the default VRF. Of corse in future the client can do anything it wants in this callback. For example, it may send requests for both default VRF and some non-default VRFs. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: call if_init()/if_terminate() from vrf_init()/vrf_terminate()Feng Lu2015-06-022-7/+4
| | | | | | | | | | | | | | | | | | Later, an interface will belong to a specific VRF, and the interface initialization will be a part of the VRF initialization. So now call if_init() from vrf_init(), and if_terminate() from vrf_terminate(). Daemons have the according changes: - if if_init() was called or "iflist" was initialized, now call vrf_init() instead; - if if_terminate() was called or "iflist" was destroyed, now call vrf_terminate() instead. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ospf6d, bgpd: avoid calling if_nametoindexFeng Lu2015-06-022-4/+4
| | | | | | | | | | | | | | As the comments in if.h, it is better to call ifname2ifindex() instead of if_nametoindex(). And ifname2ifindex() can work for VRF by appending a parameter while if_nametoindex() can not. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: allow caller to provide prefix storage in sockunion2hostprefixTimo Teräs2015-05-291-6/+5
| | | | | | | Avoids a dynamic allocation which is usually freed immediate afterwards. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: allow using rtt in route-map's set metricTimo Teräs2015-05-204-12/+52
| | | | | | | | | | | | | | | | | | | | | | Useful when the BGP neighbors are over tunnels that have large differences in geographic distances and RTTs. Especially useful for DMVPN setups to allow preferring closes hub. The parameter is added as new alias command as otherwise it seems the command parser is not able to match it properly (it seems merging is done for the various 'set metric' route-map objects in different routing engines). For same reason also they are listed as three separate options: optional +/- seems not possibly easily. Related research papers: http://www.pps.univ-paris-diderot.fr/~jch/research/delay-based.pdf http://arxiv.org/pdf/1309.0632.pdf Paper on similar extension to Babel: http://www.pps.univ-paris-diderot.fr/~jch/research/rapport-jonglez-2013.pdf Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: refactor route-map objects modifying integer valuesTimo Teräs2015-05-201-192/+111
| | | | | | | | | Use common code to parse, validate and adjust the route-map objects that contain a simple integer value. This also allows compiling the add/sub format metric object. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: straighten out ORF prefix list supportDavid Lamparter2015-05-053-5/+5
| | | | | | | | | BGP ORF prefix lists are in a separate namespace; this was previously hooked up with a special-purpose AFI value. This is a little kludgy for extension, hence this splits it off. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Paul Jakma <paul@jakma.org>
* bgpd: speed up "no-hit" withdraws for routeserversDavid Lamparter2015-05-053-12/+25
| | | | | | | | | | | | | | | | | | | | | | This accelerates handling of incoming Withdraw messages for routes that don't exist in the table to begin with. Cisco IOS 12.4(24)T4 has a bug in this regard - it sends withdraws instead of doing nothing for prefixes that are filtered. Pulling up the adj_in removal in Quagga should have no ill effect, but we can avoid the costly iteration over all rsclients if there was no adj_in entry. Performance impact of this change on routeserver with 3 buggy peers, startup/sync time: before patch: 143.12 seconds (user cpu) after patch: 7.01 seconds (user cpu) Many thanks to Nick Hilliard & INEX for providing real-world test data! Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Paul Jakma <paul@jakma.org>
* Merge branch 'volatile/fix_warnings'David Lamparter2015-04-2310-98/+43
|\ | | | | | | | | | | Thanks to Donald Sharp and Greg Troxel for providing feedback! Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: fix more initialisers (for BSD)David Lamparter2015-04-211-2/+2
| | | | | | | | | | | | | | FreeBSD and NetBSD spew a few more warnings about variable initialisers. Found with OSR's/NetDEF's fancy new CI system. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * build: add --enable-werrorDavid Lamparter2015-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows enabling -Werror in a consistent way. Note that this is different from just specifiying it in CFLAGS, since that would either break configure tests (if done on ./configure), or would override configure's CFLAGS (if done on make). Using --enable-werror instead provides a new WERROR variable that is additionally used during make with a consistent set of warning flags. The tests/ directory is exempt. (Rationale being, better to have more tests than pedantically complain about them.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: drop unused static variableDavid Lamparter2015-04-211-1/+0
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: fix SNMP write supportDavid Lamparter2015-04-211-18/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This code - dating back to the initial import in 2002 - probably never worked. Calling asn_parse_int seems to always have been wrong, and in the meantime, there no longer is a "struct variable *" argument for write_method. If anyone tried to use it, it'd probably have crashed. (I didn't try.) Fix this up so it actually works. It's the only place in Quagga where a SNMP write is actually supported, so it's an odd one out anyway, but heh. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: random() returns longDavid Lamparter2015-04-211-4/+4
| | | | | | | | | | | | | | | | | | | | bgpd was using unsigned to store a probability value to be used with random(). That, however, returns long, running into some warnings (and worst case, if RAND_MAX > UINT_MAX, won't work correctly. Just use long to shuffle the value around. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: don't use #ifdef inside macro argsDavid Lamparter2015-04-211-58/+1
| | | | | | | | | | | | | | | | Using #ifdef inside preprocessor macro argument lists is not guaranteed to work. In reality it mostly does, but we don't need these ifdefs for HAVE_IPV6 anymore, so let's get rid of the warning nonetheless. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd, zebra: fix struct/pointer sizeof mixupsDavid Lamparter2015-04-211-2/+3
| | | | | | | | | | | | | | | | | | | | Two places were taking sizeof(pointer) instead of the sizeof(struct), while performing operations on the struct. Both are initialisation functions; I guess we haven't seen fallout since they weren't critical. Fix anyway. [v2: fix mistake that actually broke bgpd RS workqueue init] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: fix ecommunity_token initialiserDavid Lamparter2015-04-211-2/+2
| | | | | | | | | | | | | | | | This pulls up ecommunity_token_unknown to be the first enum value (at 0), and uses that as initialiser to get rid of the uninitialised use warning. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: add/cleanup initialisersDavid Lamparter2015-04-211-1/+1
| | | | | | | | | | | | | | | | There were some (inconsequential) warnings about uninitialised use of variables. Also, in one case, sub-structs were mixed in initialisation, which doesn't quite work as intended. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: fix signedness mix-upsDavid Lamparter2015-04-211-1/+1
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: remove stray extra semicolonsDavid Lamparter2015-04-212-2/+2
| | | | | | | | | | | | Some places had extra semicolons where none belong. Remove them. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>