diff options
author | Hitoshi Irino <irino@sfc.wide.ad.jp> | 2019-06-24 00:39:22 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-07-02 11:40:22 +0900 |
commit | 2f5a4d59cb8d494bcf1a64d45d84bcd8fd4a7f06 (patch) | |
tree | 130afc174fe85d32abe3ad4994aecec3461ffcc4 /pkg/server/server.go | |
parent | 9f936065a907639661eca3924f0a8f09d94abbfe (diff) |
BGP connection on a speecified interface (including which is associated VRF) using syscall SO_BINDTODEVICE
Diffstat (limited to 'pkg/server/server.go')
-rw-r--r-- | pkg/server/server.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go index 82efeb6a..d77512f5 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -250,6 +250,7 @@ func (s *BgpServer) passConnToPeer(conn *net.TCPConn) { } peer.fsm.lock.RLock() localAddr := peer.fsm.pConf.Transport.Config.LocalAddress + bindInterface := peer.fsm.pConf.Transport.Config.BindInterface peer.fsm.lock.RUnlock() localAddrValid := func(laddr string) bool { if laddr == "0.0.0.0" || laddr == "::" { @@ -262,12 +263,13 @@ func (s *BgpServer) passConnToPeer(conn *net.TCPConn) { } host, _, _ := net.SplitHostPort(l.String()) - if host != laddr { + if host != laddr && bindInterface == "" { log.WithFields(log.Fields{ "Topic": "Peer", "Key": remoteAddr, "Configured addr": laddr, "Addr": host, + "BindInterface": bindInterface, }).Info("Mismatched local address") return false } |