Commit Graph

1150 Commits

Author SHA1 Message Date
Donald Sharp
18f1dc06c5 bgpd: Clean up some static analysis warnings
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-05-19 10:42:26 -04:00
Dinesh G Dutt
9f689658e6 Fix BGP JSON output
Ticket: CM-10644
Reviewed By:
Testing Done:

The JSON outputs of a bunch of BGP commands were broken due to the
addition of VRF support. This fixes them all. Also replaces the use
of "-" in some of the JSON variable names with camel case names.
2016-04-28 23:02:08 -07:00
Daniel Walton
859d388e90 quagga: "set community x:y" needs bounds checking
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10002

superm-redxp-05# conf t
superm-redxp-05(config)# route-map FOO permit 10
superm-redxp-05(config-route-map)# set community ?
  AA:NN  Community number in AA:NN format (where AA and NN are <0-65535>) or local-AS|no-advertise|no-export|internet or additive
  none   No community attribute
superm-redxp-05(config-route-map)# set community 2:2
superm-redxp-05(config-route-map)# set community 2:70000
% Malformed communities attribute
superm-redxp-05(config-route-map)# set community 70000:2
% Malformed communities attribute
superm-redxp-05(config-route-map)#
2016-04-14 18:16:43 +00:00
vivek
f186de2680 BGP: Implement key show commands for all VRFs
Key BGP 'show' commands have been expanded to support 'vrf all':

show ip bgp vrf all summary
show ip bgp vrf all neighbors
show ip bgp vrf all nexthop
show ip bgp vrf all update-group
show ip bgp vrf all
show bgp vrf all summary
show bgp vrf all update-group
show bgp vrf all

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

Ticket: CM-10402
Reviewed By: CCR-4466
Testing Done: Manual
2016-04-13 09:59:00 -07:00
vivek
8386ac4390 BGP: Update commands for VRF support
Ensure commands dealing with update-groups and peer-groups support VRFs.
Also implement a new command "show bgp vrfs" to show summary information of
all configured VRFs. Some additional code cleanup in this area.

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

Ticket: CM-9247
Reviewed By: CCR-4267
Testing Done: Manual
2016-03-09 03:39:38 +00:00
vivek
50ef26d42f BGP: Update commands for VRF support
Ensure commands dealing with display of routes and nexthops support
VRFs.

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

Ticket: CM-9247
Reviewed By: CCR-4250
Testing Done: Manual
2016-03-07 00:08:49 +00:00
Donald Sharp
a7ee645d23 bgpd: Fix function indirection when none is needed
bgp_update_main was only called by bgp_update.
bgp_update only called bgp_update_main.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reivewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-02-24 15:05:46 -05: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
06da0dafc0 bgpd: Fix 'show bgp ipv4 vpnv4 statistics' cli
When attempting to use the 'show bgp ipv4 vpnv4 statistics' cli, the safi
choosen is BGP_MPLS_LABELED_VPN which is #defined to 128.  The afi/safi
combination is fed to bgp->rib, which limits the size of the safi to BGP_SAFI_MAX
which is #defined to 5.   The correct value to use is BGP_MPLS_VPN

The bgp code differentiates between the actual safi value for BGP_MPLS_LABELED_VPN
used defined by RFC 4364, to a internal SAFI value used to limit array size.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-01-26 06:57:17 -08:00
Daniel Walton
2ec1e66ff1 BGP bestpath debugs need to display the addpath RX ID
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8459

Output with fix

2015/12/07 09:47:41.342932 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 3) and path 10.0.0.7 (addpath rxid 2) are equal via matching aspaths
2015/12/07 09:47:41.342966 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 3) wins over path 10.0.0.7 (addpath rxid 2) due to Router-ID comparison
2015/12/07 09:47:41.342978 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 4) and path 10.0.0.7 (addpath rxid 3) are equal via matching aspaths
2015/12/07 09:47:41.342988 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 4) loses to path 10.0.0.7 (addpath rxid 3) due to Router-ID comparison
2015/12/07 09:47:41.342999 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 5) and path 10.0.0.7 (addpath rxid 3) are equal via matching aspaths
2015/12/07 09:47:41.343008 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 5) loses to path 10.0.0.7 (addpath rxid 3) due to Router-ID comparison
2015/12/07 09:47:41.343019 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 6) and path 10.0.0.7 (addpath rxid 3) are equal via matching aspaths
2015/12/07 09:47:41.343029 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 6) loses to path 10.0.0.7 (addpath rxid 3) due to Router-ID comparison
2015/12/07 09:47:41.343039 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 7) and path 10.0.0.7 (addpath rxid 3) are equal via matching aspaths
2015/12/07 09:47:41.343048 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 7) loses to path 10.0.0.7 (addpath rxid 3) due to Router-ID comparison
2015/12/07 09:47:41.343058 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 3) is the bestpath from AS 0
2015/12/07 09:47:41.343068 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 3) is the initial bestpath
2015/12/07 09:47:41.343077 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 3) is the bestpath, now find multipaths
2015/12/07 09:47:41.343088 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 2) has the same nexthop as the bestpath, skip it
2015/12/07 09:47:41.343097 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 3) is the bestpath, add to the multipath list
2015/12/07 09:47:41.343109 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 4) and path 10.0.0.7 (addpath rxid 3) are equal via matching aspaths
2015/12/07 09:47:41.343119 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 4) loses to path 10.0.0.7 (addpath rxid 3) due to Router-ID comparison
2015/12/07 09:47:41.343127 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 4) is equivalent to the bestpath, add to the multipath list
2015/12/07 09:47:41.343139 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 5) and path 10.0.0.7 (addpath rxid 3) are equal via matching aspaths
2015/12/07 09:47:41.343164 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 5) loses to path 10.0.0.7 (addpath rxid 3) due to Router-ID comparison
2015/12/07 09:47:41.343173 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 5) is equivalent to the bestpath, add to the multipath list
2015/12/07 09:47:41.343186 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 6) and path 10.0.0.7 (addpath rxid 3) are equal via matching aspaths
2015/12/07 09:47:41.343196 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 6) loses to path 10.0.0.7 (addpath rxid 3) due to Router-ID comparison
2015/12/07 09:47:41.343205 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 6) is equivalent to the bestpath, add to the multipath list
2015/12/07 09:47:41.343217 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 7) and path 10.0.0.7 (addpath rxid 3) are equal via matching aspaths
2015/12/07 09:47:41.343227 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 7) loses to path 10.0.0.7 (addpath rxid 3) due to Router-ID comparison
2015/12/07 09:47:41.343236 BGP: 1.1.1.1/32: path 10.0.0.7 (addpath rxid 7) is equivalent to the bestpath, add to the multipath list
2015/12/07 09:47:41.343254 BGP: 1.1.1.1/32 add mpath nexthop 34.34.34.34 path 10.0.0.7 (addpath rxid 4)
2015/12/07 09:47:41.343268 BGP: 1.1.1.1/32 add mpath nexthop 56.56.56.56 path 10.0.0.7 (addpath rxid 6)
2015-12-07 11:56:02 -08:00
Donald Sharp
cbdee2350a Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster 2015-11-27 08:58:52 -08:00
Donald Sharp
4690c7d74c Quagga: prefix2str fixup
During CR for nexthop upstream it was noticed that usage
of prefix2str was not consistent.  This fixes this problem

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-23 13:31:11 -08:00
Daniel Walton
813d4307f9 Should be able to "no" the full text of any config line
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-5816
2015-11-23 18:05:03 +00:00
Daniel Walton
99030da124 Quagga default: BGP enable "maximum-paths 64"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8099
2015-11-20 18:41:51 +00:00
Donald Sharp
db7c85284f Quagga: Fixup cli and json keyword
The json keyword was being read incorrectly.
Basically some commands read a variable # of arguments
and in ospf the command values were being placed into
argc and argv.  With a variable # of arguments their
existed a possibility that less arguments would be read
from the cli than were being tested for in the command function
handler.  This caused core dumps in some situations.

All code to read to decide to use the json keyword has
been centralized through a function and all code
converted to use it, irrelevant if it exhibited the bug

Ticket: CM-8278
Reviewed by: CCR-3830
Testing: OSPF no longer crashes and all other test suites still run

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-18 15:36:04 -08:00
vivek
003c1ba05a BGP: Fix the setting of link-local nexthops in some situations
This patch addresses three main issues:
a. Passing along the global IPv6 nexthop received from the EBGP peer to
IBGP peers but setting the link-local IPv6 nexthop to ourselves when
advertising EBGP-learnt routes to IBGP peers (in the absence of outbound
route-map or other overrides). The fix is to not send a link-local IPv6
nexthop in this case.

b. Passing along the link-local IPv6 nexthop received from one peer to
another peer which is (or may be) on a different subnet. This violates the
semantics of link-local IPv6 address. The fix is to set the nexthop to
ourselves in the situation where the nexthop normally has to be passed
but is a link-local IPv6 address.

c. Different behavior wrt nexthop advertisement for BGP unnumbered peering
if it is setup using link-local IPv6 address versus IPv4 /30 or /31. The
fix is to make the behavior consistent as long as the interface config is
the same in both cases.

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

Ticket: CM-7846, CM-8043
Reviewed By: CCR-3749
Testing Done: Manual testing, bgpsmoke (on 2.5-br)

Note: Imported from 2.5-br patch bgpd-fix-link-local-nexthop-setting.patch
2015-11-15 07:17:47 -08:00
Daniel Walton
47e9b2923f BGP: Remove deprecated commands and add warning that "show ipv6 bgp"
will be deprecated in the future

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

Ticket: CM-8144
2015-11-13 03:14:10 +00:00
Daniel Walton
7dc9d4e4e3 bgp may add multiple path entries with the same nexthop
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8129

- We have 14 paths for each prefix, 7 are from ipv4 peers and 7 are from ipv6 peers

- There are 7 unique nexthops

- When comparing the exact same path from an v4 peer vs. a v6 peer the path from
  the v4 peer wins.  This is due to the "lowest neighbor IP" check in the decision
  algorithm.  For example below we learn NEXTHOP 210.2.4.2 from 210.2.4.2 and
  2001:20:4::2 but only the one from the v4 peer is flagged as multipath.

