diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-07-12 14:31:00 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-07-14 13:16:48 +0900 |
commit | eb95f000bf4ab70c2dad7589e58045fbce1addf1 (patch) | |
tree | 89288b13cd13e2e87727db82706c754055b0c5af /server | |
parent | 1ab232c751772d3501ee3d84be8fce095b091ca6 (diff) |
server: Skip TCP MD5Sig sockopt when empty auth-password
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/server/server.go b/server/server.go index bbbfb524..2dda4dff 100644 --- a/server/server.go +++ b/server/server.go @@ -1722,14 +1722,13 @@ func (server *BgpServer) addNeighbor(c *config.Neighbor) error { if server.bgpConfig.Global.Config.Port > 0 { for _, l := range server.Listeners(addr) { - if err := SetTcpMD5SigSockopts(l, addr, c.Config.AuthPassword); err != nil { - log.WithFields(log.Fields{ - "Topic": "Peer", - }).Debugf("failed to set md5 %s %s", addr, err) - } else { - log.WithFields(log.Fields{ - "Topic": "Peer", - }).Debugf("successfully set md5 %s", addr) + if c.Config.AuthPassword != "" { + if err := SetTcpMD5SigSockopts(l, addr, c.Config.AuthPassword); err != nil { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": addr, + }).Warnf("failed to set md5: %s", err) + } } } } @@ -1826,7 +1825,12 @@ func (server *BgpServer) deleteNeighbor(c *config.Neighbor, code, subcode uint8) return fmt.Errorf("Can't delete a peer configuration for %s", addr) } for _, l := range server.Listeners(addr) { - SetTcpMD5SigSockopts(l, addr, "") + if err := SetTcpMD5SigSockopts(l, addr, ""); err != nil { + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": addr, + }).Warnf("failed to unset md5: %s", err) + } } log.WithFields(log.Fields{ "Topic": "Peer", |