Skip to content

Commit 528fb73

Browse files
committed
fix matching loopback addresses (#5402)
Signed-off-by: zhangzujian <[email protected]>
1 parent 7cfc3bc commit 528fb73

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pkg/daemon/config.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,9 @@ func (config *Configuration) initNicConfig(nicBridgeMappings map[string]string)
284284
continue
285285
}
286286

287-
// exclude link-local and localhost addresses
287+
// exclude link-local and loopback addresses
288288
ipStr := strings.Split(addr.String(), "/")[0]
289-
_, localhost, _ := net.ParseCIDR("127.0.0.0/8")
290-
if ip := net.ParseIP(ipStr); ip == nil || ip.IsLinkLocalUnicast() || localhost.Contains(ip) {
289+
if ip := net.ParseIP(ipStr); ip == nil || ip.IsLinkLocalUnicast() || ip.IsLoopback() {
291290
continue
292291
}
293292
if len(srcIPs) == 0 || slices.Contains(srcIPs, ipStr) {

0 commit comments

Comments
 (0)