Skip to content
Snippets Groups Projects
Commit d4b9ea31 authored by Daniel Czerwonk's avatar Daniel Czerwonk
Browse files

skipping MP when not aggreed to

parent 54c41571
Branches
Tags
No related merge requests found
...@@ -222,14 +222,7 @@ func (s *establishedState) updates(u *packet.BGPUpdate) { ...@@ -222,14 +222,7 @@ func (s *establishedState) updates(u *packet.BGPUpdate) {
for r := u.NLRI; r != nil; r = r.Next { for r := u.NLRI; r != nil; r = r.Next {
pfx := bnet.NewPfx(bnet.IPv4(r.IP), r.Pfxlen) pfx := bnet.NewPfx(bnet.IPv4(r.IP), r.Pfxlen)
path := &route.Path{ path := s.newRoutePath()
Type: route.BGPPathType,
BGPPath: &route.BGPPath{
Source: s.fsm.peer.addr,
EBGP: s.fsm.peer.localASN != s.fsm.peer.peerASN,
},
}
s.processAttributes(u.PathAttributes, path) s.processAttributes(u.PathAttributes, path)
s.fsm.adjRIBIn.AddPath(pfx, path) s.fsm.adjRIBIn.AddPath(pfx, path)
...@@ -237,14 +230,11 @@ func (s *establishedState) updates(u *packet.BGPUpdate) { ...@@ -237,14 +230,11 @@ func (s *establishedState) updates(u *packet.BGPUpdate) {
} }
func (s *establishedState) multiProtocolUpdates(u *packet.BGPUpdate) { func (s *establishedState) multiProtocolUpdates(u *packet.BGPUpdate) {
path := &route.Path{ if !s.fsm.options.SupportsMultiProtocol {
Type: route.BGPPathType, return
BGPPath: &route.BGPPath{
Source: s.fsm.peer.addr,
EBGP: s.fsm.peer.localASN != s.fsm.peer.peerASN,
},
} }
path := s.newRoutePath()
s.processAttributes(u.PathAttributes, path) s.processAttributes(u.PathAttributes, path)
for pa := u.PathAttributes; pa != nil; pa = pa.Next { for pa := u.PathAttributes; pa != nil; pa = pa.Next {
...@@ -257,6 +247,16 @@ func (s *establishedState) multiProtocolUpdates(u *packet.BGPUpdate) { ...@@ -257,6 +247,16 @@ func (s *establishedState) multiProtocolUpdates(u *packet.BGPUpdate) {
} }
} }
func (s *establishedState) newRoutePath() *route.Path {
return &route.Path{
Type: route.BGPPathType,
BGPPath: &route.BGPPath{
Source: s.fsm.peer.addr,
EBGP: s.fsm.peer.localASN != s.fsm.peer.peerASN,
},
}
}
func (s *establishedState) multiProtocolUpdate(path *route.Path, nlri packet.MultiProtocolReachNLRI) { func (s *establishedState) multiProtocolUpdate(path *route.Path, nlri packet.MultiProtocolReachNLRI) {
for _, pfx := range nlri.Prefixes { for _, pfx := range nlri.Prefixes {
s.fsm.adjRIBIn.AddPath(pfx, path) s.fsm.adjRIBIn.AddPath(pfx, path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment