From 59a746bd5279fa21433be3db6289f31ea18de597 Mon Sep 17 00:00:00 2001 From: "bingshen.wbs" Date: Mon, 26 Nov 2018 21:54:41 +0800 Subject: [PATCH] remove gateway check Signed-off-by: bingshen.wbs --- plugins/ipam/host-local/backend/allocator/range.go | 4 ---- plugins/ipam/host-local/backend/allocator/range_test.go | 6 ------ 2 files changed, 10 deletions(-) diff --git a/plugins/ipam/host-local/backend/allocator/range.go b/plugins/ipam/host-local/backend/allocator/range.go index 515afd0d..9bf389e8 100644 --- a/plugins/ipam/host-local/backend/allocator/range.go +++ b/plugins/ipam/host-local/backend/allocator/range.go @@ -53,10 +53,6 @@ func (r *Range) Canonicalize() error { if err := canonicalizeIP(&r.Gateway); err != nil { 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), diff --git a/plugins/ipam/host-local/backend/allocator/range_test.go b/plugins/ipam/host-local/backend/allocator/range_test.go index 9cdb5383..ffee168e 100644 --- a/plugins/ipam/host-local/backend/allocator/range_test.go +++ b/plugins/ipam/host-local/backend/allocator/range_test.go @@ -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")) }) - 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() { snstr := "192.0.2.0/24" r := Range{