Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dhcp4d causes an IP address conflict #18

Closed
stapelberg opened this issue Dec 14, 2018 · 1 comment
Closed

dhcp4d causes an IP address conflict #18

stapelberg opened this issue Dec 14, 2018 · 1 comment

Comments

@stapelberg
Copy link
Contributor

stapelberg commented Dec 14, 2018

2018/12/14 23:10:13 dhcp4d.go:122: DHCPACK &{Num:1 Addr:10.0.0.3 HardwareAddr:00:e0:4c:68:fe:07 Hostname:xps Expiry:2018-12-15 01:10:13.724814008 +0100 CET m=+64928.993070360}
[…]
2018/12/14 23:16:54 dhcp4d.go:122: DHCPACK &{Num:1 Addr:10.0.0.3 HardwareAddr:80:e6:50:21:3a:36 Hostname:mbp Expiry:2018-12-15 01:16:54.061257234 +0100 CET m=+65329.329513710}

Unfortunately I don’t have a full capture because of issue #17

@stapelberg
Copy link
Contributor Author

Suspicion: when another MAC address new obtains an expired lease, h.leasesHW[old] is not updated, hence

if !bytes.Equal(reqIP.To4(), net.IPv4zero) {
free = h.canLease(reqIP, hwAddr)
//log.Printf("canLease(%v, %s) = %d", reqIP, hwAddr, free)
}
returns true and the lease is handed out again.

I’ll write a test to verify this tomorrow. A good fix would probably be to make leasesHW a map from hwaddr to leaseNum, so that there is precisely one data structure which needs to be updated, not two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant