Skip to content

Commit b0935b7

Browse files
KillMaster9oilbeater
authored andcommitted
fix ovn-speaker router bug (#2433)
Co-authored-by: Edison Meng (孟志慧)-浪潮数据 <mengzhihui01@inspur.com> (cherry picked from commit f4bef89)
1 parent 7f6ba2b commit b0935b7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/speaker/subnet.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package speaker
44
import (
55
"context"
66
"fmt"
7+
"golang.org/x/sys/unix"
78
"net"
89
"strconv"
910
"strings"
@@ -90,7 +91,8 @@ func (c *Controller) syncSubnetRoutes() {
9091
attrInterfaces, _ := bgpapiutil.UnmarshalPathAttributes(path.Pattrs)
9192
nextHop := getNextHopFromPathAttributes(attrInterfaces)
9293
klog.V(5).Infof("nexthop is %s, routerID is %s", nextHop.String(), c.config.RouterId)
93-
if nextHop.String() == c.config.RouterId {
94+
route, _ := netlink.RouteGet(nextHop)
95+
if len(route) == 1 && route[0].Type == unix.RTN_LOCAL || nextHop.String() == c.config.RouterId {
9496
bgpExists = append(bgpExists, d.Prefix)
9597
return
9698
}

0 commit comments

Comments
 (0)