diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-08-03 04:22:05 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-04 22:07:46 +0900 |
commit | 806e4c250b1eca27162b1515a7f6b712c9b79f1e (patch) | |
tree | c69c4d1679284cf00b75e8f648de99acd8e93a59 /config | |
parent | 6f102593b71931226d78a9f592173c4742859549 (diff) |
config: enabled IPv4/IPv6 unicast for BGP unnumbered peer by default
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config')
-rw-r--r-- | config/default.go | 10 | ||||
-rw-r--r-- | config/default_linux.go | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/config/default.go b/config/default.go index a95b535b..92c743dd 100644 --- a/config/default.go +++ b/config/default.go @@ -119,6 +119,9 @@ func setDefaultNeighborConfigValuesWithViper(v *viper.Viper, n *Neighbor, asn ui } if n.Config.NeighborInterface != "" { + if n.RouteServer.Config.RouteServerClient { + return fmt.Errorf("configuring route server client as unnumbered peer is not supported") + } addr, err := GetIPv6LinkLocalNeighborAddress(n.Config.NeighborInterface) if err != nil { return err @@ -148,7 +151,12 @@ func setDefaultNeighborConfigValuesWithViper(v *viper.Viper, n *Neighbor, asn ui } if len(n.AfiSafis) == 0 { - if ipAddr, err := net.ResolveIPAddr("ip", n.Config.NeighborAddress); err != nil { + if n.Config.NeighborInterface != "" { + n.AfiSafis = []AfiSafi{ + defaultAfiSafi(AFI_SAFI_TYPE_IPV4_UNICAST, true), + defaultAfiSafi(AFI_SAFI_TYPE_IPV6_UNICAST, true), + } + } else if ipAddr, err := net.ResolveIPAddr("ip", n.Config.NeighborAddress); err != nil { return fmt.Errorf("invalid neighbor address: %s", n.Config.NeighborAddress) } else if ipAddr.IP.To4() != nil { n.AfiSafis = []AfiSafi{defaultAfiSafi(AFI_SAFI_TYPE_IPV4_UNICAST, true)} diff --git a/config/default_linux.go b/config/default_linux.go index 34a274fd..6bee2317 100644 --- a/config/default_linux.go +++ b/config/default_linux.go @@ -38,7 +38,7 @@ func GetIPv6LinkLocalNeighborAddress(ifname string) (string, error) { if err != nil { return "", err } - if neigh.IP.IsLinkLocalUnicast() && !local { + if neigh.State&netlink.NUD_FAILED == 0 && neigh.IP.IsLinkLocalUnicast() && !local { addr = neigh.IP cnt += 1 } |