sdhcp

simple dhcp client
git clone git://git.2f30.org/sdhcp
Log | Files | Refs | LICENSE

commit b3d202e72bacd84e7a7ae53621c33fbaa983e8aa
parent 98a77a0f7ccea2df3ca9182ff82d21e6b33193b1
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 25 Apr 2014 22:54:14 +0200

fix typo and add some comments

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>

Diffstat:
Msdhcp.c | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/sdhcp.c b/sdhcp.c @@ -207,8 +207,7 @@ optget(Bootp *bp, void *data, int opt, int n) { unsigned char *p = bp->optdata; unsigned char *top = ((unsigned char *)bp) + sizeof *bp; - int code; - int len; + int code, len; while(p < top) { code = *p++; @@ -321,7 +320,7 @@ run(void) #if 0 InitReboot: /* send DHCPrequest to old server */ - dhcpsend(DHCPrequest, Broadcasr); + dhcpsend(DHCPrequest, Broadcast); goto Rebooting; Rebooting: switch (dhcprecv()) { @@ -375,7 +374,7 @@ Bound: case DHCPoffer: case DHCPack: case DHCPnak: - goto Bound; /* discard offer, ack, or nak */ + goto Bound; /* discard offer, ACK or NAK */ case Timeout: dhcpsend(DHCPrequest, Unicast); goto Renewing; @@ -386,16 +385,14 @@ Renewing: acceptlease(); goto Bound; case DHCPnak: - /* halt network; */ goto Init; - case Timeout: /* t2 expires: */ + case Timeout: dhcpsend(DHCPrequest, Broadcast); goto Rebinding; } Rebinding: switch(dhcprecv()) { case DHCPnak: /* lease expired */ - /* halt network; */ goto Init; case DHCPack: acceptlease();