summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/sources/cli-command-syntax.md8
-rw-r--r--gobgp/cmd/global.go15
-rw-r--r--server/server.go6
-rw-r--r--table/vrf.go6
4 files changed, 17 insertions, 18 deletions
diff --git a/docs/sources/cli-command-syntax.md b/docs/sources/cli-command-syntax.md
index b33553f2..67ae21b4 100644
--- a/docs/sources/cli-command-syntax.md
+++ b/docs/sources/cli-command-syntax.md
@@ -73,10 +73,10 @@ If you want to remove routes with the address of the ipv6 from global rib:
% gobgp global rib add -a ipv4-mpls 10.0.0.0/24 100/200
% gobgp global rib add -a ipv4-mpls 10.0.0.0/24 100 nexthop 20.20.20.20
% gobgp global rib add -a ipv4-mpls 10.0.0.0/24 100 med 10
-% gobgp global rib add -a vpnv4 10.0.0.0/24 rd 100:100
-% gobgp global rib add -a vpnv4 10.0.0.0/24 rd 100.100:100
-% gobgp global rib add -a vpnv4 10.0.0.0/24 rd 10.10.10.10:100
-% gobgp global rib add -a vpnv4 10.0.0.0/24 rd 100:100 rt 100:200
+% gobgp global rib add -a vpnv4 10.0.0.0/24 label 10 rd 100:100
+% gobgp global rib add -a vpnv4 10.0.0.0/24 label 10 rd 100.100:100
+% gobgp global rib add -a vpnv4 10.0.0.0/24 label 10 rd 10.10.10.10:100
+% gobgp global rib add -a vpnv4 10.0.0.0/24 label 10 rd 100:100 rt 100:200
% gobgp global rib add -a opaque key hello value world
```
diff --git a/gobgp/cmd/global.go b/gobgp/cmd/global.go
index 59e83346..125726be 100644
--- a/gobgp/cmd/global.go
+++ b/gobgp/cmd/global.go
@@ -717,20 +717,24 @@ func ParsePath(rf bgp.RouteFamily, args []string) (*api.Path, error) {
extcomms = args[1:]
case bgp.RF_IPv4_VPN, bgp.RF_IPv6_VPN:
- if len(args) < 3 || args[1] != "rd" {
+ if len(args) < 5 || args[1] != "label" || args[3] != "rd" {
return nil, fmt.Errorf("invalid format")
}
ip, net, _ := net.ParseCIDR(args[0])
ones, _ := net.Mask.Size()
- rd, err = bgp.ParseRouteDistinguisher(args[2])
+ label := 0
+ if label, err = strconv.Atoi(args[2]); err != nil {
+ return nil, fmt.Errorf("invalid format")
+ }
+ mpls := bgp.NewMPLSLabelStack(uint32(label))
+
+ rd, err = bgp.ParseRouteDistinguisher(args[4])
if err != nil {
return nil, err
}
- extcomms = args[3:]
-
- mpls := bgp.NewMPLSLabelStack()
+ extcomms = args[5:]
if rf == bgp.RF_IPv4_VPN {
if ip.To4() == nil {
@@ -836,7 +840,6 @@ func modPath(resource api.Resource, name, modtype string, args []string) error {
}
path, err := ParsePath(rf, args)
-
if err != nil {
cmdstr := "global"
if resource == api.Resource_VRF {
diff --git a/server/server.go b/server/server.go
index 11462869..754834e7 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1109,12 +1109,8 @@ func (server *BgpServer) fixupApiPath(vrfId string, pathList []*table.Path) erro
}
if vrfId != "" {
- label, err := server.globalRib.GetNextLabel(vrfId, path.GetNexthop().String(), path.IsWithdraw)
- if err != nil {
- return err
- }
vrf := server.globalRib.Vrfs[vrfId]
- if err := vrf.ToGlobalPath(path, label); err != nil {
+ if err := vrf.ToGlobalPath(path); err != nil {
return err
}
}
diff --git a/table/vrf.go b/table/vrf.go
index 83b9e353..15b194db 100644
--- a/table/vrf.go
+++ b/table/vrf.go
@@ -29,15 +29,15 @@ type Vrf struct {
LabelMap map[string]uint32
}
-func (v *Vrf) ToGlobalPath(path *Path, label uint32) error {
+func (v *Vrf) ToGlobalPath(path *Path) error {
nlri := path.GetNlri()
switch rf := path.GetRouteFamily(); rf {
case bgp.RF_IPv4_UC:
n := nlri.(*bgp.IPAddrPrefix)
- path.OriginInfo().nlri = bgp.NewLabeledVPNIPAddrPrefix(n.Length, n.Prefix.String(), *bgp.NewMPLSLabelStack(label), v.Rd)
+ path.OriginInfo().nlri = bgp.NewLabeledVPNIPAddrPrefix(n.Length, n.Prefix.String(), *bgp.NewMPLSLabelStack(0), v.Rd)
case bgp.RF_IPv6_UC:
n := nlri.(*bgp.IPv6AddrPrefix)
- path.OriginInfo().nlri = bgp.NewLabeledVPNIPv6AddrPrefix(n.Length, n.Prefix.String(), *bgp.NewMPLSLabelStack(label), v.Rd)
+ path.OriginInfo().nlri = bgp.NewLabeledVPNIPv6AddrPrefix(n.Length, n.Prefix.String(), *bgp.NewMPLSLabelStack(0), v.Rd)
case bgp.RF_EVPN:
n := nlri.(*bgp.EVPNNLRI)
switch n.RouteType {