summaryrefslogtreecommitdiffhomepage
path: root/config/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/util.go')
-rw-r--r--config/util.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/config/util.go b/config/util.go
index 36999411..8ecf56d5 100644
--- a/config/util.go
+++ b/config/util.go
@@ -140,3 +140,14 @@ func ParseMaskLength(prefix, mask string) (int, int, error) {
}
return min, max, nil
}
+
+func ExtractNeighborAddress(c *Neighbor) (string, error) {
+ addr := c.State.NeighborAddress
+ if addr == "" {
+ addr = c.Config.NeighborAddress
+ if addr == "" {
+ return "", fmt.Errorf("NeighborAddress is not configured")
+ }
+ }
+ return addr, nil
+}