873 Commits
Author SHA1 Message Date
FUJITA Tomonori 05021a6e5f server: reject route without origin attribute via AddPath()
We should do stricter validation. Probably, we should use
packet/bgp/validate.go.

close #1660

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-31 21:31:20 +09:00
IWASE YusukeandFUJITA Tomonori 055eb89b27 zclient: Drop NextHop Tracking dampening feature
The dampening feature was implemented to delay the update of nexthop
states in order to avoid the states are "extremely" frequent updated.
But with this implementation, if a path is withdrawn by peer or via API
which the dampening feature delaying the update of that path, the
withdrawn path can be restored unexpectedly again.

And currently Quagga and FRRouting does not support the dampening, this
path drops the dampening feature to avoid this problem.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-29 11:15:20 +09:00
FUJITA Tomonori df6c998bc1 table: update accepted number in adj-in rib after softreset-in
update accepted number in adj-in rib after AllowOwnAs has changed.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-28 23:20:59 +09:00
FUJITA Tomonori ff09df9841 table: fix accepted number in adj-in rib
fix accepted number in adj-in rib when it has an as-looped path.

adding another member to Path struct is pain. Should be fixed later.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-28 22:53:38 +09:00
FUJITA Tomonori da488beb00 table: remove unused id in AdjRib strcture
Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-28 22:28:12 +09:00
IWASE Yusuke 8e23e93af6 server: Apply rtfilter on eBGP session
The outgoing Route Target Constraint filter should be applied to eBGP
session, but currently applied to only iBGP session.

This patch fixes to apply rtfilter on eBGP session.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-28 09:30:05 +09:00
IWASE Yusuke fead8a63e4 server: Prefer RTC route from RR client
In case that a Route Reflector(RR) and a non RR client peering, peering
of different RR clusters for example, the RR should send the RTC route
from its client even if the RTC route from non RR client is better path
based on the best path algorithm in order to notify that some RR clients
are interested in the given Route Target.

Currently, only source peer address is concerned, the RTC route from RR
client can have lower priority than non RR client and it can not be
advertised.

This patch fixes to prefer the route from RR client when selecting the
candidate to be advertised.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-28 09:24:16 +09:00
FUJITA Tomonori 36d682afc2 server: fix infinite rtc update loop with addpath
Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-26 10:53:38 +09:00
Satoshi FujimotoandFUJITA Tomonori a0c8ba4ec1 server: Gather informations for BMPPeerDownMessage
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-05-24 11:25:11 +09:00
Satoshi FujimotoandFUJITA Tomonori a980a0237e server/server: Add field to WatchEventPeerState for PeerDownEvent
To include the PeerDownReason and data in BMP messages,
this commit adds some field to WatchEventPeerState.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-05-24 11:25:11 +09:00
Satoshi FujimotoandFUJITA Tomonori abefa741b8 server/server: Restart peers when capabilities are changed
If capabilities are added or removed by updating peer configs,
it is needed to resend Open Message contains the new capabilities.
But currently, GoBGP does not resend Open Message for
Add-Path and Graceful Restart capabilities.
This commit fixes it to resend Open Message for them.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-05-24 10:13:56 +09:00
IWASE YusukeandFUJITA Tomonori eb568b68d2 server: Withdraw routes when received RTM withdrawal
Because the RTM is removed from adj-RIB-in before collecting the
candidate routes to be withdrawn, the candidates are unexpectedly
filtered before sending withdraw messages. Then on the peers, the VPN
routes are left on.

This patch fixes to selects candidates from the filtered paths and send
withdraw messages as expected. Also resolves the TODO in
"test/scenario_test/rtc_test.py".

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-24 08:41:35 +09:00
FUJITA Tomonori bbd98ee211 fix withdraw with addpath and rtc enabled
Needs withdrawn paths that includes attributes. The attributes are
necessary because they are used with rtc table to check if the paths
were sent.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-24 08:08:17 +09:00
IWASE YusukeandFUJITA Tomonori cb30860d71 zclient: Avoid flapping of nexthop reachability
Currently, GoBGP sends the ROUTE_DELETE messages to Zebra for the paths
whose nexthop was determined as unreachable by IGP, but when Zebra
received the ROUTE_DELETE messages for the unreachable nexthop, Zebra
will send the NEXTHOP_UPDATE message with the given nexthop is
reachable via the default interface. This message unexpectedly causes
updates of the unreachable path to be reachable (not true though). Then
GoBGP will send ROUTE_ADD messages to Zebra, but those paths soon will
be invalidated via the NEXTHOP_UPDATE message, GoBGP will send the
ROUTE_DELETE messages and ... (infinite loop).

