Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cni): check to enable ipv6 flag on transparent proxy engine #4642

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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