From fa158b95ede9aae2b8c2ce182a2da0fa4bf2f489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8F=A9=E8=BD=A9?= Date: Mon, 25 Mar 2024 10:48:30 +0800 Subject: [PATCH] fix the bug of parse empty cidr --- pkg/networkengine/routedriver/vxlan/vxlan.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/networkengine/routedriver/vxlan/vxlan.go b/pkg/networkengine/routedriver/vxlan/vxlan.go index 3bd7601..0f3111d 100644 --- a/pkg/networkengine/routedriver/vxlan/vxlan.go +++ b/pkg/networkengine/routedriver/vxlan/vxlan.go @@ -454,7 +454,11 @@ func (vx *vxlan) calIPSetOnNode(network *types.Network) map[string]*netlink.IPSe continue } for _, srcCIDR := range nodeInfo.Subnets { - _, ipNet, _ := net.ParseCIDR(srcCIDR) + _, ipNet, err := net.ParseCIDR(srcCIDR) + if err != nil { + klog.Errorf("parse node subnet %s error %s", srcCIDR, err.Error()) + continue + } ones, _ := ipNet.Mask.Size() entry := &netlink.IPSetEntry{ IP: ipNet.IP,