/**
- * Copyright (C) 2012-2013 Steven Barth <steven@midlink.org>
+ * Copyright (C) 2012-2014 Steven Barth <steven@midlink.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License v2 as published by
#include <syslog.h>
#include <signal.h>
#include <unistd.h>
+#include <inttypes.h>
#include <arpa/inet.h>
#include <netinet/in.h>
inet_ntop(AF_INET6, &e[i].target, &buf[buf_len], INET6_ADDRSTRLEN);
buf_len += strlen(&buf[buf_len]);
if (type != ENTRY_HOST) {
- buf_len += snprintf(&buf[buf_len], 6, "/%hhu", e[i].length);
+ buf_len += snprintf(&buf[buf_len], 6, "/%"PRIu16, e[i].length);
if (type == ENTRY_ROUTE) {
buf[buf_len++] = ',';
if (!IN6_IS_ADDR_UNSPECIFIED(&e[i].router)) {
} else {
buf_len += snprintf(&buf[buf_len], 24, ",%u,%u", e[i].preferred, e[i].valid);
}
- if ((type == ENTRY_PREFIX || type == ENTRY_ADDRESS) && e[i].prefix_class) {
- buf_len += snprintf(&buf[buf_len], 12, ",class=%u", e[i].prefix_class);
- }
+
+ if ((type == ENTRY_PREFIX || type == ENTRY_ADDRESS) && e[i].class)
+ buf_len += snprintf(&buf[buf_len], 12, ",class=%u", e[i].class);
+ else if (type == ENTRY_PREFIX && ntohl(e[i].iaid) != 1)
+ buf_len += snprintf(&buf[buf_len], 16, ",class=%08x", ntohl(e[i].iaid));
if (type == ENTRY_PREFIX && e[i].priority) {
// priority and router are abused for prefix exclusion
void script_call(const char *status)
{
- size_t dns_len, search_len, custom_len, sntp_ip_len, sntp_dns_len;
+ size_t dns_len, search_len, custom_len, sntp_ip_len, ntp_ip_len, ntp_dns_len;
size_t sip_ip_len, sip_fqdn_len, aftr_name_len;
odhcp6c_expire();
uint8_t *search = odhcp6c_get_state(STATE_SEARCH, &search_len);
uint8_t *custom = odhcp6c_get_state(STATE_CUSTOM_OPTS, &custom_len);
struct in6_addr *sntp = odhcp6c_get_state(STATE_SNTP_IP, &sntp_ip_len);
- uint8_t *sntp_dns = odhcp6c_get_state(STATE_SNTP_FQDN, &sntp_dns_len);
+ struct in6_addr *ntp = odhcp6c_get_state(STATE_NTP_IP, &ntp_ip_len);
+ uint8_t *ntp_dns = odhcp6c_get_state(STATE_NTP_FQDN, &ntp_dns_len);
struct in6_addr *sip = odhcp6c_get_state(STATE_SIP_IP, &sip_ip_len);
uint8_t *sip_fqdn = odhcp6c_get_state(STATE_SIP_FQDN, &sip_fqdn_len);
uint8_t *aftr_name = odhcp6c_get_state(STATE_AFTR_NAME, &aftr_name_len);
if (fork() == 0) {
ipv6_to_env("RDNSS", dns, dns_len / sizeof(*dns));
ipv6_to_env("SNTP_IP", sntp, sntp_ip_len / sizeof(*sntp));
+ ipv6_to_env("NTP_IP", ntp, ntp_ip_len / sizeof(*ntp));
+ fqdn_to_env("NTP_FQDN", ntp_dns, ntp_dns_len);
ipv6_to_env("SIP_IP", sip, sip_ip_len / sizeof(*sip));
fqdn_to_env("DOMAINS", search, search_len);
- fqdn_to_env("SNTP_FQDN", sntp_dns, sntp_dns_len);
fqdn_to_env("SIP_DOMAIN", sip_fqdn, sip_fqdn_len);
fqdn_to_env("AFTR", aftr_name, aftr_name_len);
fqdn_to_ip_env("AFTR_IP", aftr_name, aftr_name_len);