From d46cb47e126fcd62f86a3b72efca55e18def1100 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 dbe5f60..aedc325 100644 --- a/pkg/networkengine/routedriver/vxlan/vxlan.go +++ b/pkg/networkengine/routedriver/vxlan/vxlan.go @@ -455,7 +455,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,