Commit Graph

143 Commits

Author SHA1 Message Date
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
paulzlabn
3f1224cd1a
Merge branch 'master' into working/master/bgp-vpn-vrf-leaking 2018-03-14 13:31:58 -07:00
vivek
b7d08f5ab5 bgpd: Fix enum, use API for log string
Suggested-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-03-13 18:14:26 +00:00
G. Paul Ziemba
ddb5b4880b bgpd: vpn-vrf route leaking
- add "debug bgp vpn label" CLI
    - improved debug messages for "debug bgp bestpath"
    - send vrf label to zebra after zebra informs bgpd of vrf_id
    - withdraw vrf_label from zebra if zebra informs bgpd that vrf_id is disabled
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:42:40 -05:00
vivek
052ea98b43 bgpd: Fix warnings
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-03-04 06:56:19 +00:00
vivek
7fd077aadd bgpd: Parse PMSI Tunnel Attribute and display
Received PMSI tunnel attributes (in EVPN type-3 route) were not recognized.
Parse them and display the tunnel type when looking at routes. Note that
the only tunnel type currently supported is ingress replication (IR). A
warning message will be logged if the received tunnel type is something
else, but the attribute is otherwise ignored.

Updates: a21bd7a (bgpd: add PMSI_TUNNEL_ATTRIBUTE to EVPN IMET routes)
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-03-04 03:28:50 +00:00
G. Paul Ziemba
a4d82a8adc bgpd: ran indent.py on some files prior to bgp vpn-vrf leaking changes
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-02-09 10:22:50 -08:00
Mitesh Kanjariya
b57ba6d2a8 bgpd: carry two MPLS labels in EVPN NLRIs
When doing symmetric routing,
EVPN type-2 (MACIP) routes need to be advertised with two labels (VNIs)
the first being the L2 VNI (identifying the VLAN) and
the second being the L3 VNI (identifying the VRF).
The receive processing needs to handle one or two labels too.

Ticket: CM-18489
Review: CCR-6949
Testing: manual and bgp/evpn/mpls smoke

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-01-23 15:58:53 -08:00
Donald Sharp
a69ea8aeac bgpd: Only build json for community when needed
Building a communities json object every time is
both expensive and memory wasteful.  Modify
code to only build the json object when needed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-17 09:04:26 -05:00
Lou Berger
e1af3f16b1 bgpd: add afi/safi to debug output
Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-31 11:06:17 -04:00
Donald Sharp
c33b83b359 bgpd: Allow turn off of 'debug bgp nht' from 'no debug bgp'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-18 14:49:59 -04:00
Daniel Walton
2a67b9150a bgpd: remove clippy references in bgp_debug.c
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-09-27 13:18:43 +00:00
Daniel Walton
ffd71765f1 bgpd: change debug_bgp_bestpath_prefix to DEFUN 2017-09-20 19:12:17 +04:00
Daniel Walton
0be4b77cda bgpd: debugs on subnets need to use apply_mask()
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

You could configure something bogus like "debug bgp updates prefix
10.1.1.1/16", this needs to be converted to "10.1.0.0/16"
2017-09-19 13:38:35 +00:00
Donald Sharp
87f6dc504d *: Add 'show debugging' command from vtysh
Allow vtysh to query every daemon about its
debugging status in one go.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-21 07:23:59 -04:00
Quentin Young
87f42c2cfa
bgpd: don't use DECLVAR without qobj pointer
Since we don't actually have a BGP context until we enter into the
`router bgp` node, debugging commands which use DECLVAR before that
happens will fail. This is just `no debug bgp` and `no debug bgp
updates`. Instead just iterate over all bgp instances and do the deed.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-10 17:05:08 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
Donald Sharp
1ea6b3f237 Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:24:46 -04:00
Donald Sharp
da571b7a6c Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:11:05 -04:00
David Lamparter
2d8270596a Merge remote-tracking branch 'frr/master' into newline-redux
Lots of conflicts from CMD_WARNING_CONFIG_FAILED...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:07:30 +02:00
David Lamparter
6d3c2ed4ed *: remove VTYNL, part 1 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
Daniel Walton
f1a05de982 vtysh: return non-zero for configuration failures
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This allows frr-reload.py (or anything else that scripts via vtysh)
to know if the vtysh command worked or hit an error.
2017-07-13 19:56:08 +00:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
Donald Sharp
aadc090505 bgpd: Refactor 'struct attr_extra' into 'struct attr'
Most of the attributes in 'struct attr_extra' allow for
the more interesting cases of using bgp.  The extra
overhead of managing it will induce errors as we add
more attributes and the extra memory overhead is
negligible on anything but full bgp feeds.

Additionally this greatly simplifies the code for
the handling of data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>

