Skip to content

Commit

Permalink
Merge pull request #17117 from danwinship/cidr-checks
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Fix crash with invalid serviceNetworkCIDR

#17076 fixed the corresponding crash with clusterNetworkCIDR, but serviceNetworkCIDR had the same problem. Also, this slightly simplifies the previous fix.
  • Loading branch information
openshift-merge-robot authored Nov 1, 2017
2 parents 8fc2fe6 + 34e9053 commit af9d638
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/network/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,18 @@ func ParseNetworkInfo(clusterNetwork []networkapi.ClusterNetworkEntry, serviceNe
for _, entry := range clusterNetwork {
cidr, err := netutils.ParseCIDRMask(entry.CIDR)
if err != nil {
_, cidr, err := net.ParseCIDR(entry.CIDR)
_, cidr, err = net.ParseCIDR(entry.CIDR)
if err != nil {
return nil, fmt.Errorf("failed to parse ClusterNetwork CIDR %s: %v", entry.CIDR, err)
}
glog.Errorf("Configured clusterNetworks value %q is invalid; treating it as %q", entry.CIDR, cidr.String())
cns = append(cns, ClusterNetwork{ClusterCIDR: cidr, HostSubnetLength: entry.HostSubnetLength})
} else {
cns = append(cns, ClusterNetwork{ClusterCIDR: cidr, HostSubnetLength: entry.HostSubnetLength})
}
cns = append(cns, ClusterNetwork{ClusterCIDR: cidr, HostSubnetLength: entry.HostSubnetLength})
}

sn, err := netutils.ParseCIDRMask(serviceNetwork)
if err != nil {
_, sn, err := net.ParseCIDR(serviceNetwork)
_, sn, err = net.ParseCIDR(serviceNetwork)
if err != nil {
return nil, fmt.Errorf("failed to parse ServiceNetwork CIDR %s: %v", serviceNetwork, err)
}
Expand Down

0 comments on commit af9d638

Please sign in to comment.