nftables vmap concatenations with interval
hi,
using nftables, I want to create a vmap :
map mymap {type ipv4_addr . iface_index : verdict }
I'd like the first argument to be an ip range/ network, so that I can add like so :
nft add element inet filter mymap { 172.18.0.1/24 . eth0 : accept } or
nft add element inet filter mymap { 172.18.0.1-172.18.0.255 . eth0 : accept }
Any hints as to what to do it?
Thanks,
Martin.
Quoted 6 lines · Martin Bednar
hi,
using nftables, I want to create a vmap :
map mymap {type
ipv4_addr.iface_index: verdict }
Quoted 7 lines
I'd like the first argument to be an ip range/ network, so that I can add like so :
nft add element inet filter mymap { 172.18.0.1/24 . eth0 : accept }nft add element inet filter mymap { 172.18.0.1-172.18.0.255 . eth0 : accept }
Any hints as to what to do it?
nft add table inet filter
nft add map inet filter mymap { type ipv4_addr . iface_index : verdict \; } nft add element inet filter mymap { 172.18.0.0 . eth0 : accept } nft add rule inet filter forward ip saddr and 255.255.255.0 . iif vmap @mymap
^^^^^^^^^^^^^^^^^^^^^^^^^^
The idea here is to mask the address, then add to the set the result of this operation, thus, 172.18.0.0
Le Tuesday, September 27, 2016 9:11:01 PM CEST Pablo Neira Ayuso a écrit :
Quoted 9 lines
nft add table inet filter
nft add map inet filter mymap { typeipv4_addr.iface_index: verdict \; } nft add element inet filter mymap { 172.18.0.0 . eth0 : accept } nft add rule inet filter forward ip saddr and 255.255.255.0 . iif vmap @mymap ^^^^^^^^^^^^^^^^^^^^^^^^^^The idea here is to mask the address, then add to the set the result of this operation, thus, 172.18.0.0
Very cool trick... Thanks. this solves 90% of what I want :) This however implies the same mask for all networks, right?
Is is somehow possible to have one vmap for networks with different masks?
Thanks.