bgpd: Fix missing label set

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 15:23:18 -04:00
vivek
b16031a2ec bgpd: Debug logging updates for EVPN
Ensure VNI and EVPN nexthops are logged in debug logs.

Updates: "bgpd: labeled unicast processing"
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-07-12 14:59:03 -04:00
vivek
a463860968 bgpd: Display extended communities in debug log
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:34:33 -04:00
Quentin Young
e31b6333f4 *: vty_outln (vty, "") --> vty_out (vty, VTYNL)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:56 +00:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Donald Sharp
1e84e9a697 Merge pull request #714 from opensourcerouting/cli_magic_defpy
CLI magic: part 1 (DEFPY)
2017-06-28 09:48:33 -04:00
Quentin Young
56b4067930 *: simplify log message lookup
log.c provides functionality for associating a constant (typically a
protocol constant) with a string and finding the string given the
constant. However this is highly delicate code that is extremely prone
to stack overflows and off-by-one's due to requiring the developer to
always remember to update the array size constant and to do so correctly
which, as shown by example, is never a good idea.b

The original goal of this code was to try to implement lookups in O(1)
time without a linear search through the message array. Since this code
is used 99% of the time for debugs, it's worth the 5-6 additional cmp's
worst case if it means we avoid explitable bugs due to oversights...

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-21 15:22:21 +00:00
David Lamparter
f787d7a0b3 bgpd: (demo) apply some DEFPY()
(This was intended as further demonstration of the DEFPY code, but it
might as well go into the tree.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-14 19:29:26 +02:00
Quentin Young
c7fb183833 bgpd: fix addpath buffer overrun
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
[DL: removed compile_commands.json]
2017-06-06 16:39:14 +02:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Renato Westphal
9ff63e6f55 bgpd: removed unused parameter from bgp_dump_attr()
Originally we used the 'peer' parameter for this:

  if (peer_sort (peer) == BGP_PEER_IBGP)
    snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %d",
              attr->local_pref);

Now we have this:

  if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))
    snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %u",
              attr->local_pref);

Remove the now useless 'peer' parameter.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-12 11:48:02 -03:00
Daniel Walton
c5a543b433 Update to draft-ietf-idr-bgp-prefix-sid-05
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

The initial implementation was against draft-keyupate-idr-bgp-prefix-sid-02
This updates our label-index implementation up to draft-ietf-idr-bgp-prefix-sid-05
- changed BGP_ATTR_LABEL_INDEX to BGP_ATTR_PREFIX_SID
- since there are multiple TLVs in BGP_ATTR_PREFIX_SID you can no longer
  rely on that flag to know if there is a label-index for the path. I
changed bgp_attr_extra_new() to init the label_index to
BGP_INVALID_LABEL_INDEX
- put some placeholder code in for the other two TLVs (IPv6 and
  Originator SRGB)
2017-04-26 21:45:32 +00:00
Vivek Venkatraman
6cf48acc1c bgpd: This patch implements the exchange of the BGP-Prefix-SID label index attr
Implement BGP Prefix-SID IETF draft to be able to signal a labeled-unicast
prefix with a label index (segment ID). This makes it easier to deploy
global MPLS labels with BGP, even without other aspects of Segment Routing
implemented.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-04-06 10:32:07 -04:00
David Lamparter
38de8d0229 bgpd: RX shutdown message in "show bgp neighbor"
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-06 19:40:26 -05:00
Philippe Guibert
ce7e1778a6 bgpd: use a define for addpath string size
The define is added in order to be reused, when one wants to display
addpath identifier as a string with some comment.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14 13:58:59 +01:00
vivek
906ad49b5e bgpd: Update logging for EVPN prefixes
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>

Ticket: CM-12262
Reviewed By: CCR-5065
Testing Done: Manual
2017-02-14 13:58:58 +01:00
Donald Sharp
56c1f7d852 frr: Remove HAVE_IPV6 from code base
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-13 08:05:50 -05:00
David Lamparter
cdc2d76507 *: coccinelle-replace vty->index
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:36:25 +01:00
David Lamparter
82992fed8c Merge branch 'vtysh-grammar'
Conflicts:
	isisd/isisd.c
	lib/Makefile.am
	lib/thread.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28 17:56:29 +01:00
David Lamparter
c5d9d3bb36 lib: replace strlcpy & strlcat with glibc versions
It seems these two were at some point copied in from rsync; replace with
more recent versions that will hopefully become available in glibc as
well.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-15 17:35:36 +09:00
Quentin Young
0c7b1b01c8 bgpd: Clean up cli help strings
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-27 23:18:26 +00:00
Quentin Young
e52702f29d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	isisd/isis_redist.c
	isisd/isis_routemap.c
	isisd/isis_vty.c
	isisd/isisd.c
	lib/command.c
	lib/distribute.c
	lib/if.c
	lib/keychain.c
	lib/routemap.c
	lib/routemap.h
	ospf6d/ospf6_asbr.c
	ospf6d/ospf6_interface.c
	ospf6d/ospf6_neighbor.c
	ospf6d/ospf6_top.c
	ospf6d/ospf6_zebra.c
	ospf6d/ospf6d.c
	ospfd/ospf_routemap.c
	ospfd/ospf_vty.c
	ripd/rip_routemap.c
	ripngd/ripng_routemap.c
	vtysh/extract.pl.in
	vtysh/vtysh.c
	zebra/interface.c
	zebra/irdp_interface.c
	zebra/rt_netlink.c
	zebra/rtadv.c
	zebra/test_main.c
	zebra/zebra_routemap.c
	zebra/zebra_vty.c
2016-10-17 23:36:21 +00:00
Lou Berger
90dcf2d777 bgp debug: restore printing of memstats on exit, now prints if any debug flag set 2016-09-30 12:57:05 -04:00
Daniel Walton
a636c635ae bgpd: collaps show ip bgp, show ip bgp x.x.x.x, etc calls
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-26 18:08:45 +00:00
Daniel Walton
c500ae4060 bgpd: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 19:45:50 +00:00
Daniel Walton
6147e2c694 convert <1-255> to (1-255), ()s to <>s, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 13:47:20 +00:00
Daniel Walton
f412b39a33 ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebra
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 03:55:26 +00:00
Daniel Walton
4dcadbefd0 bgpd: argv update for all but bgp_vty.c
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-22 15:15:50 +00:00
Lou Berger
cebb7440e0 bgp: add "debug bgp allow-martians" next hops and related code/commands 2016-09-03 11:05:51 -04:00
Donald Sharp
039f3a3495 lib, bgpd, tests: Refactor FILTER_X in zebra.h
lib/zebra.h has FILTER_X #define's.  These do not belong there.
Put them in lib/filter.h where they belong.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit 0490729cc033a3483fc6b0ed45085ee249cac779)
2016-08-16 11:00:22 -04:00
Daniel Walton
7ef817d951 BGP displays "keepalive" instead of "keepalives" for debugs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-12101
2016-08-01 12:15:28 +00:00
Daniel Walton
e99789d89d BGP: remove deprecated debugs from the parser
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-9838
2016-03-11 16:33:58 +00:00
vivek
96885f16b0 BGP: Rework iteration of peer_af_array
While processing references to the macro PEERAF_FOREACH(), aggressive loop
optimization by gcc 4.9.x (probably 4.8 and greater) was resulting in the
generated code not checking on the index as well as eliminating some code.
This was leading to a dereference of invalid memory when a BGP peer came up.

The fix is to scrap this convoluted macro. Two other changes done are to
eliminate overloading of "afindex" and make the loop iterator an integer.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Dave Olson <olson@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Daniel Walton <dwalton@cumulusnetworks.com>

Ticket: CM-8889
Reviewed By: CCR-4018
Testing Done: Verified failure scenario

Note: This code was added as part of update-groups implementation; when
upstreaming update-groups, this patch should also be included.
2016-01-22 10:56:48 -08:00
Daniel Walton
47e9b2923f BGP: Remove deprecated commands and add warning that "show ipv6 bgp"
will be deprecated in the future

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>

Ticket: CM-8144
2015-11-13 03:14:10 +00:00
Donald Sharp
77f2455171 Quagga: Fix compile warnings for GCC4.9
As part of the debian build process for jessie we are seeing
some compile issues.  This addresses these issues

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-09-25 10:11:24 -07:00
Daniel Walton
3a8c7ba1ec BGP: Display the right reason code for session reset
Ticket: CM-7439
Reviewed By: Donald Sharp
Testing Done:

If a session was reset due to a NOTIFICATION the "show ip bgp
neighbor" output would not display details on what the
notification actually was.  This patch changes that.  Example:

superm-redxp-05# show ip bgp neighbors 20.1.2.2
BGP neighbor is 20.1.2.2, remote AS 21, local AS 10, external link
[snip]
  Last reset 01:05:07, due to NOTIFICATION sent (OPEN Message Error/Bad Peer AS)
2015-09-15 19:14:06 -07:00
Daniel Walton
04b6bdc0ee bgpd: Exchange hostname capability and display hostnames in output
This patch adds a hostname capability. The node's hostname and
domainname are exchanged in the new capability and used in show command
outputs based on a knob enabled by the user. The hostname and domainname
can be a maximum of 64 chars long, each.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com>

Ticket: CM-5660
Reviewed By: CCR-2563
Testing Done:
2015-09-10 20:10:16 -07:00
Donald Sharp
6e9197093c Fixup code to use correct XMALLOC operators
Ticket: CM-7177
Reviewed-by: CCR-3396
Testing: See bug

