summaryrefslogtreecommitdiffstats
path: root/dhcp.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-11-20 09:57:46 +0000
committerRoy Marples <roy@marples.name>2008-11-20 09:57:46 +0000
commita2328d2dddd1513622f04d1953269dac6f1fd051 (patch)
tree7c5d5f51df0978ad20a9e5a347b116ab6daf2493 /dhcp.c
parent299662da4f99217bf4dfdd62147c273c0a5e3f1b (diff)
downloaddhcpcd-a2328d2dddd1513622f04d1953269dac6f1fd051.tar.xz
BOOTP fixes. Also, we don't write a BOOTP lease file.
Diffstat (limited to 'dhcp.c')
-rw-r--r--dhcp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/dhcp.c b/dhcp.c
index cd6d7195..ae93235a 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -374,7 +374,8 @@ get_option_uint8(uint8_t *i, const struct dhcp_message *dhcp, uint8_t option)
if (!p)
return -1;
- *i = *(p);
+ if (i)
+ *i = *(p);
return 0;
}
@@ -774,7 +775,7 @@ make_message(struct dhcp_message **message,
if ((type == DHCP_INFORM ||
type == DHCP_RELEASE ||
type == DHCP_REQUEST) &&
- !IN_LINKLOCAL(ntohl(iface->addr.s_addr)))
+ !IN_LINKLOCAL(ntohl(iface->addr.s_addr)))
{
dhcp->ciaddr = iface->addr.s_addr;
/* Just incase we haven't actually configured the address yet */
@@ -961,6 +962,12 @@ write_lease(const struct interface *iface, const struct dhcp_message *dhcp)
uint8_t l;
uint8_t o = 0;
+ /* We don't write BOOTP leases */
+ if (is_bootp(dhcp)) {
+ unlink(iface->leasefile);
+ return 0;
+ }
+
fd = open(iface->leasefile, O_WRONLY | O_CREAT | O_TRUNC, 0400);
if (fd == -1)
return -1;