Commit Graph

415 Commits

Author SHA1 Message Date
Quentin Young
1588f6f441
bgpd: update atomic memory orders
Use best-performing memory orders where appropriate.
Also update some style and add missing comments.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:18:04 -05:00
Quentin Young
b750b0ba76
bgpd: small i/o threading improvements
* Start bit flags at 1, not 2
* Make run-flags atomic for i/o thread
* Remove work_cond mutex, it should no longer be necessary
* Add asserts to ensure proper ordering in bgp_connect()
* Use true/false with booleans, not 1/0

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:18:01 -05:00
Quentin Young
555e09d4a2
bgpd: atomize write-quanta, add read-quanta
bgpd supports setting a write-quanta that serves as a hint on how many
packets to write per I/O cycle. Now that input is buffered, it makes
sense to add the equivalent parameter for how many packets are processed
per cycle. This is *not* how many packets are read off the wire per I/O
cycle; rather it is how many packets are processed from the input buffer
in a given cycle after having been read off the wire and sanitized.

Since these values must be used from multiple threads, they have also
been made atomic.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:18:00 -05:00
Quentin Young
424ab01d0f
bgpd: implement buffered reads
* Move and modify all network input related code to bgp_io.c
* Add a real input buffer to `struct peer`
* Move connection initialization to its own thread.c task instead of
  piggybacking off of bgp_read()
* Tons of little fixups

Primary changes are in bgp_packet.[ch], bgp_io.[ch], bgp_fsm.[ch].
Changes made elsewhere are almost exclusively refactoring peer->ibuf to
peer->curr since peer->ibuf is now the true FIFO packet input buffer
while peer->curr represents the packet currently being processed by the
main pthread.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:59 -05:00
Quentin Young
56257a44e4
bgpd: move bgp i/o to a separate source file
After implement threading, bgp_packet.c was serving the double purpose
of consolidating packet parsing functionality and handling actual I/O
operations. This is somewhat messy and difficult to understand. I've
thus moved all code and data structures for handling threaded packet
writes to bgp_io.[ch].

Although bgp_io.[ch] only handles writes at the moment to keep the noise
on this commit series down, for organization purposes, it's probably
best to move bgp_read() and its trappings into here as well and
restructure that code so that read()'s happen in the pthread and packet
processing happens on the main thread.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:59 -05:00
Quentin Young
0ca8b79f38
bgpd: use new threading infra
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:59 -05:00
Quentin Young
419dfe6a70
bgpd: dynamically allocate synchronization primitives
Changes all synchronization primitives to be dynamically allocated. This
should help catch any subtle errors in pthread lifecycles.

This change also pre-initializes synchronization primitives before
threads begin to run, eliminating a potential race condition that
probably would have caused a segfault on startup on a very fast box.

Also changes mutex and condition variable allocations to use
MTYPE_PTHREAD and updates tests to do the proper initializations.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:58 -05:00
Quentin Young
49507a6f6a
bgpd: remove unused struct thread from peer
* Remove t_write
* Remove t_keepalive

These have been replaced by pthreads and are no longer needed. Since
some code looks at these values to determine if the threads are
scheduled, also add a new bitfield to store the same information.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:58 -05:00
Quentin Young
2d4ee77490
lib, bgpd: implement pthread lifecycle management
Removes the WiP shim and implements proper thread lifecycle management.

* Declare necessary pthread_t's in bgp_master
* Define new MTYPE in lib/thread.c for pthreads
* Allocate and free BGP's pthreads appropriately
* Terminate and join threads appropriately

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:57 -05:00
Quentin Young
d3ecc69e5f
bgpd: move packet writes into dedicated pthread
* BGP_WRITE_ON() removed
* BGP_WRITE_OFF() removed
* peer_writes_on() added
* peer_writes_off() added
* bgp_write_proceed_actions() removed

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30 16:17:57 -05:00
Donald Sharp
ccd2b0e6ce
Merge pull request #1391 from LabNConsulting/working/master/patch-set/vnc-vrf-export
Support vrf export/import based on vrf-policy
2017-11-09 08:53:24 -05:00
Lou Berger
02a82b47b3 bgpd: allow for vpn->vrf imports
ignore nexthop checks for RFAPI imported routes (as is self)
      note: NHT is still updated

Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-31 11:06:17 -04:00
Don Slice
d25e4efc52 bgpd: fix various problems with hold/keepalive timers
Problem reported that we weren't adjusting the keepalive timer
correctly when we negotiated a lower hold time learned from a
peer.  While working on this, found we didn't do inheritance
correctly at all.  This fix solves the first problem and also
ensures that the timers are configured correctly based on this
priority order - peer defined > peer-group defined > global config.
This fix also displays the timers as "configured" regardless of
which of the three locations above is used.

Ticket: CM-18408
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: CCR-6807
Testing-performed:  Manual testing successful, fix tested by
submitter, bgp-smoke completed successfully
2017-10-26 11:55:31 -04:00
Renato Westphal
5ba345ccb2 Merge pull request #1047 from dwalton76/bgpd-draft-ietf-grow-bgp-gshut-10
bgpd: implement draft-ietf-grow-bgp-gshut-10
2017-09-05 10:20:49 -03:00
Donald Sharp
32592ffb4f Merge pull request #1056 from opensourcerouting/oldbits-0
"pathspace" options, vtysh-suid-cleanups, "vty_frame()"
2017-08-29 17:48:36 -04:00
David Lamparter
2b79110731 bgpd: get rid of afi_header_vty_out() & co.
afi_header_vty_out() is easily replaced with vty_frame(), which means we
can drop a whole batch of "int *write" args as well as the entirety of
bgp_config_write_family_header().

=> AFI/SAFI config writing is now a lot simpler.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-29 08:36:03 +02:00
Mitesh Kanjariya
09fdc88c8c Merge branch 'master' into dev-master 2017-08-28 18:19:03 -07:00
Daniel Walton
31d5efe2ea Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-draft-ietf-grow-bgp-gshut-10
Conflicts:
	bgpd/bgp_route.c
2017-08-28 06:59:38 -07:00
Daniel Walton
7f32323620 bgpd: implement draft-ietf-grow-bgp-gshut-10
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-08-25 18:27:49 +00:00
Daniel Walton
318cac96ef bgpd: Memory wasting in zebra by non used MPLS FECs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-08-22 18:14:50 +00:00
Jorge Boncompte
92375c917e bgpd: inline bgp_lock()/bgp_unlock()
Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
2017-08-17 17:47:07 +02:00
Mitesh Kanjariya
db0e1937ca bgpd: Ignore EVPN routes from CLAG peer when VNI comes up
There are two parts to this commit:
1. create a database of self tunnel-ip for used in martian nexthop check
In a CLAG setup, the tunnel-ip (VNI UP) notification comes before the clag-anycast-ip comes up in the system.
This was causing our self next hop check to fail and we were instaling routes with martian nexthop in zebra.
We need to keep this info in a seperate database for all local tunnel-ip.
This database will be used in parallel with the self next hop database to martian nexthop checks.
2. When a local VNI comes up, update the tunnel-ip database and filter routes in the RD table if necessary
In case of EVPN we might receive routes from clag peer before the clag-anycast ip and VNI is up on the system.
We will store the routes in the RD table for later processing.
When VNI comes UP, we loop thorugh all the routes and install them in zebra if required.
However, we were missing the martian nexthop check in this code path.
From now onwards, when a VNI comes UP,
we will first update the tunnel-ip database
We then loop through all the routes in RD table and apply martian next hop filter if required.

Things not covered in this commit but are required:

This processing is needed in general when an address becomes a connected address.
We need to loop through all the routes in BGP and apply martian nexthop filter if necessary.
This will be taken care in a seperate bug

Ticket:CM-17271/CM-16911
Reviewed By: ccr-6542
Testing Done: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-16 23:19:58 -07:00
Mitesh Kanjariya
1a98c08704 bgpd/zebra/lib: EVPN support for asymmetric VxLan routing
1. Advertise gateway mac-ip in EVPN
2. Advertise VRR mac-ip in EVPN
3. Ignore gateway mac-ip advertisements in case of distributed gateway
4. Config knob to enable/disable gateway mac-ip advertisements

Ticket: CM-16456, CM-16543, CM-16555, CM-16778
Review: CCR-6283
Unit-test: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-08 10:28:46 -04:00
vivek
ba0fcaf6df bgpd: Fix incorrect AFI reference
Fixes: "bgpd: Fixes related to use of L2VPN/EVPN"
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-08-08 10:09:37 -04:00
Donald Sharp
ab665082fe Merge pull request #882 from opensourcerouting/safi-cleanup
lib/bgpd: cleanup SAFI values
2017-08-01 14:21:26 -04:00
Renato Westphal
a46a2e9b4e bgpd: don't make any assumptions about the size of an enum
The size of an enum is compiler dependent and thus we shouldn't use
enums inside structures that represent fields of a packet.

Problem detected by the 'test_capability' unit test.

The problem was not apparent before because the 'iana_safi_t' enum didn't
exist and 'safi_t' was a typedef to uint8_t. Now we have two different
enums, 'iana_afi_t' and 'iana_safi_t', and both need to be encoded in
different ways on the wire (2 bytes vs 1 byte).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-31 23:45:03 -03:00
Renato Westphal
5c5255381e lib/bgpd: introduce the iana_safi_t enum
We had afi_t/iana_afi_t for AFIs but only safi_t for SAFIs. Fix this
inconsistency.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-31 23:44:42 -03:00
Daniel Walton
40520c3649 bgpd: peer hash expands until we are out of memory
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

swpX peers all start out with the same sockunion so initially they all
go into the same hash bucket. Once IPv6 ND has worked its magic they
will have different sockunions and will go in different buckets...life
is good.

Until then though, we are in a phase where all swpX peers have the same
socknunion. Once we have HASH_THRESHOLD (10) swpX peers and call
hash_get for a new swpX peer the hash code calls hash_expand(). This
happens because there are more than HASH_THRESHOLD entries in a single
bucket so the logic is "expand the hash to spread things out"...in our
case expanding doesn't spread out the swpX peers because all of their
sockunions are the same.

I looked at having peer_hash_make and peer_hash_same consider the ifname
of the swpX peer but that is a large change that we don't want to make
at the moment. So the fix is to put a cap on how large we are
willing to let the hash table get. By default there is no limit but if
max_size is set we will not allow the hash to expand above that.
2017-07-31 21:22:23 +00:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -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
vivek
14c1a7bf91 bgpd: EVPN initialization and cleanup
Define the EVPN (EVI) hash table and related structures and initialize
and cleanup.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:36:34 -04:00
David Lamparter
21bb7c8774 Merge commit '3d22338f04d9554fa' into evpn-prep
Conflicts:
	lib/Makefile.am

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-10 22:15:19 +02:00
Daniel Walton
4fbf55e986 Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-ipv4-plus-label-misc3 2017-06-26 17:24:44 +00: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
Daniel Walton
9bedbb1e52 bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST table
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

- All ipv4 labeled-unicast routes are now installed in the ipv4 unicast
  table. This allows us to do things like take routes from an ipv4
  unicast peer, allocate a label for them and TX them to a ipv4
  labeled-unicast peer. We can do the opposite where we take routes from
  a labeled-unicast peer, remove the label and advertise them to an ipv4
  unicast peer.

- Multipath over a labeled route and non-labeled route is not allowed.

- You cannot activate a peer for both 'ipv4 unicast' and 'ipv4
  labeled-unicast'

- The 'tag' variable was overloaded for zebra's route tag feature as
  well as the mpls label. I added a 'mpls_label_t mpls' variable to
  avoid this.  This is much cleaner but resulted in touching a lot of
  code.
2017-06-16 19:12:57 +00:00
vivek
3d22338f04 bgpd: Fixes related to use of L2VPN/EVPN
Add checks related to AFI_L2VPN/SAFI_EVPN that were missing in some parts
of the code. Fix incorrect check skipping EVPN when sending End of RIB.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-05-25 10:20:04 -07: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
Daniel Walton
343e90c328 bgpd: add ENHE support for "address-family ipv4 labeled-unicast"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-05-10 10:06:47 -04: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
Donald Sharp
64d222e2c3 bgpd: Use appropriate Attribute number for labels
The draft-ietf-idr-bgp-prefix-sid-04 specifies the label attribute
should be 40 not 30.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-06 10:32:08 -04: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
Don Slice
cd1964ff38 bgpd: labeled unicast processing
Implement support for negotiating IPv4 or IPv6 labeled-unicast address
family, exchanging prefixes and installing them in the routing table, as
well as interactions with Zebra for FEC registration. This is the
implementation of RFC 3107.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-04-06 10:32:07 -04:00
David Lamparter
3e7c8d040c Merge branch 'stable/2.0'
Fixed minor conflicts from "defaults" change on stable.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 19:01:47 +02:00
David Lamparter
8efe88eacf *: track version & "defaults" in configs
[CF]: Move default name to autoconf and update tests

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-28 19:18:42 +02:00
David Lamparter
4f04a76b71 *: add frr_init() infrastructure
Start centralising startup & option parsing into the library.

FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g.
for killing the ZLOG_* enum, and having the daemon name available)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 23:07:20 +01:00
Donald Sharp
1a664f5e36 Merge pull request #254 from donaldsharp/shutdown3
Shutdown take 3
2017-03-07 11:29:44 -05:00
David Lamparter
f6e250f850 Merge branch 'frr/pull/240' ("lib, bgpd: clean up headers")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 16:03:36 +01:00
David Lamparter
73d70fa68a bgpd: TX shutdown message
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-06 19:40:26 -05: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
Quentin Young
94c6042452 bgpd: add vty.h to bgpd.h
`struct vty` referenced in body of bgpd.h, so it should be #include'd.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-03-02 02:09:00 +00:00
Donald Sharp
37fe77317c bgpd, zebra: Allow setting ecmp from daemon cli
When starting up bgp and zebra now, you can specify
-e <number> or --ecmp <number>
and that number will be used as the maximum ecmp
that can be used.

The <number specified must be >= 1 and <= MULTIPATH_NUM
that Quagga is compiled with.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-01 07:58:32 -05:00
Philippe Guibert
2c9ba7c7cd bgpd: add support for epvn into afindex
afindex needs knowledge of l2vpn afi parameter, as well as evpn safi
parameter.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2017-02-14 13:58:57 +01:00
David Lamparter
dcb817fd27 Merge branch 'frr/pull/92' (BGP Large Community support)
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-25 23:04:29 +01:00
Job Snijders
57d187bc77 Support for BGP Large Communities
BGP Large Communities are a novel way to signal information between
networks. An example of a Large Community is: "2914:65400:38016". Large
BGP Communities are composed of three 4-byte integers, separated by a
colon. This is easy to remember and accommodates advanced routing
policies in relation to 4-Byte ASNs.

This feature was developed by:
Keyur Patel <keyur@arrcus.com> (Arrcus, Inc.),
Job Snijders <job@ntt.net> (NTT Communications),
David Lamparter <equinox@opensourcerouting.org>
and Donald Sharp <sharpd@cumulusnetworks.com>

Signed-off-by: Job Snijders <job@ntt.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-18 18:38:53 -05:00
Donald Sharp
b58ed1f8a8 Merge remote-tracking branch 'origin/master' into pim_lib_work2 2017-01-17 21:01:56 -05:00
Donald Sharp
9aa7f43f7e Merge branch 'master' into cleanup 2017-01-13 14:48:16 -05: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
vivek
9cabb64b32 Quagga: AFI/SAFI mappings IANA to/from internal values
Introduce internal and IANA defintions for AFI/SAFI and mapping
functions and modify code to use these. This refactoring will
facilitate adding support for other AFI/SAFI whose IANA values
won't be suitable for internal data structure definitions (e.g.,
they are not contiguous).
The commit adds some fixes related to afi/safi testing with 'make check
' command.

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-11416
Reviewed By: CCR-3594 (mpls branch)
Testing Done: Not tested now, tested earlier on mpls branch
2017-01-12 09:28:43 +01:00
Olivier Dugeon
b98f56422e Merge pull request #55 from donaldsharp/monotonic
Monotonic
2017-01-09 15:26:16 +01:00
Donald Sharp
3814903108 bgpd: Remove knowledge of HAVE_CLOCK_MONTONIC
thread.c fails to build properly on systems that do
not have a CLOCK_MONOTONIC.  Therefore there is
no need for bgp to have knowledge of it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-07 19:23:50 -05:00
Julien Courtat
6a9a3cde58 bgpd: enable send of Graceful Restart Preserve State F bit
Enhance struct bgp to add a new flag BGP_FLAG_GR_PRESERVE_FWD, which
allow to set the Preserve State F bit of Graceful Restart capability in
OPEN messages.

Signed-off-by: Julien Courtat <julien.courtat@6wind.com>
2017-01-06 15:08:45 +01:00
David Lamparter
19df7279f7 bgpd: add qobj registrations
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:36:25 +01:00
Renato Westphal
5f3d1bdf3c *: rename two vrf functions
Since VRFs can be searched by vrf_id or name, make this explicit in the
helper functions.

s/vrf_lookup/vrf_lookup_by_id/
s/zebra_vrf_lookup/zebra_vrf_lookup_by_id/

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28 16:18:35 -02:00
Daniel Walton
aac9ef6cb0 bgpd: add 'neighbor x.x.x.x allowas-in origin' knob
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Don Slice <dslice@cumulusnetworks.com>

Ticket: CM-13207

normal table on spine-1....we do not see 6.0.0.10 (spine-2's loopback)
spine-1 and spine-2 are in AS 65200

superm-redxp-05# show ip bgp
BGP table version is 13, local router ID is 6.0.0.9
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
*> 6.0.0.5/32       swp1            0              0 65101 ?
*> 6.0.0.6/32       swp2            0              0 65101 ?
*> 6.0.0.7/32       swp3            0              0 65104 ?
*> 6.0.0.8/32       swp4            0              0 65104 ?
*> 6.0.0.9/32       0.0.0.0                  0          32768 ?
*= 6.0.0.11/32      swp2                          0 65101 65001 ?
*>                  swp1                          0 65101 65001 ?
*= 6.0.0.12/32      swp2                          0 65101 65002 ?
*>                  swp1                          0 65101 65002 ?
*= 6.0.0.13/32      swp4                          0 65104 65001 ?
*>                  swp3                          0 65104 65001 ?
*= 6.0.0.14/32      swp4                          0 65104 65002 ?
*>                  swp3                          0 65104 65002 ?

Displayed  9 out of 13 total prefixes
superm-redxp-05#

spine-1 with "neighbor x.x.x.x allowas-in origin", we now see 6.0.0.10

superm-redxp-05# show ip bgp
BGP table version is 14, local router ID is 6.0.0.9
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
*> 6.0.0.5/32       swp1            0              0 65101 ?
*> 6.0.0.6/32       swp2            0              0 65101 ?
*> 6.0.0.7/32       swp3            0              0 65104 ?
*> 6.0.0.8/32       swp4            0              0 65104 ?
*  6.0.0.9/32       swp2                          0 65101 65200 ?
*                   swp1                          0 65101 65200 ?
*                   swp3                          0 65104 65200 ?
*                   swp4                          0 65104 65200 ?
*>                  0.0.0.0                  0          32768 ?
*= 6.0.0.10/32      swp2                          0 65101 65200 ?
*>                  swp1                          0 65101 65200 ?
*=                  swp3                          0 65104 65200 ?
*=                  swp4                          0 65104 65200 ?
*= 6.0.0.11/32      swp2                          0 65101 65001 ?
*>                  swp1                          0 65101 65001 ?
*= 6.0.0.12/32      swp2                          0 65101 65002 ?
*>                  swp1                          0 65101 65002 ?
*= 6.0.0.13/32      swp4                          0 65104 65001 ?
*>                  swp3                          0 65104 65001 ?
*= 6.0.0.14/32      swp4                          0 65104 65002 ?
*>                  swp3                          0 65104 65002 ?

Displayed  10 out of 21 total prefixes
superm-redxp-05#

The only as-paths with 65200 that made it through were the ones that
originated from 65200

superm-redxp-05# show ip bgp regexp _65200_
BGP table version is 14, local router ID is 6.0.0.9
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
*  6.0.0.9/32       swp2                          0 65101 65200 ?
*                   swp1                          0 65101 65200 ?
*                   swp3                          0 65104 65200 ?
*                   swp4                          0 65104 65200 ?
*= 6.0.0.10/32      swp2                          0 65101 65200 ?
*>                  swp1                          0 65101 65200 ?
*=                  swp3                          0 65104 65200 ?
*=                  swp4                          0 65104 65200 ?

Displayed  2 out of 21 total prefixes
superm-redxp-05#
2016-10-21 17:51:05 +00:00
Maitane Zotes
734b349e15 bgpd: implement admin distance
Until today the admin distance cannot be configured for any IPv6
routing protocol. This patch implements it for bgp.

Signed-off-by: Maitane Zotes <maz@open.ch>
Signed-off-by: Roman Hoog Antink <rha@open.ch>
2016-10-19 22:28:45 -04:00
Daniel Walton
d93f7ffcb1 bgpd: 'neighbor x.x.x.x weight' should be per address-family
Ticket: CM-13053
Reviewed By: dslice@cumulusnetworks.com

'neighbor x.x.x.x weight' was implemented as a per-peer knob instead of
a per-peer per-afi-safi option. This makes it configurable per-peer
per-afi-safi so that we can do things like soft clear that afi/safi when
weight is modified.
2016-10-10 07:53:34 -07:00
Daniel Walton
1ba2a97af9 bgpd: 'Last write' does not update when we TX a keepalive
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-5518
2016-10-06 13:20:02 +00:00
Lou Berger
65efcfce42 bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs.  This code is currently used to support IETF NVO3 style
operation.  In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs).  The code supports
per-NVE tables.

The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP.  For
general background on NVO3 and RFP concepts see [1].  For information on
Openflow see [2].

RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory.  Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow.  The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.

BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.

The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.

The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.

[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library

Now includes changes needed to merge with cmaster-next.
2016-10-03 08:17:02 -04:00
David Lamparter
4a1ab8e405 *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
This is a rather large mechanical commit that splits up the memory types
defined in lib/memtypes.c and distributes them into *_memory.[ch] files
in the individual daemons.

The zebra change is slightly annoying because there is no nice place to
put the #include "zebra_memory.h" statement.

bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the
library for its own use.  This is bad practice and would break when the
memtype are made static.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[CF: rebased for cmaster-next]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-19 16:31:04 -04:00
Renato Westphal
f43e655ed8 bgpd: fix build on Solaris
* Solaris doesn't have u_int64_t, so use uint64_t instead. C99-style
  fixed-width integers should always be preferred to improve portability;

* 's_addr' is a macro on Solaris, so we can't use it as a variable name.
  Rename the 's_addr' variable to 'addr' in the
  bgp_peer_conf_if_to_su_update_v4() function.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-08-24 11:17:55 -04:00
Paul Jakma
b892f1ddfe *: use an ifindex_t type, defined in lib/if.h, for ifindex values
(cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)
2016-08-18 07:35:38 -04:00
Sid Khot
eb117f29e1 bgpd: Fix for CM-11982 bgp failed to redistribute connected in vrf table
Made fix to update the redistribute vrf bitmap when vrf goes down and comes up.

Ticket: CM-11982
Reviewed By: CCR-5032
Testing Done: bgp-min passed, manual
2016-08-05 16:49:39 -07:00
David Lamparter
0e6cb7434f bgpd: divorce router-id logic from CLI & zebra
Logic for determining the router-id was spread out over bgp_zebra.c and
bgp_vty.c.  Move to bgpd/bgpd.c and have these two call more properly
encapsulated functions.

Significant work by Christian Franke <chris@opensourcerouting.org>.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28 07:27:47 -04:00
David Lamparter
4760600f78 bgpd: minor header/API clean up
Adds "const" on:
- peer_update_source_addr_set()
- peer_description_set()
Adds parameter names on:
- bgp_timers_set()
  (really confusing, this one, with 2 unexplained args of same type)
Adds new setter:
- peer_afc_set(), calling peer_activate/peer_deactivate.
  (intended for API consumers, matches peer->afc)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28 07:27:47 -04:00
Quentin Young
63fa10b595 bgpd: Disallow ebgp-multihop on swpX peers
Disallow setting ebgp-multihop on peers directly
connected via an interface.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-07-12 21:13:24 +00:00
Lou Berger
587ff0fd88 bgpd: encap: add encap SAFI (RFC5512)
Adds RFC5512 and Encapsulation Attribute.

Signed-off-by: Lou Berger <lberger@labn.net>
(cherry picked from commit 298cc2f688dbadf0a447fcd06ae8e20fa5006ce4)

Conflicts:
	bgpd/Makefile.am
	bgpd/bgp_attr.c
	bgpd/bgp_open.c
	bgpd/bgp_packet.c
	bgpd/bgp_route.c
	bgpd/bgp_vty.c
	bgpd/bgpd.c
2016-06-11 15:36:42 -07:00
vivek
6407da5a24 bgpd: Fixes and updates for VPNv6
VPNv6 changes picked from upstream needed fixes and updates due to some
fundamental changes implemented by Cumulus (BGP update-groups, RFC 5549
and nexthop setting etc.) which aren't present upstream.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Updates: 945c8fe, 8ecd326, bb86c60, 93b73df, f4c8985
2016-06-11 11:36:42 -07:00
Lou Berger
f4c89855b5 bgpd: encap: add attribute handling
Signed-off-by: Lou Berger <lberger@labn.net>
Reviewed-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit c3741789530ee824693fd606356acac2ad695f83)

Conflicts:
	bgpd/Makefile.am
	bgpd/bgp_attr.c
	bgpd/bgp_attr.h
	lib/memtypes.c
2016-06-09 18:36:40 -07:00
Lou Berger
bb86c6017e bgpd: improve cleanup in bgp_delete()
Signed-off-by: Lou Berger <lberger@labn.net>
(cherry picked from commit 82dd707988b7481e203cab058c92f0b3041dd558)

Conflicts:
	bgpd/bgp_nexthop.h
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_zebra.h
	bgpd/bgpd.c
	bgpd/bgpd.h
2016-06-08 17:58:42 -07:00
Timo Teräs
baa376fc1c bgpd: allow using rtt in route-map's set metric
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>
(cherry picked from commit ef757700d0fd51dc0b46df9d3631208919f9b779)
2016-06-06 08:25:42 -07:00
Paul Jakma
1f9a9fffc1 Fix most compiler warnings in default GCC build.
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.

