summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--table/message.go8
-rw-r--r--table/path.go6
2 files changed, 12 insertions, 2 deletions
diff --git a/table/message.go b/table/message.go
index 07c15511..af4affa6 100644
--- a/table/message.go
+++ b/table/message.go
@@ -257,9 +257,13 @@ func UpdatePathAggregator4ByteAs(msg *bgp.BGPUpdate) error {
}
func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage {
- rf := path.GetRouteFamily()
+ family := path.GetRouteFamily()
+ v4 := true
+ if family != bgp.RF_IPv4_UC || !path.IsWithdraw && path.GetNexthop().To4() == nil {
+ v4 = false
+ }
- if rf == bgp.RF_IPv4_UC {
+ if v4 {
nlri := path.GetNlri().(*bgp.IPAddrPrefix)
if path.IsWithdraw {
if msg != nil {
diff --git a/table/path.go b/table/path.go
index 82af18c1..c31d6cc6 100644
--- a/table/path.go
+++ b/table/path.go
@@ -394,6 +394,12 @@ func (path *Path) GetNexthop() net.IP {
}
func (path *Path) SetNexthop(nexthop net.IP) {
+ if path.GetRouteFamily() == bgp.RF_IPv4_UC && nexthop.To4() == nil {
+ path.delPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
+ mpreach := bgp.NewPathAttributeMpReachNLRI(nexthop.String(), []bgp.AddrPrefixInterface{path.GetNlri()})
+ path.setPathAttr(mpreach)
+ return
+ }
attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP)
if attr != nil {
path.setPathAttr(bgp.NewPathAttributeNextHop(nexthop.String()))