summaryrefslogtreecommitdiffstats
path: root/dhcp.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-10-18 22:58:10 +0000
committerRoy Marples <roy@marples.name>2008-10-18 22:58:10 +0000
commit9754dc73797d69cf999993af8f1f9f445d359ff4 (patch)
tree21f32b779ef0e6c91be9bf3f08cf9f3b5c7c7c94 /dhcp.c
parent6d35d0ccf958e290338706c08d5ea50f7a9448b6 (diff)
downloaddhcpcd-9754dc73797d69cf999993af8f1f9f445d359ff4.tar.xz
Alloc less for options and correctly for inform.
Diffstat (limited to 'dhcp.c')
-rw-r--r--dhcp.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/dhcp.c b/dhcp.c
index 3b698dae..79d7b003 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -1088,17 +1088,22 @@ print_option(char *s, ssize_t len, int type, int dl, const uint8_t *data)
if (!s) {
if (type & UINT8)
l = 3;
- else if (type & UINT16)
+ else if (type & UINT16) {
l = 5;
- else if (type & SINT16)
+ dl /= 2;
+ } else if (type & SINT16) {
l = 6;
- else if (type & UINT32)
+ dl /= 2;
+ } else if (type & UINT32) {
l = 10;
- else if (type & SINT32)
+ dl /= 4;
+ } else if (type & SINT32) {
l = 11;
- else if (type & IPV4)
+ dl /= 4;
+ } else if (type & IPV4) {
l = 16;
- else {
+ dl /= 4;
+ } else {
errno = EINVAL;
return -1;
}
@@ -1188,7 +1193,7 @@ configure_env(char **env, const char *prefix, const struct dhcp_message *dhcp,
if (get_option_raw(dhcp, opt->option))
e++;
}
- if (dhcp->yiaddr)
+ if (dhcp->yiaddr || dhcp->ciaddr)
e += 5;
if (*dhcp->bootfile && !(overl & 1))
e++;