netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* nftables bug: Only the first two elements of a map are used for NAT
@ 2017-02-08 18:11 Simon Hanisch
  2017-02-12 17:49 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Hanisch @ 2017-02-08 18:11 UTC (permalink / raw)
  To: netfilter-devel


[-- Attachment #1.1: Type: text/plain, Size: 1547 bytes --]

Hi,

we want to use a map for a large NAT setup, mapping subnets to a single
IP. Thats why we wanted to use a map, but only the first two elements of
the map are used for the NAT.
I added two config examples to reproduce the bug. In the first example
the NAT works fine for the network 100.64.15.0/24, in the second it does
not. The only difference is the order of the map elements.
We have build nft from the current master branch, last commit is
97a2a5bde2f03e33315eab4b76a9e69770b99351.



Working for 100.64.15.0/24

#!/usr/sbin/nft
add chain nat postrouting { type nat hook postrouting priority 100 ;}
add chain nat prerouting { type nat hook prerouting priority 0 ;}
add map nat subnettoip { type ipv4_addr: ipv4_addr ; flags interval ; }
add rule ip nat postrouting snat ip saddr map @subnettoip;
add element nat subnettoip { 100.64.13.0/24 : 192.168.0.32 }
add element nat subnettoip { 100.64.15.0/24 : 192.168.0.34 }
add element nat subnettoip { 100.64.14.0/24 : 192.168.0.33 }


Not working for 100.64.15.0/24

#!/usr/sbin/nft
add chain nat postrouting { type nat hook postrouting priority 100 ;}
add chain nat prerouting { type nat hook prerouting priority 0 ;}
add map nat subnettoip { type ipv4_addr: ipv4_addr ; flags interval ; }
add rule ip nat postrouting snat ip saddr map @subnettoip;
add element nat subnettoip { 100.64.13.0/24 : 192.168.0.32 }
add element nat subnettoip { 100.64.14.0/24 : 192.168.0.33 }
add element nat subnettoip { 100.64.15.0/24 : 192.168.0.34 }


Greetings,
Simon


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-12 17:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-08 18:11 nftables bug: Only the first two elements of a map are used for NAT Simon Hanisch
2017-02-12 17:49 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).