npc: Add comments for traffic steering

This commit is contained in:
Martynas Pumputis authored and Martynas Pumputis committed 2018-07-24 10:06:55 +02:00
1 parent 10a5b6fb51
commit c5772c814c
1 file changed
+9 -6
+9 -6
View File
@@ -459,20 +459,23 @@ func configureIPTables(config *BridgeConfig, ips ipset.Interface) error {
if config.NPC {
// Steer traffic via the NPC.
// Ignore error because chains might already exist
_ = ipt.NewChain("filter", npc.MainChain)
_ = ipt.NewChain("filter", npc.EgressChain)
// Steer egress traffic destined to local node.
if err = ipt.AppendUnique("filter", "INPUT", "-i", config.WeaveBridgeName, "-j", npc.EgressChain); err != nil {
return err
}
fwdRules = append(fwdRules, []string{
"-i", config.WeaveBridgeName,
"-m", "comment", "--comment", "NOTE: this must go before '-j KUBE-FORWARD'",
"-j", npc.EgressChain})
// If WEAVE-NPC chain doesn't exist then creating a rule in the chain will fail
fwdRules = append(fwdRules,
[][]string{
// Might include ingress traffic which is fine as long as we do not
// ACCEPT in WEAVE-NPC-EGRESS chain
{"-i", config.WeaveBridgeName,
"-m", "comment", "--comment", "NOTE: this must go before '-j KUBE-FORWARD'",
"-j", npc.EgressChain},
// The following rules are for ingress NPC processing
{"-o", config.WeaveBridgeName,
"-m", "comment", "--comment", "NOTE: this must go before '-j KUBE-FORWARD'",
"-j", npc.MainChain},