On Tue, May 3, 2011 at 4:34 PM, Blanchette, Sylvie <[email protected]> wrote:
> Denys,
>
> The notify_file directive is commented out in my udhcpd.conf.
>
> - Sylvie
>
...
> No. You are here if auto_time != 0. You need to write lease, and go back
> to waiting on select for the next packet or next timeout - exactly what
> the next code does:
>
>> + } else {
>> ! write_leases();
>> ! timeout_end = monotonic_sec() + server_config.auto_time;
>> ! continue;
>> + }
>> }
>
> I think the bug may be that your notify_file directive in udhcpd.conf
> contains an invalid path. Please post your udhcpd.conf.
Apparently (looking at your patch), you somehow spawn a copy of udhcpd
in write_leases(). write_leases from 1.15.3 is:
void FAST_FUNC write_leases(void)
{
int fd;
unsigned i;
leasetime_t curr;
int64_t written_at;
fd = open_or_warn(server_config.lease_file, O_WRONLY|O_CREAT|O_TRUNC);
if (fd < 0)
return;
curr = written_at = time(NULL);
written_at = hton64(written_at);
full_write(fd, &written_at, sizeof(written_at));
for (i = 0; i < server_config.max_leases; i++) {
leasetime_t tmp_time;
if (g_leases[i].lease_nip == 0)
continue;
/* Screw with the time in the struct, for easier writing */
tmp_time = g_leases[i].expires;
g_leases[i].expires -= curr;
if ((signed_leasetime_t) g_leases[i].expires < 0)
g_leases[i].expires = 0;
g_leases[i].expires = htonl(g_leases[i].expires);
/* No error check. If the file gets truncated,
* we lose some leases on restart. Oh well. */
full_write(fd, &g_leases[i], sizeof(g_leases[i]));
/* Then restore it when done */
g_leases[i].expires = tmp_time;
}
close(fd);
if (server_config.notify_file) {
// TODO: vfork-based child creation
char *cmd = xasprintf("%s %s",
server_config.notify_file, server_config.lease_file);
system(cmd);
free(cmd);
}
}
The only possibility to create a child is server_config.notify_file != NULL -
then the code will fall into system() call. Otherwise write_leases
simply writes out a file and returns.
Can you add
bb_error_msg("server_config.notify_file:'%s'", server_config.notify_file);
line just before "if (server_config.notify_file) ..." line, run udhcpd with -f
and verify that server_config.notify_file is NULL?
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox