openwrt / odhcpd

This repository is a mirror of https://git.openwrt.org/?p=project/odhcpd.git. Pull requests will be accepted which will be merged in odhcpd.git
GNU General Public License v2.0
160 stars 96 forks source link

valid time is expire, but dhcpv6 not release address #141

Closed Devinchai closed 4 years ago

Devinchai commented 4 years ago

Dear @dedeckeh I set 2 dhcpv6 address pool; assign to PC A and PC B. but when I pull out PC A,and wait for it valid time expire, then insert another PC C, it not assign dhcpv6 address .

I guess function "valid_until_cb" in dhcpv6-ia.c, whether change this (a->length == 128 && a->clid_len == 0)) to (a->length == 128 && a->clid_len > 0))

dedeckeh commented 4 years ago

I fail to understand the issue; do you expect the address assigned to PC A to be assigned to PC C ? And if yes why do you expect this ?

Devinchai commented 4 years ago

@dedeckeh PC A 's address not be released all the time , so PC C not get this address(only configure two address),the reason it wasn't released is because a->clid_len>0 .

dedeckeh commented 4 years ago

Are you talking about static leases ? If not I fail to understand how you can create a pool with only two IPv6 addresses ...

Devinchai commented 4 years ago

@dedeckeh , I modified function "assign_na", limit it assign only two address pool .

Devinchai commented 4 years ago

@dedeckeh , I do not understand where is dhcp's address released?

dedeckeh commented 4 years ago

It happens here https://github.com/openwrt/odhcpd/blob/master/src/dhcpv6-ia.c#L763

Devinchai commented 4 years ago

@dedeckeh , PC A get ipv6 address by dhcpv6 ,but I pull the PC A cable,the address not be released all the time in iface->ia_assignments, when the PC A address is released ?

I add log in function "valid_until_cb": add log patch: add_log

output and print log: print_log

dedeckeh commented 4 years ago

Thanks for bringing this up; fixed in https://git.openwrt.org/?p=project/odhcpd.git;a=commit;h=94a1c942315f6b3c2870cf744114bb133f209799