Skip to content

Commit 5c6a95b

Browse files
authored
Merge pull request #2603 from bboehmke/ipv6_portmapper_chain
Fixed IPv6 portmapper iptables chain initialization
2 parents 6de032e + 9c68849 commit 5c6a95b

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/bridge/setup_ip_tables.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ func (n *bridgeNetwork) setupIPTables(ipVersion iptables.IPVersion, maskedAddr *
178178
return iptable.ProgramChain(filterChain, config.BridgeName, hairpinMode, false)
179179
})
180180

181-
n.portMapper.SetIptablesChain(natChain, n.getNetworkBridgeName())
181+
if ipVersion == iptables.IPv4 {
182+
n.portMapper.SetIptablesChain(natChain, n.getNetworkBridgeName())
183+
} else {
184+
n.portMapperV6.SetIptablesChain(natChain, n.getNetworkBridgeName())
185+
}
182186
}
183187

184188
d.Lock()

iptables/iptables.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,18 @@ func (iptable IPTable) raw(args ...string) ([]byte, error) {
533533
}
534534

535535
path := iptablesPath
536+
commandName := "iptables"
536537
if iptable.Version == IPv6 {
537538
path = ip6tablesPath
539+
commandName = "ip6tables"
538540
}
539541

540542
logrus.Debugf("%s, %v", path, args)
541543

542544
startTime := time.Now()
543545
output, err := exec.Command(path, args...).CombinedOutput()
544546
if err != nil {
545-
return nil, fmt.Errorf("iptables failed: iptables %v: %s (%s)", strings.Join(args, " "), output, err)
547+
return nil, fmt.Errorf("iptables failed: %s %v: %s (%s)", commandName, strings.Join(args, " "), output, err)
546548
}
547549

548550
return filterOutput(startTime, output, args...), err

0 commit comments

Comments
 (0)