From e3eb16a1f92b272104a832ef19f05ff92543cb2f Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Tue, 9 Oct 2018 11:21:47 +0530 Subject: [PATCH] addressing review comments --- prog/weave-npc/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/prog/weave-npc/main.go b/prog/weave-npc/main.go index ab895977..61cae54c 100644 --- a/prog/weave-npc/main.go +++ b/prog/weave-npc/main.go @@ -31,6 +31,7 @@ var ( allowMcast bool nodeName string maxList int + bridgeName string ) func handleError(err error) { common.CheckFatal(err) } @@ -127,7 +128,7 @@ func createBaseRules(ipt *iptables.IPTables, ips ipset.Interface) error { // If the destination address is not any of the local pods, let it through if err := ipt.Append(npc.TableFilter, npc.MainChain, - "-m", "physdev", "--physdev-out=vethwe-bridge", "-j", "ACCEPT"); err != nil { + "-m", "physdev", "--physdev-out="+bridgeName, "-j", "ACCEPT"); err != nil { return err } @@ -170,7 +171,7 @@ func createBaseRules(ipt *iptables.IPTables, ips ipset.Interface) error { ruleSpecs := [][]string{ {"-m", "state", "--state", "RELATED,ESTABLISHED", "-j", "ACCEPT"}, - {"-m", "physdev", "--physdev-in=vethwe-bridge", "-j", "RETURN"}, + {"-m", "physdev", "--physdev-in=" + bridgeName, "-j", "RETURN"}, } if allowMcast { ruleSpecs = append(ruleSpecs, []string{"-d", "224.0.0.0/4", "-j", "RETURN"}) @@ -323,6 +324,7 @@ func main() { rootCmd.PersistentFlags().BoolVar(&allowMcast, "allow-mcast", true, "allow all multicast traffic") rootCmd.PersistentFlags().StringVar(&nodeName, "node-name", "", "only generate rules that apply to this node") rootCmd.PersistentFlags().IntVar(&maxList, "max-list-size", 1024, "maximum size of ipset list (for namespaces)") + rootCmd.PersistentFlags().StringVar(&bridgeName, "bridge-name", "vethwe-bridge", "name of the brige on which packets are received and sent") handleError(rootCmd.Execute()) }