Skip to content

Commit

Permalink
Add speaker param check (#2538)
Browse files Browse the repository at this point in the history
Co-authored-by: Edison Meng (孟志慧)-浪潮数据 <mengzhihui01@inspur.com>
  • Loading branch information
KillMaster9 and Edison Meng (孟志慧)-浪潮数据 authored Mar 23, 2023
1 parent 7e6feab commit bd91f8b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/speaker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ func ParseFlags() (*Configuration, error) {
if *argRouterId != "" && net.ParseIP(*argRouterId) == nil {
return nil, fmt.Errorf("invalid router-id format: %s", *argRouterId)
}
if *argNeighborAddress != "" && net.ParseIP(*argNeighborAddress) == nil {
if *argNeighborAddress != "" && net.ParseIP(*argNeighborAddress).To4() == nil {
return nil, fmt.Errorf("invalid neighbor-address format: %s", *argNeighborAddress)
}
if *argNeighborIPv6Address != "" && net.ParseIP(*argNeighborIPv6Address).To16() == nil {
return nil, fmt.Errorf("invalid neighbor-ipv6-address format: %s", *argNeighborIPv6Address)
}

config := &Configuration{
AnnounceClusterIP: *argAnnounceClusterIP,
Expand Down

0 comments on commit bd91f8b

Please sign in to comment.