Skip to content

Commit

Permalink
Merge pull request #7 from ististan/main
Browse files Browse the repository at this point in the history
Added jump rule to output chain for local DNAT.
  • Loading branch information
greenpau authored Apr 16, 2021
2 parents 3eb6343 + 8f92da5 commit a923e0d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/portmap/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package portmap

import (
"fmt"
"net"

"github.com/containernetworking/cni/pkg/types/current"
"github.com/greenpau/cni-plugins/pkg/utils"
"net"
)

// Interface represents a collection of addresses
Expand Down Expand Up @@ -261,6 +262,17 @@ func (p *Plugin) execAdd(conf *Config, prevResult *current.Result) error {
addr.Version, chainName, err,
)
}
if err := utils.CreateJumpRule(
addr.Version,
p.natTableName,
p.outputNatChainName,
chainName,
); err != nil {
return fmt.Errorf(
"failed creating jump rule from ipv%s output %s chain: %s",
addr.Version, chainName, err,
)
}

var destAddr net.IPNet
if addr.Version == "4" {
Expand Down

0 comments on commit a923e0d

Please sign in to comment.