Skip to content

Commit 84741b6

Browse files
committed
network policy: use 'addrtype' module and --src-type=LOCAL to match local traffic
1 parent 665e667 commit 84741b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/controllers/network_policy_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ func (npc *NetworkPolicyController) syncPodFirewallChains() (map[string]bool, er
605605
activePodFwChains[podFwChainName] = true
606606

607607
comment := "rule to permit the traffic traffic to pods when source is the pod's local node"
608-
args := []string{"-m", "comment", "--comment", comment, "-s", npc.nodeIP.String(), "-d", pod.ip, "-j", "ACCEPT"}
608+
args := []string{"-m", "comment", "--comment", comment, "-m", "addrtype", "--src-type", "LOCAL", "-d", pod.ip, "-j", "ACCEPT"}
609609
exists, err := iptablesCmdHandler.Exists("filter", podFwChainName, args...)
610610
if err != nil {
611611
return nil, fmt.Errorf("Failed to run iptables command: %s", err.Error())

0 commit comments

Comments
 (0)