(cherry picked from commit 7aa9dcef80b2ce50ecaa77653d87c8b84e009c49)

Conflicts:
	bgpd/bgp_advertise.h
	bgpd/bgp_mplsvpn.c
	bgpd/bgp_nexthop.c
	bgpd/bgp_packet.c
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	lib/command.c
	lib/if.c
	lib/jhash.c
	lib/workqueue.c
	ospf6d/ospf6_lsa.c
	ospf6d/ospf6_neighbor.h
	ospf6d/ospf6_spf.c
	ospf6d/ospf6_top.c
	ospfd/ospf_api.c
	zebra/router-id.c
	zebra/rt_netlink.c
	zebra/rt_netlink.h
2016-05-26 18:57:39 +00:00
vivek
5c81b96aca BGP: Set advertisement interval when triggering IPv6 RAs
This change extends the earlier change which added the ability in BGP to
trigger IPv6 Router Advertisements when an unnumbered neighbor is configured.
In addition to triggering the RAs, the advertisement interval is also set to
10 seconds. This is needed to handle the scenario where the peer may start
later.

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

Ticket: CM-10896
Reviewed By: CCR-4693
Testing Done: Manual, bgp-min, bgp-smoke
2016-05-12 16:51:43 -07:00
vivek
4a04e5f796 BGP: Trigger IPv6 router advertisements upon config of unnumbered neighbor
Instead of turning on IPv6 RA on every interface as soon as it has an IPv6
address, only enable it upon configuration of BGP neighbor. When the BGP
neighbor is deleted, signal that RAs can be turned off.

To support this, introduce new message interaction between BGP and Zebra.
Also, take appropriate actions in BGP upon interface add/del since the
unnumbered neighbor could exist prior to interface creation etc.

Only unnumbered IPv6 neighbors require RA, the /30 or /31 based neighbors
don't. However, to keep the interaction simple and not have to deal with
too many dynamic conditions (e.g., address deletes or neighbor change to/from
'v6only'), RAs on the interface are triggered upon any unnumbered neighbor
configuration.

BGP-triggered RAs will cause RAs to be initiated on the interface; however,
if BGP asks that RAs be stopped (upon delete of unnumbered neighbor), RAs
will continue to be exchanged if the operator has explicitly enabled.

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

Ticket: CM-10640
Reviewed By: CCR-4589
Testing Done: Various manual and automated (refer to defect)
2016-05-02 13:53:38 -07:00
Dinesh G Dutt
e60480bd74 Update last reset reason on interface down or neighbor addr loss.
Ticket:
Reviewed By:
Testing Done:

For interface-based peering, we don't update the reset reason to be
interface down. Similarly, we don't update the reason to be loss of
neighbor address (maybe due to RA loss). This patch addresses these
limitations.
2016-04-25 08:54:44 -07:00
vivek
5c81a5f382 BGP: Use VRF_UNKNOWN for initialization
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10423
Reviewed By: CCR-4474
Testing Done: Manual (basic checks)
2016-04-13 18:40:09 -07:00
Donald Sharp
f813b13b71 bgpd: Add group pointer to peer_create function.
When creating a 'struct peer' add in the ability to set the peer group
associated with that peer.

Ticket: CM-10184
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-03-31 14:01:12 -04:00
vivek
5fe9f9631d Quagga: Make routemap updates or deletes work for VRFs
Updates to routemaps and delete of the routemap were not working properly
for VRFs. This was because while routemaps are global, the routemap update
processing timer and the processing were at the per-instance level. This
approach was unable to handle processing for multiple instances as the
routemap has no tracking of which instances are still pending processing.
This lead to the processing happening correctly only for the first instance
- which could be the default instance or some other instance. It could also
result in reference to freed memory for an instance.

The fix done is to make the update/delete processing also global and not per
instance. This means that the route-map delay timer will be global and a global
thread will handle the change (or delete) for all instances instead of spawning
a separate thread for each instance. To support this, a global BGP command
"bgp route-map delay-timer <value>" has been implemented. The existing command
per-instance is not deleted but will update the global timer.

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

Ticket: CM-6970, CM-9918
Reviewed By: CCR-4320
Testing Done: Manual, bgpsmoke
2016-03-22 17:46:30 +00:00
vivek
59ecefe2db BGP: Fix linkage between BGP instance and VRF structure
The issue here has to do with the fact that VRFs (like interfaces) are not
actually getting deleted when they are removed - they remain present. This
leads to situations in which BGP may try to unlink more than once, which
messes up the reference count (lock) in the BGP instance.

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

Ticket: CM-9419
Reviewed By: CCR-4302
Testing Done: Manual, also verified by Atul

<DETAILED DESCRIPTION (REPLACE)>
2016-03-16 20:38:31 +00:00
vivek
b33adb7c40 BGP: Fix interface list upon instance creation/deletion
The BGP instance cleanup was deleting interfaces in that instance after
prior fixes, but this ended up deleting the interface list header which
was not being re-created. Added code to re-create this at the time an
instance is created.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>

Ticket: CM-9466
Reviewed By: CCR-4164
Testing Done: Manual and verified failed test
2016-02-24 04:09:21 +00:00
vivek
009b18fc80 BGP: Cleanup interfaces properly on instance delete or exit
Perform interface cleanup as an instance is deleted. This takes care of the
scenario when BGP exits (or is stopped/restarted) too as instances undergo
deletion and the interface cleanup is done as the last step in that.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Fixes: 46abd3e3e6

Ticket: CM-9410
Reviewed By: CCR-4143
Testing Done: Reran failed test
2016-02-22 06:36:37 +00:00
vivek
d1be1f083d BGP: Link BGP instance to corresponding VRF
Link BGP instance (Default or VRF) to the corresponding VRF structure and
modify lookup to use this. The logic is very similar to what is implemented
in zebra - the 'struct zebra_vrf' there is essentially 'struct bgp' in BGP.

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

Ticket: CM-9122
Reviewed By: CCR-4102
Testing Done: Manual
2016-02-19 18:43:30 -08:00
vivek
ad4cbda1a3 BGP: VRF registration and cleanup
Various changes and fixes related to VRF registration, deletion,
BGP exit etc.

- Define instance type
- Ensure proper handling upon instance create, delete and
  VRF add/delete from zebra
- Cleanup upon bgp_exit()
- Ensure messages are not sent to zebra for unknown VRFs

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

Ticket: CM-9128, CM-7203
Reviewed By: CCR-4098
Testing Done: Manual
2016-02-12 13:50:22 -08:00
Donald Sharp
6aeb9e7846 bgpd: Add the ability to use a VRF to bgp
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
2016-02-02 04:36:20 -08:00
Donald Sharp
a0cee366e8 bgpd, ripngd, zebra: Remove duplicate PSIZE define
The PSIZE macro is defined the same in multiple places.  Remove
the duplicates.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-01-26 08:41:52 -08: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
9b1be336fa BGP: ebgp-multihop should accept a value up to 255
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Don Slice <dslice@cumulusnetworks.com>

Ticket: CM-8788
2016-01-14 15:25:32 +00:00
Daniel Walton
4c48cf63ae BGP: 'neighbor swpX interface peer-group FOO' is needed to simplify swpX
configuration

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Dinesh Dutt <ddutt@cumulusnetworks.com>

Ticket: CM-8321

This allows the user to configure the peer-group as an option for the
"neighbor swpX interface" command.
{code}
!
router bgp 100
 neighbor FOO peer-group
 neighbor FOO remote-as external
 neighbor swp1 interface
 neighbor swp2 interface v6only
 neighbor swp3 interface peer-group FOO
 neighbor swp4 interface v6only peer-group FOO
!
 address-family ipv4 unicast
  neighbor FOO activate
  neighbor swp1 activate
  neighbor swp2 activate
 exit-address-family
!
{code}

Note that if the user configures
{code}
neighbor swp5 interface
neighbor swp5 peer-group FOO
{code}

We will display that as "neighbor swp5 interface peer-group FOO".  It
did not seem worth tracking that the peer-group was entered via two
lines instead of one.
2015-11-30 21:19:39 +00:00
Daniel Walton
c8560b44e0 BGP: Remove the requirement to rebind a peer to its peer-group under the address-family.
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Vivek Venkatraman <vivek@cumulusnetworks.com>

Ticket: CM-3868

NOTE: Many of the ibgp peers are not up in the 'show ip bgp summ' output below. This
is because ospf was disabled at the time.  The main thing to look for is whether or
not all of the correct peers are listed based on their 'activate' status.

Basic Example
=============

router bgp 10
 bgp router-id 10.0.0.1
 no bgp default ipv4-unicast
 no bgp bestpath as-path multipath-relax
 bgp bestpath compare-routerid
 bgp route-map delay-timer 1
 neighbor EBGP peer-group
 neighbor EBGP advertisement-interval 1
 neighbor IBGP peer-group
 neighbor IBGP remote-as 10
 neighbor IBGP update-source 10.0.0.1
 neighbor IBGP advertisement-interval 1
 neighbor 10.0.0.2 peer-group IBGP
 neighbor 10.0.0.3 peer-group IBGP
 neighbor 10.0.0.4 peer-group IBGP
 neighbor 20.1.1.6 remote-as 20
 neighbor 20.1.1.6 peer-group EBGP
 neighbor 20.1.1.7 remote-as 20
 neighbor 20.1.1.7 peer-group EBGP
 neighbor 40.1.1.2 remote-as 40
 neighbor 40.1.1.2 peer-group EBGP
 neighbor 40.1.1.6 remote-as 40
 neighbor 40.1.1.6 peer-group EBGP
 neighbor 40.1.1.10 remote-as 40
 neighbor 40.1.1.10 peer-group EBGP
!
 address-family ipv4 unicast
  neighbor EBGP activate
  neighbor IBGP activate
  neighbor IBGP next-hop-self
 exit-address-family
!

superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
r2(10.0.0.2)    4    10     107     211        0    0    0 00:23:01 Connect
r3(10.0.0.3)    4    10     107     211        0    0    0 00:23:01 Connect
r4(10.0.0.4)    4    10     207     211        0    0    0 00:23:01 Active
r6(20.1.1.6)    4    20     873     975        0    0    0 00:23:29      600
r7(20.1.1.7)    4    20     873     976        0    0    0 00:23:29      600
r8(40.1.1.2)    4    40     874     975        0    0    0 00:23:30      600
r9(40.1.1.6)    4    40     874     975        0    0    0 00:23:30      600
r10(40.1.1.10)  4    40     874     975        0    0    0 00:23:30      600

Total number of neighbors 8
superm-redxp-05#

Example where one member of the peer-group is inactive...we can do this now that
peer-group members can have different outbound policies from the peer-group.
================================================================================
superm-redxp-05# conf t
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# no neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# do show run
router bgp 10
 bgp router-id 10.0.0.1
 no bgp default ipv4-unicast
 no bgp bestpath as-path multipath-relax
 bgp bestpath compare-routerid
 bgp route-map delay-timer 1
 neighbor EBGP peer-group
 neighbor EBGP advertisement-interval 1
 neighbor IBGP peer-group
 neighbor IBGP remote-as 10
 neighbor IBGP update-source 10.0.0.1
 neighbor IBGP advertisement-interval 1
 neighbor 10.0.0.2 peer-group IBGP
 neighbor 10.0.0.3 peer-group IBGP
 neighbor 10.0.0.4 peer-group IBGP
 neighbor 20.1.1.6 remote-as 20
 neighbor 20.1.1.6 peer-group EBGP
 neighbor 20.1.1.7 remote-as 20
 neighbor 20.1.1.7 peer-group EBGP
 neighbor 40.1.1.2 remote-as 40
 neighbor 40.1.1.2 peer-group EBGP
 neighbor 40.1.1.6 remote-as 40
 neighbor 40.1.1.6 peer-group EBGP
 neighbor 40.1.1.10 remote-as 40
 neighbor 40.1.1.10 peer-group EBGP
!
 address-family ipv4 unicast
  neighbor EBGP activate
  neighbor IBGP activate
  neighbor IBGP next-hop-self
  no neighbor 10.0.0.3 activate
 exit-address-family
!
superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
r2(10.0.0.2)    4    10     107     211        0    0    0 00:23:24 Connect
r4(10.0.0.4)    4    10     207     211        0    0    0 00:23:24 Active
r6(20.1.1.6)    4    20     881     983        0    0    0 00:23:52      600
r7(20.1.1.7)    4    20     881     984        0    0    0 00:23:52      600
r8(40.1.1.2)    4    40     881     982        0    0    0 00:23:53      600
r9(40.1.1.6)    4    40     881     982        0    0    0 00:23:53      600
r10(40.1.1.10)  4    40     881     982        0    0    0 00:23:53      600

Total number of neighbors 7
superm-redxp-05#

