summaryrefslogtreecommitdiffstats
path: root/bgpd
Commit message (Collapse)AuthorAgeFilesLines
...
| * *: use void * for printing pointersDavid Lamparter2015-04-212-2/+2
| | | | | | | | | | | | | | | | | | On higher warning levels, compilers expect %p printf arguments to be void *. Since format string / argument warnings can be useful otherwise, let's get rid of this noise by sprinkling casts to void * over printf calls. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: use long long to print time_tDavid Lamparter2015-04-191-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Since we can't assume time_t to be long, int, or even long long, this consistently uses %lld/long long (or %llu/unsigned long long in a few cases) to print time_t/susecond_t values. This should fix a bunch of warnings, on NetBSD in particular. (Unfortunately, there seems to be no "PRId64" style printing macro for time_t...) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | bgpd: Display of configured dampening parametersBalaji2015-04-142-0/+35
| | | | | | | | | | | | | | | | Function to display configured bgp dampening parameters. Signed-off-by: Balaji.G <balajig81@gmail.com> [DL: formatting adjustments] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | bgpd: Configured suppress value cannot be less than the reuse value in bgp ↵Balaji2015-04-141-0/+8
|/ | | | | | | | | dampening RFC 2439, Section 4.2; the values pair up for hysteresis. Signed-off-by: Balaji.G <balajig81@gmail.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: get rid of INCLUDES, use AM_CPPFLAGSDavid Lamparter2015-02-141-1/+1
| | | | | | | | | | | | INCLUDES in configure.ac was not used at all, and INCLUDES in Makefile.am is supposed to be AM_CPPFLAGS these days. Reduces warnings spewed during bootstrap/autoreconf. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org>
* build: remove INRIA, NRL and MUSICA IPv6 quirksDavid Lamparter2015-02-141-2/+2
| | | | | | | | | Valar dohaeris. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org>
* bgpd: fix negative values in outputMilan Kocian2015-02-062-6/+6
| | | | | | | | | Negative value in output of ecommunities (and as numbers) seems odd :-). This patch fixes it. And add minor formating modification, better for big as numbers. Signed-off-by: Milan Kocian <milon@wq.cz> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: set BGP_ATTR_MP_[UN]REACH_NLRI (fixes 1a211cb)David Lamparter2014-12-081-0/+5
| | | | | | | | | | | Unfortunately, the attribute present bits for MP_REACH and MP_UNREACH which 1a211cb ("bgpd: one more fix"...) tests for are never set in their corresponding attribute parsing functions. Reported-by: Martin Winter <mwinter@netdef.org> Fixes: 1a211cb "bgpd: one more fix for tightening of check for missing well-known attributes" Cc: Paul Jakma <paul@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: stop startup timer on stopping BGP (fixes dd49eb1)David Lamparter2014-12-071-0/+2
| | | | | | | | | | | | bgp_delete() really needs to kill t_startup, otherwise after creating and quickly destroying a BGP instance it may fire on a deallocated struct bgp, overwriting memory. Reported-by: Martin Winter <mwinter@netdef.org> Fixes: dd49eb1 ("Fix BGP's use of restart bit.") Cc: Vipin Kumar <vipin@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
* bgpd: implement route-map set as-path prepend last-asTimo Teräs2014-11-253-28/+86
| | | | | | | | It picks up the AS to add from the aspath, or uses the peers AS number. Useful mostly in iBGP setups. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Reviewed-by: Paul Jakma <paul@opensourcerouting.org>
* bgpd: one more fix for tightening of check for missing well-known attributesPaul Jakma2014-11-251-2/+2
| | | | | | | | | * bgp_attr.c: (bgp_attr_check) The check for missing NEXT_HOP has the right spirit, but wrong where it counts, on the logic. It wouldn't catch a missing NEXT_HOP on a v4-only UPDATE. It would though have incorrectly flagged next-hop as missing on multi-protocol-only UPDATEs. Caught by Martin Winter with a test-suite.
* bgpd: trivial, remove unneeded extra variable in bgp_capability_restartPaul Jakma2014-11-111-6/+5
|
* Fix BGP's use of restart bit.Vipin Kumar2014-11-114-10/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | bgpd-restart-bit-fix.patch ISSUE: Quagga BGP doesn't send or use the restart-bit via the Graceful-Restart(GR) capability. GR capability implementation isn't complete as per the RFC. PATCH: Patch uses BGP instance creation as the beginning of the startup period, and 'restart_time' is taken as the startup period. As a result, BGP will set the restart bit in the GR capability of the OPEN messages during the startup period. As an indication of quagga implementation's capability of sending End-Of-RIB, helping a restarting neighbor, quagga BGP will now send global GR capability irrespective of the graceful-restart config in BGP and the address-family specific GR capability will be sent only if the GR config is present. Forwarding bit is not set assuming its not preserved. Incorporated feedback from David Lamparter via the quagga-dev mailing list. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Reviewed-by: Paul Jakma <paul@opensourcerouting.org>
* bgpd: remove unused variablesPaul Jakma2014-11-111-3/+0
|
* Add set ipv6 next-hop peer-address command.Dinesh G Dutt2014-11-111-1/+121
| | | | | | | | | | IPv4 has the ability to specify the peer address with the keyword peer-address. IPv6 mandates the use of a specific global or local address only in setting the next-hop in routemaps. This makes it cumbersome to configure some large networks with BGP and IPv6. This patch fixes that deficiency. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Paul Jakma <paul@opensourcerouting.org>
* bgpd: Fixes for recent well-known-attr check patch.Paul Jakma2014-10-281-6/+27
| | | | | | | | | | | | | | * bgp_attr.c: Recent patch to tighten well-known attr checks and apply that to all AFIs has some breakage with MP-extensions and GR, which needs to be fixed. (bgp_attr_check) Graceful Restart EoR can be an empty UPDATE for IPv4/uni. MP-Ext allow UPDATE with just MP_UNREACH_NLRI. Check for these and return proceed. NEXT_HOP becomes optional, if MP_REACH_NLRI is present and there's no v4 NLTI, update NEXT_HOP check accordingly. Print the missing attr in string form in the log message. (bgp_attr_parse) AS_PATH need not be there, so bgp_attr_munge_as4_attrs call needs to be conditional on that.
* bgpd: well-known attr check only run for v4/uni, which could cause a crash.Paul Jakma2014-10-173-54/+59
| | | | | | | | | | | | | | | | | | | | | | * ANVL testing by Martin Winter threw up a crash in bgpd in aspath_dup called from bgp_packet_attribute, if attr->aspath was NULL, on an IPv6 UPDATE. This root cause is that the checks for well-known, mandatory attributes were being applied only if an UPDATE contained the IPv4 NLRI and the peer was configured for v4/unicast (i.e. not deconfigured). This is something inherited from GNU Zebra, and never noticed before. * bgp_attr.c: (bgp_attr_parse) Move the well-known mandatory attribute check to here, so that it can be run immediately after all attributes are parsed, and before any further processing of attributes that might assume the existence of WK/M attributes (e.g. AS4-Path). (bgp_attr_munge_as4_attrs) Missing AS_PATH shouldn't happen here anymore, but retain a check anyway for robustness - it's definitely a hard error though. * bgp_attr.h: (bgp_attr_check) No longer needs to be exported, make static. * bgp_packet.c: (bgp_update_receive) Responsibility for well-known check now in bgp_attr_parse.
* bgpd.c: Remove unused store to variablePaul Jakma2014-09-231-2/+2
|
* Fix most compiler warnings in default GCC build.Paul Jakma2014-09-238-86/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix lots of warnings. Some const and type-pun breaks strict-aliasing warnings left but much reduced. * bgp_advertise.h: (struct bgp_advertise_fifo) is functionally identical to (struct fifo), so just use that. Makes it clearer the beginning of (struct bgp_advertise) is compatible with with (struct fifo), which seems to be enough for gcc. Add a BGP_ADV_FIFO_HEAD macro to contain the right cast to try shut up type-punning breaks strict aliasing warnings. * bgp_packet.c: Use BGP_ADV_FIFO_HEAD. (bgp_route_refresh_receive) fix an interesting logic error in (!ok || (ret != BLAH)) where ret is only well-defined if ok. * bgp_vty.c: Peer commands should use bgp_vty_return to set their return. * jhash.{c,h}: Can take const on * args without adding issues & fix warnings. * libospf.h: LSA sequence numbers use the unsigned range of values, and constants need to be set to unsigned, or it causes warnings in ospf6d. * md5.h: signedness of caddr_t is implementation specific, change to an explicit (uint_8 *), fix sign/unsigned comparison warnings. * vty.c: (vty_log_fixed) const on level is well-intentioned, but not going to fly given iov_base. * workqueue.c: ALL_LIST_ELEMENTS_RO tests for null pointer, which is always true for address of static variable. Correct but pointless warning in this case, but use a 2nd pointer to shut it up. * ospf6_route.h: Add a comment about the use of (struct prefix) to stuff 2 different 32 bit IDs into in (struct ospf6_route), and the resulting type-pun strict-alias breakage warnings this causes. Need to use 2 different fields to fix that warning? general: * remove unused variables, other than a few cases where they serve a sufficiently useful documentary purpose (e.g. for code that needs fixing), or they're required dummies. In those cases, try mark them as unused. * Remove dead code that can't be reached. * Quite a few 'no ...' forms of vty commands take arguments, but do not check the argument matches the command being negated. E.g., should 'distance X <prefix>' succeed if previously 'distance Y <prefix>' was set? Or should it be required that the distance match the previously configured distance for the prefix? Ultimately, probably better to be strict about this. However, changing from slack to strict might expose problems in command aliases and tools. * Fix uninitialised use of variables. * Fix sign/unsigned comparison warnings by making signedness of types consistent. * Mark functions as static where their use is restricted to the same compilation unit. * Add required headers * Move constants defined in headers into code. * remove dead, unused functions that have no debug purpose.
* *: merge branch stable/0.99.23David Lamparter2014-08-191-1/+1
|\ | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: memmove needed in community_del_valJohn Glotzer2014-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In bgpd/bgp_community_del_val memcpy is used for potentially overlapping regions which is *not* safe. It may "work" in some cases but is not guaranteed to work in all cases. The case that I saw fail was on an x86_64 architecture with the number of bytes being moved/copied equal to 8. The way the code is written the uint32_t pointers will always differ by 1, which is equivalent to a memcpy/memmove of regions that are 4 bytes away from one another. So the code failed while copying an 8 byte region to an address that is 4 bytes lower i.e. overlapping regions. Interestingly, the same architecture had no problems with a 12 byte copy. When the code failed the communities were [200,300,400] and a call was made to delete the 200 community. The result of this was an array that looked like [400,400] which was uniquified to [400]. Of course the expected result should have been [300, 400]. One additional point - in our production environment memmove would not *link* without including <string.h> but in an isolated quagga git repo this #include does not seem to be required and I see memmove is used in vtysh.c without this #include either. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: merge branch stable/0.99.23David Lamparter2014-06-295-75/+58
|\| | | | | | | | | | | bgp extcommunity fixes from stable branch Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: don't send NOTIFY twice for malformed attrsDavid Lamparter2014-06-292-12/+25
| | | | | | | | | | | | | | Most of the attribute parsing functions were already sending a notify, let's clean up the code to make it happen only once. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: fix IP endianness in debug messageDavid Lamparter2014-06-291-1/+1
| | | | | | | | | | | | inet_ntop expects network byte order. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: fix memory leak on malformed attributeDavid Lamparter2014-06-291-1/+4
| | | | | | | | | | | | | | | | When bgp_attr_parse returns BGP_ATTR_PARSE_ERROR, it may already have parsed and allocated some attributes before hitting that error. Free the attr's data before returning. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: fix double free after extcommunity set (BZ#799)David Lamparter2014-06-291-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The route-map extcommunity set code was incorrectly assuming that it owns the intern'd struct ecommunity reference. In reality, the intern'd reference belongs to bgp_update_receive() and we're not supposed to touch it in the route-map code. Instead, like all the other set commands, we use a on-heap but non-intern'd ecommunity to set the new value. This is then either intern'd in bgp_update_main/_rsclient() through bgp_attr_intern(), or free'd through bgp_attr_flush(). This fixes Bugzilla #799, which is that bgpd otherwise crashes with a double free. The ecommunity got unintern'd first in the route-map set command, then in bgp_update_receive(). Debugged-by: Milan Kocian <milon@wq.cz> Reported-by: Florian S <florian@herrenlohe.de> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: remove duplicate route-map extcommunity codeDavid Lamparter2014-06-291-50/+9
| | | | | | | | | | | | | | route_set_ecommunity_rt and _soo share almost all of their code. Let's remove one of the redundant copies. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * bgpd: fix some bgp_update_main() attribute leaksDavid Lamparter2014-06-291-6/+9
| | | | | | | | | | | | | | | | | | | | | | bgp_update_main() wasn't doing anything to release attribute values set from route maps for two of its error paths. To fix, pull up the appropriate cleanup from further down and apply it here. bgp_update_rsclient() doesn't have the issue since it immediately does bgp_attr_intern() on the results from bgp_{export,import}_modifier. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | bgpd: route-map: share aspath object compilation code where possibleTimo Teräs2014-06-251-48/+24
| | | | | | | | Signed-off-by: Timo Teräs <timo.teras@iki.fi>
* | bgpd: implement "next-hop-self all"Timo Teräs2014-06-254-9/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | As specified in: http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_bgp/command/irg-cr-book/bgp-m1.html#wp4972925610 This allows overriding next-hop for ibgp learned routes on an RR for reflected routes. Especially useful for using iBGP in DMVPN setups. See: http://blog.ipspace.net/2014/04/changes-in-ibgp-next-hop-processing.html Signed-off-by: Timo Teräs <timo.teras@iki.fi>
* | bgpd: fix route-map commentsTimo Teräs2014-06-251-4/+4
|/ | | | Signed-off-by: Timo Teräs <timo.teras@iki.fi>
* *: nuke ^L (page feed)David Lamparter2014-06-0421-244/+244
| | | | | | | | | | | | | | Quagga sources have inherited a slew of Page Feed (^L, \xC) characters from ancient history. Among other things, these break patchwork's XML-RPC API because \xC is not a valid character in XML documents. Nuke them from high orbit. Patches can be adapted simply by: sed -e 's%^L%%' -i filename.patch (you can type page feeds in some environments with Ctrl-V Ctrl-L) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: fix crash when allowas-in is done on inactive peerStephen Hemminger2014-06-031-0/+3
| | | | | | | | | | When allowas-in is changed on a peer that is not up, BGP would crash trying to do route_refresh. If peer is not up, there is no need to do notification or send. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Feng Lu <lu.feng@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: efficient NLRI packing for AFs != ipv4-unicastPradosh Mohapatra2014-06-035-172/+280
| | | | | | | | | | | | | | | | | | | | | ISSUE: Currently, for non-ipv4-unicast address families where prefixes are encoded in MP_REACH/MP_UNREACH attributes, BGP ends up sending one prefix per UPDATE message. This is quite inefficient. The patch addresses the issue. PATCH: We introduce a scratch buffer in the peer structure that stores the MP_REACH/MP_UNREACH attributes for non-ipv4-unicast families. This enables us to encode multiple prefixes. In the end, the two buffers are merged to create the UPDATE packet. Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> [DL: removed no longer existing bgp_packet_withdraw prototype] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: don't compare next-hop to router-idPradosh Mohapatra2014-06-031-10/+0
| | | | | | | | | | | | | | | | While announcing a path to a peer, the code currently compares the path's next-hop with the peer's router-id. This can lead to problems as the router IDs are unique only within an AS. Suppose AS 1 sends route with next-hop 10.1.1.1. It is possible that the speaker has an established BGP peering with a router in AS 2 with router ID 10.1.1.1. The route will not be advertised to that peer in AS 2. The patch removes this check. Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: Fix condition allowas-in in rsclient codeMilan Kocian2014-05-191-1/+1
| | | | | | | | | | | Currently when you set neighbour's 'allowas-in' option on route server side you get redistribution of the prefixes from this neighbour's table into all neighbour's tables which have the same AS number. I think that wanted behaviour is to allow import prefixes from neighbour's tables with the same AS num into neighbour which has 'allowas-in' option set. Signed-off-by: Milan Kocian <milon@wq.cz> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: support TTL-security with iBGPPradosh Mohapatra2014-05-193-26/+54
| | | | | | | | | | | | | | | | | | Traditionally, ttl-security feature has been associated with EBGP sessions as those identify directly connected external peers. The GTSM RFC (rfc 5082) does not make any restrictions on type of peering. In fact, it is beneficial to support ttl-security for both EBGP and IBGP sessions. Specifically, in data centers, there are directly connected IBGP peerings that will benefit from the protection ttl-security provides. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> [DL: function refactoring split out into previous 2 patches. changes: - bgp_set_socket_ttl(): ret type int -> void - is_ebgp_multihop_configured(): stripped peer == NULL check - comments/whitespace] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: factor out eBGP multihop checkDavid Lamparter2014-05-191-27/+39
| | | | | | | | | The check for an eBGP multihop configuration is unwieldy; factor it out into a separate function. [DL: originally by Dinesh G Dutt <ddutt@cumulusnetworks.com>, split off from the next commit] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: factor out TTL settingDavid Lamparter2014-05-191-12/+12
| | | | | | | | | | TTL/min TTL are set from both bgp_accept() and bgp_connect(). Factor them out so the following change to enable iBGP GTSM becomes more readable. [DL: originally by Dinesh G Dutt <ddutt@cumulusnetworks.com>, split off from the next commit] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: fix fast external fallover behaviorPradosh Mohapatra2014-05-191-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISSUES 1. When an interface goes down, the zclient callbacks are invoked in the following order: (a) address_delete() that removes the connected address list: ifp->connected, (b) interface_down() that performs "fast external fallover" operation. The operation relies on ifp->connected to look for peers that should be brought down. That's a cyclic dependency. 2. 'ttl-security' configuration handler sets peer->ttl to MAXTTL (so that BGP packets are sent with TTL=255, as per the requirement of ttl-security). This, however, is incompatible with 'fast external fallover' as the fallover operation checks for (ttl == 1) to determine directly connected peers. 3. The current fallover operation does not work for IPv6 address family. PATCH 1. The patch removes the dependency on 'ifp->connected' list for fast fallover. The peer already contains a nexthop structure that reflects the peering address. The nexthop structure has a pointer to the interface (ifp) that peering address resolves to. Everytime the TCP connection succeeds, the ifp is updated. The patch uses this ifp in the interface_down() callback for a match for the peers that should be brought down. 2. The evaluation for directly connected peering is enhanced as 'peer->ttl == 1' OR 'peer->gtsm_hops == 1'. Thus a ttl-security configuration on the peer with one hop is directly connected and should be brought down under 'fast external fallover'. 3. Because of fix (1), IPv6 address family works automatically. Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: increase TCP socket buffer sizeVipin Kumar2014-05-152-1/+31
| | | | | | | | | | | | | | | | | BGP does not respond fairly in high scale. As the number of BGP peers and prefixes increase, triggers like interface flaps which lead to BGP peer flaps, cause blockage in bgp_write. BGP does handle the cases of TCP socket buffer full by queuing a write event back, there is no functional issue there as such. Still, increasing the peer socket buffer size should help reduce event queueing in BGP. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com> [DL: patch split, this is item 3.] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: fix O_NONBLOCK on outgoing connectsVipin Kumar2014-05-151-0/+2
| | | | | | | | | | | | BGP was setting sockets to be non-blocking only for the accepted passive peers. As a fix, setting the BGP sockets to be non-blocking even for the active peers. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com> [DL: patch split, this is item 1.] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: send notify in OpenSent when stopping manuallyVitaliy Senchyshyn2014-05-152-31/+51
| | | | | | | | | | | | | | | | | | | | | | | | | The issue it fixes is that the notification message is not sent to a second peer when bgp is stopped manually. According to BGP RFC4271, section 8.2.2, regarding the FSM transitions, in OpenSent state: If a ManualStop event (Event 2) is issued in the OpenSent state, the local system: * sends the NOTIFICATION with a Cease, * sets the ConnectRetryTimer to zero, * releases all BGP resources, * drops the TCP connection, * sets the ConnectRetryCounter to zero, and * changes its state to Idle. I've added a check for OpenSent state when the notification is sent from the functions which are called from the CLI commands which directly/indirectly stop/restart BGP. Acked-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: display multipath status in "show ip bgp"Boian Bonev2014-05-151-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output of "show ip bg" does not show whether and which routes are installed as multipath routes along the best route: BGP table version is 0, local router ID is 10.10.100.209 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *>i1.0.0.0/24 10.10.100.1 1 111 0 15169 i * i 10.10.100.2 1 111 0 15169 i * i 10.10.100.3 1 111 0 65100 15169 i This patch adds a new status code that is showing exactly which routes are used as multipath: BGP table version is 0, local router ID is 10.10.100.209 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *>i1.0.0.0/24 10.10.100.1 1 111 0 15169 i *=i 10.10.100.2 1 111 0 15169 i * i 10.10.100.3 1 111 0 65100 15169 i The inconsistency in the status code legend ("i - internal" vs. "i internal") inherent from old IOS was fixed. It had to be touched anyways. Signed-off-by: Boian Bonev <bbonev at ipacct.com> [DL: rewrap long line, clean whitespace in same chunk] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: track correct originator-id in reflected routesPradosh Mohapatra2014-05-152-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | ISSUE: Suppose route1 and route2 received from route-reflector-client1 and client2 respectively have identical attributes. The current logic of creating the adj-rib-out for a peer threads the 'adv' structures for both routes against the same attribute. This results in 'bgp_update_packet()' to pack those routes in the same UPDATE message with one attr structure formatted. The originator-id is thus set according to the first route's received router id. This is incorrect. PATCH: Fix bgp_announce_check() function to set the originator-id in the advertising attr structure. Also, fix the attribute hash function and compare function to consider originator-id. Otherwise attributes where all fields except the originator-id are identical get merged into one memory location. Signed-off-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com> Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com> Reviewed-by: Ken Yin <kyin at cumulusnetworks.com> [DL: whitespace changes dropped] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: add 'bgp bestpath as-path multipath-relax'Pradosh Mohapatra2014-05-154-1/+54
| | | | | | | | | | Compute multipath in BGP based on AS_PATH hop count match. If the knob is turned on, it is not required to have an exact match of AS_PATHs (provided other multipath conditions are met, of course). Signed-off-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt at cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: use ATTR_FLAG_BIT() for BGP_ATTR_ valuesJorge Boncompte [DTI2]2014-05-151-4/+4
| | | | | | | | | * bgp_attr.c: this UNSET_FLAG()s are bogus. I did a quick review and I think that they could not cause any bug anyway. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Acked-by: Feng Lu <lu.feng@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/command.c: rewrite command matching/parsingChristian Franke2014-04-011-3/+0
| | | | | | | | | | Add support for keyword commands. Includes new documentation for DEFUN() in lib/command.h, for preexisting features as well as new keyword specification. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd, ospfd, zebra: fix some DEFUN definitionsChristian Franke2014-04-011-29/+29
| | | | | | | Fixup some DEFUNS with incorrect command strings or mixed up helpstrings. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: bgpd-set-v4-nexthop-for-v6-peering.patchPradosh Mohapatra2014-02-101-2/+22
| | | | | | | | | | | | | | | | | | | BGP: While advertising v4 prefixes over a v6 session, set the correct v4 nexthop. ISSUE: For an IPv6 peer, BGPd sets the local router-id as the next-hop's v4 address. This is incorrect as the router-id may not be a valid next-hop to be included in UPDATEs that contain v4 prefixes. PATCH: Set the v4 address in the next-hop field based on the interface that the peering is on (directly connected interface or loopback). Signed-off-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com> Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com> Acked-by: Feng Lu <lu.feng@6wind.com>