This code change does several small things:
(A) Fix a couple detected memory leaks
(B) Fix all malloc operations to use the correct XMALLOC operation in bgpd and parts of lib
(C) Adds a few new memory types to make it easier to detect issues
2015-08-26 07:44:57 -07:00
Donald Sharp
c744aa9fc6 Remove draft-walton-bgp-hostname-capability-00 for now 2015-06-12 07:59:12 -07:00
Donald Sharp
6410e93aa5 bgpd-hostname-cap.patch
bgpd: Exchange hostname capability and display hostnames in outputs

This patch adds a hostname capability. The node's hostname and
domainname are exchanged in the new capability and used in show command
outputs based on a knob enabled by the user. The hostname and domainname
can be a maximum of 64 chars long, each.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com>
2015-05-19 18:29:16 -07:00
Donald Sharp
ffd0c03744 bgpd: bgpd-warnings.patch
Remove compile warnings for the bgpd directory
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:
2015-05-19 18:12:17 -07:00
Donald Sharp
167d390a20 Some debug calls are being passed the incorrect peer 2015-05-19 18:04:21 -07:00
Donald Sharp
c9dc1a61e2 Fixup old debug commands to work with new cli 2015-05-19 18:04:18 -07:00
Donald Sharp
91ba2c8be3 Show enabled debugs in the running configuration 2015-05-19 18:04:06 -07:00
Donald Sharp
9fbdd10028 Add 'debug bgp bestpath' 2015-05-19 18:04:02 -07:00
Donald Sharp
801a9bcc7f Use #define for mp_nexthop_len values 2015-05-19 18:04:00 -07:00
Donald Sharp
3f9c7369f7 BGP: Add dynamic update group support
This patch implements the 'update-groups' functionality in BGP. This is a
function that can significantly improve BGP performance for Update generation
and resultant network convergence. BGP Updates are formed for "groups" of
peers and then replicated and sent out to each peer rather than being formed
for each peer. Thus major BGP operations related to outbound policy
application, adj-out maintenance and actual Update packet formation
are optimized.

BGP update-groups dynamically groups peers together based on configuration
as well as run-time criteria. Thus, it is more flexible than update-formation
based on peer-groups, which relies on operator configuration.

[Note that peer-group based update formation has been introduced into BGP by
Cumulus but is currently intended only for specific releases.]

From 11098af65b2b8f9535484703e7f40330a71cbae4 Mon Sep 17 00:00:00 2001
Subject: [PATCH] updgrp commits
2015-05-19 18:03:47 -07:00
Donald Sharp
16286195e4 Overhual BGP debugs
Summary of changes
- added an option to enable keepalive debugs for a specific peer
- added an option to enable inbound and/or outbound updates debugs for a specific peer
- added an option to enable update debugs for a specific prefix
- added an option to enable zebra debugs for a specific prefix
- combined "deb bgp", "deb bgp events" and "deb bgp fsm" into "deb bgp neighbor-events". "deb bgp neighbor-events" can be enabled for a specific peer.
- merged "deb bgp filters" into "deb bgp update"
- moved the per-peer logging to one central log file. We now have the ability to filter all verbose debugs on a per-peer and per-prefix basis so we no longer need to keep log files per-peer. This simplifies troubleshooting by keeping all BGP logs in one location.  The use
r can then grep for the peer IP they are interested in if they wish to see the logs for a specific peer.
- Changed "show debugging" in isis to "show debugging isis" to be consistent with all other protocols.  This was very confusing for the user because they would type "show debug" and expect to see a list of debugs enabled across all protocols.
- Removed "undebug" from the parser for BGP.  Again this was to be consisten with all other protocols.
- Removed the "all" keyword from the BGP debug parser.  The user can now do "no debug bgp" to disable all BGP debugs, before you had to type "no deb all bgp" which was confusing.

The new parse tree for BGP debugging is:

deb bgp as4
deb bgp as4 segment
deb bgp keepalives [A.B.C.D|WORD|X:X::X:X]
deb bgp neighbor-events [A.B.C.D|WORD|X:X::X:X]
deb bgp nht
deb bgp updates [in|out] [A.B.C.D|WORD|X:X::X:X]
deb bgp updates prefix [A.B.C.D/M|X:X::X:X/M]
deb bgp zebra
deb bgp zebra prefix [A.B.C.D/M|X:X::X:X/M]
2015-05-19 17:58:12 -07:00
Donald Sharp
fb018d251e nexthop-tracking.patch
quagga: nexthop-tracking.patch

Add next hop tracking support to Quagga. Complete documentation in doc/next-hop-tracking.txt.

Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:34 -07:00
David Lamparter
6b0655a251 *: nuke ^L (page feed)
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>
2014-06-04 06:58:02 +02:00
Leonid Rosenboim
1e0ce7caa6 bgpd: improve logging of invalid BGP Notifications
Invalid BGP Notification messages should be logged locally, cf.
RFC4271, Sect. 6.4, p 34,
  NOTIFICATION Message Error Handling

