summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorchenhaiq@yunify.com <chenhaiq@yunify.com>2018-07-09 22:05:04 +0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-07-14 15:27:53 +0900
commit179824221b5fd135375c82c6291a2bcf1008902f (patch)
treee8bbd095173c373f69c243aaefaf6d41aaa5c9b8
parentdd735314ce065cd5b170052fa0f8341ca5bf123f (diff)
cmd: implement ebgp-multihop-ttl option when add neighbor
Signed-off-by: Chen Haiquan <oc@yunify.com>
-rw-r--r--cmd/gobgp/cmd/neighbor.go15
-rw-r--r--docs/sources/cli-command-syntax.md2
2 files changed, 15 insertions, 2 deletions
diff --git a/cmd/gobgp/cmd/neighbor.go b/cmd/gobgp/cmd/neighbor.go
index ad946e5b..9b1e96ee 100644
--- a/cmd/gobgp/cmd/neighbor.go
+++ b/cmd/gobgp/cmd/neighbor.go
@@ -1044,7 +1044,8 @@ func modNeighbor(cmdType string, args []string) error {
params["allow-own-as"] = PARAM_SINGLE
params["remove-private-as"] = PARAM_SINGLE
params["replace-peer-as"] = PARAM_FLAG
- usage += " [ family <address-families-list> | vrf <vrf-name> | route-reflector-client [<cluster-id>] | route-server-client | allow-own-as <num> | remove-private-as (all|replace) | replace-peer-as ]"
+ params["ebgp-multihop-ttl"] = PARAM_SINGLE
+ usage += " [ family <address-families-list> | vrf <vrf-name> | route-reflector-client [<cluster-id>] | route-server-client | allow-own-as <num> | remove-private-as (all|replace) | replace-peer-as | ebgp-multihop-ttl <ttl>]"
}
m, err := extractReserved(args, params)
@@ -1146,6 +1147,18 @@ func modNeighbor(cmdType string, args []string) error {
if _, ok := m["replace-peer-as"]; ok {
peer.AsPathOptions.Config.ReplacePeerAs = true
}
+ if len(m["ebgp-multihop-ttl"]) == 1 {
+ ttl, err := strconv.ParseUint(m["ebgp-multihop-ttl"][0], 10, 32)
+ if err != nil {
+ return err
+ }
+ peer.EbgpMultihop = config.EbgpMultihop{
+ Config: config.EbgpMultihopConfig{
+ Enabled: true,
+ MultihopTtl: uint8(ttl),
+ },
+ }
+ }
return nil
}
diff --git a/docs/sources/cli-command-syntax.md b/docs/sources/cli-command-syntax.md
index 232f1577..a6ac362b 100644
--- a/docs/sources/cli-command-syntax.md
+++ b/docs/sources/cli-command-syntax.md
@@ -126,7 +126,7 @@ Also, refer to the following for the detail syntax of each address family.
```shell
# add neighbor
-% gobgp neighbor add { <neighbor address> | interface <ifname> } as <as number> [ vrf <vrf-name> | route-reflector-client [<cluster-id>] | route-server-client | allow-own-as <num> | remove-private-as (all|replace) | replace-peer-as ]
+% gobgp neighbor add { <neighbor address> | interface <ifname> } as <as number> [ vrf <vrf-name> | route-reflector-client [<cluster-id>] | route-server-client | allow-own-as <num> | remove-private-as (all|replace) | replace-peer-as | ebgp-multihop-ttl <ttl>]
# delete neighbor
% gobgp neighbor delete { <neighbor address> | interface <ifname> }
% gobgp neighbor <neighbor address> softreset [-a <address family>]