Skip to content

Commit

Permalink
Fixed issue where hostIP address family was not checked against the c…
Browse files Browse the repository at this point in the history
…ontainerIP address family. closes containernetworking#378
  • Loading branch information
Niels van Oosterom committed Aug 30, 2019
1 parent fb5272a commit 54adc0d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugins/meta/portmap/portmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ func fillDnatRules(c *chain, config *PortMapConf, containerIP net.IP) {
// the ordering is important here; the mark rules must be first.
c.rules = make([][]string, 0, 3*len(entries))
for _, entry := range entries {
// If a HostIp is given, only process the entry if host and container address families match
if entry.HostIP != "" {
hostIP := net.ParseIP(entry.HostIP)
isHostV6 := (hostIP.To4() == nil)

if isV6 != isHostV6 {
continue
}
}

ruleBase := []string{
"-p", entry.Protocol,
"--dport", strconv.Itoa(entry.HostPort)}
Expand Down

0 comments on commit 54adc0d

Please sign in to comment.