Current notification for invalid Notification code:

  2012/10/10 02:17:54 BGP: message index 10 not found in bgp_notify_msg (max is 8)
  2012/10/10 02:17:54 BGP: 192.168.1.1 received NOTIFICATION 10/0 ((no item found)) 0 bytes

the logging should be a bit more clear. The above logging really doesn't
explain much and looks more like a programming error.

[rewrote most of it to get in something I can call a shape -David]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-15 17:22:01 +01:00
Jorge Boncompte [DTI2]
ddc943dec3 bgpd, zebra: Fix format for some metric outputs
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-02 17:03:21 +02:00
Dmitrij Tejblum
4b4e07d2d8 bgpd: don't be confused by "unspecific" subcode in the NOTIFY message.
* bgp_debug.c (bgp_notify_open_msg, bgp_notify_update_msg,
  bgp_notify_cease_msg, bgp_notify_capability_msg): add messages for
  "unspecific" subcode.
2011-09-27 21:46:04 +04:00
David Ward
6e22b9017e bgpd: VTY string fixes for debug commands
* bgpd/bgp_debug.c: fix VTY strings for BGP debug commands to match
  correct syntax
2011-01-17 10:58:52 +03:00
Stephen Hemminger
b2d933f828 [bgpd/cleanup] make message lists read only 2009-06-18 20:18:29 +01:00
Stephen Hemminger
7fc626de5f [cleanup] Make command nodes static
The cmd_nodes used to configure vty, can mostly be static so
(basic data hiding 101).
2009-06-12 17:10:29 +01:00
Denis Ovsienko
aea339f728 [bgpd] AS4 bugfix by Chris Caputo <ccaputo@alt.net>
* bgpd/bgp_aspath.c: (aspath_make_str_count) "assert (len < str_size)" was
  getting hit under certain 4-byte ASN conditions. New realloc strategy.
* bgpd/bgp_aspath.c: (aspath_key_make) const warning fix.

"%d" -> "%u" 4-byte ASN corrections.  Prevent negative number when ASN is
above 2^31.
2009-04-30 17:16:22 +04:00
Paul Jakma
693b67b2b2 [bgpd] remove unnecessary 0 entries from struct message's
2008-03-13 Paul Jakma <paul.jakma@sun.com>

	* (various) Remove 0 entries from struct message's, unneeded due to
	  recent improvements in mes_lookup/LOOKUP.
2008-03-13 03:31:24 +00:00
Paul Jakma
0b2aa3a0a8 [bgpd] Merge AS4 support
2007-10-14 Paul Jakma <paul.jakma@sun.com>

	* NEWS: Note that MRT dumps are now version 2
	* (general) Merge in Juergen Kammer's AS4 patch.

2007-09-27 Paul Jakma <paul.jakma@sun.com>

	* bgp_aspath.c: (assegment_normalise) remove duplicates from
	  from sets.
	  (aspath_reconcile_as4) disregard a broken part of the RFC around
	  error handling in path reconciliation.
	* aspath_test.c: Test dupe-weeding from sets.
	  Test that reconciliation merges AS_PATH and AS4_PATH where
	  former is shorter than latter.

2007-09-26 Paul Jakma <paul.jakma@sun.com>

	* aspath_test.c: Test AS4_PATH reconcilation where length
	  of AS_PATH and AS4_PATH is same.

2007-09-25 Paul Jakma <paul.jakma@sun.com>

	* bgp_open.c: (peek_for_as4_capability) Fix to work.
	* bgp_packet.c: (bgp_open_receive) Fix sanity check of as4.
	* tests/bgp_capability_test.c: (general) Extend tests to validate
	  peek_for_as4_capability.
	  Add test of full OPEN Option block, with multiple capabilities,
	  both as a series of Option, and a single option.
	  Add some crap to beginning of stream, to prevent code depending
	  on getp == 0.

2007-09-18 Paul Jakma <paul.jakma@sun.com>

	* bgp_open.c: (bgp_capability_as4) debug printf inline with others.
	  (peek_for_as4_capability) There's no need to signal failure, as
	  failure is better dealt with through full capability parser -
	  just return the AS4, simpler.
	* bgp_packet.c: (bgp_open_receive) Update to match
	  peek_for_as4_capability change.
	  Allow use of BGP_AS_TRANS by 2b speakers.
	  Use NOTIFY_OPEN_ERR rather than CEASE for OPEN parsing errors.
	  (bgp_capability_msg_parse) missing argument to debug print
	  (bgp_capability_receive) missing return values.
	* tests/bgp_capability_test.c: (parse_test) update for changes to
	  peek_for_as4_capability

