summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-07-12 14:31:00 +0900
committerIWASE Yusuke <iwase.yusuke0@gmail.com>2017-07-14 13:16:48 +0900
commiteb95f000bf4ab70c2dad7589e58045fbce1addf1 (patch)
tree89288b13cd13e2e87727db82706c754055b0c5af /server
parent1ab232c751772d3501ee3d84be8fce095b091ca6 (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.go22
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",