Move acceptlease and DHCPrequest to the appropriate state section - sdhcp - simple dhcp client
(HTM) git clone git://git.codemadness.org/sdhcp
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit a48cdb438ed91b4fabaf741b9c011ba3d7984883
(DIR) parent f397bb3ea1de20c1cac1baf2e091f2ec8c79ec82
(HTM) Author: Michael Forney <mforney@mforney.org>
Date: Wed, 14 Nov 2018 18:40:36 -0800
Move acceptlease and DHCPrequest to the appropriate state section
Diffstat:
M sdhcp.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/sdhcp.c b/sdhcp.c
@@ -367,21 +367,21 @@ Selecting:
optget(&bp, dns, OBdnsserver, sizeof(dns));
optget(&bp, &t1, ODlease, sizeof(t1));
t1 = ntohl(t1);
- dhcpsend(DHCPrequest, Broadcast);
goto Requesting;
case Timeout:
goto Init;
}
}
Requesting:
+ dhcpsend(DHCPrequest, Broadcast);
for (;;) {
switch (dhcprecv()) {
case DHCPack:
- acceptlease();
goto Bound;
}
}
Bound:
+ acceptlease();
fputs("Congrats! You should be on the 'net.\n", stdout);
if (!fflag && !forked) {
if (fork())
@@ -391,30 +391,28 @@ Bound:
for (;;) {
switch (dhcprecv()) {
case Timeout:
- dhcpsend(DHCPrequest, Unicast);
goto Renewing;
}
}
Renewing:
+ dhcpsend(DHCPrequest, Unicast);
for (;;) {
switch (dhcprecv()) {
case DHCPack:
- acceptlease();
goto Bound;
case DHCPnak:
goto Init;
case Timeout:
- dhcpsend(DHCPrequest, Broadcast);
goto Rebinding;
}
}
Rebinding:
+ dhcpsend(DHCPrequest, Broadcast);
for (;;) {
switch (dhcprecv()) {
case DHCPnak: /* lease expired */
goto Init;
case DHCPack:
- acceptlease();
goto Bound;
}
}