Skip to content

Commit 7bd53d7

Browse files
Fix invalid nexthop advertisement with nexthop-unchanged
When we apply nexthop-unchanged action to the locally-originated route with unspecified nexthop (0.0.0.0 or ::), we advertise the path with unspecified nexthop. This may ends up with the session shutdown with Invalid Update Message Notification (only tested with FRR 10.2.1). Fix this issue by setting table.PolicyOptions.OldNextHop to the local peering address when the path is locally-originated and has an unspecified nexthop. Signed-off-by: Yutaro Hayakawa <[email protected]>
1 parent 62938a8 commit 7bd53d7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/server/server.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,17 @@ func (s *BgpServer) prePolicyFilterpath(peer *peer, path, old *table.Path) (*tab
781781

782782
peer.fsm.lock.RLock()
783783
options := &table.PolicyOptions{
784-
Info: peer.fsm.peerInfo,
785-
OldNextHop: path.GetNexthop(),
784+
Info: peer.fsm.peerInfo,
785+
}
786+
if path.IsLocal() && path.GetNexthop().IsUnspecified() {
787+
// We need a special treatment for the locally-originated path
788+
// with unspecified nexthop (0.0.0.0 or ::). In this case, the
789+
// OldNextHop option should be set to the local address.
790+
// Otherwise, we advertise the unspecified nexthop as is when
791+
// nexthop-unchanged is configured.
792+
options.OldNextHop = peer.fsm.peerInfo.LocalAddress
793+
} else {
794+
options.OldNextHop = path.GetNexthop()
786795
}
787796
path = table.UpdatePathAttrs(peer.fsm.logger, peer.fsm.gConf, peer.fsm.pConf, peer.fsm.peerInfo, path)
788797
peer.fsm.lock.RUnlock()

0 commit comments

Comments
 (0)