opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.36k stars 754 forks source link

Prefix ID is Out of Range under Advanced Configuration Mode #6790

Closed aque closed 1 year ago

aque commented 1 year ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

I get a "You specified an IPv6 prefix ID that is out of range." error on interfaces with Prefix ID > 0x0, even though the WAN is delegated a /62 prefix. This is caused by dhcp6-ia-pd-len == 0. In Basic DHCPv6 configuration mode, changing "Prefix delegation size" affects dhcp6-ia-pd-len, but I could not find an equivalent under Advanced configuration.

I checked 23.1.11 and 23.7.2, and both versions are affected.

To Reproduce

Steps to reproduce the behavior:

  1. Set DHCPv6 Configuration Mode to Basic
  2. Set Prefix delegation size to 64
  3. Apply config
  4. Set DHCPv6 Configuration Mode to Advanced
  5. Configure IPv6 PD for a /62 prefix
    • Send Options: ia-pd 0
    • Prefix Delegation: CHECK
    • id-assoc pd ID: 0
    • Prefix: 2603:3018:xxxx:xx34::/62
    • Preferred Lifetime: infinity
    • Prefix Interface Site-Level Aggregation Length: 2
  6. Apply config
  7. Configure LAN interface to Track WAN using Prefix ID 0x2 (2603:3018:xxxx:xx36::/64)
  8. Error pops up when attempting to save

Expected behavior

Prefix ID 0x2 on LAN is acceptable with a /62 PD under Advanced configuration mode. dhcp6-ia-pd-len is set to 2.

Describe alternatives you considered

Two workarounds:

  1. Download config.xml and set <dhcp6-ia-pd-len> to the correct value (2).
  2. Switch WAN Configuration Mode to Basic and change "Prefix delegation size" to the proper value (/62). Then, switch back to Advanced.

Possible solution: If configuration mode is Advanced, adv_dhcp6_prefix_interface_statement_sla_len could set dhcp6-ia-pd-len. It would have a value of 0 if adv_dhcp6_prefix_interface_statement_sla_len is blank.

Additional context

Advanced Configuration Mode is required to request a specific IPv6 prefix.

Environment

Lab is VMware: OPNsense 23.1.11_1-amd64 FreeBSD 13.1-RELEASE-p8 OpenSSL 1.1.1u 30 May 2023 em interface driver

Production is bare metal: OPNsense 23.7.2-amd64 FreeBSD 13.2-RELEASE-p2 OpenSSL 1.1.1v 1 Aug 2023 igb interface driver

fichtner commented 1 year ago

@aque thanks for the report. Does this help? 819689d

Cheers, Franco

aque commented 1 year ago

Thanks @fichtner for looking into this and for that quick fix. I loaded it into my lab and it is working. Is this issue safe to close, or do you prefer to keep it open until released?

fichtner commented 1 year ago

Safe to close. I’ll add this to 23.7.4 because 23.7.3 comes out today already.

Cheers, Franco