- The problem is when our bestpath is from a v6 peer, 2001:20:2::2 in this case
  (see line 85). 2001:20:2::2 sent us 210.2.2.2 so we will install that nexthop
  because it is from our bestpath, the problem is we flag the path from 210.2.2.2
  (line 37) as multipath which causes us to install two paths with nexthop 210.2.2.2

  1 superm-redxp-05# show ip bgp 2.23.24.192/28
  2 BGP routing table entry for 2.23.24.192/28
  3 Paths: (14 available, best #14, table Default-IP-Routing-Table)
  4   Advertised to non peer-group peers:
  5   210.2.0.2 210.2.1.2 210.2.2.2 210.2.3.2 210.2.4.2 210.2.5.2 210.2.6.2 210.4.1.4 2001:20::2 2001:20:1::2 2001:20:2::2 2001:20:3::2 2001:20:4::2 2001:2
  6   205 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
  7     210.2.4.2 from 210.2.4.2 (10.0.0.2)
  8       Origin IGP, localpref 100, valid, external, multipath
  9       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 10       Last update: Wed Nov 11 20:54:57 2015
 11
 12   204 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 13     210.2.3.2 from 210.2.3.2 (10.0.0.2)
 14       Origin IGP, localpref 100, valid, external, multipath
 15       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 16       Last update: Wed Nov 11 20:54:57 2015
 17
 18   202 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 19     210.2.1.2 from 210.2.1.2 (10.0.0.2)
 20       Origin IGP, localpref 100, valid, external, multipath
 21       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 22       Last update: Wed Nov 11 20:54:57 2015
 23
 24   206 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 25     210.2.5.2 from 2001:20:5::2 (10.0.0.2)
 26       Origin IGP, localpref 100, valid, external
 27       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 28       Last update: Wed Nov 11 20:54:57 2015
 29
 30   205 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 31     210.2.4.2 from 2001:20:4::2 (10.0.0.2)
 32       Origin IGP, localpref 100, valid, external
 33       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 34       Last update: Wed Nov 11 20:54:57 2015
 35
 36   203 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 37     210.2.2.2 from 210.2.2.2 (10.0.0.2)
 38       Origin IGP, localpref 100, valid, external, multipath
 39       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 40       Last update: Wed Nov 11 20:54:57 2015
 41
 42   202 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 43     210.2.1.2 from 2001:20:1::2 (10.0.0.2)
 44       Origin IGP, localpref 100, valid, external
 45       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 46       Last update: Wed Nov 11 20:54:57 2015
 47
 48   201 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 49     210.2.0.2 from 210.2.0.2 (10.0.0.2)
 50       Origin IGP, localpref 100, valid, external, multipath
 51       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 52       Last update: Wed Nov 11 20:54:57 2015
 53
 54   206 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 55     210.2.5.2 from 210.2.5.2 (10.0.0.2)
 56       Origin IGP, localpref 100, valid, external, multipath
 57       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 58       Last update: Wed Nov 11 20:54:57 2015
 59
 60   207 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 61     210.2.6.2 from 2001:20:6::2 (10.0.0.2)
 62       Origin IGP, localpref 100, valid, external
 63       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 64       Last update: Wed Nov 11 20:54:57 2015
 65
 66   207 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 67     210.2.6.2 from 210.2.6.2 (10.0.0.2)
 68       Origin IGP, localpref 100, valid, external, multipath
 69       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 70       Last update: Wed Nov 11 20:54:57 2015
 71
 72   201 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 73     210.2.0.2 from 2001:20::2 (10.0.0.2)
 74       Origin IGP, localpref 100, valid, external
 75       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 76       Last update: Wed Nov 11 20:54:57 2015
 77
 78   204 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 79     210.2.3.2 from 2001:20:3::2 (10.0.0.2)
 80       Origin IGP, localpref 100, valid, external
 81       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 82       Last update: Wed Nov 11 20:54:57 2015
 83
 84   203 200 300 790 90 80 2334 544 56 67 889 3111 777 8 879 900 88 7654 3211 113 43434 666 343 4534 667 7688
 85     210.2.2.2 from 2001:20:2::2 (10.0.0.2)
 86       Origin IGP, localpref 100, valid, external, multipath, best
 87       Community: 0:100 0:200 0:300 0:324 0:2938 0:3344 0:3545 0:4466 0:5445 0:5754
 88       Last update: Wed Nov 11 20:54:57 2015
 89
 90 superm-redxp-05#

Here you can see the two paths with nexthop 210.2.2.2

superm-redxp-05# show ip route 2.23.24.192/28
Routing entry for 2.23.24.192/28
  Known via "bgp", distance 20, metric 0, best
  Last update 00:32:12 ago
  * 210.2.2.2, via swp3
  * 210.2.0.2, via swp1
  * 210.2.1.2, via swp2
  * 210.2.2.2, via swp3
  * 210.2.3.2, via swp4
  * 210.2.4.2, via swp5
  * 210.2.5.2, via swp6
  * 210.2.6.2, via swp7

superm-redxp-05#
superm-redxp-05#

The fix is to not flag a path as multipath if it has the same nexthop as the bestpath
2015-11-12 20:30:22 +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
40d2700de3 BGP ORF fails to filter prefixes correctly
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7145
2015-11-04 16:31:33 +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
c12cd8bb71 BGP: crash in list_delete_all_node when shutting down BGP
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7904
2015-10-20 22:11:01 +00:00
Daniel Walton
0b960b4dfa Display the BGP ipv4 unicast configuration under "address-family ipv4 unicast".
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-6739

Before
router bgp 10
 bgp router-id 10.1.1.1
 bgp log-neighbor-changes
 no bgp default ipv4-unicast
 network 9.9.9.9/32
 neighbor 10.1.1.2 remote-as 10
 neighbor 10.1.1.2 shutdown
 neighbor 10.1.1.2 update-source lo
 neighbor 10.1.1.2 advertisement-interval 1
 neighbor 10.1.1.2 timers connect 10
 neighbor 10.1.1.2 activate
 neighbor 10.1.1.2 next-hop-self
 neighbor 10.1.1.2 route-map BAR in
 neighbor 10.1.1.2 route-map FOO out
 neighbor 20.1.2.2 remote-as 20
 neighbor 20.1.2.2 shutdown
 neighbor 20.1.2.2 advertisement-interval 1
 neighbor 20.1.2.2 timers connect 10
 neighbor 20.1.2.2 activate
 neighbor 20.1.2.2 route-map HAA in
 neighbor 20.1.2.2 route-map BOO out
!
 address-family ipv6
 network 2001:1:1:1::/64
 exit-address-family
!

After
!
router bgp 10
 bgp router-id 10.1.1.1
 bgp log-neighbor-changes
 no bgp default ipv4-unicast
 no bgp network import-check
 neighbor 10.1.1.2 remote-as 10
 neighbor 10.1.1.2 shutdown
 neighbor 10.1.1.2 update-source lo
 neighbor 10.1.1.2 advertisement-interval 1
 neighbor 10.1.1.2 timers connect 10
 neighbor 20.1.2.2 remote-as 20
 neighbor 20.1.2.2 shutdown
 neighbor 20.1.2.2 advertisement-interval 1
 neighbor 20.1.2.2 timers connect 10
!
 address-family ipv4 unicast
  network 9.9.9.9/32
  neighbor 10.1.1.2 activate
  neighbor 10.1.1.2 next-hop-self
  neighbor 10.1.1.2 route-map BAR in
  neighbor 10.1.1.2 route-map FOO out
  neighbor 20.1.2.2 activate
  neighbor 20.1.2.2 route-map HAA in
  neighbor 20.1.2.2 route-map BOO out
 exit-address-family
!
 address-family ipv6 unicast
  network 2001:1:1:1::/64
 exit-address-family
!
2015-10-20 22:00:40 +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
8748363d60 Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster 2015-09-30 15:08:26 -07:00
vivek
1844fdbd7f BGP: Fix source route type in redistributed route
Ticket: CM-7593
Reviewed By: CCR-3563
Testing Done: Manual verification of failed scenario (2.5-br)

When BGP receives an update to a redistributed route and the type of
the source has changed (e.g., from OSPF to static), the source route
type is not being updated in the RIB entry. This can lead to problems
such as the route being incorrectly deleted if redistribution for the
prior source is unconfigured.

Fix the code to update the source route type.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Vipin Kumar <vipin@cumulusnetworks.com>
2015-09-28 12:27:17 -07:00
Donald Sharp
77f2455171 Quagga: Fix compile warnings for GCC4.9
As part of the debian build process for jessie we are seeing
some compile issues.  This addresses these issues

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-09-25 10:11:24 -07:00
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
d1d16a965e BGP: "show ip bgp json" should return empty "routes : {}" if the table
is empty

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

Ticket: CM-7475
Reviewed By: Donald Sharp
Testing Done:

If the BGP table is empty, intead of returning

{'alert': 'No BGP network exists', 'routerId': '10.0.9.2',
'tableVersion': 180}

we should return

{'routerId': '10.0.9.2', 'routes': {}, 'tableVersion': 180}

This provides a more consistent json interface which is easier to script
against.
2015-09-17 07:54:20 -07:00
Daniel Walton
04b6bdc0ee bgpd: Exchange hostname capability and display hostnames in output
This patch adds a hostname capability. The node's hostname and
domainname are exchanged in the new capability and used in show command
outputs based on a knob enabled by the user. The hostname and domainname
can be a maximum of 64 chars long, each.

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

Ticket: CM-5660
Reviewed By: CCR-2563
Testing Done:
2015-09-10 20:10:16 -07:00
Donald Sharp
2e02b9b2d1 Fix bgp_exit crash
Ticket: CM-7358
Reviewed-by: CCR-3462
Testing: See bug
2015-09-08 06:24:21 -07:00
Donald Sharp
495f0b13e1 Fix some more memory issues in Quagga
Ticket: CM-4109
Reviewed-by: CCR-3414
Testing: See bug

Fixup of these memory issues:

(A) peer->clear_node_queue was accidently removed.  Add back in.
(B) Clean up bm->process_main_queue and bm->process_rsclient_queue initialization
(C) Some memory leaks
(D) Clean up unused threads
2015-09-02 05:19:44 -07:00
Donald Sharp
6e9197093c Fixup code to use correct XMALLOC operators
Ticket: CM-7177
Reviewed-by: CCR-3396
Testing: See bug

This code change does several small things:
(A) Fix a couple detected memory leaks
(B) Fix all malloc operations to use the correct XMALLOC operation in bgpd and parts of lib
(C) Adds a few new memory types to make it easier to detect issues
2015-08-26 07:44:57 -07:00
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
Denil Vira
610f23cfff Fix memory leak in bgpd/bgp_route.c
Ticket : CM-7047
Reviewed by : CCR-3321
Testing : Trivial

In function bgp_aggregate_add, variables 'aspath' and 'community' are
malloced but not guaranteed to be freed before the function returns.
2015-08-11 12:14:37 -07:00
Donald Sharp
43fdf718a2 Fix bgp_route.c missing code 2015-07-22 17:20:41 -07:00
Daniel Walton
b354c427e1 multipath is broken if deterministic-med is enabled 2015-07-22 12:35:38 -07:00
Donald Sharp
62d6dca0c2 Use camelCase notation for all json keywords 2015-07-22 12:35:35 -07:00
Donald Sharp
c744aa9fc6 Remove draft-walton-bgp-hostname-capability-00 for now 2015-06-12 07:59:12 -07:00
Donald Sharp
433e8b6733 bgpd-5549-display-ll-ifname.patch
BGP: Display Link local addr and ifname as part of 5549 support

As part of BGP unnumbered and RFC 5549 support, the implementation will honor the
link local address as the NH if present and so it'd be useful to display that
info along with the interface name, when displaying the BGP route summary. That
is what this patch aims to do.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-06-12 07:59:12 -07:00
Donald Sharp
f1aa5d8ac8 Key changes:
- The aspath and community structures now have a json_object where we
  store the json representation.  This is updated at the same time
  the "str" for aspath/community are updated.  We do this so that we
  do not have to compute the json rep
- Added a small wrappper to libjson0, the wrapper lives in quagga's lib/json.[ch].
- Added more structure to the json output.  Sample output:

show ip bgp summary json
------------------------
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 2400
RIB entries 4799, using 562 KiB of memory
Peers 17, using 284 KiB of memory
Peer groups 4, using 224 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4    10       0       0        0    0    0 never    Active
10.0.0.2        4    10     104       7        0    0    0 00:02:29      600
10.0.0.3        4    10     104       7        0    0    0 00:02:29      600
10.0.0.4        4    10     204       7        0    0    0 00:02:29     1200
20.1.1.6        4    20     406     210        0    0    0 00:02:44      600
20.1.1.7        4    20     406     210        0    0    0 00:02:44      600
40.1.1.2        4    40     406     210        0    0    0 00:02:44      600
40.1.1.6        4    40     406     210        0    0    0 00:02:44      600
40.1.1.10       4    40     406     210        0    0    0 00:02:44      600

Total number of neighbors 9

{
    "as": 10,
    "dynamic-peers": 0,
    "peer-count": 17,
    "peer-group-count": 4,
    "peer-group-memory": 224,
    "peer-memory": 291312,
    "peers": {
        "1.1.1.1": {
            "inq": 0,
            "msgrcvd": 0,
            "msgsent": 0,
            "outq": 0,
            "prefix-advertised-count": 0,
            "prefix-received-count": 0,
            "remote-as": 10,
            "state": "Active",
            "table-version": 0,
            "uptime": "never",
            "version": 4
        },
        "10.0.0.2": {
            "hostname": "r2",
            "inq": 0,
            "msgrcvd": 104,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 600,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "10.0.0.3": {
            "hostname": "r3",
            "inq": 0,
            "msgrcvd": 104,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 600,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "10.0.0.4": {
            "hostname": "r4",
            "inq": 0,
            "msgrcvd": 204,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 1200,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "20.1.1.6": {
            "hostname": "r6",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 20,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "20.1.1.7": {
            "hostname": "r7",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 20,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.10": {
            "hostname": "r10",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.2": {
            "hostname": "r8",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.6": {
            "hostname": "r9",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        }
    },
    "rib-count": 4799,
    "rib-memory": 575880,
    "router-id": "10.0.0.1",
    "table-version": 2400,
    "total-peers": 9
}

show ip bgp json
----------------
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i
*  40.3.88.0/24     40.1.1.6                 0             0 100 200 300 400 500 40 i
*                   40.1.1.10                0             0 100 200 300 400 500 40 i
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i
*  40.3.89.0/24     40.1.1.6                 0             0 100 200 300 400 500 40 i
*                   40.1.1.10                0             0 100 200 300 400 500 40 i
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i

        "40.3.88.0/24": [
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.6",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.10",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "bestpath": true,
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.2",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            }
        ],
        "40.3.89.0/24": [
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.6",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.10",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "bestpath": true,
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.2",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            }
        ],


show ip bgp x.x.x.x json
------------------------
BGP routing table entry for 40.3.86.0/24
Paths: (3 available, best #3, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.2 10.0.0.3 10.0.0.4 20.1.1.6 20.1.1.7 40.1.1.2 40.1.1.6 40.1.1.10
  100 200 300 400 500 40
    40.1.1.6 from 40.1.1.6 (40.0.0.9)
      Origin IGP, metric 0, localpref 100, valid, external
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT💯100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

  100 200 300 400 500 40
    40.1.1.10 from 40.1.1.10 (40.0.0.10)
      Origin IGP, metric 0, localpref 100, valid, external
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT💯100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

  100 200 300 400 500 40
    40.1.1.2 from 40.1.1.2 (40.0.0.8)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT💯100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

{
    "advertised-to": {
        "10.0.0.2": {
            "hostname": "r2"
        },
        "10.0.0.3": {
            "hostname": "r3"
        },
        "10.0.0.4": {
            "hostname": "r4"
        },
        "20.1.1.6": {
            "hostname": "r6"
        },
        "20.1.1.7": {
            "hostname": "r7"
        },
        "40.1.1.10": {
            "hostname": "r10"
        },
        "40.1.1.2": {
            "hostname": "r8"
        },
        "40.1.1.6": {
            "hostname": "r9"
        }
    },
    "paths": [
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT💯100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.6",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r9",
                "peer-id": "40.1.1.6",
                "router-id": "40.0.0.9",
                "type": "external"
            },
            "valid": true
        },
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT💯100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.10",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r10",
                "peer-id": "40.1.1.10",
                "router-id": "40.0.0.10",
                "type": "external"
            },
            "valid": true
        },
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "bestpath": {
                "overall": true
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT💯100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.2",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r8",
                "peer-id": "40.1.1.2",
                "router-id": "40.0.0.8",
                "type": "external"
            },
            "valid": true
        }
    ],
    "prefix": "40.3.86.0",
    "prefixlen": 24
}
2015-06-12 07:59:11 -07:00
Donald Sharp
31a4638f7d BGP: bestpath needs to prefer confed-external over confed-internal
Topology:
                    +-----------------------------------------+
                    |                                         |
                    |                 AS 100                  |
                    |                                         |
                    |  +----------------+                     |
  +-----------+     |  |                |                     |
  |           |     |  |   SubAS 65001  |                     |
  |   AS 90   |     |  |                |    +-------------+  |
  |    r9----------------r1---------r2----\  |             |  |
  |     |     |     |  |  |         |   | |  | SubAS 65002 |  |
  +-----|-----+     |  |  \--- r3 --/   | \-------r4       |  |
        \---------------------/  \---------------/ |       |  |
                    |  |                |    |     |       |  |
                    |  +----------------+    |     |       |  |
                    |                        |     |       |  |
                    |  +----------------+    |    r5       |  |
  +-----------+     |  |                |    |     |       |  |
  |           |     |  |   SubAS 65003  |    +-----|-------+  |
  |   AS 80   |     |  |                |          |          |
  |    r8----------------r7--------r6--------------/          |
  |           |     |  |                |                     |
  +-----------+     |  +----------------+                     |
                    +-----------------------------------------+

Important info:
- r8 originates 8.8.8.8/32
- r1, r2, r3 -> r7 are 10.0.0.1, 10.0.0.2, etc
- 'bgp bestpath compare-routerid' is configured everywhere (we could still hit
  the problem without this though)

Bestpath selection for 8.8.8.8/32 on r2 and r3 is inconsistent. Here r4
advertised the 8.8.8.8/32 to r2 first, r2 then advertised it to r3, r3 selected
the path from r2 as the bestpath due to lowest router-id.

r2
BGP routing table entry for 8.8.8.8/32
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.1 10.0.0.3 10.0.0.4
  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.4 (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external, best
      Last update: Fri May  1 14:46:57 2015

r3
BGP routing table entry for 8.8.8.8/32
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.4 90.1.1.6
  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.2 (10.0.0.2)
      Origin IGP, metric 0, localpref 100, valid, confed-internal, best
      Last update: Fri May  1 14:46:58 2015

  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.4 (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Last update: Fri May  1 14:46:57 2015

Here r4 advertised the 8.8.8.8/32 to r3 first, r3 then advertised it to r2, r2
selected the path from r3 as the bestpath due to lowest router-id.

r2
BGP routing table entry for 8.8.8.8/32
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.4
  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.4 (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Last update: Fri May  1 15:37:27 2015

  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.3 (10.0.0.3)
      Origin IGP, metric 0, localpref 100, valid, confed-internal, best
      Last update: Fri May  1 15:37:27 2015

r3
BGP routing table entry for 8.8.8.8/32
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.1 10.0.0.2 10.0.0.4 90.1.1.6
  (65002 65003) 80
    10.0.0.7 (metric 50) from 10.0.0.4 (10.0.0.4)
      Origin IGP, metric 0, localpref 100, valid, confed-external, best
      Last update: Fri May  1 15:37:22 2015

The fix is to have bestpath prefer a confed-external path over a confed-internal
path.  I added this just after the "nexthop IGP cost" step because some confed
customers will have one IGP covering multiple sub-ASs, in that case you want to
compare nexthop IGP cost.
2015-06-12 07:59:10 -07:00
Donald Sharp
356b32947f Remove the '(ignored)' output for nexthops, instead display 'used' for the used one 2015-06-12 07:59:10 -07:00
Donald Sharp
66b199b2ff Here we have an unsual confederations config, "router bgp X" and
"bgp confederation id X" are the same value.

router bgp 1
 bgp router-id 10.1.1.1
 bgp confederation identifier 1
 bgp confederation peers 24 35
 neighbor 10.1.1.2 remote-as 24
 neighbor 10.1.1.2 update-source lo
 neighbor 10.1.1.3 remote-as 1
 neighbor 10.1.1.3 update-source lo

The customer does this because they want to peer to 10.1.1.2 as a
confed-external peer but peer with 10.1.1.3 as a normal iBGP peer.

The bug was that we thought 10.1.1.3 was an EBGP peer so we did not send him
LOCALPREF which caused the Juniper to send us a NOTIFICATION. I confirmed
that quagga also sends a NOTIFICATION in this scenario.

The fix is to add a check to see if router bgp X and bgp confederation
identifier X are equal because that is a factor in determining if a peer is
EBGP or IBGP


Additional issues fixed in the this patch:

  We were not properly removing all AS_CONFED_SEQUENCEs/SETs from the aspath
  when advertising a route to an ebgp peer. This was due to two issues:

    We only called aspath_delete_confed_seq() if confederations were
    configured.  We can RX as aspath with CONFED segments even if
    confederations are not configured.

    aspath_delete_confed_seq() was implemented based on the original confed
    RFC 3065 which basically said "remove all of the leading
    AS_CONFED_SEQUENCEs/SETs" where the new confed RFC 5065 says "remove ALL
    of the AS_CONFED_SEQUENCEs/SETs"

  peer-groups did not work for confed-external peers. peer_calc_sort() always
  returned BGP_PEER_EBGP for a confederations where the remote-as was not
  specified. The reason was the peer->as_type was AS_UNSPECIFIED but we checked

    if (peer->as_type != AS_SPECIFIED)
       return (peer->as_type == AS_INTERNAL ? BGP_PEER_IBGP : BGP_PEER_EBGP);

    After fixing that I found that when we got to the else where we checked for
    peer1 we could only possibly return BGP_PEER_IBGP or BGP_PEER_EBGP, we need
    to also be able to return BGP_PEER_CONFED. I changed this to return
    peer1->sort.

  "show ip bgp x.x.x.x" would always display "Local" for the aspath. This is
  because we were calling aspath_counts_hop() to determine if the aspath was
  empty. This is wrong though because CONFED segments do not count towards
  aspath hopcount. The fix is to null check aspath->segments to determine if
  the aspath is actually empty.

  "show ip bgp x.x.x.x" and "show ip bgp neighbor" always displayed
  "internal" or "external" and never "confed-internal" or "confed-external".
  This made troubleshooting difficult because I couldn't tell exactly what
  kind of peer I was dealing with. I added the confed-internal and
  confed-external output...also added a "peer-type" field in the json output
  for 'show ip bgp x.x.x.x'

  "show ip bgp peer-group" did not list the peer-group name if we hadn't
  determined the "type" (internal, external, etc) for the peer-group
2015-06-12 07:59:10 -07:00
Donald Sharp
1ec4e1e78f Use nexthop-global-foo and nexthop-local-foo for all nexthop related JSON keys 2015-06-12 07:59:10 -07:00
Donald Sharp
c265ee22c8 If the received MP nexthop is a martian address, treat the update as
an implicit withdraw as is done for the NEXT_HOP attribute in the
update itself.

Note: Check is implemented only for IPv6 for the global nexthop. The
code will quietly ignore an invalid IPv6 link-local nexthop, if present;
this is the existing behavior and is not changed.

Signed-off-by: Vivek Venkataraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Daniel Walton <dwalton@cumulusnetworks.com>
2015-06-12 07:59:09 -07:00
Donald Sharp
3811f1e2a5 A nexthop value specified by an outbound routemap is not being
honored correctly for EBGP peers after the introduction of the
dynamic update groups functionality. Ensure this is handled
correctly. Also, the route-map can separately set different
nexthops - IPv4, IPv6 global or IPv6 link-local; treat these
separately.
2015-06-12 07:58:14 -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
d998c0f713 Fixup 'force' -vs- 'all' compile issue
Our code implemented 'force' for a keyword while quagga mainline implemented 'all'.
This fixups the #define usage that was missed that came in during one of the patch
files.  This is a compile only testing

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-05-20 07:00:02 -07:00
Donald Sharp
4125bb6716 If the default route is removed from the BGP table we must re-evaluate "neighbor x.x.x.x default-originate" 2015-05-19 18:29:19 -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
1c36cb2e22 Rename BGP's "peer-id" to "peer-router-id" and "peer-ip" to "peer-id" 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
3caff6ca60 Include loopback IP addresses in martian NEXTHOP check 2015-05-19 18:29:15 -07:00
Donald Sharp
8f9505715d 'show ip bgp neighbors 10.1.1.2 advertised-routes' fails for route-reflector-clients 2015-05-19 18:29:15 -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
91e89998d6 If the route-map used on a redistribute statement does not exists we should DENY all 2015-05-19 18:04:24 -07:00
Donald Sharp
98a4a44edc An undefined route-map should deny everything 2015-05-19 18:04:21 -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
dc83d712b1 When a peer that is Established goes down, it is moved into the Clearing
state to facilitate clearing of the routes received from the peer - remove
from the RIB, reselect best path, update/delete from Zebra and to other
peers etc. At the end of this, a Clearing_Completed event is generated to
the FSM which will allow the peer to move out of Clearing to Idle.

The issue in the code is that there is a possibility of multiple Clearing
Completed events being generated for a peer, one per AFI/SAFI. Upon the
first such event, the peer would move to Idle. If other events happened
(e.g., new connection got established) before the last Clearing_Completed
event is received, bad things can happen.

Fix to ensure only one Clearing_Completed event is generated.
2015-05-19 18:04:12 -07:00
Donald Sharp
036a4e7dc8 'show ip bgp x.x.x.x' should display swpX when link-local peering 2015-05-19 18:04:06 -07:00
Donald Sharp
15f606c9ff Remove incorrect call to delete NHT for a route added via "network" command.
When a route is announced in BGP via "network" command, we also register its
next hop with NHT code to allow of updates when the nexthop changes. When this
route is deleted via "no network" command, we incorrectly make a second call to
unregister the NHT tracking associated with this route. This causes a crash.
Fix that.
2015-05-19 18:04:04 -07:00
Donald Sharp
9fbdd10028 Add 'debug bgp bestpath' 2015-05-19 18:04:02 -07:00
Donald Sharp
f4eeff72d5 The path ordering has an impact on whether paths are flagged as multipath, this should not be the case. 2015-05-19 18:04:01 -07:00
Donald Sharp
43143c8f2c Addpath does not work for soft-reconfiguration 2015-05-19 18:04:01 -07:00
Donald Sharp
801a9bcc7f Use #define for mp_nexthop_len values 2015-05-19 18:04:00 -07:00
Donald Sharp
f992e2a98c Install aggregate routes we create in the RIB 2015-05-19 18:03:58 -07:00
Donald Sharp
cd808e7453 Check for overflow when RXing NLRI with addpath 2015-05-19 18:03:56 -07:00
Donald Sharp
e5eee9afc3 The 'show ip bgp json' output is incorrect if the aspath is empty 2015-05-19 18:03:55 -07:00
Donald Sharp
2fed88876a Ensure that routes from a peer are not considered for best path
comparison if the peer is not in an Established state. There can
be a window between a peer being deleted and the background
thread that actually clears the routes (marks them as "removed")
runs during which best path may run. If this path selection
compared two prefixes all the way down to peer IP addresses and
one of these two peers had just been deleted, that peer would
not have its sockunion structures, especially su_remote, resulting
in a BGPD exception.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-05-19 18:03:51 -07:00
Donald Sharp
75aead62b7 When internal operations are performed (e.g., best-path selection, next-hop
change processing etc.) that refer to the BGP instance, the correct BGP
instance must be referenced and not the default BGP instance. The default
BGP instance is the first instance on the instance list. In a scenario
where one BGP instance is deleted (through operator action such as a
"no router bgp" command) and another instance exists or is created, there
may still be events in-flight that need to be processed against the
deleted instance. Trying to process these against the default instance
is erroneous. The calls to bgp_get_default() must be limited to the user
interface (vtysh) context.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-05-19 18:03:50 -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
316e074deb bgpd: Add route-map support for set ip next-hop unchanged
In the data center, where load balancers are announced as VIPs, and eBGP
is used as the routing protocol, this feature is required to ensure that
VIP announcements can be made from anywhere the operator sees fit.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-05-19 18:03:49 -07:00
Donald Sharp
b05a1c8b75 Add json output support for a few BGP show commands 2015-05-19 18:03:48 -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
0de5153cfb During best path selection, if one of the candidates is a stale entry, do not
perform the neighbor address comparison as that information is invalid for
the stale entry. Attempting to perform the comparison results in a bgpd
exception.
2015-05-19 18:03:44 -07:00
Donald Sharp
31eba040c2 If a BGP path has an unreachable nexthop display that path as invalid 2015-05-19 18:03:43 -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
3f3dd76fcf BGP: back to back route refreshes can set BGP_INFO_ATTR_CHANGED on the first route refresh but then clear it on the second
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 18:03:38 -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
4092b06c7f Add [bestpath|multipath] option to 'show ip bgp x.x.x.x' 2015-05-19 17:58:11 -07:00
Donald Sharp
8ad7271db8 Add clear command to force a bestpath recalculation and re-advertisement of a prefix 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
b5d58c32bb Fix aggregation issues found via ANVL
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:47:24 -07:00
Donald Sharp
42f7e18488 atomic-aggregate is lost when we aggregate another aggregate that has atomic-aggregate 2015-05-19 17:47:21 -07:00
Donald Sharp
fc9a856f70 bgpd-nht-connected-route.patch
BGP: Use next hop tracking for connected routes too

And cleanup obsolete code in bgp_scan and bgp_import.
2015-05-19 17:47:21 -07:00
Donald Sharp
0d9551dc3c Add support for route tags
Credit
------
A huge amount of credit for this patch goes to Piotr Chytla for
their 'route tags support' patch that was submitted to quagga-dev
in June 2007.

Documentation
-------------
All ipv4 and ipv6 static route commands now have a "tag" option
which allows the user to set a tag between 1 and 65535.

quagga(config)# ip route 1.1.1.1/32 10.1.1.1 tag ?
  <1-65535>  Tag value
quagga(config)# ip route 1.1.1.1/32 10.1.1.1 tag 40
quagga(config)#

quagga# show ip route 1.1.1.1/32
Routing entry for 1.1.1.1/32
  Known via "static", distance 1, metric 0, tag 40, best
  * 10.1.1.1, via swp1

quagga#

The route-map parser supports matching on tags and setting tags
!
route-map MATCH_TAG_18 permit 10
 match tag 18
!

!
route-map SET_TAG_22 permit 10
 set tag 22
!

BGP and OSPF support:
- matching on tags when redistribing routes from the RIB into BGP/OSPF.
- setting tags when redistribing routes from the RIB into BGP/OSPF.

BGP also supports setting a tag via a table-map, when installing BGP
routes into the RIB.

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:46:33 -07:00
Donald Sharp
bc41314335 bgpd: bgpd-route-map-match-interface.patch
BGP: Add match interface support to BGP route-map.

Currently, BGP route maps don't support interface match. This is a problem
for commands such as redistribite connected that cannot exclude routes from
specific interfaces (such as mgmt interfaces).
2015-05-19 17:40:47 -07:00
Donald Sharp
0b16f23991 Summary: Test effect of route-map on received/advertised routes
This patch adds the ability to see the effect of applying a route-map on
the routes received or advertised from or to a neighbor. This effect can
be seen without actually affecting the current state. If the result seen
is what is desired, then the user can actually apply the route-map.
Currently, the application acts on route-map in or out and on unsuppress
maps.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:45 -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
80e0ad24f9 BGP doesn't count a route with an unreachable nexthop in PfxRcd
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:40:38 -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
47fc97cc8d Patch to produce output of BGP commands in csv format. Useful for easier scripting. 2015-05-19 17:40:34 -07:00
Donald Sharp
fb018d251e nexthop-tracking.patch
quagga: nexthop-tracking.patch

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

Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:34 -07:00
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
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
David Lamparter
052573ee23 *: merge branch stable/0.99.23
bgp extcommunity fixes from stable branch

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-06-29 12:52:52 +02:00
David Lamparter
c460e5720c bgpd: fix some bgp_update_main() attribute leaks
bgp_update_main() wasn't doing anything to release attribute values
set from route maps for two of its error paths.  To fix, pull up the
appropriate cleanup from further down and apply it here.

bgp_update_rsclient() doesn't have the issue since it immediately
does bgp_attr_intern() on the results from bgp_{export,import}_modifier.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-06-29 12:47:21 +02: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
2c13299a05 bgpd: don't compare next-hop to router-id
While announcing a path to a peer, the code currently compares the path's
next-hop with the peer's router-id. This can lead to problems as the router
IDs are unique only within an AS. Suppose AS 1 sends route with next-hop
10.1.1.1. It is possible that the speaker has an established BGP peering
with a router in AS 2 with router ID 10.1.1.1. The route will not be
advertised to that peer in AS 2.

The patch removes this check.

Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-06-03 15:08:08 +02:00
Milan Kocian
000e157c85 bgpd: Fix condition allowas-in in rsclient code
Currently when you set neighbour's 'allowas-in' option on route server side
you get redistribution of the prefixes from this neighbour's table into all
neighbour's tables which have the same AS number. I think that wanted behaviour
is to allow import prefixes from neighbour's tables with the same AS num
into neighbour which has 'allowas-in' option set.

Signed-off-by: Milan Kocian <milon@wq.cz>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-05-19 23:51:19 +02:00
Boian Bonev
b366b51840 bgpd: display multipath status in "show ip bgp"
The output of "show ip bg" does not show whether and which routes are
installed as multipath routes along the best route:

BGP table version is 0, local router ID is 10.10.100.209
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i1.0.0.0/24       10.10.100.1              1    111      0 15169 i
* i                 10.10.100.2              1    111      0 15169 i
* i                 10.10.100.3              1    111      0 65100 15169 i

This patch adds a new status code that is showing exactly which routes
are used as multipath:

BGP table version is 0, local router ID is 10.10.100.209
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
              i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i1.0.0.0/24       10.10.100.1              1    111      0 15169 i
*=i                 10.10.100.2              1    111      0 15169 i
* i                 10.10.100.3              1    111      0 65100 15169 i

The inconsistency in the status code legend ("i - internal" vs. "i internal")
inherent from old IOS was fixed. It had to be touched anyways.

Signed-off-by: Boian Bonev <bbonev at ipacct.com>
[DL: rewrap long line, clean whitespace in same chunk]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-05-15 19:23:36 +02:00
Pradosh Mohapatra
689bb66c6a bgpd: track correct originator-id in reflected routes
ISSUE:

Suppose route1 and route2 received from route-reflector-client1 and client2
respectively have identical attributes. The current logic of creating the
adj-rib-out for a peer threads the 'adv' structures for both routes against
the same attribute. This results in 'bgp_update_packet()' to pack those
routes in the same UPDATE message with one attr structure formatted. The
originator-id is thus set according to the first route's received router id.
This is incorrect.

PATCH:

Fix bgp_announce_check() function to set the originator-id in the
advertising attr structure. Also, fix the attribute hash function and
compare function to consider originator-id. Otherwise attributes where all
fields except the originator-id are identical get merged into one memory
location.

Signed-off-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com>
Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com>
Reviewed-by: Ken Yin <kyin at cumulusnetworks.com>
[DL: whitespace changes dropped]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-05-15 19:15:45 +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
Christian Franke
2b00515a9b bgpd, ospfd, zebra: fix some DEFUN definitions
Fixup some DEFUNS with incorrect command strings or mixed up helpstrings.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-04-01 17:32:49 +02:00
Christian Franke
d53d8fda42 bgpd: fix crash in soft-reconfiguration
Commit 8692c50652 introduced a bug where bgpd would crash on
soft-reconfiguration.

This happens e.g. when there are filtered unicast routes because
rn->info is NULL in that case, which the code did not account for.

Reported-by: Paweł Staszewski <pstaszewski@itcare.pl>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-02-01 17:55:04 +01:00
Christian Franke
dcab1bb822 bgpd: conditional default-originate using route-map
Incorporate a patch by Svetozar Mihailov which implements
default-originate route-maps to behave as expected, i.e. allowing
the default route to be advertised conditionally, depending on a
criterion given by the route-map.

I am aware that the performance attributes of the following implementation
are far from optimal. However, this affects only code paths belonging to
a feature that is broken without this patch, therefore, it seems reasonable
to me to have this in the mainline for now.

Cc: Svetozar Mihailov <quagga@j.zarhi.com>
Reported-by: Sébastien Cramatte <scramatte@gmail.com>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-16 01:45:57 +01:00
Stephen Hemminger
07ff4dc4d2 bgpd: mark route nodes scheduled into work queue
The flag bit BGP_NODE_PROCESS_SCHEDULED is checked but never set.
This causes route node to be scheduled multiple times under load.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-15 17:49:41 +01:00
Jorge Boncompte [DTI2]
24e50f2013 bgpd: avoid heap fragmentation in bgp_clear_route_table
In bgp_clear_route_table, moved cleanup code before the allocation
of the work queue items. This returns the memory to the system
allocator before allocating new and might therefore help avoiding
heap fragmentation.

* bgp_route.c: (bgp_clear_route_table) moved code blocks.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Reviewed-by: Leonid Rosenboim <Leonid.Rosenboim@windriver.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-14 14:43:51 +01:00
Jorge Boncompte [DTI2]
ebbb5fca5c bgpd: fix for leaked struct bgp_adj_[in|out] on peer shutdown
If a peer with soft-reconfiguration configured is cleared, the
function bgp_clear_route_table() doesn't free the bgp_adj_in and bgp_adj_out
structures of route nodes that for some reason, ej. denied by a filter,
don't have routes attached "rn->info == NULL".

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Reviewed-by: Leonid Rosenboim <Leonid.Rosenboim@windriver.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-01-14 14:42:38 +01:00
Avneesh Sachdev
67174041d2 bgpd: make bgp_table a wrapper around table library
Make the BGP table code a thin wrapper around the table implementation
in libzebra.

  * bgpd/bgp_table.[ch]

    - Use the ROUTE_NODE_FIELDS macro to embed the fields of a
      route_node in the bgp_node structure.

    - Add a route_table field to the bgp_table structure.

      Initialize the route_table with a delegate, such that the nodes
      in the table are bgp_node structures.

    - Add inline wrappers that call route_table functions underneath,
      and accept/return the correct BGP types.

  * bgpd/bgp_route.c

    Change some code to use inline wrappers instead of accessing
    fields of nodes/tables directly. The latter does not always work
    because the types of some fields need to be translated now.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-09-26 21:50:48 +02:00
Jorge Boncompte [DTI2]
bb782fb50e bgpd: Partially revert f018db8, fixes BZ#730
The change from bgp_node_get() to bgp_node_lookup() broke aggregation.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Tested-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-06-21 09:49:15 +02:00
Jorge Boncompte [DTI2]
f018db83a0 bgpd: optimize bgp_aggregate_[increment|decrement]()
If there were no aggregates configured this functions were allocating
and freeing a struct bgp_node for every call, and it's called for every
prefix received.

* bgp_route.c: Bail out early if the there are no aggregates configured.
  Change from bgp_node_get() to bgp_node_lookup() that does not allocate
  a new struct bgp_node if not found.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:35:50 +02:00
Jorge Boncompte [DTI2]
343aa82219 bgpd: optimize bgp_update_main() in the soft_reconfig case
Avoids 3 checks per call.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:35:50 +02:00
Jorge Boncompte [DTI2]
577ac57b78 bgpd: Remove useless initialization
It's initialized below

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:25:50 +02:00
Jorge Boncompte [DTI2]
558d1fec11 bgpd: reduce struct attr_extra allocations/freeing
Try to use on stack structs for temporary uses.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:25:50 +02:00
Jorge Boncompte [DTI2]
6182d65b23 bgpd: fix struct attr_extra leak in bgp_default_originate()
The call to bgp_attr_default_set() above creates the attr_extra struct,
but the attr.extra = NULL initialization was leaking it.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:25:49 +02:00
Jorge Boncompte [DTI2]
e16a413313 bgpd: remove some useless initializations
* bgp_attr.c: (bgp_attr_default_intern) bgp_attr_default_set() already
  initializes the memory. Fixes a struct attr_extra leak.
* bgp_route.c: Remove useless on stack struct initializations.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:25:49 +02:00
Jorge Boncompte [DTI2]
8ff56318a8 bgpd: optimize bgp_info_cmp()
* bgp_route.c: (bgp_info_cmp) Reduce indirections, precalculate some
  values that are used several times, reduce conditionals.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:25:49 +02: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
Jorge Boncompte [DTI2]
10f9bf3f20 bgpd: optimize bgp_nexthop_self()
This function scores 2nd, profiling a full internet table load. It's called
for every prefix received.
  Instead of looping in the interface lists comparing addresses use a hash
to mantain them.

* bgpd.c: Init the own address hash.
* bgp_nexthop.c: Introduce methods to maintain an own address hash.
  (bgp_connected_add) add addresses to the hash.
  (bgp_connected_delete) delete addresses from the hash.
  (bgp_nexthop_self) lookup addresses in the hash. Removed the unused afi_t
  parameter.
* bgp_route.c: (bgp_update_main) Micro-optimization, rearranged condition to
  not lookup the hash for bogus nexthops (0.0.0.0 or a class D/E address)

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22 20:25:07 +02:00
Jorge Boncompte [DTI2]
8692c50652 bgpd: fix crash with vpnv4 soft-reconfiguration
bgp_afi_node_get() expects a non-NULL prd for a SAFI_MPLS_VPN prefix.

* bgp_route.c: pass down the struct prefix_rd from bgp_soft_reconfig_in()
  and bgp_soft_reconfig_rsclient().

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-21 15:48:30 +02:00
Jorge Boncompte [DTI2]
c63b83fe8d bgpd: Fix memory leak of some "show ip bgp neighbor" commands
sockunion_str2su() use is prone to memory leaks. Remove it's use all over
the code.

At least these commands leaked a sockunion union:
    - show ip bgp vpnv4 ... routes
    - show ip bgp ... received prefix-filter

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@diac24.net>
2012-05-02 17:03:27 +02:00
Jorge Boncompte [DTI2]
ddc943dec3 bgpd, zebra: Fix format for some metric outputs
Metrics are unsigned values.

  * bgpd/bgp_{debug,route,vty}.c,
  * zebra/zebra_vty.c: replace %d with %u for metrics & distances

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[reworded commit message]
Signed-off-by: David Lamparter <equinox@diac24.net>
2012-05-02 17:03:21 +02:00
Avneesh Sachdev
3cf6c2b4e4 Merge branch 'quagga' into google-bgp-multipath
Conflicts:
	bgpd/bgp_route.c
2012-04-09 00:25:15 -07:00
G.Balaji
73bfe0bd9a bgpd: Addition of ipv6 network command in Multicast address family mode.
The patch adds the ipv6 network command in the BGP multicast address
      family mode.
2012-01-23 14:31:05 +04:00
G.Balaji
5a616c08ce bgpd: IPv4 MP-BGP Routes addition and deletion
This patch contains the following:
1. Addition of IPv4 SAFI_MULTICAST BGP routes into the BGP Multicast RIB.
2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.
2012-01-23 14:30:33 +04:00
Denis Ovsienko
8e80bdf20f bgpd: touch nexthop handling code
bgp_nexthop_lookup_ipv6(): declare variables where they are actually
used, drop no-op initialization (the field is already 0)
bgp_nexthop_lookup(): ditto
bgp_nexthop_check_ebgp(): rename to bgp_nexthop_onlink()
bgp_nexthop_cache_changed(): rename to bgp_nexthop_cache_different()
2012-01-08 11:30:55 +00:00
Denis Ovsienko
733cd9e579 bgpd: justify checks for IPv4 class D/E
* lib/prefix.h
  * IPV4_CLASS_DE(): make consistent with counterpart macros
* bgp_packet.c
  * bgp_open_receive(): test using macro instead of ">="
* bgp_route.c
  * bgp_update_rsclient(): idem
  * bgp_update_main(): idem
2012-01-02 18:37:42 +04:00
Stephen Hemminger
9206f9ecd5 fix set never used warnings
(This patch was modified to leave calls to stream_getl() in place, they
are necessary for the stream's internal pointer to advance to the
correct position. -- Denis)

Signed-off-by: Denis Ovsienko <infrastation@yandex.ru>

Fix gcc warnings about varables that are set but never used.

* bgpd/bgp_attr.c
  * cluster_unintern(): ret
  * transit_unintern(): ret
  * bgp_attr_default_intern(): attre
  * bgp_mp_reach_parse(): rd_high, rd_low
* bgpd/bgp_route.c
  * bgp_announce_check_rsclient(): bgp
* bgpd/bgp_zebra.c
  * zebra_read_ipv4(): ifindex
  * zebra_read_ipv6(): ifindex
* bgpd/bgpd.c
  * bgp_config_write_peer(): filter
* lib/distribute.c
  * distribute_list_all(): dist
  * distribute_list(): dist
  * distribute_list_prefix_all(): dist
  * distribute_list_prefix(): dist
* lib/if_rmap.c
  * if_rmap(): if_rmap
* lib/vty.c
  * vty_accept(): vty
* lib/zclient.c
  * zclient_read(): ret
* zebra/irdp_interface.c
  * if_group(): zi
* zebra/rt_netlink.c
  * kernel_read(): ret, sock
2011-12-18 20:21:21 +04:00
Stephen Hemminger
f04a80a5d2 bgpd: store nexthop info for redistributed IPV6 routes
BGP was ignoring nexthop info for static and other redistributed
routes for IPv6.  Build extra attribute info to store the nexthop.
See also:
  https://bugzilla.vyatta.com/show_bug.cgi?id=6073
2011-12-06 15:03:00 +04: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
Paul Jakma
036a6e6cf6 Merge branch 'attr-errors'
Contains BGP fixes:

- set extcommunity crash: tihs patch tries to make the refcounting more robust
  but does not fully solve the problem, sadly.
- BGP attribute error handling: Little testing.
2011-07-29 18:16:25 +01:00
Josh Bailey
0b597ef00e bgpd: When advertising a multipath route, the attribute set to be
advertised is based on the bestpath attribute set, but the
following attributes are aggregated from the attribute sets
of the multipath constituents:
- AS_PATH
- ORIGIN
- COMMUNITIES
- EXTENDED COMMUNITIES

In addition the route is advertised with the NEXT_HOP set
to the router's interface IP address, instead of the NEXT_HOP
of the best path. This is to ensure that traffic will go to this
router so it can be fanned out via the multipath route.

* bgpd/ecommunity.c
  * ecommunity_uniq_sort(): Make this function externally accessible
* bgpd/ecommunity.h
  * Add external declaration for ecommunity_uniq_sort()
* bgpd/bgp_mpath.c
  * bgp_info_nexthop_cmp(): Replace calls to bgp_attr_extra_get()
    to avoid unwanted memory allocation
  * bgp_info_mpath_free(): Free aggregate attribute for multipath
  * bgp_info_mpath_attr(): Lookup aggregate attribute of a multipath route
  * bgp_info_mpath_attr_set(): Set aggregate attribute of a multipath route
  * bgp_info_mpath_aggregate_update(): Update the aggregate attribute
    of a multipath route
* bgpd/bgp_mpath.h
  * bgp_info_mpath: Add pointer to hold aggregate attribute of a multipath
  * Add external declarations for new functions
* bgpd/bgp_route.c
  * bgp_announce_check(): Use aggregate attribute when announcing multipath
    route
  * bgp_announce_check_rsclient(): Use aggregate attribute when announcing
    multipath route
  * bgp_best_selection(): After updating multipath set, update the
    multipath aggregate attribute
2011-07-20 20:49:11 -07:00
Josh Bailey
6918e74b97 bgpd: For deterministic MED build a multipath set for each peer AS as the
first stage of the best path calculation. The second stage then
selects a winner from each peer AS's best path. In the second stage we
clear multipath set of the non-selected best paths via
bgp_mp_dmed_deselect(). Since the multipath set is already marked up
for the winning path, we don't call bgp_info_mpath_update() after the
second stage calculation.

* bgpd/bgp_mpath.c
  * bgp_mp_dmed_deselect(): New function to cleanup the multipath
    markup if a DMED selected path loses in stage 2 of the best path
    calculation
* bgpd/bgp_mpath.h
  * Add external declaration of bgp_mp_dmed_deselect()
* bgpd/bgp_route.c
  * bgp_best_selection(): If multipath is enabled, build up the mp_list
    for the current peer AS, and do the RIB markup the best path from
    that AS. In the second stage, clear the RIB markup for the DMED
    selected path if it is not selected as best. Only call
    bgp_info_mpath_update() in the second stage when not doing
    deterministic MED.
2011-07-20 20:48:20 -07:00
Josh Bailey
8196f13d2a bgpd: Modify the BGP to zebra route announcement to support multipath
routes. Use a growable buffer (bgp_nexthop_buf) to collect nexthops
that are included in the announcement. Use the BGP_INFO_MULTIPATH_CHG
flag to trigger zebra announcement so zebra will be updated if the
multipath set changes. Display all multipath nexthops in
'debug bgp zebra' output.

* bgpd/bgp_main.c
  * bgp_exit(): Free bgp_nexthop_buf when exiting
* bgpd/bgp_route.c
  * bgp_process_rsclient(): Clear BGP_INFO_MULTIPATH_CHG after processing
  * bgp_process_main(): Check BGP_INFO_MULTIPATH_CHG to trigger zebra
    announcement and clear aftr processing
* bgpd/bgp_zebra.c
  * bgp_nexthop_buf: Growable buffer used to collect nexthops for zebra
    announcement
  * bgp_zebra_announce(): Grow bgp_nexthop_buf if needed. Include
    multipath count in zebra announcement and add all nexthops to
    bgp_nexthop_buf. Pass bgp_nexthop_buf data to zebra announcement.
    Added nexthops to debug output.
  * bgp_zebra_init(): Initialize bgp_nexthop_buf at startup
* bgpd/bgp_zebra.h
  * BGP_NEXTHOP_BUF_SIZE: Default initial bgp_nexthop_buf size has room
    for 8 nexthops
2011-07-20 20:47:07 -07:00
Josh Bailey
de8d5dff15 bgpd: Adds support to mark up the BGP rib table entry with multipath
information based on the multipath list (mp_list) generated during
the best path calculation. Display "multipath" for paths that are
multipath and also on bestpath if the route is multipath. Flag a
best path with the BGP_INFO_MULTIPATH_CHG if the multipath
set has changed since the last update. This can be used to trigger
updates to zebra and peers.

The multipath markup is a lazily allocated bgp_info_mpath structure
that is added to the best path and any multipaths. The mpath structures
are linked together with the best path element at the head and the
other elements ordered by nexthop and then by peer address. This
markup scheme is updated by calling bgp_info_mpath_update() and passing
in a new mp_list the the current multipath set. There are additional
API's for walking the multipath set, querying the count of multipaths,
and for cleaning up the multipath markup information when freeing path
information.

* bgpd/bgp_mpath.c
  * bgp_info_mpath_new(): Allocation of new mpath element
  * bgp_info_mpath_free(): Release memory for mpath element
  * bgp_info_mpath_get(): Access mpath element of path. Allocate memory
    on-demand
  * bgp_info_mpath_enqueue(): Enqueue a path onto the multipath list
  * bgp_info_mpath_dequeue(): Remove a path from the multipath list
  * bgp_info_mpath_first(): Return first path on the multipath list
  * bgp_info_mpath_next(): Return next path on the multipath list
  * bgp_info_mpath_count(): Return the number of paths on the multipath list
  * bgp_info_mpath_count_set(): Set the number of paths on the multipath list
  * bgp_info_mpath_update(): Update multipath markup on bgp route table entry
    and flag any changes. Emit 'debug bgp event' output on any multipath
    change.
* bgpd/bgp_mpath.h
  * struct bgp_info_mpath: Information added to a bgp_info path to record
    multipath information
  * External declarations for new functions in bgp_mpath.c
* bgpd/bgp_route.c
  * bgp_info_free(): Free mpath memory when freeing path information
  * bgp_info_reap(): Dequeue path from multipath queue before deleting it
  * bgp_best_selection(): Calls bgp_info_mpath_update() with latest
    mp_list to mark-up rib table entry
  * bgp_vty_out_detail(): Add display of multipath flag for a path. Also
    display 'multipath' for bestpath if it is a multipath route
* bgpd/bgp_route.h
  * struct bgp_info: Add pointer to bgp_info_mpath information
  * Add flags to mark a path as multipath (BGP_INFO_MULTIPATH) and
    to mark bestpath if multipath information has changed
    (BGP_INFO_MULTIPATH_CHG)
* lib/memtypes.c
  * Add MTYPE_BGP_MPATH_INFO for allocating memory for bgp_info_mpath
* tests/bgp_mpath_test.c
  * Add test case for bgp_info_mpath_update() and supporting functions
2011-07-20 20:46:01 -07:00
Josh Bailey
96450faf33 bgpd: Adds equal-paths check to path comparison. Paths that are
equal to the best path are accumulated onto an ordered list (mp_list)
if maximum-paths is configured. A future commit will add the
multipath markup to the BGP rib table based on the mp_list. Add
unit test for the added mp_list functions.

Deterministic MED is not supported in this commit, it will be
added later.

* bgpd/bgp_aspath.c
  * Make aspath_cmp() an external symbol so it can be used in
    equivalent paths check
* bgpd/bgp_aspath.h
  * Add extern declaration of aspath_cmp()
* bgpd/bgp_mpath.c
  * bgp_info_nexthop_cmp(): Compares nexthops of two paths
  * bgp_info_mpath_cmp(): Compare function to order multipaths by
    nexthop and then by peer address
  * bgp_mp_list_init(): Initialize a list with the multipath order function
  * bgp_mp_list_clear(): Clear out the mp_list
  * bgp_mp_list_add(): Add a multipath to mp_list
* bgpd/bgp_mpath.h
  * External declarations for above added functions in bgp_mpath.c
* bgpd/bgp_route.c
  * bgp_info_cmp(): Add equivalent paths result (paths_eq). If eBGP
    paths are equal down to IGP metric check, flag as equal if peer AS
    matches. Similarly for iBGP paths but compare full AS_PATH.
  * bgp_best_selection(): If multipath is enabled, accumulate equivalent paths
    in mp_list. Add debug bgp event output to see result (will be filtered
    later to display only when change occurs)
  * bgp_process_rsclient(): Pass multipath config to bgp_best_selection()
  * bgp_process_main(): Pass multipath config to bgp_best_selection()
* tests/bgp_mpath_test.c
  * Add unit test case for bgp_mp_list functions
2011-07-20 20:45:12 -07:00
Paul Jakma
3bde17f1af bgpd: Fix compile failure if IPv6 build was disabled.
* bgp_route.c: ({no_,}ipv6_bgp_network_ttl_cmd) depends on ipv6_bgp_network
  which is HAVE_IPV6, so these should be too.
  (bgp_route_init) and the installs should be similarly ifdefed
2011-03-23 10:30:30 +00:00
Michael Lambert
95cbbd2ace bgpd: New show commands for improved view and address family support
Many show commands do not have support for multiple views and do not
treat different address families uniformly.  The following changes add
a number of commands with support for views and rationalized treatment
of IPv4 v IPv6 and unicast v multicast (such as in JUNOS, IOS XR and
more recent versions of IOS).

* bgp_route.c: (bgp_show_community) Inserted a new second argument (the
  name of the view) and the code to look up that name in the BGP structure.
  The NULL argument in the call to bgp_show (indicating the default view)
  was replaced by the specified view.  The existing calls to
  bgp_show_community had a NULL second argument inserted to make clear
  that they refer to the default view.

  (top level) Added new functions via the DEFUN and/or ALIAS macros (and
  the associated command table entries) to add the commands

    show bgp ipv4 (unicast|multicast)
    show bgp ipv4 (unicast|multicast) A.B.C.D
    show bgp ipv4 (unicast|multicast) A.B.C.D/M
    show bgp ipv6 (unicast|multicast)
    show bgp ipv6 (unicast|multicast) X:X::X:X
    show bgp ipv6 (unicast|multicast) X:X::X:X/M

      These show either the full BGP table or the specified route or
      prefix for the given address family.

    show bgp view WORD (ipv4|ipv6) (unicast|multicast) community
    show bgp view WORD (ipv4|ipv6) (unicast|multicast) community \
            (AA:NN|local-AS|no-advertise|no-export){1,4}

      For the specified view and address family, these show entries
      matching any community or the specified communit(y)(ies).

    show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors \
            (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)

      For the specified view and address family, show the routes
      advertised to or received from the given BGP neighbor.

    show bgp [view WORD] ipv4 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X)
    show bgp [view WORD] ipv4 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X) A.B.C.D
    show bgp [view WORD] ipv4 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X) A.B.C.D/M
    show bgp [view WORD] ipv6 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X)
    show bgp [view WORD] ipv6 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X) X:X::X:X
    show bgp [view WORD] ipv6 (unicast|multicast) \
            rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M

      For the specifed (optional) view and address family, show either
      the full BGP table or the specified route or prefix for the given
      route server client peer.

* bgp_vty.c: (top level) Added new functions via the DEFUN and/or ALIAS
  macros (and the associated command table entries) to add the commands

    show bgp [view WORD] (ipv4|ipv6) (unicast|multicast) summary
    show bgp [view WORD] (ipv4|ipv6) (unicast|multicast) rsclient summary

      For the specified (optional) view and address family, display
      either the normal summary table for BGP peers, or the route server
      client table showing the import and export policies.
2011-03-21 17:30:52 +00:00
Paul Jakma
c8f3fe3063 bgpd: Remove AS Path limit/TTL functionality
* draft-ietf-idr-as-pathlimit doesn't seem to have gone anywhere, and its
  author does not think it will make progress in IDR. Remove all support
  introduced for it, but leave stubs for the commands to avoid breaking
  any configurations.

  Basically reverts cecab5e9725792e60a5e4b473e238a14cd85815d.
2011-03-21 13:51:14 +00:00
Paul Jakma
f6f434b282 bgpd: Try fix extcommunity resource allocation probs, particularly with 'set extcom..'
* Extended communities has some kind of resource allocation problem which
  causes a double-free if the 'set extcommunity ...' command is used.
  Try fix by properly interning extcommunities.

  Also, more generally, make unintern functions take a double pointer
  so they can NULL out callers references - a usefully defensive programming
  pattern for functions which make refs invalid.

  Sadly, this patch doesn't fix the problem entirely - crashes still
  occur on session clear.

