From 439b4ad190d08f1c067554f7a7ed49e91747bae3 Mon Sep 17 00:00:00 2001 From: Martynas Pumputis Date: Sat, 20 Jan 2018 12:51:31 +0100 Subject: [PATCH] Improve naming of ensureRulesAtTop function --- net/bridge.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/bridge.go b/net/bridge.go index b2183103..403d43ed 100644 --- a/net/bridge.go +++ b/net/bridge.go @@ -470,7 +470,7 @@ func configureIPTables(config *BridgeConfig) error { // and allow replies back fwdRules = append(fwdRules, []string{"-o", config.WeaveBridgeName, "-m", "conntrack", "--ctstate", "RELATED,ESTABLISHED", "-j", "ACCEPT"}) - if err := ensureRules("filter", "FORWARD", fwdRules, ipt); err != nil { + if err := ensureRulesAtTop("filter", "FORWARD", fwdRules, ipt); err != nil { return err } @@ -491,11 +491,11 @@ func linkSetUpByName(linkName string) error { return netlink.LinkSetUp(link) } -// ensureRules ensures the presence of given iptables rules. +// ensureRulesAtTop ensures the presence of given iptables rules. // // If any rule from the list is missing, the function deletes all given -// rules and re-inserts them to ensure the order of the rules. -func ensureRules(table, chain string, rulespecs [][]string, ipt *iptables.IPTables) error { +// rules and re-inserts them at the top of the chain to ensure the order of the rules. +func ensureRulesAtTop(table, chain string, rulespecs [][]string, ipt *iptables.IPTables) error { allFound := true for _, rs := range rulespecs {