summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gobgp/cmd/neighbor.go19
-rw-r--r--server/server.go4
2 files changed, 20 insertions, 3 deletions
diff --git a/gobgp/cmd/neighbor.go b/gobgp/cmd/neighbor.go
index f30f1643..5b108ebb 100644
--- a/gobgp/cmd/neighbor.go
+++ b/gobgp/cmd/neighbor.go
@@ -803,13 +803,13 @@ func modNeighborPolicy(remoteIP, policyType, cmdType string, args []string) erro
}
func modNeighbor(cmdType string, args []string) error {
- m := extractReserved(args, []string{"interface", "as", "vrf"})
+ m := extractReserved(args, []string{"interface", "as", "vrf", "route-reflector-client", "route-server-client"})
usage := fmt.Sprintf("usage: gobgp neighbor %s [<neighbor-address>| interface <neighbor-interface>]", cmdType)
if cmdType == CMD_ADD {
- usage += " as <VALUE> [ vrf <vrf-name> ]"
+ usage += " as <VALUE> [ vrf <vrf-name> | route-reflector-client [<cluster-id>] | route-server-client ]"
}
- if (len(m[""]) != 1 && len(m["interface"]) != 1) || len(m["as"]) > 1 || len(m["vrf"]) > 1 {
+ if (len(m[""]) != 1 && len(m["interface"]) != 1) || len(m["as"]) > 1 || len(m["vrf"]) > 1 || len(m["route-reflector-client"]) > 1 {
return fmt.Errorf("%s", usage)
}
unnumbered := len(m["interface"]) > 0
@@ -833,6 +833,19 @@ func modNeighbor(cmdType string, args []string) error {
if len(m["vrf"]) == 1 {
peer.Conf.Vrf = m["vrf"][0]
}
+ if rr, ok := m["route-reflector-client"]; ok {
+ peer.RouteReflector = &api.RouteReflector{
+ RouteReflectorClient: true,
+ }
+ if len(rr) == 1 {
+ peer.RouteReflector.RouteReflectorClusterId = rr[0]
+ }
+ }
+ if _, ok := m["route-server-client"]; ok {
+ peer.RouteServer = &api.RouteServer{
+ RouteServerClient: true,
+ }
+ }
return peer
}
var err error
diff --git a/server/server.go b/server/server.go
index 17710f11..bcf34bd3 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1675,6 +1675,10 @@ func (server *BgpServer) addNeighbor(c *config.Neighbor) error {
}
}
+ if c.RouteServer.Config.RouteServerClient && c.RouteReflector.Config.RouteReflectorClient {
+ return fmt.Errorf("can't be both route-server-client and route-reflector-client")
+ }
+
if server.bgpConfig.Global.Config.Port > 0 {
for _, l := range server.Listeners(addr) {
if err := SetTcpMD5SigSockopts(l, addr, c.Config.AuthPassword); err != nil {