* bgp_ecommunity.h: (ecommunity_{free,unintern}) take double pointer
  args.
* bgp_community.h: (community_unintern) ditto
* bgp_attr.h: (bgp_attr_intern) ditto
* bgp_aspath.h: (bgp_aspath.h) ditto
* (general) update all callers of above
* bgp_routemap.c: (route_set_ecommunity_{rt,soo}) intern the new extcom added
  to the attr, and unintern any old one.
  (route_set_ecommunity_{rt,soo}_compile) intern the extcom to be used
  for the route-map set.
  (route_set_ecommunity_*_free) unintern to match, instead of free
  (route_set_ecommunity_soo) Do as _rt does and don't just leak
  any pre-existing community, add to it (is additive right though?)
2011-03-21 13:51:14 +00:00
Wataru Tanitsu
c099baf6f0 bgpd: Fix display of unsigned attributes
* bgp_route.c: (route_vty_out*) The local prefix, metric and weight values
  are all stored as uint32_t.  Change the format to %u so that large values
  are not displayed as negative integers.
2011-03-21 13:15:32 +00:00
Stephen Hemminger
7badc26301 bgpd: fix use of free memory by update_rsclient
* bgp_route.c: (bgp_static_update_rsclient) BGP sometimes crashes when
  removing route server client because of use after free.

  The code to update rsclient created a local static copy of bgp attributes
  but neglected to handle the extra information pointer.  The extra
  information was getting freed by bgp_attr_unintern() and reused later when
  the copy was passed to bgp_attr_intern().

  The fix is to use the attr_dup function to create a copy of the extra
  information, then clean it up.
2011-03-21 13:15:32 +00:00
Robert Bays
368473f612 bgpd: unlock node on aggregate error
* bgp_route.c: (bgp_aggregate_set) make sure to unlock BGP node if failure
2011-03-21 13:15:32 +00:00
Robert Bays
f6269b4f7a bgpd: fix errors in aggregate address command
* bgpd: (bgp_aggregate_{set,unset,delete}) This fixes locking and other
  issues with aggregate set/unset command
2011-03-21 13:15:32 +00:00
Chris Caputo
6c88b44dcb bgpd: fix bgp_node locking issues
* bgpd: Connected table locks were being locked but not unlocked, such that
  eventually a lock would exceed 2^31 and become negative, thus triggering
  an assert later on.
* bgp_main.c: (bgp_exit) delete connected elements along with ifp's.
* bgp_nexthop.c: (bgp_nexthop_lookup{,_ipv6}) add missing unlocks
  (bgp_multiaccess_check_v4) ditto
  (bgp_connected_{add,delete}) Use a distinct memtype for bgp_connected_ref.
  (bgp_scan_finish) reset the nexthop cache to clean it up when bgpd exits
* bgp_route.c: fix missing bgp_node unlocks
* lib/memtype.c: (memory_list_bgp) add MTYPE_BGP_CONN
* testing: has been tested for almost 2 months now.
2011-03-21 13:15:32 +00:00
Paul Jakma
d1de1c2596 Merge paul/ospfd/201012-review ospfd and lib/ fixes and performance improvements 2011-03-20 22:09:15 +00:00
John Kemp
30b0017696 bgpd: improve "monotonic" uptime correction
Older versions of Quagga/Zebra would output a value in MRT table
dump files for "uptime" aka "ORIGINATED" that was a WALL clock
value.  Given that uptime is now internally a bgp_clock MONOTONIC
value, the output in the MRT files is showing up as monotonic.

Note: time of MRT dump is still recorded correctly as a
time() based value, so we haven't lost that value.

Proposal is to correct the uptime output on the vty and in the
MRT files to again display something more akin to WALL time.

* bgp_dump.c: (bgp_dump_routes_func) add conditional correction
* bgp_route.c: (route_vty_out_detail) make correction conditional, move
  variable declaration to beginning of the function
2011-03-18 17:52:18 +03:00
Paul Jakma
838bbde042 bgpd: Simplify process queue init
* bgp_route.c: (bgp_process_queue_init) rsclient wasn't getting all the
  same things initialised as the main queue. Simplify to make it more robust.
2010-12-08 16:53:08 +00:00
Vladimir L Ivanov
213b6cd9fb bgpd: fix printed value of last-update timestamp
* bgp_route.c: (route_vty_out_detail) calculate time value
    in a way, which works regardless of monotonic clock
    being used or not
2010-10-21 14:59:54 +04:00
Michael Lambert
4c9641ba4d bgpd, lib: adopt afi_t and safi_t in several places
* bgpd/bgp_attr.c, bgpd/bgp_open.h, bgpd/bgp_route.c, lib/prefix.c,
  lib/prefix.h: Various integer types were being used where, if we
  had strict type checking, afi_t and safi_t would be required.

Signed-off-by: G.Balaji <balajig81@gmail.com>
(cherry picked from commit c8af35ffa2dc79ff7d7ff00b1b61f1f50a100ab6)
2010-10-06 12:33:05 -04: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
9e4ca89c36 bgpd: compile warnings cleanup
* bgpd/bgp_fsm.c
  * bgp_clearing_completed(): only used in one file, can be static
* bgpd/bgp_packet.c
  * afi2str(): sayonara
  * safi2str(): sayonara
* bgpd/bgp_route.c
  * bgp_distance_reset(): sayonara
* bgpd/bgp_zebra.c
  * bgp_ifindex_by_nexthop(): sayonara
2009-12-10 11:57:05 +03:00
Vasilis Tsiligiannis
638b70ba98 [bgp] Fix nexthop reachability check on confederations
* bgp_route.c: (bgp_update_main) Nexthop reachability should be checked for
  confederations too in case a prefix is received from more than one
  confederation peers.
2009-07-21 14:44:41 +01:00
Paul Jakma
a294365797 [bgpd] fix typo made by paul in previous commit 2009-07-21 14:02:04 +01:00
Nick Hilliard
e7cc3b383e [bgpd] Small buffer overrun in bgp_clear_node_queue_init
* bgp_route.c: (bgp_clear_node_queue_init) fix buffer
  overrun.
2009-07-21 11:34:27 +01:00
Chris Caputo
228da42898 [bgpd] Stability fixes including bugs 397, 492
I've spent the last several weeks working on stability fixes to bgpd.
These patches fix all of the numerous crashes, assertion failures, memory
leaks and memory stomping I could find.  Valgrind was used extensively.

Added new function bgp_exit() to help catch problems.  If "debug bgp" is
configured and bgpd exits with status of 0, statistics on remaining
lib/memory.c allocations are printed to stderr.  It is my hope that other
developers will use this to stay on top of memory issues.

Example questionable exit:

  bgpd: memstats: Current memory utilization in module LIB:
  bgpd: memstats:  Link List                     :          6
  bgpd: memstats:  Link Node                     :          5
  bgpd: memstats:  Hash                          :          8
  bgpd: memstats:  Hash Bucket                   :          2
  bgpd: memstats:  Hash Index                    :          8
  bgpd: memstats:  Work queue                    :          3
  bgpd: memstats:  Work queue item               :          2
  bgpd: memstats:  Work queue name string        :          3
  bgpd: memstats: Current memory utilization in module BGP:
  bgpd: memstats:  BGP instance                  :          1
  bgpd: memstats:  BGP peer                      :          1
  bgpd: memstats:  BGP peer hostname             :          1
  bgpd: memstats:  BGP attribute                 :          1
  bgpd: memstats:  BGP extra attributes          :          1
  bgpd: memstats:  BGP aspath                    :          1
  bgpd: memstats:  BGP aspath str                :          1
  bgpd: memstats:  BGP table                     :         24
  bgpd: memstats:  BGP node                      :          1
  bgpd: memstats:  BGP route                     :          1
  bgpd: memstats:  BGP synchronise               :          8
  bgpd: memstats:  BGP Process queue             :          1
  bgpd: memstats:  BGP node clear queue          :          1
  bgpd: memstats: NOTE: If configuration exists, utilization may be expected.

Example clean exit:

  bgpd: memstats: No remaining tracked memory utilization.

This patch fixes bug #397: "Invalid free in bgp_announce_check()".

This patch fixes bug #492: "SIGBUS in bgpd/bgp_route.c:
bgp_clear_route_node()".

My apologies for not separating out these changes into individual patches.
The complexity of doing so boggled what is left of my brain.  I hope this
is all still useful to the community.

This code has been production tested, in non-route-server-client mode, on
a linux 32-bit box and a 64-bit box.

Release/reset functions, used by bgp_exit(), added to:

  bgpd/bgp_attr.c,h
  bgpd/bgp_community.c,h
  bgpd/bgp_dump.c,h
  bgpd/bgp_ecommunity.c,h
  bgpd/bgp_filter.c,h
  bgpd/bgp_nexthop.c,h
  bgpd/bgp_route.c,h
  lib/routemap.c,h

File by file analysis:

* bgpd/bgp_aspath.c: Prevent re-use of ashash after it is released.

* bgpd/bgp_attr.c: #if removed uncalled cluster_dup().

* bgpd/bgp_clist.c,h: Allow community_list_terminate() to be called from
  bgp_exit().

* bgpd/bgp_filter.c: Fix aslist->name use without allocation check, and
  also fix memory leak.

* bgpd/bgp_main.c: Created bgp_exit() exit routine.  This function frees
  allocations made as part of bgpd initialization and, to some extent,
  configuration.  If "debug bgp" is configured, memory stats are printed
  as described above.

* bgpd/bgp_nexthop.c: zclient_new() already allocates stream for
  ibuf/obuf, so bgp_scan_init() shouldn't do it too.  Also, made it so
  zlookup is global so bgp_exit() can use it.

* bgpd/bgp_packet.c: bgp_capability_msg_parse() call to bgp_clear_route()
  adjusted to use new BGP_CLEAR_ROUTE_NORMAL flag.

* bgpd/bgp_route.h: Correct reference counter "lock" to be signed.
  bgp_clear_route() now accepts a bgp_clear_route_type of either
  BGP_CLEAR_ROUTE_NORMAL or BGP_CLEAR_ROUTE_MY_RSCLIENT.

* bgpd/bgp_route.c:
  - bgp_process_rsclient(): attr was being zero'ed and then
    bgp_attr_extra_free() was being called with it, even though it was
    never filled with valid data.

  - bgp_process_rsclient(): Make sure rsclient->group is not NULL before
    use.

  - bgp_processq_del(): Add call to bgp_table_unlock().

  - bgp_process(): Add call to bgp_table_lock().

  - bgp_update_rsclient(): memset clearing of new_attr not needed since
    declarationw with "= { 0 }" does it.  memset was already commented
    out.

  - bgp_update_rsclient(): Fix screwed up misleading indentation.

  - bgp_withdraw_rsclient(): Fix screwed up misleading indentation.

  - bgp_clear_route_node(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT.

  - bgp_clear_node_queue_del(): Add call to bgp_table_unlock() and also
    free struct bgp_clear_node_queue used for work item.

  - bgp_clear_node_complete(): Do peer_unlock() after BGP_EVENT_ADD() in
    case peer is released by peer_unlock() call.

  - bgp_clear_route_table(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT.  Use
    struct bgp_clear_node_queue to supply data to worker.  Add call to
    bgp_table_lock().

  - bgp_clear_route(): Add support for BGP_CLEAR_ROUTE_NORMAL or
    BGP_CLEAR_ROUTE_MY_RSCLIENT.

  - bgp_clear_route_all(): Use BGP_CLEAR_ROUTE_NORMAL.

  Bug 397 fixes:

    - bgp_default_originate()
    - bgp_announce_table()

* bgpd/bgp_table.h:
  - struct bgp_table: Added reference count.  Changed type of owner to be
    "struct peer *" rather than "void *".

  - struct bgp_node: Correct reference counter "lock" to be signed.

* bgpd/bgp_table.c:
  - Added bgp_table reference counting.

  - bgp_table_free(): Fixed cleanup code.  Call peer_unlock() on owner if
    set.

  - bgp_unlock_node(): Added assertion.

  - bgp_node_get(): Added call to bgp_lock_node() to code path that it was
    missing from.

* bgpd/bgp_vty.c:
  - peer_rsclient_set_vty(): Call peer_lock() as part of peer assignment
    to owner.  Handle failure gracefully.

  - peer_rsclient_unset_vty(): Add call to bgp_clear_route() with
    BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.

* bgpd/bgp_zebra.c: Made it so zclient is global so bgp_exit() can use it.

* bgpd/bgpd.c:
  - peer_lock(): Allow to be called when status is "Deleted".

  - peer_deactivate(): Supply BGP_CLEAR_ROUTE_NORMAL purpose to
    bgp_clear_route() call.

  - peer_delete(): Common variable listnode pn.  Fix bug in which rsclient
    was only dealt with if not part of a peer group.  Call
    bgp_clear_route() for rsclient, if appropriate, and do so with
    BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.

  - peer_group_get(): Use XSTRDUP() instead of strdup() for conf->host.

  - peer_group_bind(): Call bgp_clear_route() for rsclient, and do so with
    BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.

  - bgp_create(): Use XSTRDUP() instead of strdup() for peer_self->host.

  - bgp_delete(): Delete peers before groups, rather than after.  And then
    rather than deleting rsclients, verify that there are none at this
    point.

  - bgp_unlock(): Add assertion.

  - bgp_free(): Call bgp_table_finish() rather than doing XFREE() itself.

* lib/command.c,h: Compiler warning fixes.  Add cmd_terminate().  Fixed
  massive leak in install_element() in which cmd_make_descvec() was being
  called more than once for the same cmd->strvec/string/doc.

* lib/log.c: Make closezlog() check fp before calling fclose().

* lib/memory.c: Catch when alloc count goes negative by using signed
  counts.  Correct #endif comment.  Add log_memstats_stderr().

* lib/memory.h: Add log_memstats_stderr().

* lib/thread.c: thread->funcname was being accessed in thread_call() after
  it had been freed.  Rearranged things so that thread_call() frees
  funcname.  Also made it so thread_master_free() cleans up cpu_record.

* lib/vty.c,h: Use global command_cr.  Add vty_terminate().

* lib/zclient.c,h: Re-enable zclient_free().
2009-07-19 18:28:08 +01:00
Paul Jakma
650f76c2e1 [bgpd] Log a debug/update warning if filters are configured but don't exist
* bgp_route.c: (bgp_{input,output}_filter) Log a debug warning if a route is
  received or sent and a filter name is configured for a prefix, as or
  distribute list but none is found - guaranteed configuration mistake.
2009-06-26 16:12:19 +01:00
Tomasz Pala
2a71e9ce89 [bgpd] Add 'show ip bgp view WORD neighbors IP (advertised|received)-routes'
* bgp_route.c: Was missing these commands.
2009-06-24 21:36:50 +01:00
Chris Caputo
50aef6f3b0 Fix "show ip bgp dampened-paths" garbage output.
* bgpd/bgp_damp.c: Make bgp_damp_reuse_time_vty() accept a buffer and
  length, rather than returning a local var buffer whose contents can get
  trounced.  Remove duplicate BGP_UPTIME_LEN define.
* bgpd/bgp_damp.h: bgp_damp_reuse_time_vty() prototype change.
* bgpd/bgp_route.c: Provide bgp_damp_reuse_time_vty() with a buffer and
  length.  Remove duplicate BGP_UPTIME_LEN define.

This problem was noticed in 2005...

  http://hibernia.jakma.org/~paul/patches/quagga-test.diff

...but the fix didn't make it into the code.

Signed-off-by: Chris Caputo <ccaputo@alt.net>
2009-06-23 14:25:20 +01: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
Stephen Hemminger
dde7258666 [bgpd] Make declarations match
These variables are const.
2009-06-18 20:18:28 +01:00
Stephen Hemminger
66e5cd8719 [cleanup] functions taking no args should be declared with void args
Use Ansi-C prototypes rather than old K&R method of declaring
function without arguments
2009-06-12 17:09:03 +01:00
Stephen Hemminger
393deb9bd6 [cleanup] Convert XMALLOC/memset to XCALLOC
Simple conversion of XMALLOC/memset to XCALLOC
2009-06-12 17:07:49 +01:00
Denis Ovsienko
aea339f728 [bgpd] AS4 bugfix by Chris Caputo <ccaputo@alt.net>
* bgpd/bgp_aspath.c: (aspath_make_str_count) "assert (len < str_size)" was
  getting hit under certain 4-byte ASN conditions. New realloc strategy.
* bgpd/bgp_aspath.c: (aspath_key_make) const warning fix.

"%d" -> "%u" 4-byte ASN corrections.  Prevent negative number when ASN is
above 2^31.
2009-04-30 17:16:22 +04:00
Michael Lambert
a8bf6f526e [bgpd] Fix definition of an rsclient command
* bgp_route.c: (show_ip_bgp_view_rsclient_route_cmd) Add the missing "ip"
  to the command string.

Signed-off-by: Paul Jakma <paul@quagga.net>
2008-09-24 17:23:11 +01:00
Paul Jakma
62687ff1cd [vty] Add support for a 'restricted mode' with anonymous vty connections
* lib/command.h: Add a RESTRICTED_NODE, intended for use with
	  anonymous, 'no login' vtys, to provide a subset of 'view' mode
	  commands.
	* lib/command.c: Add RESTRICTED_NODE bits, nothing special, just
	  following VIEW_NODE.
	* lib/vty.c: (vty_auth) enable authentication should fall back to
	  restricted/view node as appropriate.
	  (vty_create) init vty's to restricted/view node as appropriate,
	  for the 'no login' case.
	  (vty_{no_,}restricted_mode_cmd) config commands to enable
	  'anonymous restricted' in vty configuration.
	  (vty_config_write) 'anonymous restricted' config.
	  (vty_init) Install some commands to restricted mode, and the
	  'anonymous restricted' config commands into VTY_NODE.
	* bgpd/*.c: Install some of the safe(r) BGP commands into
	  'restricted mode', i.e. lookup commands of non-sensitive data.
	  Useful with looking-glass route-servers.
2008-08-23 14:27:06 +01:00
Paul Jakma
30a2231a48 [warnings] Fix various SOS warnings
2008-08-15 Paul Jakma <paul.jakma@sun.com>

	* */*: Fix various problems flagged by Sun Studio compiler.
	  - '<qualifier> <storage>' obsolescent in declarations
	  - empty statements (';' after ALIAS definitions)
	  - implicit declarations (e.g printstack in lib/log.c)
	  - "\%" in printf string instead of "%%"
	  - loops that return on the first iteration (legitimately, but
 	    compiler can't really know), e.g. bgp_routemap.c
 	  - internal declarations which mask prototypes.
2008-08-22 19:52:59 +01:00
Paul Jakma
750e814693 [bgpd] Fix triggerable crash when compiled with --disable-bgp-announce
2008-07-22 Paul Jakma <paul.jakma@sun.com>

	* HACKING: Document preference for compiler conditional code, over
	  cpp conditional.
	* configure.ac: DISABLE_BGP_ANNOUNCE always should be defined.
	* bgp_{packet,route,advertise}.c: change to compiler testing of
	  DISABLE_BGP_ANNOUNCE, rather than cpp.

2008-07-22 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp>

	* bgp_packet.c: (bgp_update_packet_eor) Fix crash triggerable
	  if a bgpd was compiled with --disable-bgp-announce and if GR is
	  advertised by peer.
2008-07-22 21:11:48 +00:00
Denis Ovsienko
841f7a57b1 + [bgpd] Added new route-map set statement: "as-path ignore" 2008-04-10 11:47:45 +00:00
Paul Jakma
9eda90ce80 [bgpd] bug #398 Bogus free on out route-map, and assert() with rsclients
2007-08-27 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_announce_check) Fix bug #398, slight
	  modification of Vladimir Ivanov's suggested fix - to keep
	  memory alloc conditional.
	  (bgp_process_announce_selected) Don't take struct attr as
	  argument, none of the callers need it and it needlessly
	  distances allocation from use.
	  Free the extended attr, the attr itself is on the stack.
	  Fix bad indentation.
	* bgp_attr.c: (bgp_packet_attribute) Remove incorrect assert,
	  and adjust conditional to test attr->extra, diagnosis by
	  Vladimir Ivanov in bug #398.

2007-08-27 Vladimir Ivanov <wawa@yandex-team.ru>

	* bgp_route.c: (bgp_announce_check_rsclient) copy of
	  ri->attr is no longer deep enough, due to addition of
	  attr->extra. It should use bgp_attr_dup, as
	  bgp_announce_check() does.
2007-08-30 13:36:17 +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
b24970241a [bgpd] bug #370, default-originate was broken by a silly thinko
2007-05-25 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_default_originate) Sanity check added
	  previously was broken and always failed, thus this function
	  never could run, bug #370.
2007-06-14 11:17:58 +00:00
Paul Jakma
fb982c25aa [bgpd] Trim memory usage of BGP routes
2007-05-03 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.h: (struct info) Move less frequently used
	  fields to a lazily allocated struct info_extra.
	  Export bgp_info_extra_get
	* bgp_route.c: (bgp_info_extra_new) allocate extra
	  (bgp_info_extra_free) Free damp info and the info_extra.
	  (bgp_info_extra_get) Retrieve the info_extra of a struct
	  info, allocating as required.
	  (generally) adjust to use info->extra
	* bgp_damp.c: (generally) use bgp_info_extra_get to access
	  dampinfo
	* bgp_attr.h: Move rarely allocated attributes from struct attr
	  to a struct attr_extra, for a substantial saving in size of
	  struct attr.
	* bgp_attr.c: (bgp_attr_extra_{new,free}), new, self-explanatory.
	  (bgp_attr_extra_get) Get the attr_extra for a given struct
	  attr, allocating it if needs be.
	  (bgp_attr_dup) Shallow copy the struct attr and its attr_extra.
	  (generally) adjust to know about attr->extra.
	* bgp_debug.c: (bgp_dump_attr) ditto
	* bgp_vty.c: (show_bgp_memory) print attr and info extra sizes.
	* bgp_nexthop.c: (generally) adjust to know about attr->extra
	  and info->extra.
	* bgp_{packet,routemap,snmp,zebra}.c: ditto
	* lib/memtypes.c: Add MTYPE_ATTR_EXTRA and MTYPE_BGP_ROUTE_EXTRA
2007-05-04 20:15:47 +00:00
Paul Jakma
16d2e2410d [bgpd] V. quick route flap gets mistaken for duplicate, route is then ignored
2007-04-08 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (general) Same bug as fixed on 2006-11-28 by ajs for
	  bgp static routes, but for main BGP RIB: Quick 'flap' of routes
	  can cause bgpd to mistake a new route for a duplicate route,
	  due to presence of removed, but not yet processed BGP RIB entry.
	  (bgp_update_rsclient) Ignore REMOVED bgp_info for duplicate,
	  restore route instead.
	  (bgp_update_main) Ditto.
2007-04-10 19:32:10 +00:00
Paul Jakma
f2c31acb6f [bgpd] Peer delete can race with reconfig leading to crash
2007-02-22 Paul Jakma <paul.jakma@sun.com>

	* bgp_fsm.c: (bgp_fsm_change_status) Handle state change into
	  clearing or greater here. Simpler.
	  (bgp_event) Clearing state change work moved to previous
	* bgp_route.c: (bgp_clear_route_node) Clearing adj-in here
	  is too late, as it leaves a race between a peer being deleted
	  and an identical peer being configured before clearing
	  completes, leading to a crash.
	  Simplest fix is to clean peers Adj-in up-front, rather than
	  queueing such work.
	  (bgp_clear_route_table) Clear peer's Adj-In and Adj-Out
	  up-front here, rather than queueing such work.
	  Extensive comment added on the various bits of indexed data
	  that exist and how they need to be dealt with.
	  (bgp_clear_route) Update comment.
2007-02-22 17:48:42 +00:00
Andrew J. Schorr
8d45210e7c [bgpd] Fix bug where a deleted route that was quickly re-added was being lost
2006-11-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* bgp_route.c: (bgp_info_restore) New function that undoes
	  the effects of a previous call to bgp_info_delete.  This is
	  used when a route is deleted and quickly re-added before the
	  deletion has been processed.
	  (bgp_static_update_rsclient, bgp_static_update_main,
	  bgp_redistribute_add) Check whether a pre-existing route
	  has the BGP_INFO_REMOVED set, and, if so, we need to call
	  bgp_info_restore to resurrect it.
2006-11-28 19:50:46 +00:00
Paul Jakma
56395af705 [bgpd] trivial: non C99 u_int.._t should be uint.._t
2006-10-27 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_table_stats) oops, u_intXX_t should be
	  uintXX_t
