From 82e0235c10dda8b9baeb06b6383bec1f43bb61a2 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Mon, 18 Mar 2013 09:21:53 +0100 Subject: [PATCH] Fix several incorrect array indices * fixes preference handling * fixes custom client IDs --- src/dhcpv6.c | 2 +- src/odhcp6c.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dhcpv6.c b/src/dhcpv6.c index da920ce..e991958 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -520,7 +520,7 @@ static int dhcpv6_handle_advert(_unused enum dhcpv6_msg orig, cand.preference -= 2000; } else if (otype == DHCPV6_OPT_PREF && olen >= 1 && cand.preference >= 0) { - cand.preference = odata[1]; + cand.preference = odata[0]; } else if (otype == DHCPV6_OPT_RECONF_ACCEPT) { cand.wants_reconfigure = true; } else if (otype == DHCPV6_OPT_IA_PD && request_prefix) { diff --git a/src/odhcp6c.c b/src/odhcp6c.c index 50404af..f4f83f1 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -89,7 +89,7 @@ int main(_unused int argc, char* const argv[]) buf[0] = 0; buf[1] = DHCPV6_OPT_CLIENTID; buf[2] = 0; - buf[4] = l; + buf[3] = l; odhcp6c_add_state(STATE_CLIENT_ID, buf, l + 4); } else { help = true; -- 2.25.1