Skip to content

Commit

Permalink
cli: Use network IP address for EVPN Prefix route
Browse files Browse the repository at this point in the history
Currently, "gobgp" command use the host IP when adding a new EVPN Prefix
route, but it should be the network IP address, otherwise the two routes
to "192.168.0.1/24" and "192.168.0.2/24" will be determined as different
routes.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
  • Loading branch information
iwaseyusuke authored and fujita committed Nov 21, 2017
1 parent b94f12f commit f974b98
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gobgp/cmd/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,11 @@ func ParseEvpnIPPrefixArgs(args []string) (bgp.AddrPrefixInterface, []string, er
}
}

ip, n, err := net.ParseCIDR(m[""][0])
_, nw, err := net.ParseCIDR(m[""][0])
if err != nil {
return nil, nil, err
}
ones, _ := n.Mask.Size()
ones, _ := nw.Mask.Size()

var gw net.IP
if len(m["gw"]) > 0 {
Expand Down Expand Up @@ -549,7 +549,7 @@ func ParseEvpnIPPrefixArgs(args []string) (bgp.AddrPrefixInterface, []string, er
RD: rd,
ETag: etag,
IPPrefixLength: uint8(ones),
IPPrefix: ip,
IPPrefix: nw.IP,
GWIPAddress: gw,
Label: label,
}
Expand Down

0 comments on commit f974b98

Please sign in to comment.