Skip to content

Commit

Permalink
fix(cni): check to enable ipv6 flag on transparent proxy engine
Browse files Browse the repository at this point in the history
Signed-off-by: slonka <slonka@users.noreply.github.com>
  • Loading branch information
slonka committed Jul 19, 2022
1 parent 333ad04 commit 094cf78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/cni/pkg/cni/injector_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (

"github.com/kumahq/kuma-net/iptables/builder"
"github.com/kumahq/kuma-net/iptables/config"

"github.com/kumahq/kuma/pkg/transparentproxy"
)

func convertToUint16(field string, value string) (uint16, error) {
Expand Down Expand Up @@ -93,6 +95,12 @@ func mapToConfig(intermediateConfig *IntermediateConfig) (*config.Config, error)
if err != nil {
return nil, err
}
enableIpV6, err := transparentproxy.ShouldEnableIPv6()
if err != nil {
return nil, err
}
cfg.IPv6 = enableIpV6

inboundPortV6, err := convertToUint16("inbound port ipv6", intermediateConfig.inboundPortV6)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/transparentproxy/transparentproxy_experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func hasLocalIPv6() (bool, error) {
return false, nil
}

func shouldEnableIPv6() (bool, error) {
func ShouldEnableIPv6() (bool, error) {
hasIPv6Address, err := hasLocalIPv6()
if !hasIPv6Address || err != nil {
return false, err
Expand Down Expand Up @@ -124,7 +124,7 @@ func (tp *ExperimentalTransparentProxy) Setup(tpConfig *config.TransparentProxyC
}
}

ipv6, err := shouldEnableIPv6()
ipv6, err := ShouldEnableIPv6()
if err != nil {
return "", errors.Wrap(err, "cannot verify if IPv6 should be enabled")
}
Expand Down

0 comments on commit 094cf78

Please sign in to comment.