2007-07-25 Paul Jakma <paul.jakma@sun.com>

	* Remove 2-byte size macros, just make existing macros take
	  argument to indicate which size to use.
	  Adjust all users - typically they want '1'.
	* bgp_aspath.c: (aspath_has_as4) New, return 1 if there are any
	  as4's in a path.
	  (aspath_put) Return the number of bytes actually written, to
	  fix the bug Juergen noted: Splitting of segments will change
	  the number of bytes written from that already written to the
	  AS_PATH header.
	  (aspath_snmp_pathseg) Pass 2-byte flag to aspath_put. SNMP
	  is still defined as 2b.
	  (aspath_aggregate) fix latent bug.
	  (aspath_reconcile_as4) AS_PATH+NEW_AS_PATH reconciliation
	  function.
	  (aspath_key_make) Hash the AS_PATH string, rather than
	  just taking the addition of assegment ASes as the hash value,
	  hopefully sligthly more collision resistant.
	  (bgp_attr_munge_as4_attrs) Collide the NEW_ attributes
	  together with the OLD 2-byte forms, code Juergen
	  had in bgp_attr_parse but re-organised a bit.
	  (bgp_attr_parse) Bunch of code from Juergen moves
	  to previous function.
	  (bgp_packet_attribute) Compact significantly by
	  just /always/ using extended-length attr header.
	  Fix bug Juergen noted, by using aspath_put's
	  (new) returned size value for the attr header rather
	  than the (guesstimate) of aspath_size() - the two could
	  differ when aspath_put had to split large segments, unlikely
	  this bug was ever hit in the 'wild'.
	  (bgp_dump_routes_attr) Always use extended-len and
	  use aspath_put return for header length. Output 4b ASN
	  for AS_PATH and AGGREGATOR.
	* bgp_ecommunity.c: (ecommunity_{hash_make,cmp}) fix
	  hash callback declarations to match prototypes.
	  (ecommunity_gettoken) Updated for ECOMMUNITY_ENCODE_AS4,
	  complete rewrite of Juergen's changes (no asdot support)
	* bgp_open.c: (bgp_capability_as4) New, does what it says
	  on the tin.
	  (peek_for_as4_capability) Rewritten to use streams and
	  bgp_capability_as4.
	* bgp_packet.c: (bgp_open_send) minor edit
	  checked (in the abstract at least) with Juergen.
	  Changes are to be more accepting, e.g, allow AS_TRANS on
	  a 2-byte session.
	* (general) Update all commands to use CMD_AS_RANGE.
	* bgp_vty.c: (bgp_clear) Fix return vals to use CMD_..
	  Remove stuff replicated by VTY_GET_LONG
	  (bgp_clear_vty) Return bgp_clear directly to vty.
	* tests/aspath_test.c: Exercise 32bit parsing. Test reconcile
	  function.
	* tests/ecommunity_test.c: New, test AS4 ecommunity changes,
	  positive test only at this time, error cases not tested yet.

2007-07-25 Juergen Kammer <j.kammer@eurodata.de>

	* (general) AS4 support.
	* bgpd.h: as_t changes to 4-bytes.
	* bgp_aspath.h: Add BGP_AS4_MAX and BGP_AS_TRANS defines.
	* bgp_aspath.c: AS_VALUE_SIZE becomes 4-byte, AS16_VALUE_SIZE
	  added for 2-byte.
	  Add AS16 versions of length calc macros.
	  (aspath_count_numas) New, count number of ASes.
	  (aspath_has_as4) New, return 1 if there are any as4's in a
	  path.
	  (assegments_parse) Interpret assegment as 4 or 2 byte,
	  according to how the caller instructs us, with a new
	  argument.
	  (aspath_parse) Add use32bit argument to pass to
	  assegments_parse. Adjust all its callers to pass 1, unless
	  otherwise noted.
	  (assegment_data_put) Adjust to be able to write 2 or 4 byte
	  AS, according to new use32bit argument.
	  (aspath_put) Adjust to write 2 or 4.
	  (aspath_gettoken) Use a long for passed in asno.
	* bgp_attr.c: (attr_str) Add BGP_ATTR_AS4_PATH and
	  BGP_ATTR_AS4_AGGREGATOR.
	  (bgp_attr_aspath) Call aspath_parse with right 2/4 arg, as
	  determined by received-capability flag.
	  (bgp_attr_aspath_check) New, code previously in attr_aspath
	  but moved to new func so it can be run after NEW_AS_PATH
	  reconciliation.
	  (bgp_attr_as4_path) New, handle NEW_AS_PATH.
	  (bgp_attr_aggregator) Adjust to cope with 2/4 byte ASes.
	  (bgp_attr_as4_aggregator) New, read NEW_AGGREGATOR.
	  (bgp_attr_parse) Add handoffs to previous parsers for the two
	  new AS4 NEW_ attributes.
	  Various checks added for NEW/OLD reconciliation.
	  (bgp_packet_attribute) Support 2/4 for AS_PATH and
	  AGGREGATOR, detect when NEW_ attrs need to be sent.
	* bgp_debug.{c,h}: Add 'debug bgp as4'.
	* bgp_dump.c: MRTv2 support, unconditionally enabled, which
	  supports AS4. Based on patches from Erik (RIPE?).
	* bgp_ecommunity.c: (ecommunity_ecom2str) ECOMMUNITY_ENCODE_AS4
	  support.
	* bgp_open.c: (peek_for_as4_capability) New, peek for AS4
	  capability prior to full capability parsing, so we know which
	  ASN to use for struct peer lookup.
	  (bgp_open_capability) Always send AS4 capability.
	* bgp_packet.c: (bgp_open_send) AS4 handling for AS field
	  (bgp_open_receive) Peek for AS4 capability first, and figure
	  out which AS to believe.
	* bgp_vty.c: (bgp_show_peer) Print AS4 cap
	* tests/aspath_test.c: Support asn32 changes, call aspath_parse
	  with 16 bit.
	* vtysh/extract.pl: AS4 compatibility for router bgp ASNUMBER
	* vtysh/extract.pl.in: AS4 compatibility for router bgp ASNUMBER
	* vtysh/vtysh.c: AS4 compatibility for router bgp ASNUMBER
