Skip to content

Commit

Permalink
Rename setupIPTablesInternal -> setupNonInternalNetworkRules
Browse files Browse the repository at this point in the history
setupIPTablesInternal is/was called from setupIPTables to set
up some rules for a network ... "internal" behaviour of the
outer function.

Then commit 7b64b1c added support for "--internal" bridge
networks, calling setupInternalNetworkRules from setupIPTables
instead of setupIPTablesInternal.

So, setupIPTablesInternal is the function that deals with
everything except "--internal" networks ... rename it.

Signed-off-by: Rob Murray <rob.murray@docker.com>
  • Loading branch information
robmry committed Dec 17, 2024
1 parent 556b8ee commit 0f259dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libnetwork/drivers/bridge/setup_ip_tables_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ func (n *bridgeNetwork) setupIPTables(ipVersion iptables.IPVersion, maskedAddr *
return setupInternalNetworkRules(config.BridgeName, maskedAddr, config.EnableICC, false)
})
} else {
if err = setupIPTablesInternal(ipVersion, config, maskedAddr, hairpinMode, true); err != nil {
if err = setupNonInternalNetworkRules(ipVersion, config, maskedAddr, hairpinMode, true); err != nil {
return fmt.Errorf("Failed to Setup IP tables: %w", err)
}
n.registerIptCleanFunc(func() error {
return setupIPTablesInternal(ipVersion, config, maskedAddr, hairpinMode, false)
return setupNonInternalNetworkRules(ipVersion, config, maskedAddr, hairpinMode, false)
})

natChain, filterChain, _, _, err := n.getDriverChains(ipVersion)
Expand Down Expand Up @@ -341,7 +341,7 @@ func (r iptRule) String() string {
return strings.Join(cmd, " ")
}

func setupIPTablesInternal(ipVer iptables.IPVersion, config *networkConfiguration, addr *net.IPNet, hairpin, enable bool) error {
func setupNonInternalNetworkRules(ipVer iptables.IPVersion, config *networkConfiguration, addr *net.IPNet, hairpin, enable bool) error {
hostIP := config.HostIPv4
nat := !config.GwModeIPv4.routed()
if ipVer == iptables.IPv6 {
Expand Down

0 comments on commit 0f259dd

Please sign in to comment.