Compare commits

...
Author SHA1 Message Date
Simon Kelley 459380965a Fix last commit. 2013-01-15 21:57:42 +00:00
Simon Kelley 21bac1bccd Check IAID as well as CLID for lease identity. 2013-01-14 21:35:05 +00:00
Simon Kelley b1a1b6def5 Tweak DHCP startup logging. 2013-01-11 16:28:50 +00:00
2 changed files with 34 additions and 42 deletions

No files matched your search

+31 -39
View File
@@ -679,7 +679,7 @@ void log_context(int family, struct dhcp_context *context)
void *start = &context->start; void *start = &context->start;
void *end = &context->end; void *end = &context->end;
char *n = "", *m = "", *p = daemon->namebuff; char *template = "", *p = daemon->namebuff;
*p = 0; *p = 0;
@@ -695,37 +695,34 @@ void log_context(int family, struct dhcp_context *context)
} }
#endif #endif
if ((context->flags & CONTEXT_DHCP) || if (family != AF_INET && (context->flags & CONTEXT_DEPRECATE))
!(context->flags & (CONTEXT_CONSTRUCTED | CONTEXT_TEMPLATE))) strcpy(daemon->namebuff, _(", prefix deprecated"));
else
{ {
if (family != AF_INET && (context->flags & CONTEXT_DEPRECATE)) p += sprintf(p, _(", lease time "));
strcpy(daemon->namebuff, _(", prefix deprecated")); prettyprint_time(p, context->lease_time);
else p += strlen(p);
{
p += sprintf(p, _(", lease time "));
m = p;
prettyprint_time(p, context->lease_time);
p += strlen(p);
}
} }
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
if (context->flags & CONTEXT_CONSTRUCTED) if (context->flags & CONTEXT_CONSTRUCTED)
{ {
char ifrn_name[IFNAMSIZ]; char ifrn_name[IFNAMSIZ];
if (indextoname(daemon->doing_dhcp6 ? daemon->dhcp6fd : daemon->icmp6fd, context->if_index, ifrn_name))
{
n = p;
p += sprintf(p, ", constructed for %s", ifrn_name);
}
}
if (context->flags & CONTEXT_TEMPLATE) template = p;
{ p += sprintf(p, ", ");
n = p;
p += sprintf(p, ", template for %s%s", context->template_interface, if (indextoname(daemon->doing_dhcp6 ? daemon->dhcp6fd : daemon->icmp6fd, context->if_index, ifrn_name))
(context->flags & CONTEXT_WILDCARD) ? "*" : ""); sprintf(p, "constructed for %s", ifrn_name);
} }
else if (context->flags & CONTEXT_TEMPLATE)
{
template = p;
p += sprintf(p, ", ");
sprintf(p, "template for %s%s", context->template_interface,
(context->flags & CONTEXT_WILDCARD) ? "*" : "");
}
#endif #endif
if ((context->flags & CONTEXT_DHCP) || family == AF_INET) if ((context->flags & CONTEXT_DHCP) || family == AF_INET)
@@ -734,27 +731,22 @@ void log_context(int family, struct dhcp_context *context)
inet_ntop(family, end, daemon->dhcp_buff3, 256); inet_ntop(family, end, daemon->dhcp_buff3, 256);
my_syslog(MS_DHCP | LOG_INFO, my_syslog(MS_DHCP | LOG_INFO,
(context->flags & CONTEXT_RA_STATELESS) ? (context->flags & CONTEXT_RA_STATELESS) ?
_("%s stateless on %s%.0s%.0s") : _("%s stateless on %s%.0s%.0s%s") :
(context->flags & CONTEXT_STATIC) ? (context->flags & CONTEXT_STATIC) ?
_("%s, static leases only on %.0s%s%s") : _("%s, static leases only on %.0s%s%s%.0s") :
(context->flags & CONTEXT_PROXY) ? (context->flags & CONTEXT_PROXY) ?
_("%s, proxy on subnet %.0s%s%.0s") : _("%s, proxy on subnet %.0s%s%.0s%.0s") :
_("%s, IP range %s -- %s%s"), _("%s, IP range %s -- %s%s%.0s"),
(family != AF_INET) ? "DHCPv6" : "DHCP", (family != AF_INET) ? "DHCPv6" : "DHCP",
daemon->dhcp_buff, daemon->dhcp_buff3, daemon->namebuff); daemon->dhcp_buff, daemon->dhcp_buff3, daemon->namebuff, template);
} }
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
if (context->flags & CONTEXT_RA_NAME) if (context->flags & CONTEXT_RA_NAME)
my_syslog(MS_DHCP | LOG_INFO, _("DHCPv4-derived IPv6 names on %s%s"), my_syslog(MS_DHCP | LOG_INFO, _("DHCPv4-derived IPv6 names on %s%s"), daemon->addrbuff, template);
daemon->addrbuff, n);
if ((context->flags & CONTEXT_RA) || (option_bool(OPT_RA) && (context->flags & CONTEXT_DHCP) && family == AF_INET6))
if (context->flags & CONTEXT_RA) my_syslog(MS_DHCP | LOG_INFO, _("router advertisement on %s%s"), daemon->addrbuff, template);
my_syslog(MS_DHCP | LOG_INFO, _("router advertisement on %s%s%s"),
daemon->addrbuff,
(context->flags & (CONTEXT_CONSTRUCTED | CONTEXT_TEMPLATE)) ? "" : ", prefix valid ",
(context->flags & (CONTEXT_CONSTRUCTED | CONTEXT_TEMPLATE)) ? n : m);
#endif #endif
} }
+3 -3
View File
@@ -575,9 +575,9 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh
inet_ntop(AF_INET6, &config->addr6, daemon->addrbuff, ADDRSTRLEN); inet_ntop(AF_INET6, &config->addr6, daemon->addrbuff, ADDRSTRLEN);
if (ltmp && ltmp->clid && if (ltmp && ltmp->clid &&
(ltmp->clid_len != clid_len || memcmp(ltmp->clid, clid, clid_len) != 0)) (ltmp->clid_len != clid_len || memcmp(ltmp->clid, clid, clid_len) != 0 || ltmp->hwaddr_type != iaid))
my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it is leased to %s"), my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it is leased to %s#%d"),
daemon->addrbuff, print_mac(daemon->namebuff, ltmp->clid, ltmp->clid_len)); daemon->addrbuff, print_mac(daemon->namebuff, ltmp->clid, ltmp->clid_len), ltmp->hwaddr_type);
else if (have_config(config, CONFIG_DECLINED) && else if (have_config(config, CONFIG_DECLINED) &&
difftime(now, config->decline_time) < (float)DECLINE_BACKOFF) difftime(now, config->decline_time) < (float)DECLINE_BACKOFF)
my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it was previously declined"), my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it was previously declined"),