Skip to content

Commit e51ead5

Browse files
committed
Change in bridge/setup_ip_tables.go
- With the transition to ipam, bridge ip address stored in `bridgeInterface` is guaranteed to be the ip of the OS bridge by the `setupBridgeIPv4` step function. Therefore the `setupIPTables()` step function no longer needs to fetch the address from the OS. Signed-off-by: Alessandro Boch <[email protected]>
1 parent 06be98e commit e51ead5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/bridge/setup_ip_tables.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"github.com/Sirupsen/logrus"
88
"github.com/docker/libnetwork/iptables"
9-
"github.com/docker/libnetwork/netutils"
109
)
1110

1211
// DockerChain: DOCKER iptable chain name
@@ -60,6 +59,8 @@ func setupIPChains(config *configuration) (*iptables.ChainInfo, *iptables.ChainI
6059
}
6160

6261
func (n *bridgeNetwork) setupIPTables(config *networkConfiguration, i *bridgeInterface) error {
62+
var err error
63+
6364
d := n.driver
6465
d.Lock()
6566
driverConfig := d.config
@@ -73,14 +74,9 @@ func (n *bridgeNetwork) setupIPTables(config *networkConfiguration, i *bridgeInt
7374
// Pickup this configuraton option from driver
7475
hairpinMode := !driverConfig.EnableUserlandProxy
7576

76-
addrv4, _, err := netutils.GetIfaceAddr(config.BridgeName)
77-
if err != nil {
78-
return fmt.Errorf("Failed to setup IP tables, cannot acquire Interface address: %s", err.Error())
79-
}
80-
ipnet := addrv4.(*net.IPNet)
8177
maskedAddrv4 := &net.IPNet{
82-
IP: ipnet.IP.Mask(ipnet.Mask),
83-
Mask: ipnet.Mask,
78+
IP: i.bridgeIPv4.IP.Mask(i.bridgeIPv4.Mask),
79+
Mask: i.bridgeIPv4.Mask,
8480
}
8581
if config.Internal {
8682
if err = setupInternalNetworkRules(config.BridgeName, maskedAddrv4, true); err != nil {

0 commit comments

Comments
 (0)