Re: dhcpcd-6.3.1 segfault
Roy Marples
Mon Mar 10 12:26:13 2014
Hi
On 09/03/2014 22:08, xinglp wrote:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 dhcp6_handledata (arg=0x7fff11a4ee20) at dhcp6.c:2129
2129 syslog(LOG_DEBUG, "%s: validated using 0x%08"
PRIu32,
(gdb) l
2124 syslog(LOG_DEBUG, "dhcp_auth_validate:
%m");
2125 syslog(LOG_ERR, "%s: authentication
failed from %s",
2126 ifp->name, ctx->sfrom);
2127 return;
2128 }
2129 syslog(LOG_DEBUG, "%s: validated using 0x%08"
PRIu32,
2130 ifp->name, state->auth.token->secretid);
2131 } else if (ifo->auth.options & DHCPCD_AUTH_REQUIRE) {
2132 syslog(LOG_ERR, "%s: no authentication from
%s",
2133 ifp->name, ctx->sfrom);
I'm using openwrt in router, with dnsmasq and odhcpd.
I can only try WIDE, ISC and dnsmasq dhcp6s ....... and I cannot
replicate this error. Of the 3, only WIDE supports authentication.
I have looked over the sources and it seems to me that this can only
happen when accepting a RECONFIGURE key.
The attached patch should solve it. Please let me know ASAP as I need to
get a new release out of the door :)
I have built odhcpd on a test linux box, but I have no idea how to
configure it.
Can you also please supply me with your /etc/config/dhcp file as a
reference even if the attached patch works please so I can test against
different odhcpd options!
Thanks
Roy
Index: auth.c
==================================================================
--- auth.c
+++ auth.c
@@ -229,10 +229,15 @@
errno = EINVAL;
return NULL;
}
if (state->reconf == NULL)
errno = ENOENT;
+ /* Free the old token so we log acceptance */
+ if (state->token) {
+ free(state->token);
+ state->token = NULL;
+ }
/* Nothing to validate, just accepting the key */
return state->reconf;
case 2:
if (!((mp == 4 && mt == DHCP_FORCERENEW) ||
(mp == 6 && mt == DHCP6_RECONFIGURE)))
Index: dhcp.c
==================================================================
--- dhcp.c
+++ dhcp.c
@@ -1059,12 +1059,16 @@
syslog(LOG_DEBUG, "%s: dhcp_auth_validate: %m",
ifp->name);
free(dhcp);
return NULL;
}
- syslog(LOG_DEBUG, "%s: validated using 0x%08" PRIu32,
- ifp->name, state->auth.token->secretid);
+ if (state->auth.token)
+ syslog(LOG_DEBUG, "%s: validated using 0x%08" PRIu32,
+ ifp->name, state->auth.token->secretid);
+ else
+ syslog(LOG_DEBUG, "%s: accepted reconfigure key",
+ ifp->name);
}
return dhcp;
}
Index: dhcp6.c
==================================================================
--- dhcp6.c
+++ dhcp6.c
@@ -2119,12 +2119,16 @@
syslog(LOG_DEBUG, "dhcp_auth_validate: %m");
syslog(LOG_ERR, "%s: authentication failed from %s",
ifp->name, ctx->sfrom);
return;
}
- syslog(LOG_DEBUG, "%s: validated using 0x%08" PRIu32,
- ifp->name, state->auth.token->secretid);
+ if (state->auth.token)
+ syslog(LOG_DEBUG, "%s: validated using 0x%08" PRIu32,
+ ifp->name, state->auth.token->secretid);
+ else
+ syslog(LOG_DEBUG, "%s: accepted reconfigure key",
+ ifp->name);
} else if (ifo->auth.options & DHCPCD_AUTH_REQUIRE) {
syslog(LOG_ERR, "%s: no authentication from %s",
ifp->name, ctx->sfrom);
return;
} else if (ifo->auth.options & DHCPCD_AUTH_SEND)
Archive administrator: postmaster@marples.name