Example where the peer-group is inactive but a member of the peer-group is active:
==================================================================================
superm-redxp-05(config)# router bgp 10
superm-redxp-05(config-router)# address-family ipv4 unicast
superm-redxp-05(config-router-af)# neighbor 10.0.0.3 activate
superm-redxp-05(config-router-af)# no neighbor IBGP activate
superm-redxp-05(config-router-af)#
superm-redxp-05(config-router-af)# neighbor 10.0.0.4 activate
superm-redxp-05(config-router-af)# end
superm-redxp-05# show run
router bgp 10
 bgp router-id 10.0.0.1
 no bgp default ipv4-unicast
 no bgp bestpath as-path multipath-relax
 bgp bestpath compare-routerid
 bgp route-map delay-timer 1
 neighbor EBGP peer-group
 neighbor EBGP advertisement-interval 1
 neighbor IBGP peer-group
 neighbor IBGP remote-as 10
 neighbor IBGP update-source 10.0.0.1
 neighbor IBGP advertisement-interval 1
 neighbor 10.0.0.2 peer-group IBGP
 neighbor 10.0.0.3 peer-group IBGP
 neighbor 10.0.0.4 peer-group IBGP
 neighbor 20.1.1.6 remote-as 20
 neighbor 20.1.1.6 peer-group EBGP
 neighbor 20.1.1.7 remote-as 20
 neighbor 20.1.1.7 peer-group EBGP
 neighbor 40.1.1.2 remote-as 40
 neighbor 40.1.1.2 peer-group EBGP
 neighbor 40.1.1.6 remote-as 40
 neighbor 40.1.1.6 peer-group EBGP
 neighbor 40.1.1.10 remote-as 40
 neighbor 40.1.1.10 peer-group EBGP
!
 address-family ipv4 unicast
  neighbor EBGP activate
  neighbor IBGP next-hop-self
  neighbor 10.0.0.4 activate
 exit-address-family
!

superm-redxp-05# show ip bgp summ
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 4200
RIB entries 2399, using 281 KiB of memory
Peers 8, using 129 KiB of memory
Peer groups 2, using 112 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
r4(10.0.0.4)    4    10     207     211        0    0    0 00:24:56 Active
r6(20.1.1.6)    4    20     911    1013        0    0    0 00:25:24      600
r7(20.1.1.7)    4    20     911    1014        0    0    0 00:25:24      600
r8(40.1.1.2)    4    40     912    1013        0    0    0 00:25:25      600
r9(40.1.1.6)    4    40     912    1013        0    0    0 00:25:25      600
r10(40.1.1.10)  4    40     912    1013        0    0    0 00:25:25      600

Total number of neighbors 6
superm-redxp-05#
2015-11-20 18:53:50 +00:00
vivek
c2d58d6d0f BGP: Handle router-id correctly in config and display.
BGP is currently displaying the in-use router-id in the config. This is
conditional on a CONFIG flag, however, that flag is set even when there
is no configured router-id and the router-id learnt from Zebra is in-use.
The CONFIG flag for router-id is redundant since there is a separate
variable for the configured value, so use that and deprecate the CONFIG
flag. This also makes BGP behave like OSPF.

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

Ticket: CM-8077, CM-8220
Reviewed By: CCR-3793
Testing Done: Manual verification (in 2.5-br)

Note: Imported from 2.5-br patch bgpd-fix-router-id-config-display.patch
2015-11-17 13:57:56 -08:00
Daniel Walton
219178b6ba Quagga default: BGP "no-as-set" should be the default for "bgp as-path multipath-relax"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7928
2015-11-10 15:33:24 +00:00
Daniel Walton
2a3d57318c BGP: route-server will now use addpath...chop the _rsclient code
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8122

per draft-ietf-idr-ix-bgp-route-server-09:

2.3.2.2.2.  BGP ADD-PATH Approach

   The [I-D.ietf-idr-add-paths] Internet draft proposes a different
   approach to multiple path propagation, by allowing a BGP speaker to
   forward multiple paths for the same prefix on a single BGP session.

   As [RFC4271] specifies that a BGP listener must implement an implicit
   withdraw when it receives an UPDATE message for a prefix which
   already exists in its Adj-RIB-In, this approach requires explicit
   support for the feature both on the route server and on its clients.

   If the ADD-PATH capability is negotiated bidirectionally between the
   route server and a route server client, and the route server client
   propagates multiple paths for the same prefix to the route server,
   then this could potentially cause the propagation of inactive,
   invalid or suboptimal paths to the route server, thereby causing loss
   of reachability to other route server clients.  For this reason, ADD-
   PATH implementations on a route server should enforce send-only mode
   with the route server clients, which would result in negotiating
   receive-only mode from the client to the route server.

This allows us to delete all of the following code:

- All XXXX_rsclient() functions
- peer->rib
- BGP_TABLE_MAIN and BGP_TABLE_RSCLIENT
- RMAP_IMPORT and RMAP_EXPORT
2015-11-10 15:29:12 +00:00
Daniel Walton
06370dacc0 BGP: Implement "neighbor x.x.x.x addpath-tx-bestpath-per-AS"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8114
2015-11-06 16:34:41 +00:00
Daniel Walton
adbac85e10 BGP: support for addpath TX
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com

Ticket: CM-8014

This implements addpath TX with the first feature to use it
being "neighbor x.x.x.x addpath-tx-all-paths".

One change to show output is 'show ip bgp x.x.x.x'.  If no addpath-tx
features are configured for any peers then everything looks the same
as it is today in that "Advertised to" is at the top and refers to
which peers the bestpath was advertise to.

