Skip to content
Snippets Groups Projects
Commit bd2a1211 authored by Maximilian Wilhelm's avatar Maximilian Wilhelm
Browse files

Add configuration parameters for route reflection (RFC4456)


  Add configuration parameters for route reflection and propagate config
  options into peer and FSM.

Signed-off-by: default avatarMaximilian Wilhelm <max@sdn.clinic>
parent 03c33a2f
No related branches found
No related tags found
No related merge requests found
......@@ -10,20 +10,22 @@ import (
// Peer defines the configuration for a BGP session
type Peer struct {
AdminEnabled bool
ReconnectInterval time.Duration
KeepAlive time.Duration
HoldTime time.Duration
LocalAddress bnet.IP
PeerAddress bnet.IP
LocalAS uint32
PeerAS uint32
Passive bool
RouterID uint32
AddPathSend routingtable.ClientOptions
AddPathRecv bool
ImportFilter *filter.Filter
ExportFilter *filter.Filter
RouteServerClient bool
IPv6 bool
AdminEnabled bool
ReconnectInterval time.Duration
KeepAlive time.Duration
HoldTime time.Duration
LocalAddress bnet.IP
PeerAddress bnet.IP
LocalAS uint32
PeerAS uint32
Passive bool
RouterID uint32
AddPathSend routingtable.ClientOptions
AddPathRecv bool
ImportFilter *filter.Filter
ExportFilter *filter.Filter
RouteServerClient bool
RouteReflectorClient bool
RouteReflectorClusterID uint32
IPv6 bool
}
......@@ -77,13 +77,15 @@ func (s *establishedState) init() error {
}
n := &routingtable.Neighbor{
Type: route.BGPPathType,
Address: s.fsm.peer.addr,
IBGP: s.fsm.peer.localASN == s.fsm.peer.peerASN,
LocalASN: s.fsm.peer.localASN,
RouteServerClient: s.fsm.peer.routeServerClient,
LocalAddress: localAddr,
CapAddPathRX: s.fsm.options.AddPathRX,
Type: route.BGPPathType,
Address: s.fsm.peer.addr,
IBGP: s.fsm.peer.localASN == s.fsm.peer.peerASN,
LocalASN: s.fsm.peer.localASN,
RouteServerClient: s.fsm.peer.routeServerClient,
LocalAddress: localAddr,
CapAddPathRX: s.fsm.options.AddPathRX,
RouteReflectorClient: s.fsm.peer.routeReflectorClient,
ClusterID: s.fsm.peer.clusterID,
}
s.fsm.adjRIBOut = adjRIBOut.New(n, s.fsm.peer.exportFilter)
......
......@@ -28,17 +28,19 @@ type peer struct {
fsms []*FSM
fsmsMu sync.Mutex
rib *locRIB.LocRIB
routerID uint32
addPathSend routingtable.ClientOptions
addPathRecv bool
reconnectInterval time.Duration
keepaliveTime time.Duration
holdTime time.Duration
optOpenParams []packet.OptParam
importFilter *filter.Filter
exportFilter *filter.Filter
routeServerClient bool
rib *locRIB.LocRIB
routerID uint32
addPathSend routingtable.ClientOptions
addPathRecv bool
reconnectInterval time.Duration
keepaliveTime time.Duration
holdTime time.Duration
optOpenParams []packet.OptParam
importFilter *filter.Filter
exportFilter *filter.Filter
routeServerClient bool
routeReflectorClient bool
clusterID uint32
}
func (p *peer) snapshot() PeerInfo {
......@@ -106,21 +108,23 @@ func newPeer(c config.Peer, rib *locRIB.LocRIB, server *bgpServer) (*peer, error
c.LocalAS = server.localASN
}
p := &peer{
server: server,
addr: c.PeerAddress,
peerASN: c.PeerAS,
localASN: c.LocalAS,
fsms: make([]*FSM, 0),
rib: rib,
addPathSend: c.AddPathSend,
addPathRecv: c.AddPathRecv,
reconnectInterval: c.ReconnectInterval,
keepaliveTime: c.KeepAlive,
holdTime: c.HoldTime,
optOpenParams: make([]packet.OptParam, 0),
importFilter: filterOrDefault(c.ImportFilter),
exportFilter: filterOrDefault(c.ExportFilter),
routeServerClient: c.RouteServerClient,
server: server,
addr: c.PeerAddress,
peerASN: c.PeerAS,
localASN: c.LocalAS,
fsms: make([]*FSM, 0),
rib: rib,
addPathSend: c.AddPathSend,
addPathRecv: c.AddPathRecv,
reconnectInterval: c.ReconnectInterval,
keepaliveTime: c.KeepAlive,
holdTime: c.HoldTime,
optOpenParams: make([]packet.OptParam, 0),
importFilter: filterOrDefault(c.ImportFilter),
exportFilter: filterOrDefault(c.ExportFilter),
routeServerClient: c.RouteServerClient,
routeReflectorClient: c.RouteReflectorClient,
clusterID: c.RouteReflectorClusterID,
}
p.fsms = append(p.fsms, NewActiveFSM2(p))
......
......@@ -17,6 +17,7 @@ type UpdateSender struct {
routingtable.ClientManager
fsm *FSM
iBGP bool
rrClient bool
toSendMu sync.Mutex
toSend map[string]*pathPfxs
destroyCh chan struct{}
......@@ -31,6 +32,7 @@ func newUpdateSender(fsm *FSM) *UpdateSender {
return &UpdateSender{
fsm: fsm,
iBGP: fsm.peer.localASN == fsm.peer.peerASN,
rrClient: fsm.peer.routeReflectorClient,
destroyCh: make(chan struct{}),
toSend: make(map[string]*pathPfxs),
}
......
......@@ -22,6 +22,12 @@ type Neighbor struct {
// Peer is a route server client
RouteServerClient bool
// Peer is a route reflector client
RouteReflectorClient bool
// Our route reflection clusterID
ClusterID uint32
// CapAddPathRX indicates if the peer supports receiving multiple BGP paths
CapAddPathRX bool
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment