summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gobgp/cmd/common.go4
-rw-r--r--gobgp/cmd/monitor.go4
-rw-r--r--server/server.go12
3 files changed, 13 insertions, 7 deletions
diff --git a/gobgp/cmd/common.go b/gobgp/cmd/common.go
index 327b204c..e67b0a26 100644
--- a/gobgp/cmd/common.go
+++ b/gobgp/cmd/common.go
@@ -465,7 +465,9 @@ func checkAddressFamily(ip net.IP) (bgp.RouteFamily, error) {
case "ipv6-flowspec", "ipv6-flow", "flow6":
rf = bgp.RF_FS_IPv6_UC
case "":
- if len(ip) == 0 || ip.To4() != nil {
+ if ip == nil {
+ return rf, nil
+ } else if len(ip) == 0 || ip.To4() != nil {
rf = bgp.RF_IPv4_UC
} else {
rf = bgp.RF_IPv6_UC
diff --git a/gobgp/cmd/monitor.go b/gobgp/cmd/monitor.go
index 6cddb0ac..d54a1cd1 100644
--- a/gobgp/cmd/monitor.go
+++ b/gobgp/cmd/monitor.go
@@ -22,7 +22,6 @@ import (
"github.com/spf13/cobra"
"golang.org/x/net/context"
"io"
- "net"
"os"
)
@@ -30,7 +29,7 @@ func NewMonitorCmd() *cobra.Command {
ribCmd := &cobra.Command{
Use: CMD_RIB,
Run: func(cmd *cobra.Command, args []string) {
- rf, err := checkAddressFamily(net.IP{})
+ rf, err := checkAddressFamily(nil)
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -69,6 +68,7 @@ func NewMonitorCmd() *cobra.Command {
},
}
+ ribCmd.PersistentFlags().StringVarP(&subOpts.AddressFamily, "address-family", "a", "", "address family")
globalCmd := &cobra.Command{
Use: CMD_GLOBAL,
diff --git a/server/server.go b/server/server.go
index f41066a9..261f3e9a 100644
--- a/server/server.go
+++ b/server/server.go
@@ -608,6 +608,8 @@ func (server *BgpServer) broadcastBests(bests []*table.Path) {
}
}
+ rf := path.GetRouteFamily()
+
result := &GrpcResponse{
Data: &api.Destination{
Prefix: path.GetNlri().String(),
@@ -625,11 +627,13 @@ func (server *BgpServer) broadcastBests(bests []*table.Path) {
remainReqs = append(remainReqs, req)
continue
}
- m := &broadcastGrpcMsg{
- req: req,
- result: result,
+ if req.RouteFamily == bgp.RouteFamily(0) || req.RouteFamily == rf {
+ m := &broadcastGrpcMsg{
+ req: req,
+ result: result,
+ }
+ server.broadcastMsgs = append(server.broadcastMsgs, m)
}
- server.broadcastMsgs = append(server.broadcastMsgs, m)
remainReqs = append(remainReqs, req)
}
server.broadcastReqs = remainReqs