I found a couple of bugs in sdhcp... both having to do with
renewal. If you are having problems renewing your lease or find that
your IP keeps changing... read on.
The first problem is that sdhcp assumes the renew and rebind times
will be set. These fields are optional, only the lease time is
required. So you may end up never timing out until the lease
expires. This can cause you to lose your IP depending on the server.
Because the optget() is a relatively expensive call, it is actually
cheaper to calculate the times every time. I have attached a patch
that does this.
The second problem is the server IP. sdhcp assumes that the server id
(ODserverid) is the IP of the server. This is not always the case. It
seems that the only safe IP is the address from the recvfrom().
Currently sdhcp ignores this value, but it should set server IP to
this. I don't have a patch for this since the suckless sdhcp and my
sdhcp have diverged a lot here. If you ask nicely I might roll up a
patch.
All the ODserverid code should be safe to remove.
Cheers,
Sean
- text/x-patch attachment: patch
Received on Wed Mar 11 2020 - 00:37:41 CET