npc: Add comments for traffic steering
This commit is contained in:
1 parent
10a5b6fb51
commit
c5772c814c
1 file changed
+9
-6
+9
-6
@@ -459,20 +459,23 @@ func configureIPTables(config *BridgeConfig, ips ipset.Interface) error {
|
|||||||
|
|
||||||
if config.NPC {
|
if config.NPC {
|
||||||
// Steer traffic via the NPC.
|
// Steer traffic via the NPC.
|
||||||
|
|
||||||
// Ignore error because chains might already exist
|
// Ignore error because chains might already exist
|
||||||
_ = ipt.NewChain("filter", npc.MainChain)
|
_ = ipt.NewChain("filter", npc.MainChain)
|
||||||
_ = ipt.NewChain("filter", npc.EgressChain)
|
_ = 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 {
|
if err = ipt.AppendUnique("filter", "INPUT", "-i", config.WeaveBridgeName, "-j", npc.EgressChain); err != nil {
|
||||||
return err
|
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,
|
fwdRules = append(fwdRules,
|
||||||
[][]string{
|
[][]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,
|
{"-o", config.WeaveBridgeName,
|
||||||
"-m", "comment", "--comment", "NOTE: this must go before '-j KUBE-FORWARD'",
|
"-m", "comment", "--comment", "NOTE: this must go before '-j KUBE-FORWARD'",
|
||||||
"-j", npc.MainChain},
|
"-j", npc.MainChain},
|
||||||
|
|||||||
Reference in new issue
Block a user