This patch fixes to avoid sending the ROUTE_DELETE messages for the
unreachable paths because those paths are inactivated on Zebra and not
installed to FIB.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-23 13:00:33 +09:00
FUJITA Tomonori 30e519ea8e server: use negotiated family instead configured
Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-23 06:09:07 +09:00
Patrick HemmerandFUJITA Tomonori 9c8b20a2ef fix graceful-restart when not all peers are restarting
This fixes an issue where GoBGP would incorrectly defer sending routes to a peer on a graceful restart.
RFC4724 states:

> Once the session between the Restarting Speaker and the Receiving
> Speaker is re-established, the Restarting Speaker will receive and
> process BGP messages from its peers.  However, it MUST defer route
> selection for an address family until it either (a) receives the
> End-of-RIB marker from all its peers (excluding the ones with the
> "Restart State" bit set in the received capability and excluding the
> ones that do not advertise the graceful restart capability) or (b)
> the Selection_Deferral_Timer referred to below has expired.

The scenario that this fixes is where you have 3 (or more) peers, and 2 of the peers ("A" and "B") perform a graceful restart at the same time, but the 3rd ("C") does not. If after restart peer C sends EOR to peer A before peer B reaches BGP_FSM_ESTABLISHED with peer A, it defers the route selection. However once peer B does reach BGP_FSM_ESTABLISHED, peer A still wouldn't send any updates to peer C until the deferral expired.

This commit changes the behavior so that upon restart, once the peer receives EOR from all non-restarting peers and reaches BGP_FSM_ESTABLISHED for all restarting peers, the routes are sent to all peers.
2018-05-22 22:01:28 +09:00
FUJITA Tomonori c5fdcad572 fix add-path with vrf-neighbor
close #1661

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-11 23:31:49 +09:00
IWASE Yusuke 5653720231 mrt: Improve golint result
Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-11 12:52:32 +09:00
IWASE Yusuke 04f36f09a1 mrt: Enable to dump locally generated routes
For reloading locally generated routes by using MRT dump file, this
patch enables to include locally generated routes into TABLE_DUMPv2
records.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-05-11 12:48:42 +09:00
FUJITA Tomonori 2b0f16dcc6 bmp: avoid huge memory allocation for sending paths initially
We had to serialize all the paths once because the paths could be
modified later. Now they are immutable so we don't need.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-10 23:13:21 +09:00
FUJITA Tomonori 691d80e5d1 make Path objects in rib read-only
Now you can read Path objects in rib safely. Nobody modifies
them. GetRib() API doesn't need to clone the objects. With full
routes, this avoid allocating temporary huge memory.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-10 23:13:21 +09:00
Satoshi Fujimoto 0f88373949 server/server: Fix typo
Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-05-09 11:23:41 +09:00
FUJITA Tomonori dc9fe2b1cc table: use shorter key for map of ipv4 and ipv6 prefixes
save about 100MB memory.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +09:00
FUJITA Tomonori dd85cab1ec table: remove uuid member in originInfo structure
Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +09:00
FUJITA Tomonori 8347c6c94c table: remove VrfIds member in Path structure
Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +09:00
FUJITA Tomonori 6110fad594 avoid updating Path in the rib via MarkStale()
A path object in the adj-in is also in the master rib. We can't update
such.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +09:00
FUJITA Tomonori 957917651e table: remove withdraw/newPath/oldPath Lists in Destination
Shrink memory usage.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +09:00
FUJITA Tomonori ee91af5b63 preparation for shrinking Destination structure
Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +09:00
FUJITA Tomonori 2dbca9e29a use sorted single master table for route server setup
https://github.com/osrg/gobgp/issues/1249

The IN policy was removed. The modification by the IMPORT policy are
visible to all route server peers.