root@superm-redxp-05[quagga-stash5]# vtysh -c 'show ip bgp 1.1.1.1'
BGP routing table entry for 1.1.1.1/32
Paths: (6 available, best #6, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8)
  Local, (Received from a RR-client)
    12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 8
      Last update: Fri Oct 30 18:26:44 2015
[snip]

but once you enable an addpath feature we must display "Advertised to" on a path-by-path basis:

superm-redxp-05# show ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32
Paths: (6 available, best #6, table Default-IP-Routing-Table)
  Local, (Received from a RR-client)
    12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 8
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:44 2015

  Local, (Received from a RR-client)
    34.34.34.34 (metric 20) from r3(10.0.0.3) (10.0.0.3)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 7
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:39 2015

  Local, (Received from a RR-client)
    56.56.56.56 (metric 20) from r6(10.0.0.6) (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 6
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:39 2015

  Local, (Received from a RR-client)
    56.56.56.56 (metric 20) from r5(10.0.0.5) (10.0.0.5)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 5
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:39 2015

  Local, (Received from a RR-client)
    34.34.34.34 (metric 20) from r4(10.0.0.4) (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, internal
      AddPath ID: RX 0, TX 4
      Advertised to: r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:39 2015

  Local, (Received from a RR-client)
    12.12.12.12 (metric 20) from r1(10.0.0.1) (10.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      AddPath ID: RX 0, TX 3
      Advertised to: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8)
      Last update: Fri Oct 30 18:26:34 2015

superm-redxp-05#
2015-11-05 17:29:43 +00:00
Daniel Walton
400b1fad1d Deactivate BGP peer via "no neighbor x.x.x.x activate" removes other config
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-6281
2015-10-29 20:33:30 +00:00
Daniel Walton
88b8ed8dec BGP: peer-group restrictions should be relaxed, update-groups determine outbound policy anyway
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com>

Ticket: CM-7933
2015-10-28 01:54:48 +00:00
Daniel Walton
dd793e4a9c Use a hash to store BGP peer structures
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-5370
2015-10-23 17:34:50 +00:00
Daniel Walton
3fd8c52723 Lower BGP's default keepalive/holdtime to 3s/9s
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7900
2015-10-20 22:07:54 +00:00
Daniel Walton
ca5c79854c Remove BGP_ERROR_START_TIMER, it was no longer used
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7903
2015-10-20 22:06:52 +00:00
Daniel Walton
5623e905f2 Enable "bgp network import-check exact" by default. Without this it is
very easy to blackhole routes.

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

Ticket: CM-6649
2015-10-20 21:57:09 +00:00
Daniel Walton
bd4b893f77 Remove BGP's asorig timer, it is no longer used
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-20 21:54:07 +00:00
Daniel Walton
23a1f277a9 Lower the default 'timers connect' in BGP to 10 seconds
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-20 21:53:10 +00:00
Daniel Walton
12179ba3be Lower the default MRAI timer for EBGP peers to zero
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-20 21:51:00 +00:00
Daniel Walton
1670355a5a Lower the default MRAI timer for iBGP peers to 0 2015-10-20 21:50:03 +00:00
Donald Sharp
9229d914dd bgpd: fix using of two pointers for struct thread_master *
Ticket: CM-7861
Reviewed by: CCR-3651
Testing: See bug

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>
2015-10-14 06:16:10 -07:00
Donald Sharp
87d4a78163 bgpd: backout change of bm->master and master
Upstream does wanted the reverse of what was done
in this patch.  Back out the patch.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-13 13:00:55 -07:00
Donald Sharp
7dfe5b9499 bgpd: fix using of two pointers for struct thread_master
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>
2015-09-23 18:38:27 -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
Morgan Stewart
856ca177c4 Added json formating support to show-...-neighbors-... bgp commands.
Ticket: CM-6789
Reviewed By: CCR-3263
Testing Done: Manual Testing and smoke tests

Whenever some sort of output is encountered, added a json version with
proper logic as well.
2015-08-12 13:24:02 -07:00
Donald Sharp
88177fe3ed Fixup of warnings in the code
Ticket: None
Reviewed by: Trivial
Testing:

A bunch of warnings have crept in to the code base.  This
fixes the issue
2015-07-25 15:55:47 -07:00
Donald Sharp
a538debe66 Cleanup of missing NEXTHOP_FORCE_SELF 2015-07-22 13:18:24 -07:00
Donald Sharp
28066f4bcc Fixup of peer memory leaks in bgp
When deleting a set of peers, the peer->group pointer was being set to NULL
and then passed into peer_delete.

peer_delete has functionality to safely remove the peer->group structure if it
non-null and to remove the peer->group if it's refcnt reaches zero.

This is a day one bug in the quagga source tree.
2015-07-22 12:35:38 -07:00
Donald Sharp
14051b3615 bgpd-capability-cleanup.patch
BGP: Make Capability handling a little more robust

This patch does two things:
- Returns the right sub error code when a malformed capability is rcvd
- Verifies that the capability length is a multiple of an individual unit

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Vivek Venkataraman <vivek@cumulusnetworks.com>
2015-07-22 12:35:38 -07:00
Donald Sharp
7f342629a9 This patch changes ospfd from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering neighbors discovered on BFD enabled interfaces with PTM/BFD through zebra. Neighbor is registered with BFD when 2-way adjacency is established and deregistered when adjacency goes down if the BFD is enabled on the interface through which the neighbor was discovered.
OSPF BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).
interface <if-name>
  ip ospf bfd <detect mult> <min rx> <min tx>

This patch also adds BFD support for IPv6 OSPF. ospf6d  will dynamically register/deregister IPv6 neighbors with BFD for monitoring the connectivity of the neighbor. Neighbor is registered with BFD when 2-way adjacency is established and deregistered when adjacency goes down if the BFD is enabled on the interface through which the neighbor was discovered.

OSPF6 BFD command added to configure BFD and parameters (detect multiplier, min rx and min tx).
interface <if-name>
  ipv6 ospf6 bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Kanna Rajagopal <kanna@cumulusnetworks.com>
2015-07-22 12:35:37 -07:00
Donald Sharp
7bbc6864de When IPv6 peer BFD down status is received by BGP, all the the peers for which the BFD is enabled are brought down. This happens due to reverse memcmp check of destination and source IPv6 addresses with the BFD enabled BGP peers. Fixed it by doing the memcmp correctly.
Also, there is no reason stored in the last_reset field when BGP peer goes down due BFD. Incorrect/no peer down reason can get logged when BGP peer goes down due to BFD. Fixed it by adding new BFD peer down reason code and storing it in the peer last_reset field when peer is broght down due to BFD.
2015-07-22 12:35:37 -07:00
Donald Sharp
8ffedceac3 bgpd-interface-ipv4-cmd.patch
BGP: Determine peer's IP address if interface has /30, /31

Allow interface-based session config for IPv4 numbered links
if the link address is either /30 or /31. This is not RFC5549,
but can be deployed now, and independent of whether the peer
supports RFC5549 or not.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-By:   Vivek Venkataram <vivek@cumulusnetworks.com>
2015-07-22 12:35:37 -07:00
Donald Sharp
c744aa9fc6 Remove draft-walton-bgp-hostname-capability-00 for now 2015-06-12 07:59:12 -07:00
Donald Sharp
c43ed2e48a This patch changes BGP from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering BFD enabled peers with PTM/BFD through zebra. Peer is registered with BFD when it goes into established state and de-registers when it goes out of establish state.
This patch also adds BFD multihop support for BGP. Whether a peer is multi-hop or single hop is determined internally. All IGP peers are considered as multi-hop peers. EBGP peers are considered as single hop unless configured as multi-hop.

BGP BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).

router bgp <as-number>
  neighbor <name/ip-address> bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by:   Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by:   Kanna Rajagopal <kanna@cumulusnetworks.com>
2015-06-12 07:59:11 -07:00
Donald Sharp
8a92a8a00c bgpd, zebra: rfc-5549-generic.patch
This adds support for BGP RFC 5549 (Extended Next Hop Encoding capability)

     * send and receive of the capability
     * processing of IPv4->IPv6 next-hops
     * for resolving these IPv6 next-hops, itsworks with the current
       next-hop-tracking support
     * added a new message type between BGP and Zebra for such route
       install/uninstall
     * zserv side of changes to process IPv4 prefix ->IPv6 next-hops
     * required show command changes for IPv4 prefix having IPv6 next-hops

Few points to note about the implementation:

     * It does an implicit next-hop-self when a [IPv4 prefix -> IPv6 LL next-hop]
       is to be considered for advertisement to IPv4 peering (or IPv6 peering
       without Extended next-hop capability negotiated)

     * Currently feature is off by default, enable it by configuring
       'neighbor <> capability extended-nexthop'

     * Current support is for IPv4 Unicast prefixes only.

IMPORTANT NOTE:

     This patch alone isn't enough to have IPv4->IPv6 routes installed into
     the kernel. A separate patch is needed for that to work for the netlink
     interface.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
             Vivek Venkatraman <vivek@cumulusnetworks.com>
             Donald Sharp <sharpd@cumulusnetworks.com>
2015-06-11 09:19:12 -07:00
Donald Sharp
840fced957 BGP 'show ip bgp nei x.x.x.x advertised-route' does not display 'Originating default network 0.0.0.0' 2015-05-19 18:29:19 -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
0299c00427 bgpd: bgpd-no-as.patch
bgp: Fixup of the remote-as command to allow user to not have to enter an actual as number
Signed-off-by: Donald Sharp<sharpd@cumulusnetworks.com>
Reviewed-by:
2015-05-19 18:04:25 -07:00
Donald Sharp
0de4848df6 If a route-map is used on a neighbor default-originate statement we need to dynamically add/del the default route if the permit/deny result of the route-map changes. 2015-05-19 18:04:20 -07:00
Donald Sharp
078430f609 bgpd-nht-import-check-fix.patch
BGP: Fix network import check use with NHT instead of scanner

When next hop tracking was implemented and the bgp scanner was eliminated,
the "network import-check" command got broken. This patch fixes that
issue. NHT is used to not just track nexthops, but also the static routes
that are announced as part of BGP's network command. The routes are
registered only when import-check is enabled. To optimize performance,
we register static routes only when import-check is enabled.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 18:04:20 -07:00
Donald Sharp
6403814caa When unexpected events are received, do not silently transition to Idle
state through bgp_ignore() as that may not do required cleanup. Instead,
define a new event handler to handle such cases, which will go through
bgp_stop(). A similar change is also done to handle the case where an
event handler fails.

Also add a couple of variables to keep track of events for a peer.
2015-05-19 18:04:12 -07:00
Donald Sharp
16fc1eec45 Add a no-as-set option to multipath-relax 2015-05-19 18:03:58 -07:00
Donald Sharp
907f92c8fc bgpd: Disable connected check for next hop on eBGP peers
In the data center, in conjunction with next hop propagation for features
such as announcing VIP routes to load balancers and such, it is desired to
disable the connected route check even on ebgp peers with TTL of 1. This
patch is used to disable the check for all peers instead of the peer by
peer check that is currently supported. Furthermore, the existing
disable-connected-check is different from how Cisco implements this feature.
So, we add this new flag to avoid reliance on the existing flag.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-05-19 18:03:49 -07:00
Donald Sharp
f14e6fdbe2 This patch adds support for allowing BGP to create and bring up neighbor
sessions dynamically. The operator configures a range of neighbor addresses
to which peering is allowed. The ranges are configured as subnets and
multiple ranges are allowed. Each range is associated with a peer-group
so that additional parameters can be configured.

BGP neighbor sessions are dynamically created when connections are initiated
by remote neighbors whose addresses fall within a configured range. The
sessions are deleted when the BGP connection terminates.

A limit on the number of neighbors allowed from each range of addresses
can be specified.

IPv4 and IPv6 peering is supported. Over the peering, any of the address
families configured for the peer-group can be negotiated.
2015-05-19 18:03:47 -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
a82478b985 BGP: add addpath RX support 2015-05-19 18:03:45 -07:00
Donald Sharp
7c8ff89e93 Multi-Instance OSPF Summary
——————————————-------------

- etc/init.d/quagga is modified to support creating separate ospf daemon
  process for each instance. Each individual instance is monitored by
  watchquagga just like any protocol daemons.(requires initd-mi.patch).

- Vtysh is modified to able to connect to multiple daemons of the same
  protocol (supported for OSPF only for now).

- ospfd is modified to remember the Instance-ID that its invoked with. For
  the entire life of the process it caters to any command request that
  matches that instance-ID (unless its a non instance specific command).
  Routes/messages to zebra are tagged with instance-ID.

- zebra route/redistribute mechanisms are modified to work with
  [protocol type + instance-id]

- bgpd now has ability to have multiple instance specific redistribution
  for a protocol (OSPF only supported/tested for now).

- zlog ability to display instance-id besides the protocol/daemon name.

- Changes in other daemons are to because of the needed integration with
  some of the modified APIs/routines. (Didn’t prefer replicating too many
  separate instance specific APIs.)

- config/show/debug commands are modified to take instance-id argument
  as appropriate.

Guidelines to start using multi-instance ospf
---------------------------------------------

The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.

To enable multiple instances, do the following:

     1. service quagga stop
     2. Modify /etc/quagga/daemons to add instance-ids of each desired
        instance in the following format:
        ospfd=“yes"
        ospfd_instances="1,2,3"
	assuming you want to enable 3 instances with those instance ids.
     3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
        and ospfd-3.conf.
     4. service quagga start/restart
     5. Verify that the deamons are started as expected. You should see
        ospfd started with -n <instance-id> option.
     	ps –ef | grep quagga
     	With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
	ospfd-<instance-id>/vty to each instance.
     6. vtysh to work with instances as you would with any other deamons.
     7. Overall most quagga semantics are the same working with the instance
     	deamon, like it is for any other daemon.

NOTE:
     To safeguard against errors leading to too many processes getting invoked,
     a hard limit on number of instance-ids is in place, currently its 5.
     Allowed instance-id range is <1-65535>
     Once daemons are up, show running from vtysh should show the instance-id
     of  each daemon as 'router ospf <instance-id>’  (without needing explicit
     configuration)
     Instance-id can not be changed via vtysh, other router ospf configuration
     is allowed as before.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 18:03:42 -07:00
Donald Sharp
c7122e1424 Implement BGP as-override feature 2015-05-19 18:03:14 -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
d889623f1a Changes to improve BGP convergence time:
- Schedule write thread for advertisements and withdraws only if corresponding
  FIFOs are growing and/or upon work_queue getting fully processed.
- Set non-default yield time for the main work_queue, as the default value
  of 10ms results in yielding after processing very few nodes.
- Remove unnecessary scheduling of write thread when update packet is formed.
- If MRAI is 0, don't start a timer unnecessarily, directly schedule write
  thread.
- Some debugs.
2015-05-19 17:58:12 -07:00
Donald Sharp
0a91ff55b8 BGP crashes if attributes alone consume > 4096 bytes 2015-05-19 17:58:10 -07:00
Donald Sharp
5000f21c25 Add replace-as option to remove-private-as 2015-05-19 17:57:34 -07:00
Donald Sharp
d5a5c8f05b This patch adds support for a new BFD session down message from zebra to
protocols. BGP and OSPF are integrated to respond this BFD session down message
originated in Zebra via ptmd.

BGP and OSPF now have a bfd command, which tells OSPF/BGP to respond to the
BFD session down message.

OSPF:

interface <>
 ip ospf bfd

BGP:

router bgp <>
  neighbor <> bfd

Please note that these commands don't enable BFD as a protocol. BFD configuration
and paramter tuning are via BFD applicable UI.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
2015-05-19 17:47:23 -07:00
Donald Sharp
518f0eb188 bgpd: bgpd-event-driven-route-map-updates.patch
BGP: Reprocess the trigger points when an attached route map changes

Currently, modifications to route maps do not affect already processed
routes; they only affect new route updates. This patch addresses this
limitation.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:45 -07:00
Donald Sharp
abc920f85e bgpd-maxmed-administrative-onstartup.patch
COMMAND:

Possible forms of the command configuration:

[no] bgp max-med administrative
[no] bgp max-med administrative <max-med-value>
[no] bgp max-med on-startup <period>
[no] bgp max-med on-startup <period> <max-med-value>

DESCRIPTION:

'administrative' takes effect from the time of the config until the config is
removed.

'on-startup' is effective only at the startup time for the given '<period>'
after the first peer is established.

'<max-med-value>' is used as the MED value to be sent out when the max-med
is effective. Default max-med value is 4294967294.

NOTE:
When max-med is active, MED is changed only in the outgoing attributes to the
peers, it doesn't modify any MED specific state of the attributes in BGP on
the local node.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:40:42 -07:00
Donald Sharp
5ca5f1c8af Reduce the amount of time it takes to bring up a large number of peers
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:40:42 -07:00
Donald Sharp
4a16ae86a6 bgpd-scale-update-delay-packing.patch
ISSUE:
During startup, BGP update prefix packing wasnt optimal and route installation
was found to be spread over.

SOLUTION:
With this patch, update-delay post processing is serialized to achieve:
 a. better peer update packing
    (which helps in reducing total number of BGP update packets)
 b. installation of the resulting routes in zebra as close to each others
    as possible.
    (which can help zebra batch its processing and updates to Kernel better)
2015-05-19 17:40:42 -07:00
Donald Sharp
8bd9d9483f bgpd: bgpd-ibgp-policy-out-allow-mods.patch
BGPd: Allow route-map policy modifications to also affect route reflectors.

By default, attribute modification via route-map policy out is ignored on
reflected routes. This patch provides an option to allow this modification
to occur. Once enabled, it affects all reflected routes.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:41 -07:00
Donald Sharp
a80beece64 'neighbor <if-name> interface' config support in BGP including RA/Zebra changes.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
             Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:40 -07:00
Donald Sharp
d6661008e2 Save the last message from a peer that caused us to send a NOTIFICATION
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:40:39 -07:00
Donald Sharp
1ff9a34058 bgpd: bgpd-fsm-fix.patch
BGP: Fix FSM to handle active/passive connections better

The existing code didn't work well when dual connections resulted between
peers during session bringup. This patch fixes that.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:37 -07:00
Donald Sharp
cb1faec922 bgpd: bgpd-mrai.patch
BGP: Event-driven route announcement taking into account min route advertisement interval

ISSUE

BGP starts the routeadv timer (peer->t_routeadv) to expire in 1 sec
when a peer is established. From then on, the timer expires
periodically based on the configured MRAI value (default: 30sec for
EBGP, 5sec for IBGP).  At the expiry, the write thread is triggered
that takes the routes from peer's sync FIFO (adj-rib-out) and sends
UPDATEs. This has a few drawbacks:

(1) Delay in new route announcement: Even when the last UPDATE message
    was sent a while back, the next route change will necessarily have
    to wait for routeadv expiry
(2) CPU usage: The timer is always armed. If the operator chooses to
    configure a lower value of MRAI (zero second is a preferred choice
    in many deployments) for better convergence, it leads to high CPU
    usage for BGP process, even at the times of no network churn.

PATCH

Make the route advertisement event-driven - When routes are added to
peer's sync FIFO, check if the routeadv timer needs to be adjusted (or
started). Conversely, do not arm the routeadv timer unconditionally.

The patch also addresses route announcements during read-only mode
(update-delay).  During read-only mode operation, the routeadv timer
is not started. When BGP comes out of read-only mode and all the
routes are processed, the timer is started for all peers with zero
expiry, so that the UPDATEs can be sent all at once. This leads to
(near-)optimal UPDATE packing.

Finally, the patch makes the "max # packets to write to peer socket at
a time" configurable. Currently it is hard-coded to 10. The command is
at the top router-bgp mode and is called "write-quanta <number>". It
is a useful convergence parameter to tweak.

Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:40:37 -07:00
Donald Sharp
73ac816057 bgpd: bgpd-table-map.patch
COMMAND:

table-map <route-map-name>

DESCRIPTION:

This feature is used to apply a route-map on route updates from BGP to Zebra.
All the applicable match operations are allowed, such as match on prefix,
next-hop, communities, etc. Set operations for this attach-point are limited
to metric and next-hop only. Any operation of this feature does not affect
BGPs internal RIB.

Supported for ipv4 and ipv6 address families. It works on multi-paths as well,
however, metric setting is based on the best-path only.

IMPLEMENTATION NOTES:

The route-map application at this point is not supposed to modify any of BGP
route's attributes (anything in bgp_info for that matter). To achieve that,
creating a copy of the bgp_attr was inevitable. Implementation tries to keep
the memory footprint low, code comments do point out the rationale behind a
few choices made.

bgp_zebra_announce() was already a big routine, adding this feature would
extend it further. Patch has created a few smaller routines/macros whereever
possible to keep the size of the routine in check without compromising on the
readability of the code/flow inside this routine.

For updating a partially filtered route (with its nexthops), BGP to Zebra
replacement semantic of the next-hops serves the purpose well. However, with
this patch there could be some redundant withdraws each time BGP announces a
route thats (all the nexthops) gets denied by the route-map application.
Handling of this case could be optimized by keeping state with the prefix and
the nexthops in BGP. The patch doesn't optimizing that case, as even with the
redundant withdraws the total number of updates to zebra are still be capped
by the total number of routes in the table.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
2015-05-19 17:40:34 -07:00
Donald Sharp
f188f2c424 bgpd: bgpd-update-delay.patch
COMMAND:

'update-delay <max-delay in seconds> [<establish-wait in seconds>]'

DESCRIPTION:

This feature is used to enable read-only mode on BGP process restart or when
BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode
would begin as soon as the first peer reaches Established state and a timer
for <max-delay> seconds is started.

During this mode BGP doesn't run any best-path or generate any updates to its
peers. This mode continues until:

1. All the configured peers, except the shutdown peers, have sent explicit EOR
(End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached
Established is considered an implicit-EOR.
   If the <establish-wait> optional value is given, then BGP will wait for
   peers to reach establish from the begining of the update-delay till the
   establish-wait period is over, i.e. the minimum set of established peers for
   which EOR is expected would be peers established during the establish-wait
   window, not necessarily all the configured neighbors.
2. max-delay period is over.

On hitting any of the above two conditions, BGP resumes the decision process
and generates updates to its peers.

Default <max-delay> is 0, i.e. the feature is off by default.

This feature can be useful in reducing CPU/network used as BGP restarts/clears.
Particularly useful in the topologies where BGP learns a prefix from many peers.
Intermediate bestpaths are possible for the same prefix as peers get established
and start receiving updates at different times. This feature should offer a
value-add if the network has a high number of such prefixes.

IMPLEMENTATION OBJECTIVES:

Given this is an optional feature, minimized the code-churn. Used existing
constructs wherever possible (existing queue-plug/unplug were used to achieve
delay and resume of best-paths/update-generation). As a result, no new
data-structure(s) had to be defined and allocated. When the feature is disabled,
the new node is not exercised for the most part.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
             Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:33 -07:00
Donald Sharp
fe7d2a4834 bgpd: 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.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
2015-05-19 17:40:32 -07:00
Donald Sharp
5e242b0dd3 cluster-id length equality for multipath
A fat tree topology running IBGP gets into two issues with anycast address
routing. Consider the following topology:

        R9   R10
          x x
  R3   R4     R7   R8
     x           x
  R1   R2     R5   R6
  |    |      |    |
 10/8 10/8  10/8   S

Let's remind ourselves of BGP decision process steps:

1. Highest Local Preference
2. Shortest AS Path Length
3. Lowest Origin Type
4. Lowest MED (Multi-Exit Discriminator)
5. Prefer External to Internal
6. Closest Egress (Lowest IGP Distance)
7. Tie Breaking (Lowest-Router-ID)
8. Tie Breaking (Lowest-cluster-list length)
9. Tie Breaking (Lowest-neighbor-address)

Without any policies, steps 1-6 will almost always evaluate identically for
all paths received on any router in the above topology. Let's assume that
the router-ids follow the following inequality: R1 < R2 < R5 < R6. Owing to
the 7th step above, all routers will now choose R1's path as the best. This
is undesirable. As an example, traffic from S to 10/8 will follow the path
S -> R6 -> R7 -> R9 -> R4 -> R2 -> 10/8 instead of S -> R6 -> R7 -> R5 -> 10/8.
Furthermore, once R7 (& R8) chooses R1's path as the best, it would withdraw
its path learned through (R5, R6) from (R9, R10). This leads to inefficient
load balancing - e.g. R9 can't do ECMP across all available egresses -
(R1, R2, R5).

The patch addresses these issues by noting that that cluster list is always
carried along with the routes and its length is a good indicator of IBGP
hops. It thus makes sense to compare that as an extension to metric after
step 6. That automatically ensures correct multipath computation.

Unfortunately a partial deployment of this in a generic topology (note:
fat-tree/clos topologies work fine) may lead to potential loops. It needs
to be looked into.

Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:31 -07:00
Timo Teräs
9e7a53c179 bgpd: implement "next-hop-self all"
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>
2014-06-25 21:20:20 +03: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
Pradosh Mohapatra
8c71e481da bgpd: efficient NLRI packing for AFs != ipv4-unicast
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>
2014-06-03 15:08:32 +02:00
Vitaliy Senchyshyn
6aa136f1ea bgpd: send notify in OpenSent when stopping manually
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>
2014-05-15 19:54:04 +02:00
Pradosh Mohapatra
2fdd455cfd bgpd: add 'bgp bestpath as-path multipath-relax'
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>
2014-05-15 19:15:22 +02:00
Andrew Certain
9d3f9705d8 bgpd: add replace-as modifier for BGP neighbor
Added replace-as modifier for BGP neighbors when using
local-as. If the replace-as modifier is specified, only the
replacement AS as specified by the local-as modifier is
prepended to the AS_PATH, not the process's AS.

In bgp_attr.c, I decided that

if (peer->change_local_as) {
  /* If replace-as is specified, we only use the change_local_as when
     advertising routes. */
  if( ! CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ) {
    aspath = aspath_add_seq (aspath, peer->local_as);
  }
  aspath = aspath_add_seq (aspath, peer->change_local_as);
} else {
  aspath = aspath_add_seq (aspath, peer->local_as);
}

was clearer than the alternative that didn't duplicate the prepending of the
process's AS:

/* First, append the process local AS unless we have an alternate local_as
 * and we're replacing it (as opposed to just prepending it). */
if (! (peer->change_local_as
       && CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ) ) {
  aspath = aspath_add_seq (aspath, peer->local_as);
}

if (peer->change_local_as)
  aspath = aspath_add_seq (aspath, peer->change_local_as);
}

But I could be convinced otherwise.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-11-30 21:10:00 +01:00
Paul Jakma
cccbc01518 bgpd: Add "no listen" socket option for the BGP master configuration
* bgpd.h: add a BGP_OPT_NO_LISTEN option for the master BGP configuration,
  to prevent any listen socket being created automatically. Allows code
  to be used outside of BGP daemon settings.
* bgpd.c: (bgp_get) honour above the flag, suppress auto-creation of listen
  socket on first BGP instance if set.
  (bgp_option_set) whitelist BGP_OPT_NO_LISTEN
2012-06-14 17:30:14 +01:00
Paul Jakma
ad12dde6f9 Revert "bgpd: Make socket init separate, so unit tests work again."
This reverts commit 7621f336e2. See bug #727
2012-06-13 22:50:07 +01:00
Jorge Boncompte [DTI2]
6d85b15bbb bgpd: remove calls to peer_sort() from fast-path
peer_sort() it's called so much as to be annoying. In the assumption
that the 'sort' of the peer doesn't change during an established session,
I have changed all calls to peer_sort() in the 'fast-path' to only check
the 'sort'. All the calls from the vty and such still recalculate the sort
and store it in the peer.

  There's a lot of other calls to peer_sort() that could be changed but some
maube tricky, someone more knowledgeable may try to reduce them.

  This hits peer_sort() from 5th out of the stadium^H^H list on a full
internet table loading profiling session.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:25:10 +02:00
Paul Jakma
7621f336e2 bgpd: Make socket init separate, so unit tests work again.
* Separate out BGP socket initialisation from bgp_get, and make it an
  explicit function. Allows unit tests to work again and probably also
  benefits dry-run.
* bgpd.c: (bgp_get) move socket init out...
  (bgp_socket_init) to here
* bgp_main.c: and call it after dry-run.
* bgpd.h: (bgp_socket_init) add prototype
2012-05-02 11:02:11 +01:00
Avneesh Sachdev
3cf6c2b4e4 Merge branch 'quagga' into google-bgp-multipath
Conflicts:
	bgpd/bgp_route.c
2012-04-09 00:25:15 -07:00
Denis Ovsienko
42e6d745d1 bgpd: more SAFI fixes
(with resolved conflict in bgpd/bgp_packet.c)

Two macros resolving to the same integer constant broke a case block and
a more thorough merge of BGP_SAFI_VPNV4 and BGP_SAFI_VPNV6 was
performed.

* bgpd.h: MPLS-labeled VPN SAFI is AFI-independent, switch to single
* macro
* bgp_capability_test.c: update test data
* bgp_mp_attr_test.c: idem
* bgp_route.c: (bgp_maximum_prefix_overflow, bgp_table_stats_vty) update
  macro and check conditions (where appropriate)
* bgp_packet.c: (bgp_route_refresh_send, bgp_capability_send,
  bgp_update_receive, bgp_route_refresh_receive): idem
* bgp_open.c: (bgp_capability_vty_out, bgp_afi_safi_valid_indices,
  bgp_open_capability_orf, bgp_open_capability): idem
* bgp_attr.c: (bgp_mp_reach_parse, bgp_packet_attribute,
  bgp_packet_withdraw): idem
