@@ -25,6 +25,7 @@ import (
25
25
"context"
26
26
"errors"
27
27
"fmt"
28
+ "os"
28
29
goruntime "runtime"
29
30
"time"
30
31
@@ -110,6 +111,7 @@ func (s *ProxyServer) platformCheckSupported(ctx context.Context) (ipv4Supported
110
111
logger := klog .FromContext (ctx )
111
112
112
113
if isIPTablesBased (s .Config .Mode ) {
114
+ // Check for the iptables and ip6tables binaries.
113
115
ipts := utiliptables .NewDualStack ()
114
116
ipv4Supported = ipts [v1 .IPv4Protocol ] != nil
115
117
ipv6Supported = ipts [v1 .IPv6Protocol ] != nil
@@ -122,11 +124,17 @@ func (s *ProxyServer) platformCheckSupported(ctx context.Context) (ipv4Supported
122
124
logger .Info ("No iptables support for family" , "ipFamily" , v1 .IPv6Protocol )
123
125
}
124
126
} else {
125
- // Assume support for both families.
126
- // FIXME: figure out how to check for kernel IPv6 support using nft
127
+ // The nft CLI always supports both families.
127
128
ipv4Supported , ipv6Supported = true , true
128
129
}
129
130
131
+ // Check if the OS has IPv6 enabled, by verifying if the IPv6 interfaces are available
132
+ _ , errIPv6 := os .Stat ("/proc/net/if_inet6" )
133
+ if errIPv6 != nil {
134
+ logger .Info ("No kernel support for family" , "ipFamily" , v1 .IPv6Protocol )
135
+ ipv6Supported = false
136
+ }
137
+
130
138
// The Linux proxies can always support dual-stack if they can support both IPv4
131
139
// and IPv6.
132
140
dualStackSupported = ipv4Supported && ipv6Supported
0 commit comments