On Thu, Dec 18, 2014 at 03:04:38PM +0100, Peter Valdemar Mørch wrote: > netcfg: Do not kill_dhcp_client after setting the hostname and domain, > otherwise Linux udhcpc will stop renewing its lease, and on other > platforms dhclient will de-configure the network interface (#757711, > #757988). The call chain is this: udpkg --configure --force-configure netcfg \_ netcfg Z \_ dhcp6c \_ udhcpc udpkg does not collect netcfg's exit code. Instead it continues poll()ing to forward stderr. It receives the SIGCHLD but does not act upon it with a wait() or waitpid(). The function udpkg uses to invoke netcfg's configure comes from libdebian-installer: [...] snprintf(buf, sizeof(buf), "exec %s configure", config); if ((r = di_exec_shell_log(buf)) != 0) [...] Essentially dhcp6c and udhcpc need to be daemonized off correctly once they go into "lease acquired, renew in the background" mode and close their file descriptors[*]. However doing that early likely loses logging, so it'd be best if the programs would do the right thing. At least udhcpc calls bb_daemonize(0), which doesn't do any fd closing. For dhcp6c (wide-dhcpv6-client) we currently force foreground mode (-f). It is not sufficient for netcfg to simply close stderr, as all producers need to close it, as far as I understand. On the other hand it also seems wrong for di_exec_shell_log to continue after the invoked binary exited. I suspect that'd mean ppoll() and proper signal handling, but I'm at a loss right now how to do that properly in C. Maybe that's the right place to fix it in the meantime. Kind regards Philipp Kern [*] It has been a long-standing problem with some d-i (maybe just Ubuntu with isc-dhcp-client) that leases are not renewed during the runtime of the installation. Which might break networking when the switch throws you off post-expiry.
Attachment:
signature.asc
Description: Digital signature