This saves some dozens bytes memory per a path.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-05-07 21:18:04 +09:00
Satoshi FujimotoandFUJITA Tomonori d31262de7d fsm: Don't wait EoR if the peer is restarting
RFC4724(Graceful Restart) says that if "Restart State" bit is set
in the Open message, its peer must not wait for the EoR marker
from the speaker before advertising routing information to the speaker.
But currently, GoBGP waits EoR even if "Restart State" bit is set
in graceful restart process.

This commit fixes it to skipping syncing process for the
restarting peers.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-04-18 21:06:25 +09:00
IWASE Yusuke b2e07101e9 server: Fix outgoing rtfilter
Currently, the result of Route Target Constraint filter is unexpectedly
ignored when Route Reflector reflecting the VPN routes because "ignore"
flag can be overwritten without evaluated.

This patch fixes to return "nil" before "ignore" flag overwritten and
enable to filter outgoing VPN routes based on RTC.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-04-18 09:18:13 +09:00
IWASE Yusuke ff81215c9c server: Avoid infinite UPDATE loop of RTM NLRI
When GoBGP dropped adj-Rib-out per Peer, we fixed to send the same Route
Target Membership (RTM) NLRI even if it is already sent. This can cause
the infinite UPDATE loop when Route Reflector(RR) reflects RTM NLRI to
its clients.

For example, the following situation causes the infinite UPDATE loop.

Topology:

     +----- RR -----+
     |              |
  Client1        Client2

When Client1 has VRF with RT 65000:1 and sends a RTM NLRI to RR, then RR
reflects the NLRI to Client2. If a new VRF with the same RT 65000:1 on
Client2 is created, Client2 will notify it to RR, then RR calculates the
best, but RR will send the NLRI from Client2 to Client1 even if it is
not the best. Client1 receives the NLRI again, calculates the best and
re-sends the best. Then, RR reflects the received NLRI ... (infinite
loop).

This patch fixes to compare the candidate path to be sent with the old
path and assume the given candidate path was already sent before if the
candidate path and the old path is the same path. Then avoids the
infinite UPDATE loop.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-04-09 12:00:22 +09:00
Abhijit GadgilandFUJITA Tomonori d5201470f3 server/rpki: fixed ROA sort
The typo in function Less() was causing logical error during comparison
and the comparison would always return whether AS number was less or not
regardless of Maxlen.

fixes #1633
2018-04-05 11:00:50 +09:00
IWASE Yusuke 264bd0ca12 packet/bgp: Getter functions for AS segment
This patch adds getter functions for the segment type and AS list of
each segment without using type assertion.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-04-03 09:16:41 +09:00
Satoshi Fujimoto cab913cb45 server/server: Set rsRib to RS client in adding dynamic neighbor
Currently, globalRib is always set to dynamic neighbors
even if they are route server clients.
This patch fixes to set rsRib when the neighbor is
a route server client.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2018-03-27 11:10:44 +09:00
kishiguro c216447b0b Fix AddPath MarshallingOption bug.
When neighbor had AddPath capability, then disable AddPath after that.  Old marshallingOptions remains.  So once neighbor enabled AddPath it can't be disabled with no AddPath capability option in Open Message.
2018-03-22 01:24:31 +09:00
IWASE YusukeandFUJITA Tomonori af84d6d79c zclient: Avoid directly access to RIB
In order to avoid races, zclient should not access to RIB without
calling APIs of BgpServer.
But currently zclient directly accesses to the global RIB when handling
NEXTHO_UPDATE messages.

This patch fixes this problem by calling BgpServer.GetRib().

Signed-off-by: IWASE Yusuke <[email protected]>
2018-02-23 14:40:48 +09:00
IWASE Yusuke 1fd4610372 config: Option to disable best path selection
Note: When this option is specified, no path will be redistributed to
any peer, because there is no best path.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-02-08 15:33:34 +09:00
FUJITA Tomonori e847d3733d server: fix dynamic neighbor crash
close #1575

if L854 is executed before L924, we hit a crash because of closing a
channel twice. This fixes the isseu but We had better to refactor the
code to delete a peer.

Signed-off-by: FUJITA Tomonori <[email protected]>
2018-02-01 22:20:56 +09:00
IWASE YusukeandFUJITA Tomonori 38223f2f51 server: Avoid to delete received paths with DeletePath API
"cli-command-syntax.md" describes "rib del all" command should delete
all locally generated paths, but currently this command deletes all paths
including received path from neighbors unexpectedly.

This patch fixes the DeletePath API to delete only locally generated
paths and solves this problem.

Current:
$ gobgp global rib -a ipv4
   Network              Next Hop             AS_PATH              Age        Attrs
*> 10.12.1.0/24         0.0.0.0                                   00:00:00   [{Origin: ?}]
*  10.12.1.0/24         10.0.0.1             65001                00:00:00   [{Origin: ?}]
$ gobgp global rib -a ipv4 del all
$ gobgp global rib -a ipv4
Network not in table

With this patch:
$ gobgp global rib -a ipv4
   Network              Next Hop             AS_PATH              Age        Attrs
*> 10.12.1.0/24         0.0.0.0                                   00:00:00   [{Origin: ?}]
*  10.12.1.0/24         10.0.0.1             65001                00:00:00   [{Origin: ?}]
$ gobgp global rib -a ipv4 del all
$ gobgp global rib -a ipv4
   Network              Next Hop             AS_PATH              Age        Attrs
*> 10.12.1.0/24         10.0.0.1             65001                00:00:10   [{Origin: ?}]

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-26 16:52:35 +09:00
Aman ShaikhandFUJITA Tomonori e36879ff7b server: resolve next-hop with FRR/Zebra for VRF routes 2018-01-26 16:17:24 +09:00
IWASE YusukeandFUJITA Tomonori 549b703738 *: Use strconv.ParseUint instead of strconv.Atoi()
For the 32-bit platform compatibility.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-24 08:18:50 +09:00
IWASE YusukeandFUJITA Tomonori 5ef8b8db3f server_test: Enhance test cases for MonitorRib API
Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-11 15:43:18 +09:00
IWASE YusukeandFUJITA Tomonori 51d0e6e91f server: Empty path list in initial WatchEventUpdate
Currently, MonitorRib API with ADJ_IN type and "current" flag returns
the initial response with an empty path list when gRPC client connecting
to GoBGP daemon.
This causes the client can not receive the current paths which GoBGP
daemon already has.

This patch fixes to compose the initial MonitorRib response with the
current paths.

Signed-off-by: IWASE Yusuke <[email protected]>
2018-01-11 15:43:18 +09:00
Satoshi FujimotoandFUJITA Tomonori 61cdca78d7 config/util: Refactor to make arguments to receivers
For code readability, this commit make some arguments
to receivers.

Signed-off-by: Satoshi Fujimoto <[email protected]>
2017-12-16 22:10:33 +09:00
FUJITA Tomonori 9da6e7c3a2 bmp: set A flag in Per-Peer Header
Needs to set set A flag in Per-Peer Header if the peer use the legacy
2-byte AS_PATH format.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-12-07 21:59:03 +09:00
FUJITA Tomonori 9225bec8e0 cmd: fix getNeighbor() to take bogus neighbor name
This fixes the ae7e572550 commit
regression. gobgp neighbor command takes a bogus neighbor name like
the following:

fujita@ubuntu:~/go/src/github.com/osrg/gobgp/gobgp$ ./gobgp n 1
BGP neighbor is 172.17.0.2, remote AS 65001
  BGP version 4, remote router ID unknown
  BGP state = active, up for 17496d 14:21:50
  BGP OutQ = 0, Flops = 0
  Hold time is 0, keepalive interval is 0 seconds
  Configured hold time is 60, keepalive interval is 20 seconds

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-11-26 23:16:25 +09:00
FUJITA Tomonori ab756c8937 table: fix merging of v4 paths with addpath enabled
V4 NLRI needs more 4 bytes with addpath enabled.

Signed-off-by: FUJITA Tomonori <[email protected]>
2017-11-23 21:43:50 +09:00
Eiichiro WatanabeandFUJITA Tomonori 667ffe3995 server: Allow 0 value to roaManager.AS for library usage 2017-11-22 16:22:35 +09:00
FUJITA Tomonori cf94bda929 server: adminDown operation wrongly resets State.PeerAs
Signed-off-by: FUJITA Tomonori <[email protected]>
2017-11-22 11:08:14 +09:00