Skip to content

Commit

Permalink
if the string of ip is empty,program will die
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Aug 16, 2021
1 parent 1065c8e commit 169a325
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/ovs/ovn-nbctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,10 @@ func (c Client) createRouterPort(ls, lr, ip, mac string) error {
klog.Errorf("failed to create switch router port %s %v", lsTolr, err)
return err
}

if len(ip) == 0 {
klog.Errorf("failed to create switch router port: ip is empty")
return err
}
ipStr := strings.Split(ip, ",")
if len(ipStr) == 2 {
_, err = c.ovnNbCommand(MayExist, "lrp-add", lr, lrTols, mac, ipStr[0], ipStr[1])
Expand Down

0 comments on commit 169a325

Please sign in to comment.