2007-10-14 22:32:21 +00:00
Paul Jakma
fb982c25aa [bgpd] Trim memory usage of BGP routes
2007-05-03 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.h: (struct info) Move less frequently used
	  fields to a lazily allocated struct info_extra.
	  Export bgp_info_extra_get
	* bgp_route.c: (bgp_info_extra_new) allocate extra
	  (bgp_info_extra_free) Free damp info and the info_extra.
	  (bgp_info_extra_get) Retrieve the info_extra of a struct
	  info, allocating as required.
	  (generally) adjust to use info->extra
	* bgp_damp.c: (generally) use bgp_info_extra_get to access
	  dampinfo
	* bgp_attr.h: Move rarely allocated attributes from struct attr
	  to a struct attr_extra, for a substantial saving in size of
	  struct attr.
	* bgp_attr.c: (bgp_attr_extra_{new,free}), new, self-explanatory.
	  (bgp_attr_extra_get) Get the attr_extra for a given struct
	  attr, allocating it if needs be.
	  (bgp_attr_dup) Shallow copy the struct attr and its attr_extra.
	  (generally) adjust to know about attr->extra.
	* bgp_debug.c: (bgp_dump_attr) ditto
	* bgp_vty.c: (show_bgp_memory) print attr and info extra sizes.
	* bgp_nexthop.c: (generally) adjust to know about attr->extra
	  and info->extra.
	* bgp_{packet,routemap,snmp,zebra}.c: ditto
	* lib/memtypes.c: Add MTYPE_ATTR_EXTRA and MTYPE_BGP_ROUTE_EXTRA
2007-05-04 20:15:47 +00:00
Andrew J. Schorr
a39275d76d [bgpd] Implement 'debug bgp zebra' to log all messages to and from zebra.
2006-11-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* bgp_debug.h: Declare new bgp_debug_zebra conf and term flags,
	  and define BGP_DEBUG_ZEBRA.
	* bgp_debug.c: Declare conf_bgp_debug_zebra and term_bgp_debug_zebra.
	  (debug_bgp_zebra, no_debug_bgp_zebra, undebug_bgp_zebra) New
	  functions to enable/disable bgp zebra debugging.
	  (no_debug_bgp_all) Turn off zebra debugging.
	  (show_debugging_bgp) Show whether zebra debugging is on.
	  (bgp_config_write_debug) Add 'debug bgp zebra' if configured.
	  (bgp_debug_init) Add new zebra debugging commands.
	* bgp_zebra.c: (bgp_router_id_update, bgp_interface_add,
	  bgp_interface_delete, bgp_interface_up, bgp_interface_down,
	  bgp_interface_address_add, bgp_interface_address_delete,
	  zebra_read_ipv4, zebra_read_ipv6, bgp_zebra_announce,
	  bgp_zebra_withdraw, bgp_redistribute_set, bgp_redistribute_unset)
	  If zebra debugging is enabled, log an appropriate debug message.
