remove gateway check
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
This commit is contained in:
parent
3fb464786f
commit
59a746bd52
@ -53,10 +53,6 @@ func (r *Range) Canonicalize() error {
|
|||||||
if err := canonicalizeIP(&r.Gateway); err != nil {
|
if err := canonicalizeIP(&r.Gateway); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
subnet := (net.IPNet)(r.Subnet)
|
|
||||||
if !subnet.Contains(r.Gateway) {
|
|
||||||
return fmt.Errorf("gateway %s not in network %s", r.Gateway.String(), subnet.String())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RangeStart: If specified, make sure it's sane (inside the subnet),
|
// RangeStart: If specified, make sure it's sane (inside the subnet),
|
||||||
|
@ -121,12 +121,6 @@ var _ = Describe("IP ranges", func() {
|
|||||||
Expect(err).Should(MatchError("RangeStart 192.0.2.50 not in network 192.0.2.0/24"))
|
Expect(err).Should(MatchError("RangeStart 192.0.2.50 not in network 192.0.2.0/24"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should reject invalid gateways", func() {
|
|
||||||
r := Range{Subnet: mustSubnet("192.0.2.0/24"), Gateway: net.ParseIP("192.0.3.0")}
|
|
||||||
err := r.Canonicalize()
|
|
||||||
Expect(err).Should(MatchError("gateway 192.0.3.0 not in network 192.0.2.0/24"))
|
|
||||||
})
|
|
||||||
|
|
||||||
It("should parse all fields correctly", func() {
|
It("should parse all fields correctly", func() {
|
||||||
snstr := "192.0.2.0/24"
|
snstr := "192.0.2.0/24"
|
||||||
r := Range{
|
r := Range{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user