Skip to content

Commit

Permalink
fix: fix up break from main for loop in a switch statement
Browse files Browse the repository at this point in the history
related: #1536
  • Loading branch information
ttys3 committed Feb 16, 2022
1 parent 69470fb commit 2b7e73c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/ipmatch/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func LookupExtIface(ifname string, ifregexS string, ipStack int, opts PublicIPOp
}

// Check IP
ifaceLoop:
for _, ifaceToMatch := range ifaces {
switch ipStack {
case IPv4Stack:
Expand All @@ -105,7 +106,7 @@ func LookupExtIface(ifname string, ifregexS string, ipStack int, opts PublicIPOp
if matched := matchIP(ifregex, ifaceIPs); matched != nil {
ifaceAddr = matched
iface = &ifaceToMatch
break
break ifaceLoop
}
case IPv6Stack:
ifaceIPs, err := ip.GetInterfaceIP6Addr(&ifaceToMatch)
Expand All @@ -116,7 +117,7 @@ func LookupExtIface(ifname string, ifregexS string, ipStack int, opts PublicIPOp
if matched := matchIP(ifregex, ifaceIPs); matched != nil {
ifaceV6Addr = matched
iface = &ifaceToMatch
break
break ifaceLoop
}
case DualStack:
ifaceIPs, err := ip.GetInterfaceIP4Addr(&ifaceToMatch)
Expand All @@ -139,7 +140,7 @@ func LookupExtIface(ifname string, ifregexS string, ipStack int, opts PublicIPOp
if matched := matchIP(ifregex, ifaceV6IPs); matched != nil {
ifaceV6Addr = matched
iface = &ifaceToMatch
break
break ifaceLoop
}
}
}
Expand Down

0 comments on commit 2b7e73c

Please sign in to comment.