diff options
| author | Roy Marples <roy@marples.name> | 2008-11-20 09:57:46 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-11-20 09:57:46 +0000 |
| commit | a2328d2dddd1513622f04d1953269dac6f1fd051 (patch) | |
| tree | 7c5d5f51df0978ad20a9e5a347b116ab6daf2493 /dhcp.c | |
| parent | 299662da4f99217bf4dfdd62147c273c0a5e3f1b (diff) | |
| download | dhcpcd-a2328d2dddd1513622f04d1953269dac6f1fd051.tar.xz | |
BOOTP fixes. Also, we don't write a BOOTP lease file.
Diffstat (limited to 'dhcp.c')
| -rw-r--r-- | dhcp.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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; |
