openwrt / odhcp6c

This repository is a mirror of https://git.openwrt.org/?p=project/odhcp6c.git. It is for reference only and is not active for checks-ins or reporting issues; issues should be reported at: https://bugs.openwrt.org. Pull requests will be accepted which will be merged in odhcp6c.git
GNU General Public License v2.0
78 stars 84 forks source link

odhcp6c: fix IA discard when T1 > 0 and T2 = 0 #72

Closed DavidB137 closed 2 years ago

DavidB137 commented 2 years ago

My ISP uses DHCPv6 advertisements where IA_PD T1 is non-zero (43200) and T2 is zero. Current implementation of odhcp6c doesn't handle that and just switches to stateless mode.

According to RFC 8415, section 21.21:

If a client receives an IA_PD with T1 greater than T2 and both T1 and T2 are greater than 0, the client discards the IA_PD option and processes the remainder of the message as though the server had not included the IA_PD option.

Currently odhcp6c discards IA_PD option if t1 > t2: https://github.com/openwrt/odhcp6c/blob/39b584bcac8770619b545d6ae344758f87028612/src/dhcpv6.c#L1346-L1347

The same applies for IA_NA.

Fix it by editing IA discard condition according to RFC.

Signed-off-by: Dávid Benko davidbenko@davidbenko.dev

dedeckeh commented 2 years ago

Path pushed to master (https://git.openwrt.org/?p=project/odhcp6c.git;a=commit;h=9212bfcbab7681cd30186ac7f1ef4c47bf38c89a); thx