Skip to content

Commit

Permalink
add judge before use slices's index
Browse files Browse the repository at this point in the history
  • Loading branch information
pengbinbin committed Jul 3, 2021
1 parent f61bcd9 commit ced4340
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/daemon/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ func (c *Controller) getPolicyRouting(subnet *kubeovnv1.Subnet) ([]netlink.Rule,
} else {
for i := range protocols {
rule.Family, _ = util.ProtocolToFamily(protocols[i])
_, rule.Src, _ = net.ParseCIDR(cidr[i])
if len(cidr) == len(protocols) {
_, rule.Src, _ = net.ParseCIDR(cidr[i])
}
rules = append(rules, *rule)
}
}
Expand Down

0 comments on commit ced4340

Please sign in to comment.