2006-11-30 16:36:57 +00:00
Paul Jakma
ca058a30b1 [bgpd] Fix 0.99 shutdown regression, introduce Clearing and Deleted states
2006-09-14 Paul Jakma <paul.jakma@sun.com>

	* (general) Fix some niggly issues around 'shutdown' and clearing
	  by adding a Clearing FSM wait-state and a hidden 'Deleted'
	  FSM state, to allow deleted peers to 'cool off' and hit 0
	  references. This introduces a slow memory leak of struct peer,
	  however that's more a testament to the fragility of the
	  reference counting than a bug in this patch, cleanup of
	  reference counting to fix this is to follow.
	* bgpd.h: Add Clearing, Deleted states and Clearing_Completed
	  and event.
	* bgp_debug.c: (bgp_status_msg[]) Add strings for Clearing and
	  Deleted.
	* bgp_fsm.h: Don't allow timer/event threads to set anything
	  for Deleted peers.
	* bgp_fsm.c: (bgp_timer_set) Add Clearing and Deleted. Deleted
	  needs to stop everything.
	  (bgp_stop) Remove explicit fsm_change_status call, the
	  general framework handles the transition.
	  (bgp_start) Log a warning if a start is attempted on a peer
	  that should stay down, trying to start a peer.
	  (struct .. FSM) Add Clearing_Completed
	  events, has little influence except when in state
	  Clearing to signal wait-state can end.
	  Add Clearing and Deleted states, former is a wait-state,
	  latter is a placeholder state to allow peers to disappear
	  quietly once refcounts settle.
	  (bgp_event) Try reduce verbosity of FSM state-change debug,
	  changes to same state are not interesting (Established->Established)
	  Allow NULL action functions in FSM.
	* bgp_packet.c: (bgp_write) Use FSM events, rather than trying
	  to twiddle directly with FSM state behind the back of FSM.
	  (bgp_write_notify) ditto.
	  (bgp_read) Remove the vague ACCEPT_PEER peer_unlock, or else
	  this patch crashes, now it leaks instead.
	* bgp_route.c: (bgp_clear_node_complete) Clearing_Completed
	  event, to end clearing.
	  (bgp_clear_route) See extensive comments.
	* bgpd.c: (peer_free) should only be called while in Deleted,
	  peer refcounting controls when peer_free is called.
	  bgp_sync_delete should be here, not in peer_delete.
	  (peer_delete) Initiate delete.
	  Transition to Deleted state manually.
	  When removing peer from indices that provide visibility of it,
	  take great care to be idempotent wrt the reference counting
	  of struct peer through those indices.
	  Use bgp_timer_set, rather than replicating.
	  Call to bgp_sync_delete isn't appropriate here, sync can be
	  referenced while shutting down and finishing deletion.
	  (peer_group_bind) Take care to be idempotent wrt list references
	  indexing peers.
2006-09-14 02:58:49 +00:00
paul
94f2b3923e 2005-06-28 Paul Jakma <paul.jakma@sun.com>
* (global) The great bgpd extern and static'ification.
	* bgp_routemap.c: remove unused ROUTE_MATCH_ASPATH_OLD code
	  (route_set_metric_compile) fix u_int32_t to ULONG_MAX comparison
	  warnings.
	* bgp_route.h: (bgp_process, bgp_withdraw, bgp_update) export these
	  used by various files which had their own private declarations,
	  in the case of mplsvpn - incorrect.
2005-06-28 12:44:16 +00:00
ajs
557865c28e 2004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* *.c: Change level of debug messages to LOG_DEBUG.
2004-12-08 19:59:11 +00:00
paul
fd79ac918b 2004-10-13 Paul Jakma <paul@dishone.st>
* (global) more const'ification and fixups of types to clean up code.
	* bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect,
          should use something like the VTY_GET_INTEGER macro, but without
          the vty_out bits..
        * bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE
          (no_set_aggregator_as) ditto.
        * bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is
          returned, add comments about troublesome return value.
2004-10-13 05:06:08 +00:00
paul
e01f9cbb87 2004-07-09 Paul Jakma <paul@dishone.st>
Merge of GNU Zebra cvs2svn changesets r799, r800 and r807.

        * bgp_dump.c: (bgp_dump_attr) cleanup. return status code. check
          attributes present before printing.
        * bgp_dump.c: update bgp_dump_attr prototype.
        * bgp_packet.c: (bgp_update_receive) init attrstr. check status
          of bgp_dump_attr. Log end-of-rib UPDATEs.
2004-07-09 17:48:53 +00:00
hasso
3950fda506 Merge bgpd changeset 1185 from Zebra repository by Rivo Nurges. 2004-05-20 10:22:49 +00:00
hasso
9b87e41cae Update cease codes in bgp_debug.c file as well. Just update to patch from
Rivo.
2004-04-20 16:54:49 +00:00
gdt
5e4fa1646c 2004-03-16 David Young <dyoung@pobox.com>
* (many) reference <lib/version.h> rather than "version.h",
	because version.h is a generated file and not present in the
	source tree when using objdir builds.

(committed by gdt)
works fine with normal builds; didn't try objdir
2004-03-16 14:38:36 +00:00
paul
718e374419 Initial revision 2002-12-13 20:15:29 +00:00