Skip to content

Commit

Permalink
Add the bgp router-id format check (#2316)
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 (孟志慧)-浪潮数据 committed Feb 13, 2023
1 parent f7f2375 commit 1c97f58
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/speaker/config.go
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"flag"
"fmt"
"net"
"os"
"time"

Expand Down Expand Up @@ -98,6 +99,9 @@ func ParseFlags() (*Configuration, error) {
if ht > 65536 || ht < 3 {
return nil, errors.New("the bgp holdtime must be in the range 3s to 65536s")
}
if *argRouterId != "" && net.ParseIP(*argRouterId) == nil {
return nil, fmt.Errorf("invalid router-id format: %s", *argRouterId)
}

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

0 comments on commit 1c97f58

Please sign in to comment.