summaryrefslogtreecommitdiffhomepage
path: root/config
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-06-01 04:50:38 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-06-01 05:06:37 +0000
commit4c9cd88c61cb848e36a45657b7cbc63b9c783dc4 (patch)
tree65f5dfdc3b1e26a2376e0c45d5991c0df2af98d3 /config
parent835d1f38e7f164393494191a5a58b29c8c9a88ac (diff)
server/config: fix md5ed ipv6 active connection
Local address of md5ed active connection was hard-coded as "0.0.0.0". Let's set appropriate default local address (0.0.0.0 or ::) in SetDefaultConfigValues() and clean up (*FSM).connectLoop() instead of ad-hoc connectLoop() fix. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config')
-rw-r--r--config/default.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/config/default.go b/config/default.go
index 02ec5784..ea1c731f 100644
--- a/config/default.go
+++ b/config/default.go
@@ -113,6 +113,17 @@ func SetDefaultConfigValues(v *viper.Viper, b *BgpConfigSet) error {
n.Timers.Config.IdleHoldTimeAfterReset = float64(DEFAULT_IDLE_HOLDTIME_AFTER_RESET)
}
+ if !vv.IsSet("neighbor.transport.config.local-address") {
+ v6 := true
+ if ip := net.ParseIP(n.Config.NeighborAddress); ip.To4() != nil {
+ v6 = false
+ }
+ if v6 {
+ n.Transport.Config.LocalAddress = "::"
+ } else {
+ n.Transport.Config.LocalAddress = "0.0.0.0"
+ }
+ }
if !vv.IsSet("neighbor.afi-safis") {
if ip := net.ParseIP(n.Config.NeighborAddress); ip.To4() != nil {
n.AfiSafis = []AfiSafi{defaultAfiSafi(AFI_SAFI_TYPE_IPV4_UNICAST, true)}