Commit 903650af authored by Simon Kelley's avatar Simon Kelley

Further fixes to DHCP logging.

parent ef1d7425
...@@ -830,7 +830,7 @@ void log_context(int family, struct dhcp_context *context) ...@@ -830,7 +830,7 @@ void log_context(int family, struct dhcp_context *context)
if (indextoname(daemon->icmp6fd, context->if_index, ifrn_name)) if (indextoname(daemon->icmp6fd, context->if_index, ifrn_name))
sprintf(p, "%s for %s", (context->flags & CONTEXT_OLD) ? "old prefix" : "constructed", ifrn_name); sprintf(p, "%s for %s", (context->flags & CONTEXT_OLD) ? "old prefix" : "constructed", ifrn_name);
} }
else if (context->flags & CONTEXT_TEMPLATE) else if (context->flags & CONTEXT_TEMPLATE && !(context->flags & CONTEXT_RA_STATELESS))
{ {
template = p; template = p;
p += sprintf(p, ", "); p += sprintf(p, ", ");
...@@ -842,6 +842,16 @@ void log_context(int family, struct dhcp_context *context) ...@@ -842,6 +842,16 @@ void log_context(int family, struct dhcp_context *context)
if (!(context->flags & CONTEXT_OLD) && if (!(context->flags & CONTEXT_OLD) &&
((context->flags & CONTEXT_DHCP) || family == AF_INET)) ((context->flags & CONTEXT_DHCP) || family == AF_INET))
{ {
#ifdef HAVE_DHCP6
if (context->flags & CONTEXT_RA_STATELESS)
{
if (context->flags & CONTEXT_TEMPLATE)
strncpy(daemon->dhcp_buff, context->template_interface, 256);
else
strcpy(daemon->dhcp_buff, daemon->addrbuff);
}
else
#endif
inet_ntop(family, start, daemon->dhcp_buff, 256); inet_ntop(family, start, daemon->dhcp_buff, 256);
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,
...@@ -862,6 +872,7 @@ void log_context(int family, struct dhcp_context *context) ...@@ -862,6 +872,7 @@ void log_context(int family, struct dhcp_context *context)
strcpy(daemon->addrbuff, context->template_interface); strcpy(daemon->addrbuff, context->template_interface);
template = ""; template = "";
} }
if ((context->flags & CONTEXT_RA_NAME) && !(context->flags & CONTEXT_OLD)) if ((context->flags & CONTEXT_RA_NAME) && !(context->flags & CONTEXT_OLD))
my_syslog(MS_DHCP | LOG_INFO, _("DHCPv4-derived IPv6 names on %s%s"), daemon->addrbuff, template); my_syslog(MS_DHCP | LOG_INFO, _("DHCPv4-derived IPv6 names on %s%s"), daemon->addrbuff, template);
......
...@@ -64,8 +64,10 @@ struct script_data ...@@ -64,8 +64,10 @@ struct script_data
#ifdef HAVE_TFTP #ifdef HAVE_TFTP
off_t file_len; off_t file_len;
#endif #endif
#ifdef HAVE_DHCP6 #ifdef HAVE_IPV6
struct in6_addr addr6; struct in6_addr addr6;
#endif
#ifdef HAVE_DHCP6
int iaid, vendorclass_count; int iaid, vendorclass_count;
#endif #endif
unsigned char hwaddr[DHCP_CHADDR_MAX]; unsigned char hwaddr[DHCP_CHADDR_MAX];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment