summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packet/bgp/validate.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/packet/bgp/validate.go b/packet/bgp/validate.go
index 77a125b9..be44e605 100644
--- a/packet/bgp/validate.go
+++ b/packet/bgp/validate.go
@@ -37,7 +37,7 @@ func ValidateUpdateMsg(m *BGPUpdate, rfs map[RouteFamily]BGPAddPathMode, doConfe
}
}
- if len(m.NLRI) > 0 {
+ if _, ok := seen[BGP_ATTR_TYPE_MP_REACH_NLRI]; ok || len(m.NLRI) > 0 {
// check the existence of well-known mandatory attributes
exist := func(attrs []BGPAttrType) (bool, BGPAttrType) {
for _, attr := range attrs {
@@ -48,7 +48,10 @@ func ValidateUpdateMsg(m *BGPUpdate, rfs map[RouteFamily]BGPAddPathMode, doConfe
}
return true, 0
}
- mandatory := []BGPAttrType{BGP_ATTR_TYPE_ORIGIN, BGP_ATTR_TYPE_AS_PATH, BGP_ATTR_TYPE_NEXT_HOP}
+ mandatory := []BGPAttrType{BGP_ATTR_TYPE_ORIGIN, BGP_ATTR_TYPE_AS_PATH}
+ if len(m.NLRI) > 0 {
+ mandatory = append(mandatory, BGP_ATTR_TYPE_NEXT_HOP)
+ }
if ok, t := exist(mandatory); !ok {
eMsg := "well-known mandatory attributes are not present. type : " + strconv.Itoa(int(t))
data := []byte{byte(t)}