Skip to contentSkip to conversation

Rightmost part IPv6 address masking?

iproute2 Roman Mamedov 1 participant 1 message Aug 4, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

ip6tables supports the little-known format to mask the rightmost part of an IPv6 address:

# ip6tables -A FORWARD -d ::a:b:c:d/::ffff:ffff:ffff:ffff -j ACCEPT

would match any IP which ends with the specified sequence, i.e.:
*:*:*:*:a:b:c:d. This is really useful in cases where the ISP provides a dynamic IPv6 prefix, or there are prefixes from multiple ISPs in a LAN.

However in iproute2 there is no such support for "ip rule":

# ip -6 rule add from ::a:b:c:d/::ffff:ffff:ffff:ffff lookup main
Error: inet6 prefix is expected rather than "::a:b:c:d/::ffff:ffff:ffff:ffff".

I suppose the iproute2 developers might be reading this, so could you please consider adding support for masks like these? Aside from that, would you reckon there's a limitation which would prevent this kind of masks from working on the kernels-side?

Or maybe anyone can suggest the proper way to specify this for "ip rule" which is supported currently?

Thanks

Signature · 2 lines
With respect,
Roman