import of dnsmasq-2.51.tar.gz

This commit is contained in:
Simon Kelley
2009-10-13 17:49:32 +01:00
parent 77e94da7bb
commit 1f15b81d61
34 changed files with 2729 additions and 2194 deletions

View File

@@ -45,11 +45,16 @@ static char *compile_opts =
"no-"
#endif
"DHCP "
#if defined(HAVE_DHCP) && !defined(HAVE_SCRIPT)
"no-scripts "
#endif
#ifndef HAVE_TFTP
"no-"
#endif
"TFTP";
static volatile pid_t pid = 0;
static volatile int pipewrite;
@@ -68,7 +73,7 @@ int main (int argc, char **argv)
struct iname *if_tmp;
int piperead, pipefd[2], err_pipe[2];
struct passwd *ent_pw = NULL;
#ifdef HAVE_DHCP
#if defined(HAVE_DHCP) && defined(HAVE_SCRIPT)
uid_t script_uid = 0;
gid_t script_gid = 0;
#endif
@@ -202,7 +207,7 @@ int main (int argc, char **argv)
if (daemon->port != 0)
pre_allocate_sfds();
#ifdef HAVE_DHCP
#if defined(HAVE_DHCP) && defined(HAVE_SCRIPT)
/* Note getpwnam returns static storage */
if (daemon->dhcp && daemon->lease_change_command && daemon->scriptuser)
{
@@ -352,7 +357,7 @@ int main (int argc, char **argv)
/* if we are to run scripts, we need to fork a helper before dropping root. */
daemon->helperfd = -1;
#if defined(HAVE_DHCP) && !defined(NO_FORK)
#if defined(HAVE_DHCP) && defined(HAVE_SCRIPT)
if (daemon->dhcp && daemon->lease_change_command)
daemon->helperfd = create_helper(pipewrite, err_pipe[1], script_uid, script_gid, max_fd);
#endif
@@ -603,7 +608,7 @@ int main (int argc, char **argv)
bump_maxfd(piperead, &maxfd);
#ifdef HAVE_DHCP
# ifndef NO_FORK
# ifdef HAVE_SCRIPT
while (helper_buf_empty() && do_script_run(now));
if (!helper_buf_empty())
@@ -674,7 +679,7 @@ int main (int argc, char **argv)
if (daemon->dhcp && FD_ISSET(daemon->dhcpfd, &rset))
dhcp_packet(now);
# ifndef NO_FORK
# ifdef HAVE_SCRIPT
if (daemon->helperfd != -1 && FD_ISSET(daemon->helperfd, &wset))
helper_write();
# endif
@@ -857,7 +862,7 @@ static void async_event(int pipe, time_t now)
if (daemon->tcp_pids[i] != 0)
kill(daemon->tcp_pids[i], SIGALRM);
#if defined(HAVE_DHCP) && !defined(NO_FORK)
#if defined(HAVE_DHCP) && defined(HAVE_SCRIPT)
/* handle pending lease transitions */
if (daemon->helperfd != -1)
{