return ntohl(buf);
}
+static char *dhcpv6_msg_to_str(enum dhcpv6_msg msg)
+{
+ static char *dhcpv6_msg_str[] = {
+ "UNKNOWN",
+ "SOLICIT",
+ "ADVERTISE",
+ "REQUEST",
+ "RENEW",
+ "REBIND",
+ "REPLY",
+ "DECLINE",
+ "RECONFIGURE",
+ "INFORMATION REQUEST",
+ };
+
+ if (msg < _DHCPV6_MSG_MAX)
+ return dhcpv6_msg_str[msg];
+
+ return "Unknown";
+}
+
int init_dhcpv6(const char *ifname, unsigned int options, int sol_timeout)
{
client_options = options;
if (sendmsg(sock, &msg, 0) < 0) {
char in6_str[INET6_ADDRSTRLEN];
- syslog(LOG_ERR, "Failed to send DHCPV6 message to %s (%s)",
+ syslog(LOG_ERR, "Failed to send %s message to %s (%s)",
+ dhcpv6_msg_to_str(type),
inet_ntop(AF_INET6, (const void *)&srv.sin6_addr,
in6_str, sizeof(in6_str)), strerror(errno));
}
// Fall through
case DHCPV6_MSG_INFO_REQ:
msg = odata[0];
+ syslog(LOG_NOTICE, "Got a %s (msg-type %s)",
+ dhcpv6_msg_to_str(otype),
+ dhcpv6_msg_to_str(msg));
break;
default:
uint32_t t1, t2;
uint16_t otype, olen;
uint8_t *odata;
+ char buf[INET6_ADDRSTRLEN];
t1 = ntohl(ia_hdr->t1);
t2 = ntohl(ia_hdr->t2);
if (t1 > t2)
return 0;
+ syslog(LOG_INFO, "IAID %04x T1 %d T2 %d", ia_hdr->iaid, t1, t2);
+
// Update address IA
dhcpv6_for_each_option(&ia_hdr[1], end, otype, olen, odata) {
struct odhcp6c_entry entry = {IN6ADDR_ANY_INIT, 0, 0,
if (ok) {
if (odhcp6c_update_entry(STATE_IA_PD, &entry, 0, 0))
updated_IAs++;
+
+ syslog(LOG_INFO, "%s/%d preferred %d valid %d",
+ inet_ntop(AF_INET6, &entry.target, buf, sizeof(buf)),
+ entry.length, entry.preferred , entry.valid);
}
entry.priority = 0;
if (odhcp6c_update_entry(STATE_IA_NA, &entry, 0, 0))
updated_IAs++;
+
+ syslog(LOG_INFO, "%s preferred %d valid %d",
+ inet_ntop(AF_INET6, &entry.target, buf, sizeof(buf)),
+ entry.preferred , entry.valid);
}
}
+
return updated_IAs;
}
t1 = l_t1;
t2 = l_t2;
t3 = l_t3;
+
+ syslog(LOG_INFO, "T1 %"PRId64"s, T2 %"PRId64"s, T3 %"PRId64"s", t1, t2, t3);
}
return (int)(ia_pd_entries + ia_na_entries);