if (r < 0)
return r;
- r = fw_nftables_init_family(nfnl, AF_INET6);
- if (r < 0)
- log_debug_errno(r, "Failed to init ipv6 NAT: %m");
+ if (socket_ipv6_is_supported()) {
+ r = fw_nftables_init_family(nfnl, AF_INET6);
+ if (r < 0)
+ log_debug_errno(r, "Failed to init ipv6 NAT: %m");
+ }
ctx->nfnl = TAKE_PTR(nfnl);
return 0;
int r;
+ if (!socket_ipv6_is_supported() && af == AF_INET6)
+ return -EOPNOTSUPP;
+
r = fw_nftables_add_masquerade_internal(ctx, add, af, source, source_prefixlen);
if (r != -ENOENT)
return r;
int r;
+ if (!socket_ipv6_is_supported() && af == AF_INET6)
+ return -EOPNOTSUPP;
+
r = fw_nftables_add_local_dnat_internal(ctx, add, af, protocol, local_port, remote, remote_port, previous_remote);
if (r != -ENOENT)
return r;