2011-09-29 22:14:11 +04:00
Denis Ovsienko
beb1ca03bf bgpd: fix SAFI for for MPLS labeled VPN-IPv6
* bgpd.h: change value of BGP_SAFI_VPNV6 to 128 (RFC4659, BZ#659)
* bgp_route.c: (bgp_table_stats_vty) fix length argument to strncmp()
2011-09-29 22:07:54 +04: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
Josh Bailey
165b5fff9d bgpd: Add new configuration cli for eBGP and iBGP multipath.
There is support to configure this for each (AFI,SAFI), but
currently this configuration is only present for IPv4 unicast:

 maximum-paths [ibgp] <1-255>
 no maximum-paths [ibgp] [<1-255>]

* bgpd/Makefile.am
  * Add bgp_mpath.h and bgp_mpath.c to build
* bgpd/bgp_mpath.h
  * New file for bgp multipath declarations
  * define BGP_DEFAULT_MAXPATHS
* bgpd/bgp_mpath.c
  * bgp_maximum_paths_set(): Configure maximum paths for the given
    afi, safi and bgp instance
  * bgp_maximum_paths_unset(): Return maximum paths configuration to
    the default setting for the given afi, safi and bgp instance
* bgpd/bgp_vty.c
  * Define command strings for above CLI
  * bgp_config_write_maxpaths(): Outputs configuration for the given
    afi, safi and bgp instance
  * Install command elements for IPv4 unicast
* bgpd/bgp_zebra.h
  * bgp_config_write_maxpaths(): External declaration
* bgpd/bgpd.c
  * bgp_create(): Initialize bgp instance to default maximum paths setting
  * bgp_config_write_family(): Output maximum paths configuration
    for the given address family
  * bgp_config_write(): Output maximum paths configuration for
    IPv4 unicast address family
* bgpd/bgpd.h
  * struct bgp: Add storage for maximum paths configuration for
    each afi, safi
2011-07-20 20:43:22 -07:00
Stephen Hemminger
f5a4827db6 bgpd: refine the setting up of GTSM
* bgpd.h: Add error code for setting GTSM on iBGP
* bgpd.c: (peer_ttl_security_hops_set) use previous error code and signal
  incompatibility of GTSM+iBGP to vty.
  Consider the session state when setting GTSM, and reset Open/Active peers
  to let them pick up new TTL from start.
2011-03-28 11:27:41 +01:00
Nick Hilliard
fa411a212b bgpd: RFC 5082 Generalized TTL Security Mechanism support
* bgpd: Add support for RFC 5082 GTSM, which allows the TTL field to be used
  to verify that incoming packets have been sent from neighbours no more
  than X IP hops away. In other words, this allows packets that were sent from
  further away (i.e. not by the neighbour with known distance, and so possibly
  a miscreant) to be filtered out.
* lib/sockunion.{c,h}: (sockopt_minttl) new function, to set a minimum TTL
  using the IP_MINTTL socket opt.
* bgpd.h: (BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK) define for command
  error for minttl.
  (struct peer) add a config variable, to store the configured minttl.
  (peer_ttl_security_hops_{set,unset}) configuration handlers
* bgpd.c: (peer_group_get) init gtsm_hops
  (peer_ebgp_multihop_{un,}set) check for conflicts with GTSM. Multihop and
  GTSM can't both be active for a peer at the same time.
  (peer_ttl_security_hops_set) set minttl, taking care to avoid conflicts with
  ebgp_multihop.
  (bgp_config_write_peer) write out minttl as "neighbor .. ttl-security hops X".
* bgp_vty.c: (bgp_vty_return) message for
  BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
  (peer_ebgp_multihop_{un,}set_vty)
* bgp_network.c: (bgp_accept) set minttl on accepted sockets if appropriate.
  (bgp_connect) ditto for outbound.
2011-03-23 15:33:17 +00:00
Stephen Hemminger
65957886bf bgp: use monotonic clock for time of day
BGP uses time() to get system time of day; but that value
fluctuates with time adjustments from NTP. This can cause premature
flapping of peer sessions and other failures.

Use the system monotonic clock supported by Quagga thread library
to avoid issue.

See: http://bugzilla.vyatta.com/show_bug.cgi?id=4467

* bgpd/bgp_fsm.c
  * bgp_uptime_reset(): dismiss function
* bgpd/bgpd.c
  * bgp_clock(): new function
* bgpd/bgp_damp.c
  * bgp_reuse_timer(): employ bgp_clock() instead of time(NULL)
  * bgp_damp_withdraw(): idem
  * bgp_damp_update(): idem
  * bgp_damp_scan(): idem
  * bgp_damp_info_vty(): idem
  * bgp_damp_reuse_time_vty(): idem
* bgpd/bgp_fsm.c
  * bgp_routeadv_timer(): idem
  * bgp_stop(): idem
  * bgp_establish(): idem
* bgpd/bgp_packet.c
  * bgp_update_receive(): idem
* bgpd/bgp_route.c
  * bgp_update_rsclient(): idem
  * bgp_update_main(): idem
  * bgp_static_update_rsclient(): idem
  * bgp_static_update_main(): idem
  * bgp_static_update_vpnv4(): idem
  * bgp_aggregate_route(): idem
  * bgp_aggregate_add(): idem
  * bgp_redistribute_add(): idem
* bgpd/bgp_snmp.c
  * bgpPeerTable(): idem
  * bgpTrapEstablished(): idem
  * bgpTrapBackwardTransition(): idem
* bgpd/bgpd.c
  * peer_create(): idem
  * peer_uptime(): idem
  * bgp_master_init(): idem
2010-01-15 16:22:10 +03:00
Stephen Hemminger
da88ea82ac bgpd: code cleanup
* bgpd/bgp_aspath.c
  * ashash: only used in one file, make static
  * aspath_count_numas(): dead code, sayonara
* bgpd/bgpd.c
  * peer_nsf_stop(): only used in one file, make static
* bgpd/bgp_packet.h
  * bgp_capability_receive(): add missing prototype for a
    global function
2009-12-17 13:14:28 +03:00
Stephen Hemminger
0088b5dc55 [bgpd] reference count the BGP instance
When a BGP instance is deleted with lots of routes and neighbors
it is possible for the peer rsclient queue to run after
bgp_delete has been called. This would lead to bgpd crashing,
see https://bugzilla.vyatta.com/show_bug.cgi?id=3436

The fix is to add reference counting to the BGP instance and defer
actual freeing until all references are gone.

This patch also fixes a memory leak where the self-reference
peer instance was being created but never freed.

The check in bgp_clear_route is no longer valid because it is possible
for it to be called when peer is in Deleted state during cleanup.
2009-06-18 20:18:28 +01:00
Paul Jakma
6556d8a040 Revert "[bgpd] Add 'bgp open-accept' option, to send OPEN immediately on accepted conns"
Revert commit d664ae1182. An experimental
patch which violates RFC4271 quite badly, but managed to accidently sneak
its way in.
2008-08-26 14:33:28 +01:00
Paul Jakma
d664ae1182 [bgpd] Add 'bgp open-accept' option, to send OPEN immediately on accepted conns
2007-08-31 Paul Jakma <paul.jakma@sun.com>

	* (general) Add 'bgp open-accept' option, to allow bgpd to send OPEN
	  on accepted connections, i.e. to not wait till after
	  collision-detect to send OPEN, which appears to be allowed in
	  RFC4271. This may help speed up establishing sessions, or help
	  avoid FSM problems with sessions to certain peers. Not enabled by
	  default though.
2008-08-22 19:52:12 +01:00
Paul Jakma
0df7c91f04 [bgpd] TCP-MD5: password vty configuration and initial Linux support
2008-07-21 Paul Jakma <paul.jakma@sun.com>

	* bgp_packet.c: (bgp_open_receive) fix warning in a zlog call
	* bgp_vty.c: (bgp_vty_return) add return code
	* bgpd.c: (bgp_master_init) setup the socket list.
	* bgp_network.c: Remove the dual IPv4/6 socket thing for now, which
	  was implemented by Michael, until such time as its clear its
	  required for Linux (see sockopt comments). IPv6 support, including
	  IPv4 sessions on AF_INET6 sockets, therefore is broken, and the
	  '-l 0.0.0.0' arguments would need to be given to bgpd to make
	  things work here.

2008-07-21 Michael H. Warfield <mhw@wittsend.com>
           YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
	   Tomohiko Kusuda <kusuda@inetcore.com>
           Leigh Brown <leigh@solinno.co.uk>

	* bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5
	  sockopt and bgpd.
	  (bgp_md5_set_socket) Helper for bgp_connect
	  (bgp_md5_set) setup TCP-MD5SIG for the given peer.
	  (bgp_connect) call out to bgp_md5_set_socket for the outgoing
	  connect socket.
	  (bgp_socket) save references to the listen sockets, needed if
	  TCP-MD5SIG is applied later or changed.
	* bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password'
	  commands.
	* bgpd.c: (peer_{new,delete) manage TCP-MD5 password
	  (peer_group2peer_config_copy) inherit TCP-MD5 password
	  (peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5
	  passwords: applying checks, stopping peers, and trying to return
	  errors to UI, etc.
	  (bgp_config_write_peer) save password.
	  Fix missing newline in writeout of neighbor ... port.

2008-07-21 Paul Jakma <paul.jakma@sun.com>

	* sockunion.c: ifdef out various places that converted
	  v4mapped sockets to pure v4. Doesn't seem necessary at all,
	  presumably a workaround for now historical inet_ntop bugs (?)

2008-07-21 Michael H. Warfield <mhw@wittsend.com>
           YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

	* sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
2008-07-21 21:02:49 +00:00
Paul Jakma
3a02d1f7fb 2007-10-30 Nick Hilliard <nick@inex.ie>
* bgp_main.c: Add 'listenon' argument, to pass address to bind
	  to.
	* bgp_network.c: (bgp_socket) Extend to take bind address.
	* bgpd.c: (bgp_init) Pass stored address.
	* bgpd.h: (struct bgp_master) storage for bind address

2007-11-01 Paul Jakma <paul.jakma@sun.com>

	* tools/multiple-bgpd.sh: New, quick script to launch a bunch of
	  bgpds.
2007-11-01 14:29:11 +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
41367172d8 [bgpd] Add support for AS_PATHLIMIT / draft-ietf-idr-as-pathlimit
2007-07-31 Paul Jakma <paul.jakma@sun.com>

	* (general) Support for draft-ietf-idr-as-pathlimit-03.
	* bgp_attr.h: (struct attr) Add pathlimit struct
          bgp_attr.c: (attr_str) Add BGP_ATTR_AS_PATHLIMIT string.
          (attrhash_key_make) tally pathlimit too
          (attrhash_cmp) cmp pathlimit attr
          (bgp_attr_aspathlimit) New, parse AS_PATHLIMIT attr.
          (bgp_attr_parse) ditto
          (bgp_packet_attribute) Write out AS_PATHLIMIT when set
          (bgp_dump_routes_attr) ditto
         * bgp_route.h: (struct bgp_static) Add TTL field
         * bgp_route.c: (bgp_announce_check) Drop paths that are over
           their hop-count TTL before sending via EBGP.
           Mangle ASN in pathlimit for confeds/private as best we can.
           (bgp_static_update_{rsclient,main}) Add any configure pathlimit
           information.
           (bgp_pathlimit_update_parents) New, update atomic-aggr setting for
           parents of an aspathlimit'ed static.
           (bgp_static_set) Add TTL argument, for all the 'bgp network'
           commands.
           Call previous for TTL changed statics.
           (bgp_static_unset) Call pathlimit_update_parents.
           (various bgp network commands) Add 'pathlimit <0-255>' qualifier
           to all the various forms, bar route-map - which can set ttl
           itself.
         * bgp_routemap.c: (general) Add support for 'set pathlimit ttl' and
           'match pathlimit as'.
         * doc/bgpd.texi: Document 'network ... pathlimit <ttl>'
2007-08-06 15:24:51 +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 Jakma
1a392d46db [bgpd] Handle pcount as flags are changed, fixing pcount issues
2006-09-06 Paul Jakma <paul.jakma@sun.com>

	* (general) Squash any and all prefix-count issues by
	  abstracting route flag changes, and maintaining count as and
	  when flags are modified (rather than relying on explicit
	  modifications of count being sprinkled in just the right
	  places throughout the code).
	* bgp_route.c: (bgp_pcount_{dec,inc}rement) removed.
	  (bgp_pcount_adjust) new, update prefix count as
	  needed for a given route.
	  (bgp_info_{uns,s}et_flag) set/unset a BGP_INFO route status
	  flag, calling previous function when appropriate.
	  (general) Update all set/unsets of flags to use previous.
	  Remove pcount_{dec,inc}rement calls.
	  No need to unset BGP_INFO_VALID in places where
	  bgp_info_delete is called, it does that anyway.
	* bgp_{damp,nexthop}.c: Update to use bgp_info_{un,}set_flag.
	* bgp_route.h: Export bgp_info_{un,}set_flag.
	  Add a 'meta' BGP_INFO flag, BGP_INFO_UNUSEABLE.
	  Move BGP_INFO_HOLDDOWN macro to here from bgpd.h
2006-09-07 00:24:49 +00:00
Paul Jakma
64e580a72d [bgpd] Record afi/safi in bgp_table. Serialise peer clear with FSM.
2006-02-21 Paul Jakma <paul.jakma@sun.com>

	* bgpd.h: move the clear_node_queue to be peer specific.
	  Add a new peer status flag, PEER_STATUS_CLEARING.
	* bgp_table.h: (struct bgp_table) Add fields to record afi,
          safi of the table.
          (bgp_table_init) Take afi and safi to create table for.
        * bgp_table.c: (bgp_table_init) record the afi and safi.
        * bgp_nexthop.c: Update all calls to bgp_table_init.
        * bgp_vty.c: ditto.
        * bgpd.c: ditto.
        * bgp_fsm.c: (bgp_timer_set) dont bring up a session which is
	  clearing.
        * bgp_route.c: (general) Update all bgp_table_init calls.
          (bgp_process_{rsclient,main}) clear_node is serialised
          via PEER_STATUS_CLEARING and fsm now.
          (struct bgp_clear_node_queue) can be removed. struct bgp_node
          can be the queue item data directly, as struct peer can be
          kept in the new wq global user data and afi/safi can be
          retrieved via bgp_node -> bgp_table.
          (bgp_clear_route_node) fix to get peer via wq->spec.data,
          afi/safi via bgp_node->bgp_table.
          (bgp_clear_node_queue_del) no more item data to delete, only
          unlock the bgp_node.
          (bgp_clear_node_complete) only need to unset CLEARING flag
          and unlock struct peer.
          (bgp_clear_node_queue_init) queue attaches to struct peer
          now. record peer name as queue name.
          (bgp_clear_route_table) If queue transitions to active,
          serialise clearing by setting PEER_STATUS_CLEARING rather
          than plugging process queue, and lock peer while queue
          active.
          Update to pass only bgp_node as per-queue-item specific data.
2006-02-21 01:09:01 +00:00
paul
37c38304e4 [bgpd] remove export of long defunct function
2006-01-10 Juris Kalnins <juris@mt.lv>

	* bgpd.h: (bgp_router_id_unset) ex-function, remove.
2006-01-10 22:15:45 +00:00
paul
b40d939b47 2005-08-22 Paul Jakma <paul.jakma@sun.com>
* bgp_route.h: (struct bgp_info) add a new flag, BGP_INFO_REMOVED.
	  BGP_INFO_VALID is already overloaded, don't care to do same thing
	  to STALE or HISTORY.
	* bgpd.h: (BGP_INFO_HOLDDOWN) Add INFO_REMOVED to the macro, as a
	  route which should generally be ignored.
	* bgp_route.c: (bgp_info_delete) Just set the REMOVE flag, rather
	  than doing actual work, so that bgp_process (called directly,
	  or indirectly via the scanner) can catch withdrawn routes.
	  (bgp_info_reap) Actually remove the route, what bgp_info_delete
	  used to do, only for use by bgp_process.
	  (bgp_best_selection) reap any REMOVED routes, other than the old
	  selected route.
	  (bgp_process_rsclient) reap the old-selected route, if appropriate
	  (bgp_process_main) ditto
	  (bgp_rib_withdraw, bgp_rib_remove) make them more consistent with
	  each other. Don't play games with the VALID flag, bgp_process
	  is async now, so it didn't make a difference anyway.
	  Remove the 'force' argument from bgp_rib_withdraw, withdraw+force
	  is equivalent to bgp_rib_remove. Update all its callers.
	  (bgp_update_rsclient) bgp_rib_withdraw and force set is same as
	  bgp_rib_remove.
	  (route_vty_short_status_out) new helper to print the leading
	  route-status string used in many command outputs. Consolidate.
	  (route_vty_out, route_vty_out_tag, damp_route_vty_out,
	   flap_route_vty_out) use route_vty_short_status_out rather than
	  duplicate.
	  (route_vty_out_detail) print state of REMOVED flag.
	  (BGP_SHOW_SCODE_HEADER) update for Removed flag.
2005-08-22 22:34:41 +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
paul
200df115ea 2005-06-01 Paul Jakma <paul.jakma@sun.com>
* bgpd/(general) refcount struct peer and bgp_info, hence allowing us
	  add work_queues for bgp_process.
	* bgpd/bgp_route.h: (struct bgp_info) Add 'lock' field for refcount.
	  Add bgp_info_{lock,unlock} helper functions.
	  Add bgp_info_{add,delete} helpers, to remove need for
	  users managing locking/freeing of bgp_info and bgp_node's.
	* bgpd/bgp_table.h: (struct bgp_node) Add a flags field, and
	  BGP_NODE_PROCESS_SCHEDULED to merge redundant processing of
	  nodes.
	* bgpd/bgp_fsm.h: Make the ON/OFF/ADD/REMOVE macros lock and unlock
	  peer reference as appropriate.
	* bgpd/bgp_damp.c: Remove its internal prototypes for
	  bgp_info_delete/free. Just use bgp_info_delete.
	* bgpd/bgpd.h: (struct bgp_master) Add work_queue pointers.
	  (struct peer) Add reference count 'lock'
	  (peer_lock,peer_unlock) New helpers to take/release reference
	  on struct peer.
	* bgpd/bgp_advertise.c: (general) Add peer and bgp_info refcounting
	  and balance how references are taken and released.
	  (bgp_advertise_free) release bgp_info reference, if appropriate
	  (bgp_adj_out_free) unlock peer
	  (bgp_advertise_clean) leave the adv references alone, or else
	  call bgp_advertise_free cant unlock them.
	  (bgp_adj_out_set) lock the peer on new adj's, leave the reference
	  alone otherwise. lock the new bgp_info reference.
	  (bgp_adj_in_set) lock the peer reference
	  (bgp_adj_in_remove) and unlock it here
	  (bgp_sync_delete) make hash_free on peer conditional, just in
	  case.
	* bgpd/bgp_fsm.c: (general) document that the timers depend on
	  bgp_event to release a peer reference.
	  (bgp_fsm_change_status) moved up the file, unchanged.
	  (bgp_stop) Decrement peer lock as many times as cancel_event
	  canceled - shouldnt be needed but just in case.
	  stream_fifo_clean of obuf made conditional, just in case.
	  (bgp_event) always unlock the peer, regardless of return value
	  of bgp_fsm_change_status.
	* bgpd/bgp_packet.c: (general) change several bgp_stop's to BGP_EVENT's.
	  (bgp_read) Add a mysterious extra peer_unlock for ACCEPT_PEERs
	  along with a comment on it.
	* bgpd/bgp_route.c: (general) Add refcounting of bgp_info, cleanup
	  some of the resource management around bgp_info. Refcount peer.
	  Add workqueues for bgp_process and clear_table.
	  (bgp_info_new) make static
	  (bgp_info_free) Ditto, and unlock the peer reference.
	  (bgp_info_lock,bgp_info_unlock) new exported functions
	  (bgp_info_add) Add a bgp_info to a bgp_node in correct fashion,
	  taking care of reference counts.
	  (bgp_info_delete) do the opposite of bgp_info_add.
	  (bgp_process_rsclient) Converted into a work_queue work function.
	  (bgp_process_main) ditto.
	  (bgp_processq_del) process work queue item deconstructor
	  (bgp_process_queue_init) process work queue init
	  (bgp_process) call init function if required, set up queue item
	  and add to queue, rather than calling process functions directly.
	  (bgp_rib_remove) let bgp_info_delete manage bgp_info refcounts
	  (bgp_rib_withdraw) ditto
	  (bgp_update_rsclient) let bgp_info_add manage refcounts
	  (bgp_update_main) ditto
	  (bgp_clear_route_node) clear_node_queue work function, does
	  per-node aspects of what bgp_clear_route_table did previously
	  (bgp_clear_node_queue_del) clear_node_queue item delete function
	  (bgp_clear_node_complete) clear_node_queue completion function,
	  it unplugs the process queues, which have to be blocked while
	  clear_node_queue is being processed to prevent a race.
	  (bgp_clear_node_queue_init) init function for clear_node_queue
	  work queues
	  (bgp_clear_route_table) Sets up items onto a workqueue now, rather
	  than clearing each node directly. Plugs both process queues to
	  avoid potential race.
	  (bgp_static_withdraw_rsclient) let bgp_info_{add,delete} manage
	  bgp_info refcounts.
	  (bgp_static_update_rsclient) ditto
	  (bgp_static_update_main) ditto
	  (bgp_static_update_vpnv4) ditto, remove unneeded cast.
	  (bgp_static_withdraw) see bgp_static_withdraw_rsclient
	  (bgp_static_withdraw_vpnv4) ditto
	  (bgp_aggregate_{route,add,delete}) ditto
	  (bgp_redistribute_{add,delete,withdraw}) ditto
	* bgpd/bgp_vty.c: (peer_rsclient_set_vty) lock rsclient list peer
	  reference
	  (peer_rsclient_unset_vty) ditto, but unlock same reference
	* bgpd/bgpd.c: (peer_free) handle frees of info to be kept for lifetime
	  of struct peer.
	  (peer_lock,peer_unlock) peer refcount helpers
	  (peer_new) add initial refcounts
	  (peer_create,peer_create_accept) lock peer as appropriate
	  (peer_delete) unlock as appropriate, move out some free's to
	  peer_free.
	  (peer_group_bind,peer_group_unbind) peer refcounting as
	  appropriate.
	  (bgp_create) check CALLOC return value.
	  (bgp_terminate) free workqueues too.
	* lib/memtypes.c: Add MTYPE_BGP_PROCESS_QUEUE and
	  MTYPE_BGP_CLEAR_NODE_QUEUE
2005-06-01 11:17:05 +00:00
paul
00d252cb5f 2005-05-23 Paul Jakma <paul@dishone.st>
* bgp_fsm.h: Add extern qualifier to exported functions
	* bgp_nexthop.c: add static to nexthop specific globals
	* *.h: Add guard defines
2005-05-23 14:19:54 +00:00
hasso
6811845b67 * bgpd.texi: Document new "bgp bestpath as-path confed" command.
* bgp_aspath.[ch], bgp_route.c, bgp_vty.c, bgpd.[ch]: Allow to enable
	  the length of confederation path segments to be included during the
	  as-path length check in the best path decision.
2005-04-08 15:40:36 +00:00
hasso
6ffd207959 * bgp_route.c, bgp_vty.c, bgp_zebra.c, bgpd.[ch]: "enforce-multihop"
-> "disable-connected-check".

	[merge from GNU Zebra]
2005-02-02 14:50:11 +00:00
hasso
93406d87e6 * bgp_fsm.c, bgp_open.c, bgp_packet.c, bgp_route.[ch], bgp_vty.c,
bgpd.[ch]: Add BGP_INFO_STALE flag and end-of-rib support. "bgp
	  graceful-restart" commands added. Show numbers of individual
	  messages in "show ip bgp neighbor" command. Final pieces of graceful
	  restart.

	[merge from GNU Zebra]
2005-02-02 14:40:33 +00:00
hasso
c9502438e8 * bgp_open.c, bgp_packet.c, bgp_vty.c, bgpd.[ch]: Remove "no neighbor
capability route-refresh" commands. Route refresh capability is sent
	  anyway now. Preserve dummy deprecated commands.

	[merge from GNU Zebra]
2005-02-01 22:01:48 +00:00
hasso
3d515fd9af * bgp_attr.c, bgp_snmp.c, bgp_vty.c, bgpd.[ch]: Remove support for old
draft - ie. "neighbor version 4-" commands. Preserve dummy "neighbor
	  version" command as deprecated.

	[merge from GNU Zebra]
2005-02-01 21:30:04 +00:00
hasso
0a486e5fcb * bgpd.[ch], bgp_vty.c, bgp_route.c: "Restart session after
maximum-prefix limit" feature support.

	[merge from GNU Zebra]
2005-02-01 20:57:17 +00:00
hasso
f418446bb7 * bgp_nexthop.c: Improve debug.
* bgpd.[ch], bgp_nexthop.c, bgp_snmp.c: Remove useless bgp_get_master()
          function.
        * bgp_packet.c: MP AFI_IP update and withdraw parsing.
        * bgp_fsm.c: Reset peer synctime in bgp_stop(). bgp_fsm_change_status()
          is better place to log about peer status change than bgp_event().
          Log in bgp_connect_success().
        * bgp_vty.c: Fix typo in comment.
        * bgp_attr.c: Better log about unknown attribute.

	[merge from GNU Zebra]
2005-02-01 20:13:16 +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
hasso
18a6dce6f8 Common router id. 2004-10-03 18:18:34 +00:00
paul
fee0f4c629 2004-09-13 Jose Luis Rubio <jrubio@dit.upm.es>
(at Technical University of Madrid as part of Euro6ix Project)

        Enhanced Route Server functionality and Route-Maps:

        * bgpd/bgpd.h: Modified 'struct peer' and 'struct bgp_filter' to
        support rs-clients. A 'struct bgp_table *rib' has been added to the
        first (to mantain a separated RIB for each rs-client) and two new
        route-maps have been added to the last (for import/export policies).
        Added the following #defines: RMAP_{IN|OUT|IMPORT|EXPORT|MAX},
        PEER_RMAP_TYPE_{IMPORT|EXPORT} and BGP_CLEAR_SOFT_RSCLIENT.

        * bgpd/bgpd.c: Modified the functions that create/delete/etc peers in
        order to consider the new fields included in 'struct peer' for
        supporting rs-clients, i.e. the import/export route-maps and the
        'struct bgp_table'.

        * bgpd/bgp_route.{ch}: Modified several functions related with
        receiving/sending announces in order to support the new Route Server
        capabilities.
        Function 'bgp_process' has been reorganized, creating an auxiliar
        function for best path selection ('bgp_best_selection').
        Modified 'bgp_show' and 'bgp_show_route' for displaying information
        about any RIB (and not only the main bgp RIB).
        Added commands for displaying information about RS-clients RIBs:
        'show bgp rsclient (A.B.C.D|X:X::X:X)', 'show bgp rsclient
        (A.B.C.D|X:X::X:X) X:X::X:X/M', etc

        * bgpd/bgp_table.{ch}: The structure 'struct bgp_table' now has two
        new fields: type (which can take the values BGP_TABLE_{MAIN|RSCLIENT})
        and 'void *owner' which points to 'struct bgp' or 'struct peer' which
        owns the table.
        When creating a new bgp_table by default 'type=BGP_TABLE_MAIN' is set.

        * bgpd/bgp_vty.c: The commands 'neighbor ... route-server-client' and
        'no neighbor ... route-server-client' now not only set/unset the flag
        PEER_FLAG_RSERVER_CLIENT, but they create/destroy the 'struct
        bgp_table' of the peer. Special actions are taken for peer_groups.
        Command 'neighbor ... route-map WORD (in|out)' now also supports two
        new kinds of route-map: 'import' and 'export'.
        Added commands 'clear bgp * rsclient', etc. These commands allow a new
        kind of soft_reconfig which affects only the RIB of the specified
        RS-client.
        Added commands 'show bgp rsclient summary', etc which display a
        summary of the rs-clients configured for the corresponding address
        family.

        * bgpd/bgp_routemap.c: A new match statement is available,
        'match peer (A.B.C.D|X:X::X:X)'. This statement can only be used in
        import/export route-maps, and it matches when the peer who announces
        (when used in an import route-map) or is going to receive (when used
        in an export route-map) the route is the same than the one specified
        in the statement.
        For peer-groups the statement matches if the specified peer is member
        of the peer-group.
        A special version of the command, 'match peer local', matches with
        routes originated by the Route Server (defined with 'network ...',
        redistributed routes and default-originate).

        * lib/routemap.{ch}: Added a new clause 'call NAME' for use in
        route-maps. It jumps into the specified route-map and when it returns
        the first route-map ends if the called RM returns DENY_MATCH, or
        continues in other case.
2004-09-13 05:12:46 +00:00
hasso
538621f2f8 Merge graceful restart capability display and some small fixes from Zebra
repository by Rivo Nurges.
2004-05-21 09:31:30 +00:00
hasso
e0701b7955 Merge bgpd changeset 1176 from Zebra repository by Rivo Nurges. 2004-05-20 09:19:34 +00:00
paul
eb821189d2 2004-05-01 Paul Jakma <paul@dishone.st>
* Revert the attempted clean-up of the dummy peer hack, reverts
          patchsets 435 (see 2004-02-17 below) and 456.
2004-05-01 08:44:08 +00:00
paul
545acafbf5 2004-04-16 rivo nurges <rix@estpak.ee>
* bgpd.h: update cease subcodes to draft-ietf-idr-cease-subcode-05
        * bgpd.h, bgpd.c, bgp_route.c, bgp_route.h: fix UNH IOL BGP-4.1.6a
2004-04-20 15:13:15 +00:00
paul
6ad23f05e3 2004-02-17 Paul Jakma <paul@dishone.st>
* bgpd.h: (bgp_peer) add fd_local and fd_accept
          file descriptor's, fd becomes a pointer to one of these.
        * bgpd.c: (global) adjust for fact that fd is now a pointer.
          (peer_create_accept) removed.
        * bgp_route.c: (global) adjust for change of peer fd to pointer
        * bgp_packet.c: (bgp_collision_detect) adjust and remove the
          "replace with other peer" hack.
        * bgp_network.c: (bgp_accept) Remove the dummy peer hack.
          Update peer->fd_accept instead.
          (global) Adjust fd references - now a pointer.
        * bgp_fsm.c: (global) adjust peer fd to pointer.
          (bgp_connection_stop) new function, to stop connection.
          (global) adjust everything which closed peer fd to use
          bgp_connection_stop().
2004-02-17 19:45:10 +00:00
paul
848973c71e 2003-08-13 kunihiro <kunihiro@zebra.org>
* bgpd/bgp{_fsm.c,_vty.c,d.c,d.h}: Add support for "bgp
          log-neighbor-changes" command.
2003-08-13 00:32:49 +00:00
paul
ac41b2a2d4 2003-08-11 kunihiro <kunihiro@zebra.org
* bgp_route{,map}.c: Extend 'set ip next-hop' in route-maps with
         ability to specify 'peer-address' rather than IP.
2003-08-12 05:32:27 +00:00
paul
6cbbc3cc9f Import of zebra.org 20030428-18:07 IST 2003-04-28 17:11:02 +00:00
paul
23bd12c31d [zebra 18626] move zebra socket paths to configure.ac
moved definition of the various socket paths from the
per daemon header files into configure.ac. it will set the paths to
be in the directory specified by --localstatedir=<prefix> or
otherwise will try to guess as best it can ( a la pid file path
detection - which probably should try reference ${prefix} too).

the present hardcoded socket path, /tmp, isnt really correct. should
be in /var somewhere really.
2003-04-07 06:11:09 +00:00
paul
718e374419 Initial revision 2002-12-13 20:15:29 +00:00