2006-10-27 16:58:20 +00:00
Paul Jakma
6f58544db5 [bgpd] struct peer must have bgp field valid (redistribute crash)
2006-10-19 Paul Jakma <paul.jakma@sun.com>

	* bgpd.c: (peer_new) bgp element of peer absolutely must be
	  filled in, make peer_new() require it as argument and update
	  all callers. Fixes a crash reported by Jan 'yanek' Bortl and
	  Andrew Schorr where bgpd would crash in bgp_pcount_adjust
	  trying to dereference the bgp member of bgp->peer_self,
	  triggered through redistribution.
	* bgp_route.c: (bgp_pcount_adjust) assert sanity of arguments.
2006-10-22 19:13:07 +00:00
Paul Jakma
53d9f67a18 [bgpd] CID#73, potential crash in bgp statistics if called for AFI/SAFI with emtpy table
2006-10-15 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_table_stats_walker) NULL deref if table is
	  empty, bgp_table_top may return NULL, Coverity CID#73.
2006-10-15 23:41:16 +00:00
Paul Jakma
09dd561eb4 [bgpd] reduce the process queue hold time to something more sensible
2006-09-14 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_process_queue_init) process queue hold time
	  too high, adds extra memory load. Change to be much lower,
	  until such time as it's made configurable.
2006-09-14 03:38:16 +00:00
Paul Jakma
8383a9bd27 [bgpd] RIB statistics address space size shouldnt double count space
2006-09-14 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_table_stats_walker) Address space announced
	  should only count top-level unaggregateable prefixes, to
	  avoid falling afoul of anti-dodgy-accounting regulations
	  in various jurisdictions.. ;)
2006-09-14 03:06:54 +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
2815e61ffb [bgpd] Add RIB reporting commands, show bgp ... statistics
2006-09-13 Paul Jakma <paul.jakma@sun.com>

	* bgp_aspath.c: (aspath_highest) new, return highest ASN in an
	  aspath.
	* bgp_route.c: (bgp_peer_count_walker) new, do the walk done
	  in bgp_peer_counts as a thread.
	  (bgp_peer_counts) move walk to previous and call it via
	  thread_execute so this RIB walk shows up in thread stats.
	  (bgp_table_stats) New, gather some statistics for a given
	  RIB.
	  (bgp_table_stats_walker) New, RIB walker thread for former.
	  (bgp_table_stats_vty) Parsing front-end for 'show bgp ...',
	  useful model for future rationalisation of 'show ... bgp'.
	  (bgp_route_init) Add new RIB stats commands.
2006-09-14 02:56:07 +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
ff7924f6c0 [bgpd] Add 'show ... neighbor .... prefix-counts' command
2006-09-03 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: Add 'show ... bgp ... <neighbour> prefix-count'
	  commands, to provide detailed counts of prefixes for a peer.
	  Informative, and should help pin down to pfxcnt drift
	  problems.
2006-09-04 01:10:36 +00:00
Paul Jakma
b2518c1e88 [bgpd] CID #4,#5,#9,#10, simplify aspath_print_vty usage
2006-05-12 Paul Jakma <paul.jakma@sun.com>

	* bgp_aspath.{c,h}: (aspath_print_vty) take a format string,
	  so as to reduce burden on callers, all in bgp_route.c
	* bgp_route.c: (route_vty_out{,tmp}) Update to match
	  aspath_print_vty, simplifying checks needed to get spacing
	  right. CID #4,#5.
	  ({damp,flap}_route_vty_out) Ditto, CID #9, #10
2006-05-12 23:48:40 +00:00
Paul Jakma
06e110f937 [bgpd] CID #6, remove useless NULL check, bgp_static_update_rsclient
2006-05-12 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_static_update_rsclient) Remove useless NULL
	  check, code already assumes bgp_static can not be NULL,
	  fixes CID #6.
2006-05-12 23:29:22 +00:00
Paul Jakma
dd8103a917 [bgpd] CID #7, remove useless NULL check, bgp_static_update_main
2006-05-12 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_static_update_main) Remove useless NULL
	  check, code already assumes bgp_static can not be NULL,
	  fixes CID #7.
2006-05-12 23:27:30 +00:00
Paul Jakma
da5b30f6fb [bgpd] Bug #240, Fix route-server crash when static routes are configured
2006-05-08 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_afi_node_get) given table should never be
	  NULL, check/assert this.
	  (bgp_static_update) Bug #240. Rsclients should only be passed
	  the static update if they are configured for the afi,safi.
2006-05-08 14:37:17 +00:00
Paul Jakma
65ca75e0d1 [bgpd] Fix bug where FSM can stay hung forever in Idle/Clrng
2006-05-04 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (general) Fix logical bug in clearing, noted
	  by Chris Caputo in [quagga-users 6728] - clearing depended on
	  at least one route being added to workqueue, in order for
	  workqueue completion function to restart FSM. However, if no
	  routes are cleared, then the completion function never is
	  called, it needs to be called manually if the workqueue
	  didn't get scheduled.
	  Finally, clearing is per-peer-session, not per AFI/SAFI, so
	  the FSM synchronisation should be in bgp_clear_route_table.
	  (bgp_clear_route_table) Wrong place for FSM/clearing
	  synchronisation, move to..
	  (bgp_clear_route) FSM/clearing synchronisation should be
	  here.
	  If no routes were cleared, no workqueue scheduled, call
	  the completion func to ensure FSM kicks off again.
2006-05-04 08:08:15 +00:00
Paul Jakma
3e0c78ef8a [bgpd] Start off FSM again once clearing finishes.
2006-03-03 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_clear_node_complete) Doh. When clearing
	  is complete we need to kick off FSM again.
2006-03-06 18:06:53 +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 Jakma
7c7fa1b431 [bgpd] trivial readability fix
2006-02-18 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.c: (bgp_announce_check) trivial, move declaration
	  of two local variables into the only block where they are
	  used, to aid the reader.
2006-02-18 10:52:09 +00:00
paul
902212c3f3 [bgpd] Fix peer prefix counts and make it slightly more robust
2006-02-05 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.h: Add BGP_INFO_COUNTED to track whether
	  prefix has been counted or not.
	* bgp_route.c: (bgp_pcount_{inc,dec}rement) new helpers, to
	  centralise inc/dec of prefix-count,
	  (bgp_rib_remove) Remove pcount decrement, use helper.
	  (bgp_rib_withdraw) ditto, additionally use previous function
	  too.
	  (bgp_update_main) Use pcount helpers.
	  (bgp_clear_route_node) ditto, aslo REMOVED routes don't need
	  clearing.
2006-02-05 17:51:19 +00:00
paul
306d889043 [lib/workqueue] remove the useless 'delay' factor.
2006-02-02 Paul Jakma <paul.jakma@sun.com>

	* workqueue.h: (struct work_queue) Remove the delay field.
	  It served no purpose and just introduced bad behaviour.
	  Should be excised before its allowed to escape into 1.0.
	  This removes need for the 'flood' and runs_since_clear
	  fields.
	* workqueue.c: (general) excise delay factor between queue
	  runs, hence the 'flood' crap too.. See above.
	* bgp_route.c: (bgp_{clear_node,process}_queue_init) delay
	  field is removed from workqueue spec.
2006-02-02 17:50:19 +00:00
paul
e8e1946edf [compiler] miscellaneous trivial compiler warning fixes
2006-01-19 Paul Jakma <paul.jakma@sun.com>

        * (general) various miscellaneous compiler warning fixes.
          Remove redundant break statements from switch clauses
          which return.
          return from main, not exit, cause it annoys SOS.
          Remove stray semi-colons which cause empty-statement
          warnings.
	* zebra/main.c: (sighup) remove private declaration of external
	  function.
2006-01-19 20:16:55 +00:00
paul
0fb58d5d79 2005-11-14 Paul Jakma <paul.jakma@sun.com>
* zebra_rib.c: (rib_process) convert to new workqueue specs and
	  shut up gcc, which complains about cast from void via
	  function parameters, for some dumb reason. Do the cast
	  inside the function instead.
	  (rib_queue_qnode_del) ditto.
	  (rib_queue_init) no need for the casts anymore.
2005-11-14 14:31:49 +00:00
paul
fe69a505f7 2005-09-10 Paul Jakma <paul.jakma@sun.com>
* Makefile.am: bgpd shouldn't list libgp's sources as its own.
	  Use LDADD.
	* bgp_aspath.h:
	  (struct assegment) New struct, abstract representation of a
	  list of AS_PATH segments and the contained ASNs.
	  (struct aspath) Remove the raw-data related
	  fields, reference the abstract struct assegment instead.
	  Remove several other computed fields, it's just a
	  headache to maintain them and they're cheap to compute from
	  struct assegment.
	  (aspath_parse) parse a stream, not a pointer to raw data.
	  (aspath_count_{hops,confeds,size}) helpers to access
	  information formerly directly contained in struct aspath.
	  (aspath_snmp_pathseg) Helper for SNMP, BGP MIB wants
	  to be able to output hex representation of raw data.
	* bgp_aspath.c: (general) partial-rewrite. Store aspath data
	  as an abstract singly-linked list of abstract segments,
          rather than storing the raw data, and parsing it each and
	  every time. Remove several count/size fields which are cheap
	  to compute from the abstract segment structure.
	  (global) Include stream.h, needed for aspath_parse, and
	  others. Couple of helper macros added.
	  (struct assegment_header) Just the header, and only the
	  header.
	  (assegment_data_{new,free}) convenience functions for
	  AS_SEG_DATA allocation, the dynamic, per-segment array of
	  ASNs.
	  (assegment_{new,free,free_all,dup,dup_all}) convenience
	  functions for creating struct assegments. The _all forms will
	  follow the entire chain of segments from the given segment.
	  (assegment_prepend_asns) new function, prepend an ASN N times
	  to segment.
 	  (assegment_append_asns) Append a list (array) of ASNs to
	  segment.
	  (int_cmp) convenience function for the aspath hash.
	  (assegment_normalise) new function. Normalise the given
	  segment chain to meet expectations of Quagga, and to
	  eliminate differing raw representations of the same paths.
	  Merge 'runs' of SEQUENCEs into one segment as our internal
	  segment is not limited by the protocol AS_PATH segment
	  length. Sort ASNs in SETs.
	  (aspath_new) Take void argument to quell warnings. Use the
	  assegment convenience functions.
	  (assegment_count_{asns,confeds,hops}) new functions to
	  compute at runtime values previously held in struct aspath.
	  (aspath_size) ditto.
	  (aspath_make_str_count) rewritten to stringify new
	  representation, and to be slightly easier to understand
	  hopefully.
	  (aspath_str_update) convenience function, update the aspath
	  str. Should investigate removing maintained string from
	  struct aspath, just run-time compute it, as per other fields.
	  It's just a maintenance headache, would save noticeable
	  amount of RAM with possibly not much extra run-time cost.
	  (aspath_dup) use the assegment dup functions.
	  (aspath_hash_alloc) Take void * argument to satisfy gcc. Use
	  the proper helper functions to dup data.
	  (assegments_parse) new function. parse raw AS_PATH data into
	  struct assegments. Normalise and return the head of the list.
	  (aspath_parse) Parse a stream, not pointer to raw data and
	  use assegments_parse to do it.
	  (assegment_data_put) Write out a single segment data in protocol
	  form to stream.
	  (assegment_header_put) ditto but for segment header.
	  (aspath_put) new function. As per previous but for an entire
	  struct aspath.
	  (aspath_snmp_pathseg) wrapper around aspath_put for
	  bgp_snmp.c. Uses a static buffer sadly.
	  (aspath_aggregate_as_set_add) rewritten to use assegments.
	  (aspath_aggregate) ditto
	  (aspath_{firstas,loop,private_as}_check) ditto
	  (aspath_{merge,prepend,add_one_as}) ditto
	  (aspath_cmp_left{_confed}) ditto
	  (aspath_delete_confed_seq) ditto, plus fixed to properly
	  delete all leading confed segments.
	  (aspath_as_add) Just use assegment_append_asns.
	  (aspath_segment_add) updated to use assegments.
	  (enum as_token) Add values for confeds
	  (aspath_gettoken) Add support for confeds
	  (aspath_str2aspath) ditto
	  (aspath_key_make) updated to use as_segments. Also, add
	  segment type into the hash value as appropriate.
	  (aspath_cmp) updated to use as_segments.
	  (aspath_print) don't segfault on NULL argument.
	* bgp_attr.c: (bgp_attr_aspath) aspath_parse wants the stream
	  now. No need for manual forwarding of stream.
	  (bgp_packet_attribute) empty aspath is now denoted by NULL
	  segment field, length is gone.
	  Use aspath_size() to determine size.
	  (bgp_attr_init) Fix declaration, explicitely specify void
	  arg.
	  (bgp_dump_routes_attr) Use aspath_size() to determine size.
	* bgp_route.c: (bgp_info_cmp) use the aspath_count_* functions.
	  (bgp_rib_withdraw) remove unused variable. Use
	  aspath_count_hops.
	* bgp_snmp.c: (bgp4PathAttrTable) raw data is gone, use
	  aspath_snmp_pathseg to get the representation.
2005-09-10 16:55:02 +00:00
hasso
b7395791a3 * bgp_route.c: Third (?) attempt to fix best selection breakage
introduced long time ago with route server patch. Hopefully
	  it's last case to fix - route-server client not in peer group.

	[backport candidate]
2005-08-26 12:58:38 +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
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
paul
1eb8ef2584 2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
	  and some basic auditing of usage.
	* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
	* HACKING: Add notes about deprecating interfaces and commands.
	* lib/linklist.h: Add usage comments.
	  Rename getdata macro to listgetdata.
	  Rename nextnode to listnextnode and fix its odd behaviour to be
	  less dangerous.
	  Make listgetdata macro assert node is not null, NULL list entries
          should be bug condition.
          ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
          with for loop, Suggested by Jim Carlson of Sun.
          Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
          "safety" of previous macro.
	  LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
	  distinguish from the similarly named functions, and reflect their
	  effect better.
	  Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
	  with the old defines which were modified above,
	  for backwards compatibility - guarded to prevent Quagga using it..
	* lib/linklist.c: fix up for linklist.h changes.
	* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
	  scan of the area list, rather than scanning all areas first for
	  INTER_ROUTER and then again for INTER_NETWORK. According to
	  16.2, the scan should be area specific anyway, and further
	  ospf6d does not seem to implement 16.3 anyway.
2005-04-07 07:30:20 +00:00
hasso
6cf159b978 * bgp_route.c: Don't crash while clearing route tables if there is
no particular afi/safi configured.

	[backport candidate]
2005-03-21 10:28:14 +00:00
hasso
338b342415 * bgp_route.c: Make reannouncing prefixes with changed attributes
work again.
2005-02-23 14:27:24 +00:00
hasso
fee6e4e454 * bgp_clist.[ch], bgp_route.c, bgp_routemap.c, bgp_vty.c:
community-list cleanup.

	[merge from GNU Zebra]
2005-02-02 16:29:31 +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
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
ajs
3b8b185503 2005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* buffer.h: Fix comment on buffer_getstr to reflect that it now
	  uses XMALLOC.
	* buffer.c: (buffer_getstr) Use XMALLOC(MTYPE_TMP) instead of malloc.
	* filter.c: (access_list_remark,ipv6_access_list_remark) Use
	  argv_concat instead of buffer_getstr.
	* if.c: (interface_desc) Use argv_concat instead of buffer_getstr.
	* plist.c: (ip_prefix_list_description,ipv6_prefix_list_description)
	  Use argv_concat instead of buffer_getstr.
	* bgp_filter.c: (ip_as_path,no_ip_as_path) Use argv_concat instead
	  of buffer_getstr.
	* bgp_route.c: (bgp_show_regexp) Fix memory leak: need to free string
	  returned by buffer_getstr.
	  (bgp_show_community) Must use XFREE instead of free on string
	  returned by buffer_getstr.
	* bgp_routemap.c: (set_community) Must use XFREE instead of free
	  on string returned by buffer_getstr.
	* bgp_vty.c: (neighbor_description) Use argv_concat instead of
	  buffer_getstr.
2005-01-29 18:19:13 +00:00
hasso
6d69429c1b * bgp_route.c: Fix showstopper bug. New route must be selected also
if old one is flaged as BGP_INFO_ATTR_CHANGED.
2005-01-24 09:29:42 +00:00
hasso
f127165de0 * bgp_route.c: Clear peer's routing table regardless whether it's
configured or not. Being not configured is even better reason to
	  do it.
2005-01-17 11:04:32 +00:00
ajs
d2c1f16be4 2004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* *.c: Change level of debug messages to LOG_DEBUG.
2004-12-08 21:10:20 +00:00
ajs
5a64665039 2004-11-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* vty.h: Remove fields in struct vty that were related to VTY_CONTINUE
	  capabilities (that were used only in bgpd/bgp_route.c and are now
	  removed).  Also remove some other fields that were not being
	  used at all.
	* vty.c: (vty_execute) Do not test for obsolete status values VTY_START
	  and VTY_CONTINUE.
	  (vty_read) Remove calls to vty->output_func since that was part
	  of the VTY_CONTINUE infrastructure that has been removed.
	  (vty_flush) Remove code to support VTY_START and VTY_CONTINUE.
	  (vty_close) Remove code to cancel vty->t_output thread, since that
	  thread was never actually used.
	* bgp_route.c: Remove all code related to VTY_CONTINUE; this feature
	  is deprecated because the output did not represent a single point
	  in time.  All output needs to be generated inline and buffered
	  by the library code.
	  (route_vty_out,route_vty_out_tag,damp_route_vty_out,
	   flap_route_vty_out) Remove code to count number of lines of output,
	   since this was only useful for VTY_CONTINUE behavior.
	  (bgp_show_callback) Removed.
	  (bgp_show_table) Remove hooks for VTY_CONTINUE callback support.
	  As a result, there's a new output_arg argument to this function.
	  Make function static.
	  (bgp_show) Make function static and add a new output_arg argument.
	  Change all functions that call bgp_show or bgp_show_table to
	  pass the new output_arg argument (that used to be passed inside
	  vty->output_arg).
	* bgp_mplsvpn.c: Remove declarations of functions defined in
	  bgp_route.c; these declarations belong in bgp_route.h.
	* bgp_route.h: Declare 3 global functions used in both bgp_route.c
	  and in bgp_mplsvpn.c.
2004-11-05 01:25:55 +00:00
paul
fd79ac918b 2004-10-13 Paul Jakma <paul@dishone.st>
* (global) more const'ification and fixups of types to clean up code.
	* bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect,
          should use something like the VTY_GET_INTEGER macro, but without
          the vty_out bits..
        * bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE
          (no_set_aggregator_as) ditto.
        * bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is
          returned, add comments about troublesome return value.
2004-10-13 05:06:08 +00:00
paul
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
paul
f5ba387492 2004-07-09 Sowmini Varadhan <sowmini.varadhan@sun.com>
* bgp_packet.c: (bgp_collision_detect) Send NOTIFY on new socket
          if that is connection we're closing.
          (bgp_read) invalid marker check applies to KEEPALIVE too.
        * bgp_route.c: Ignore multicast NRLI, dont send NOTIFY.
2004-07-09 12:11:31 +00:00
paul
5228ad27e2 2004-06-04 Paul Jakma <paul@dishone.st>
* type mismatch fixes
2004-06-04 17:58:18 +00:00
hasso
e0701b7955 Merge bgpd changeset 1176 from Zebra repository by Rivo Nurges. 2004-05-20 09:19:34 +00:00
paul
35be31b6b2 2004-05-01 rivo nurges <rix@estpak.ee>
* bgp_route.c: fix UNH IOL BGP-4.1.12f
2004-05-01 18:17:04 +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
c001ae6281 2003-11-03 Paul Jakma <paul@dishone.st>
* bgpd/bgp_route.c: Delete some extraneous whitespace. Credit to
	  a person on #quagga whose name I unfortunately can not recall.
2003-11-03 12:37:43 +00:00
paul
bb46e94fcc 2003-10-24 Jose Luis Rubio Guivernau <jrubio@dit.upm.es>
* Better 'show bgp' support for views (eg ipv6), see [quagga-dev 238]
        * bgpd/bgp_route.c: (bgp_show) Take a struct bgp argument instead of
          view string.
          (bgp_show_neighbor_route) Take a struct peer argument instead of
          ip string.
          (peer_adj_routes) ditto
          (show_adj_routes) ditto
          (peer_lookup_in_view) new function to return appropriate struct
          peer for a given view string.
          (misc) Fixup all calls to above to reflect new calling arguments,
          and use peer_lookup_in_view as needed. Additional commands
          installed to use expanded functionality above, existing commands
          modified to suit as well.
        * bgpd/bgp_vty.c: 2 new aliases.
2003-10-24 19:02:03 +00:00
paul
3b424979f5 2003-10-13 Jay Fenlason <fenlason@redhat.com>
* lib/zebra.h: define UINT32_MAX for those systems which do not
	  provide it.
	* bgp_attr.h: define BGP_MED_MAX.
	* bgp_route.c: update defines/constants to BGP_MED_MAX.
	* bgp_routemap.c: ditto. clean up route_match_metric_compile
	  slightly to avoid unneccesary XMALLOC.
2003-10-13 09:47:32 +00:00
paul
50d649aaf9 2003-08-27 Kunihiro Ishiguro <kunihiro@zebra.org>
* bgpd/bgp_route.c: Unrevert the revert of the possible first fix
	  for maximum-prefix.
2003-08-27 12:25:49 +00:00
paul
c22854b878 2003-08-27 Kunihiro Ishiguro <kunihiro@zebra.org>
* bgpd/bgp_route.c: More work on bgp maximum prefix support
2003-08-27 07:07:02 +00:00
paul
c2f3a4cc77 2003-08-26 Kunihiro <kunihiro@zebra.org>
* bgpd/bgp_route.c: fix maximum prefix comparison
2003-08-26 04:11:35 +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
286e1e7153 2003-08-07 kunihiro <kunihiro@zebra.org>
* bgpd/bgp_route.c: route server passes routes which may have
	  no-export community
2003-08-08 00:24:31 +00:00
paul
718e374419 Initial revision 2002-12-13 20:15:29 +00:00