summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--api/gobgp.pb.go6
-rw-r--r--api/gobgp.proto2
-rw-r--r--gobgp/cmd/neighbor.go10
-rw-r--r--server/server.go11
4 files changed, 13 insertions, 16 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go
index d59a11da..a4f6069b 100644
--- a/api/gobgp.pb.go
+++ b/api/gobgp.pb.go
@@ -537,9 +537,9 @@ func (m *Path) String() string { return proto.CompactTextString(m) }
func (*Path) ProtoMessage() {}
type Destination struct {
- Prefix string `protobuf:"bytes,1,opt,name=prefix" json:"prefix,omitempty"`
- Paths []*Path `protobuf:"bytes,2,rep,name=paths" json:"paths,omitempty"`
- LongerPrefix bool `protobuf:"varint,3,opt,name=longer_prefix" json:"longer_prefix,omitempty"`
+ Prefix string `protobuf:"bytes,1,opt,name=prefix" json:"prefix,omitempty"`
+ Paths []*Path `protobuf:"bytes,2,rep,name=paths" json:"paths,omitempty"`
+ LongerPrefixes bool `protobuf:"varint,3,opt,name=longer_prefixes" json:"longer_prefixes,omitempty"`
}
func (m *Destination) Reset() { *m = Destination{} }
diff --git a/api/gobgp.proto b/api/gobgp.proto
index b78020bb..2d5cde94 100644
--- a/api/gobgp.proto
+++ b/api/gobgp.proto
@@ -170,7 +170,7 @@ message Path {
message Destination {
string prefix = 1;
repeated Path paths = 2;
- bool longer_prefix = 3;
+ bool longer_prefixes = 3;
}
message Table {
diff --git a/gobgp/cmd/neighbor.go b/gobgp/cmd/neighbor.go
index 41b7579e..f08d49b0 100644
--- a/gobgp/cmd/neighbor.go
+++ b/gobgp/cmd/neighbor.go
@@ -410,17 +410,17 @@ func showNeighborRib(r string, name string, args []string) error {
if rf != bgp.RF_IPv4_UC && rf != bgp.RF_IPv6_UC {
return fmt.Errorf("route filtering is only supported for IPv4/IPv6 unicast routes")
}
- longerPrefix := false
+ longerPrefixes := false
if len(args) > 1 {
- if args[1] != "longer-prefix" {
+ if args[1] != "longer-prefixes" {
return fmt.Errorf("invalid format for route filtering")
}
- longerPrefix = true
+ longerPrefixes = true
}
arg.Destinations = []*api.Destination{
&api.Destination{
- Prefix: args[0],
- LongerPrefix: longerPrefix,
+ Prefix: args[0],
+ LongerPrefixes: longerPrefixes,
},
}
}
diff --git a/server/server.go b/server/server.go
index 089d8e0a..2bb89d8e 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1441,27 +1441,24 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg {
}
for _, dst := range arg.Destinations {
key := dst.Prefix
- y, err := f(key)
- if err != nil {
+ if _, err := f(key); err != nil {
if host := net.ParseIP(key); host != nil {
masklen := 32
if af == bgp.RF_IPv6_UC {
masklen = 128
}
for i := masklen; i > 0; i-- {
- if y, _ = f(fmt.Sprintf("%s/%d", key, i)); y {
+ if y, _ := f(fmt.Sprintf("%s/%d", key, i)); y {
break
}
}
}
- } else if !y && dst.LongerPrefix {
+ } else if dst.LongerPrefixes {
_, prefix, _ := net.ParseCIDR(key)
ones, bits := prefix.Mask.Size()
for i := ones + 1; i <= bits; i++ {
prefix.Mask = net.CIDRMask(i, bits)
- if y, _ = f(prefix.String()); y {
- break
- }
+ f(prefix.String())
}
}
}