@@ -224,7 +224,7 @@ func (cfg *NftablesConfigurator) AppendInpodRules(podOverrides config.PodLevelOv
224224
225225 // CLI: nft add rule inet istio-ambient-nat istio-prerouting meta l4proto tcp ip6 saddr
226226 // fd16:9254:7127:1337:ffff:ffff:ffff:ffff counter accept
227- cfg .ruleBuilder .AppendRule (IstioPreroutingChain , AmbientNatTable ,
227+ cfg .ruleBuilder .AppendV6RuleIfSupported (IstioPreroutingChain , AmbientNatTable ,
228228 "meta l4proto tcp" ,
229229 "ip6 saddr" , cfg .cfg .HostProbeV6SNATAddress .String (), Counter ,
230230 "accept" ,
@@ -240,7 +240,7 @@ func (cfg *NftablesConfigurator) AppendInpodRules(podOverrides config.PodLevelOv
240240 )
241241
242242 // CLI: nft add rule inet istio-ambient-nat istio-output meta l4proto tcp ip6 daddr fd16:9254:7127:1337:ffff:ffff:ffff:ffff counter accept
243- cfg .ruleBuilder .AppendRule (IstioOutputChain , AmbientNatTable ,
243+ cfg .ruleBuilder .AppendV6RuleIfSupported (IstioOutputChain , AmbientNatTable ,
244244 "meta l4proto tcp" ,
245245 "ip6 daddr" , cfg .cfg .HostProbeV6SNATAddress .String (), Counter ,
246246 "accept" ,
@@ -259,7 +259,7 @@ func (cfg *NftablesConfigurator) AppendInpodRules(podOverrides config.PodLevelOv
259259 "redirect to" , ":" + fmt .Sprint (config .ZtunnelInboundPlaintextPort ),
260260 )
261261
262- cfg .ruleBuilder .AppendRule (IstioPreroutingChain , AmbientNatTable ,
262+ cfg .ruleBuilder .AppendV6RuleIfSupported (IstioPreroutingChain , AmbientNatTable ,
263263 "ip6 daddr" , "!=" , "::1/128" ,
264264 "tcp dport" , "!=" , fmt .Sprint (config .ZtunnelInboundPort ),
265265 "mark and 0xfff" , "!=" , fmt .Sprintf ("0x%x" , config .InpodMark ), Counter ,
@@ -301,7 +301,7 @@ func (cfg *NftablesConfigurator) AppendInpodRules(podOverrides config.PodLevelOv
301301 )
302302
303303 // CLI: nft add rule inet istio-ambient-nat istio-output ip6 daddr != ::1/128 tcp dport 53 mark and 0xfff != 0x539 counter redirect to :15053
304- cfg .ruleBuilder .AppendRule (
304+ cfg .ruleBuilder .AppendV6RuleIfSupported (
305305 IstioOutputChain , AmbientNatTable ,
306306 "ip6 daddr" , "!=" , "::1/128" ,
307307 "tcp dport" , "53" ,
@@ -356,7 +356,7 @@ func (cfg *NftablesConfigurator) AppendInpodRules(podOverrides config.PodLevelOv
356356 )
357357
358358 // CLI: nft add rule inet istio-ambient-nat istio-output oifname "lo" ip6 daddr != ::1/128 counter accept
359- cfg .ruleBuilder .AppendRule (
359+ cfg .ruleBuilder .AppendV6RuleIfSupported (
360360 IstioOutputChain , AmbientNatTable ,
361361 "oifname" , "lo" ,
362362 "ip6 daddr" ,
@@ -377,7 +377,7 @@ func (cfg *NftablesConfigurator) AppendInpodRules(podOverrides config.PodLevelOv
377377 "redirect to" , ":" + fmt .Sprintf ("%d" , config .ZtunnelOutboundPort ),
378378 )
379379
380- cfg .ruleBuilder .AppendRule (
380+ cfg .ruleBuilder .AppendV6RuleIfSupported (
381381 IstioOutputChain , AmbientNatTable ,
382382 "meta l4proto tcp" ,
383383 "ip6 daddr" ,
@@ -473,7 +473,7 @@ func (cfg *NftablesConfigurator) CreateHostRulesForHealthChecks() error {
473473 "ip" , "daddr" , fmt .Sprintf ("@%s-v4" , config .ProbeIPSet ), Counter , "snat" , "to" , cfg .cfg .HostProbeSNATAddress .String ())
474474
475475 // For V6 we have to use a different set and a different SNAT IP
476- cfg .ruleBuilder .AppendRule (PostroutingChain , AmbientNatTable , "meta l4proto tcp" , "skuid" , kubeletUID ,
476+ cfg .ruleBuilder .AppendV6RuleIfSupported (PostroutingChain , AmbientNatTable , "meta l4proto tcp" , "skuid" , kubeletUID ,
477477 "ip6" , "daddr" , fmt .Sprintf ("@%s-v6" , config .ProbeIPSet ), Counter , "snat" , "to" , cfg .cfg .HostProbeV6SNATAddress .String ())
478478
479479 return util .RunAsHost (func () error {
0 commit comments