Page MenuHomeFreeBSD

Add ability to use dynamic external prefix in ipfw_nptv6 module

Authored by ae on Oct 30 2018, 7:50 PM.



The idea is to have ability to specify interface name that will obtain IPv6 prefix dynamically instead of using ext_prefix argument.

  • to ipfw(8) added ability to use ext_if ifname argument
  • to keep ABI the struct _ipfw_nptv6_cfg was modified using anonymous union. The size of if_name is the same as in6_addr.
  • added ifaddr_event_ext handler and the code modified to be able use specified if_name to obtain external prefix.

The nptv6 instance will handle ifaddr events and take suitable address as external prefix. When address disappears, or interface has not suitable address, instance silently skips handling of matched packets. So, they probably will be routed untranslated.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

0mp added a subscriber: 0mp.

The manpage change looks fine. Remember to bump the date :)

This revision is now accepted and ready to land.Oct 30 2018, 8:25 PM

Hi, I tested this code and it works like a charm! Thanks! Now I can have a static addresses config for jails with a dynamic external prefix.
I needed this because my ISP uses DHCPv6 to delegate prefixes which can change, so a static NPTv6 rule in IPFW was a nono.

I guess this wont be MFC'able to STABLE12 as it uses the other patch in D17100? Or maybe this breaks ABI, anyway thanks for doing this!

This revision was automatically updated to reflect the committed changes.