dhcp-agent-commits Mailing List for dhcp-agent (Page 29)
Status: Alpha
Brought to you by:
actmodern
You can subscribe to this list here.
2002 |
Jan
|
Feb
(33) |
Mar
|
Apr
|
May
(19) |
Jun
(61) |
Jul
(12) |
Aug
|
Sep
(5) |
Oct
(31) |
Nov
(24) |
Dec
(56) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(9) |
Feb
|
Mar
(16) |
Apr
(4) |
May
(68) |
Jun
(70) |
Jul
(100) |
Aug
(54) |
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(7) |
Jun
(12) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(8) |
Oct
(5) |
Nov
(6) |
Dec
(4) |
2008 |
Jan
(9) |
Feb
(20) |
Mar
(32) |
Apr
(18) |
May
(19) |
Jun
(12) |
Jul
(23) |
Aug
(7) |
Sep
(15) |
Oct
(22) |
Nov
(50) |
Dec
(68) |
2009 |
Jan
(63) |
Feb
(23) |
Mar
(43) |
Apr
(50) |
May
(110) |
Jun
(103) |
Jul
(71) |
Aug
(26) |
Sep
(16) |
Oct
(31) |
Nov
(8) |
Dec
(13) |
2010 |
Jan
(6) |
Feb
(6) |
Mar
(36) |
Apr
(57) |
May
(67) |
Jun
(70) |
Jul
(44) |
Aug
(46) |
Sep
(27) |
Oct
(2) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: <bk...@us...> - 2002-06-10 23:15:23
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8642 Modified Files: acconfig.h acinclude.m4 aclocal.m4 config.h.in configure configure.in Log Message: Check for kill(pid, 0) behaviour. Index: acconfig.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acconfig.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** acconfig.h 6 Jun 2002 23:59:00 -0000 1.5 --- acconfig.h 10 Jun 2002 23:15:20 -0000 1.6 *************** *** 13,14 **** --- 13,17 ---- /* have sig_atomic_t */ #undef HAVE_SIG_ATOMIC_T + + /* kill(pid, 0) can be used to detect a process we can signal */ + #undef KILL_SIGNAL_DETECT Index: acinclude.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acinclude.m4,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** acinclude.m4 6 Jun 2002 03:25:04 -0000 1.5 --- acinclude.m4 10 Jun 2002 23:15:20 -0000 1.6 *************** *** 154,155 **** --- 154,204 ---- ], [ac_have_primacros_h="1"], AC_MSG_ERROR([I could not generate replacement C99 macros for stdint types! sorry I cannot carry on!]))]) + + AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, + [AC_MSG_CHECKING(if kill can be used to detect a process that can be signaled) + AC_TRY_RUN([ + /* Check the behaviour of kill(pid, 0). + * We expect it to return 0 for an existing process that we can + * signal, and < 0 otherwise. + */ + + #include <stdlib.h> + #include <stdio.h> + + #include <sys/types.h> + #include <sys/wait.h> + #include <signal.h> + #include <unistd.h> + + int main(int argc, char *argv[]) + { + pid_t child_pid; + int kill_existing, kill_nonexisting; + int wait_status; + + child_pid = fork(); + + if (child_pid == -1) { + perror("fork"); + exit(1); + } else if (child_pid == 0) { + (void)sleep(3600); + _exit(0); + } + + kill_existing = kill(child_pid, 0); + + (void)kill(child_pid, SIGTERM); + (void)wait(&wait_status); + + kill_nonexisting = kill(child_pid, 0); + + if (kill_existing == 0 && kill_nonexisting < 0) + exit(0); /* the behaviour we expect */ + else + fprintf(stderr, "error: returned (%d,%d); expecting (0,-1)\n", + kill_existing, kill_nonexisting); + + exit(1); + } + ], [AC_DEFINE(KILL_SIGNAL_DETECT) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) Index: aclocal.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/aclocal.m4,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** aclocal.m4 6 Jun 2002 03:25:04 -0000 1.5 --- aclocal.m4 10 Jun 2002 23:15:20 -0000 1.6 *************** *** 1,5 **** ! dnl aclocal.m4 generated automatically by aclocal 1.4-p4 ! dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,5 ---- ! dnl aclocal.m4 generated automatically by aclocal 1.4-p5 ! dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 167,170 **** --- 167,219 ---- AC_MSG_ERROR([I could not generate replacement C99 macros for stdint types! sorry I cannot carry on!]))]) + AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, + [AC_MSG_CHECKING(if kill can be used to detect a process that can be signaled) + AC_TRY_RUN([ + /* Check the behaviour of kill(pid, 0). + * We expect it to return 0 for an existing process that we can + * signal, and < 0 otherwise. + */ + + #include <stdlib.h> + #include <stdio.h> + + #include <sys/types.h> + #include <sys/wait.h> + #include <signal.h> + #include <unistd.h> + + int main(int argc, char *argv[]) + { + pid_t child_pid; + int kill_existing, kill_nonexisting; + int wait_status; + + child_pid = fork(); + + if (child_pid == -1) { + perror("fork"); + exit(1); + } else if (child_pid == 0) { + (void)sleep(3600); + _exit(0); + } + + kill_existing = kill(child_pid, 0); + + (void)kill(child_pid, SIGTERM); + (void)wait(&wait_status); + + kill_nonexisting = kill(child_pid, 0); + + if (kill_existing == 0 && kill_nonexisting < 0) + exit(0); /* the behaviour we expect */ + else + fprintf(stderr, "error: returned (%d,%d); expecting (0,-1)\n", + kill_existing, kill_nonexisting); + + exit(1); + } + ], [AC_DEFINE(KILL_SIGNAL_DETECT) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. *************** *** 176,180 **** dnl AM_INIT_AUTOMAKE(package,version, [no-define]) ! AC_DEFUN(AM_INIT_AUTOMAKE, [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] --- 225,229 ---- dnl AM_INIT_AUTOMAKE(package,version, [no-define]) ! AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] *************** *** 204,208 **** # ! AC_DEFUN(AM_SANITY_CHECK, [AC_MSG_CHECKING([whether build environment is sane]) # Just in case --- 253,257 ---- # ! AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case *************** *** 245,249 **** dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. ! AC_DEFUN(AM_MISSING_PROG, [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if --- 294,298 ---- dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. ! AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if *************** *** 261,265 **** # Like AC_CONFIG_HEADER, but automatically create stamp file. ! AC_DEFUN(AM_CONFIG_HEADER, [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) --- 310,314 ---- # Like AC_CONFIG_HEADER, but automatically create stamp file. ! AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** config.h.in 7 Jun 2002 00:04:37 -0000 1.10 --- config.h.in 10 Jun 2002 23:15:20 -0000 1.11 *************** *** 15,18 **** --- 15,21 ---- #undef HAVE_SIG_ATOMIC_T + /* kill(pid, 0) can be used to detect a process we can signal */ + #undef KILL_SIGNAL_DETECT + /* default client work directory */ #undef CLIENT_WORK_DIR Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** configure 7 Jun 2002 12:51:12 -0000 1.18 --- configure 10 Jun 2002 23:15:20 -0000 1.19 *************** *** 1,5 **** #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated by Autoconf 2.50 for dhcp-agent 0.36. # # Report bugs to <tm...@wh...>. --- 1,5 ---- #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated by Autoconf 2.52 for dhcp-agent 0.36. # [...3165 lines suppressed...] { (exit 1); exit 1; }; } --- 3868,3872 ---- else # /dev/null tree ! { { echo "$as_me:3870: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3840,3844 **** if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3842: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else --- 3985,3989 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3987: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** configure.in 7 Jun 2002 12:51:13 -0000 1.18 --- configure.in 10 Jun 2002 23:15:20 -0000 1.19 *************** *** 47,50 **** --- 47,54 ---- AC_SUBST(DHCP_SNPRINTF) + dnl check if kill(pid, 0) can be used to detect a process we can signal + + AC_WF_CHECK_KILL_SIGNAL_DETECT + dnl check for types |
From: Thamer Al-H. <act...@us...> - 2002-06-08 17:35:05
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv8029 Modified Files: dhcp-agent.h dhcp-interface.c Log Message: added routine to dhcp-interface.c to return list of ethernet interfaces which are either not up or do not have an address assigned; Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** dhcp-agent.h 8 Jun 2002 06:00:29 -0000 1.52 --- dhcp-agent.h 8 Jun 2002 17:35:02 -0000 1.53 *************** *** 820,823 **** --- 820,824 ---- extern void destroy_interface_control(interface_control_t *ic); extern int interface_get_ip_addr(interface_control_t *ic, uint32_t *addr); + extern list_t *interface_get_available(void); /* client states */ Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-interface.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-interface.c 6 Jun 2002 23:59:00 -0000 1.15 --- dhcp-interface.c 8 Jun 2002 17:35:02 -0000 1.16 *************** *** 142,143 **** --- 142,202 ---- return 0; } + + /* utility to get interface list and place it in a list. */ + + static int list_available_interfaces(const struct intf_entry *entry, void *arg) + { + list_t **p_list; /* pointer to linked list. */ + list_t *head; /* head of linked list. */ + char *intf_name = NULL; + + p_list = arg; + head = *p_list; + + /* + * Check the interface type is ethernet, + * is down OR has no IP address assigned to it. + * If it passes then add the name to the list. + */ + + if(entry->intf_type == INTF_TYPE_ETH) { + + if(((entry->intf_flags&INTF_FLAG_UP) == 0) /* true if not up. */ + || (entry->intf_addr.addr_type == ADDR_TYPE_NONE)) /* or true if no address + set. */ + intf_name = strdup(entry->intf_name); + } + + if(intf_name != NULL) + head = add_to_end_of_list(head, intf_name); + + *p_list = head; + + return 0; + } + + list_t *interface_get_available(void) + { + intf_t *interfaces; + list_t *interface_list; + list_t **p_list = xmalloc(sizeof(list_t *)); + *p_list = NULL; + + interfaces = intf_open(); + if(interfaces == NULL) { + + error_message("dhcp-interface: interfaces_get_available: could not obtain interface handle: %s\n", strerror(errno)); /* yes it's too long -- need exception stack. */ + + xfree(p_list); + intf_close(interfaces); + return NULL; + } + + intf_loop(interfaces, list_available_interfaces, p_list); + + interface_list = *p_list; + xfree(p_list); + intf_close(interfaces); + + return interface_list; + } |
From: Thamer Al-H. <act...@us...> - 2002-06-07 20:46:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv19494 Modified Files: dhcp-agent.h Log Message: we don't need an ifdef in dhcp-agent.h for progname Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** dhcp-agent.h 6 Jun 2002 23:59:00 -0000 1.50 --- dhcp-agent.h 7 Jun 2002 20:46:35 -0000 1.51 *************** *** 57,64 **** # include <config.h> ! #if !defined(HAVE_PROGNAME) ! /* must be placed in main source of each binary. */ ! extern const char *__progname; ! #endif #if defined(HAVE_GETOPT_H) --- 57,63 ---- # include <config.h> ! /* must be placed in main source of each binary. ! * if not available. */ ! extern const char *__progname; #if defined(HAVE_GETOPT_H) |
From: Thamer Al-H. <act...@us...> - 2002-06-07 13:14:49
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv27505 Modified Files: dhcpclient.1 Log Message: new (better) manpage; thanks Brian J. Kifiak Index: dhcpclient.1 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcpclient.1,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcpclient.1 11 Feb 2002 18:02:24 -0000 1.8 --- dhcpclient.1 7 Jun 2002 13:14:47 -0000 1.9 *************** *** 1,71 **** .Dd January, 29, 2001 ! .Dt DHCPCLIENT .Sh NAME .Nm dhcpclient ! -- DHCP Client. .Sh SYNOPSIS ! .Nm dhcpclient ! .Op -avckw ! .Op -k ! .Op Ar -d working directory ! .Op Ar -i interface name ! .Op Ar -m fake mac source address ! .Op Ar -l verbosity_level .Sh DESCRIPTION ! .I ! dhcpclient is a DHCP client daemon. It will start up in the ! foreground until it initializes its interface, and then go into the ! background and renew its lease when it needs to. You may safely run ! more than one dhcpclient per host since it stores all its data in ! control files named after the interface it is configuring. It is not ! safe to run more than one dhcpclient per interface. Currently only ! the basic networking DHCP options are handled. The interfaces IP ! address, the routing table, and the domain name system are setup. ! .Sh OPTIONS ! .Bl -tag ! .It Op -p ! Run in promiscious mode (implicit with -m flag). You should only ! use this option if the system you are using dhcpclient on is ! sufficiently broken that it needs promiscious mode to receive ! packets with libpcap. ! .It Op Ar -i interface name ! Specifies a the name of an interface dhcpsniff will use. otherwise ! dhcpsniff will let pcap decide. Default value is "eth0" ! .It Op Ar -d working directory ! By default dhcpclient will use "/etc/dhcpclient" to store its ! control files. This option allows another directory to be used. Be ! warned that the directory must be only readable and writeable by ! root to ensure security. ! .It Op -a ! Run in foreground always. ! .It Op -k ! Kill current dhcpclient on specified interface. ! .It Op -v ! Print version. ! .It Op -w ! Wake current dhcpclient on specificed interface. This forces a renew. ! .It Op -c ! Clear cache. Should be used if client crashes and leaves corrupt ! cache. ! .It Op Ar -m fake mac address ! Use a fake mac source address. Useful only for diagnostics where ! want to see if a specific lease based on a mac address is accessible. ! .It Op Ar -l verbosity level ! Verbosity level can be set to the following integers: ! .Bl -tag ! .It 0 No output ! .It 1 Only error messages are outputed. ! .It 2 Normal output; errors and info messages. ! .It 3 Warning level. Output warnings along with error and info messages. ! .It 4 Debug level. Lots of diagnostic output. All messages. ! .El ! .El ! .Sh BUGS .Pp ! dhcpclient is still in alpha mode. .Pp .Sh SEE ALSO ! .Xr dhcpsniff 1 .Sh AUTHORS ! Thamer Al-Harbash .Aq tm...@wh... --- 1,111 ---- + .\" $Header$ .Dd January, 29, 2001 ! .Dt DHCPCLIENT 1 .Sh NAME .Nm dhcpclient ! .Nd DHCP (Dynamic Host Configuration Protocol) Client .Sh SYNOPSIS ! .Nm ! .Op Fl achkpvw ! .Op Fl d Ar directory ! .Op Fl i Ar interface ! .Op Fl l Ar level ! .Op Fl m Ar mac_addr .Sh DESCRIPTION ! .Nm ! is a DHCP client daemon. ! .Nm ! currently it only configures basic networking: the interface's IP address; the ! routing table; and the domain name system using the DHCP-provided settings. .Pp ! By default, ! .Nm ! runs in the foreground until it initializes its interface, then forks ! into the background, renewing its lease as needed. ! .Pp ! More than one ! .Nm ! may safely be run per host, but it is not safe to run more than one ! .Nm ! per interface. ! A single ! .Nm ! deals with a single interface. .Pp + The options are as follows: + .Bl -tag -width Ds + .It Fl a + Always run in the foreground. + .It Fl c + Clear cache. + Useful if + .Nm + crashes and leaves a corrupt cache. + .It Fl d Ar directory + Control file directory. + Default is + .Pa /etc/dhcpclient . + The directory is created readable and writable to root (the usual + user of + .Nm + ) to ensure security. + .It Fl h + Help. + .It Fl i Ar interface + Perform DHCP query on + .Ar interface , + otherwise it will scan the interface table and use the first + downed ethernet interface it finds, or the first ethernet + interface it finds. + .It Fl k + Kill + .Nm dhcpclient . + .It Fl l Ar level + Set the verbosity level to one of the following: + .Bl -tag -width "l 0 " -compact + .It Fl l Ar 0 + Don't generate messages. + .It Fl l Ar 1 + Generate messages only for errors. + .It Fl l Ar 2 + Generate messages for errors and misc. info (normal). + .It Fl l Ar 3 + Generate messages for errors, warnings, and misc. info. + .It Fl l Ar 4 + Generate messages for all conditions, plus diagnostics. + .El + .It Fl m Ar mac_addr + Send DHCP query using + .Ar mac_addr . + Useful for diagnostics when testing response based a MAC address. + Implies + .Fl p . + .It Fl p + Put the interface into promiscuous mode. + Should only be used if the system is sufficiently broken that + .Xr pcap 3 + needs promiscuous mode to receive packets. + .It Fl v + Version. + .It Fl w + Wake + .Nm dhcpclient , + forcing a renew. + .El + .Sh BUGS + .Nm + is still in alpha mode. + .Sh FILES + .Bl -tag -width "/etc/dhcpclient" -compact + .It Pa /etc/dhcpclient + Control file directory + .El .Sh SEE ALSO ! .Xr dhcpsniff 1 , ! .Xr dnet 3 , ! .Xr pcap 3 .Sh AUTHORS ! .An Thamer Al-Harbash .Aq tm...@wh... + .An Brian J. Kifiak + .Aq bk...@rt... |
From: Thamer Al-H. <act...@us...> - 2002-06-07 12:51:16
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv17553 Modified Files: configure configure.in dhcp-util.h Log Message: fix to __progname detection in configure.in; added license to dhcp-util.h Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** configure 6 Jun 2002 23:59:00 -0000 1.17 --- configure 7 Jun 2002 12:51:12 -0000 1.18 *************** *** 2756,2759 **** --- 2756,2760 ---- #include <stdlib.h> #include <stdio.h> + extern const char *__progname; int *************** *** 2768,2796 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2770: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2773: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2776: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2779: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF #define HAVE_PROGNAME 1 EOF ! , echo "$as_me:2784: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! echo "$as_me:2789: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext; ! echo "$as_me:2794: checking for sig_atomic_t" >&5 echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 if test "${ac_cv_type_sig_atomic_t+set}" = set; then --- 2769,2798 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2771: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2774: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2777: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2780: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF #define HAVE_PROGNAME 1 EOF ! ! echo "$as_me:2786: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! echo "$as_me:2791: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext; ! echo "$as_me:2796: checking for sig_atomic_t" >&5 echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 if test "${ac_cv_type_sig_atomic_t+set}" = set; then *************** *** 2798,2802 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2800 "configure" #include "confdefs.h" #include <signal.h> --- 2800,2804 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2802 "configure" #include "confdefs.h" #include <signal.h> *************** *** 2814,2827 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2816: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2819: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2822: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2825: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes --- 2816,2829 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2818: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2821: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2824: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2827: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes *************** *** 2833,2837 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2835: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then --- 2835,2839 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2837: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then *************** *** 2842,2846 **** fi ! echo "$as_me:2844: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then --- 2844,2848 ---- fi ! echo "$as_me:2846: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then *************** *** 2848,2852 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2850 "configure" #include "confdefs.h" #include <sys/types.h> --- 2850,2854 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2852 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2870,2883 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2872: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2875: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2878: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2881: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void --- 2872,2885 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2874: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2877: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2880: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2883: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void *************** *** 2889,2893 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2891: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 --- 2891,2895 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2893: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 *************** *** 2898,2902 **** if test -z "$pcap_prefix"; then ! echo "$as_me:2900: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" --- 2900,2904 ---- if test -z "$pcap_prefix"; then ! echo "$as_me:2902: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" *************** *** 2909,2913 **** if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2911: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2911,2915 ---- if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2913: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2918,2926 **** fi ! echo "$as_me:2920: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2924: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" --- 2920,2928 ---- fi ! echo "$as_me:2922: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2926: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" *************** *** 2933,2937 **** if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2935: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2935,2939 ---- if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2937: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2942,2946 **** fi ! echo "$as_me:2944: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" --- 2944,2948 ---- fi ! echo "$as_me:2946: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" *************** *** 2959,2963 **** # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2961: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then --- 2961,2965 ---- # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2963: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then *************** *** 2976,2980 **** if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2978: found $ac_dir/$ac_word" >&5 break fi --- 2978,2982 ---- if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2980: found $ac_dir/$ac_word" >&5 break fi *************** *** 2987,2994 **** if test -n "$DNET_PATH"; then ! echo "$as_me:2989: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:2992: result: no" >&5 echo "${ECHO_T}no" >&6 fi --- 2989,2996 ---- if test -n "$DNET_PATH"; then ! echo "$as_me:2991: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:2994: result: no" >&5 echo "${ECHO_T}no" >&6 fi *************** *** 3000,3004 **** if test $DNET_PATH = "no"; then ! echo "$as_me:3002: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then --- 3002,3006 ---- if test $DNET_PATH = "no"; then ! echo "$as_me:3004: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then *************** *** 3008,3012 **** LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 3010 "configure" #include "confdefs.h" --- 3010,3014 ---- LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 3012 "configure" #include "confdefs.h" *************** *** 3027,3040 **** _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:3029: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:3032: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:3035: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:3038: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes --- 3029,3042 ---- _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:3031: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:3034: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:3037: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:3040: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes *************** *** 3047,3056 **** LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:3049: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:3054: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } --- 3049,3058 ---- LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:3051: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:3056: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } *************** *** 3159,3163 **** ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:3161: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF --- 3161,3165 ---- ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:3163: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF *************** *** 3335,3339 **** --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3337: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 --- 3337,3341 ---- --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3339: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 *************** *** 3359,3368 **** # This is an error. ! -*) { { echo "$as_me:3361: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3366: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; --- 3361,3370 ---- # This is an error. ! -*) { { echo "$as_me:3363: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3368: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; *************** *** 3605,3609 **** if test x"$ac_file" != x-; then ! { echo "$as_me:3607: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" --- 3607,3611 ---- if test x"$ac_file" != x-; then ! { echo "$as_me:3609: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" *************** *** 3623,3627 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3625: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3625,3629 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3627: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3636,3640 **** else # /dev/null tree ! { { echo "$as_me:3638: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3638,3642 ---- else # /dev/null tree ! { { echo "$as_me:3640: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3697,3701 **** esac ! test x"$ac_file" != x- && { echo "$as_me:3699: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} --- 3699,3703 ---- esac ! test x"$ac_file" != x- && { echo "$as_me:3701: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} *************** *** 3708,3712 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3710: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3710,3714 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3712: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3721,3725 **** else # /dev/null tree ! { { echo "$as_me:3723: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3723,3727 ---- else # /dev/null tree ! { { echo "$as_me:3725: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3838,3842 **** if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3840: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else --- 3840,3844 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3842: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** configure.in 6 Jun 2002 23:59:00 -0000 1.17 --- configure.in 7 Jun 2002 12:51:13 -0000 1.18 *************** *** 59,65 **** #include <stdlib.h> #include <stdio.h> ],[ const char *s = __progname; ! ], [ AC_DEFINE(HAVE_PROGNAME), AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no)]); AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T)], [], [#include <signal.h>]) --- 59,67 ---- #include <stdlib.h> #include <stdio.h> + extern const char *__progname; ],[ const char *s = __progname; ! ], [ AC_DEFINE(HAVE_PROGNAME) ! AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no)]); AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T)], [], [#include <signal.h>]) Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-util.h 7 Jun 2002 00:04:37 -0000 1.1 --- dhcp-util.h 7 Jun 2002 12:51:13 -0000 1.2 *************** *** 1,2 **** --- 1,29 ---- + /* $Header$ + * + * Copyright 2001 Thamer Alharbash + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + */ + + #ifndef DHCP_UTIL_H + #define DHCP_UTIL_H + /* Utility functions. */ *************** *** 33,34 **** --- 60,63 ---- extern struct timeval timeval_diff(struct timeval begin, struct timeval end); extern const char *getprogname(void); + + #endif /* DHCP_UTIL_H */ |
From: Thamer Al-H. <act...@us...> - 2002-06-07 00:04:40
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv30399 Modified Files: config.h.in Added Files: dhcp-util.h Log Message: added dhcp-util.h --- NEW FILE: dhcp-util.h --- /* Utility functions. */ /* in case strdup is not available. */ # ifndef HAVE_STRDUP extern char *strdup(char *s); # endif /* HAVE_STRDUP */ extern void error_message(char *fmt, ...); extern void fatal_error(char *fmt, ...); extern void warn_message(char *fmt, ...); extern void debug_message(char *fmt, ...); extern int get_verbosity_level(void); extern int set_verbosity_level(int verbosity_level_to_set); extern void *xmalloc(size_t size); extern void *xcalloc(size_t size); extern void xfree(void *p); extern int check_for_interrupts(void); extern void suspend_for_interrupts(void); extern void block_interrupts(void); extern void add_interrupt_handler(int sigtype, void (*sighandler)(int)); extern void info_message(char *fmt, ...); extern char *splice_string(const char *s1, const char *s2); extern char *splice_many_strings(int num, char *s, ...); extern void trim_string(char *s); extern int string_matches(const char *s1, const char *s2); extern int hex_string_to_value(char *string, unsigned char *dst); extern int is_string(const char *string, int len); extern uint16_t get_random_uint16(void); extern uint32_t get_random_uint32(void); extern struct timeval timeval_diff(struct timeval begin, struct timeval end); extern const char *getprogname(void); Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** config.h.in 6 Jun 2002 23:59:00 -0000 1.9 --- config.h.in 7 Jun 2002 00:04:37 -0000 1.10 *************** *** 3,6 **** --- 3,10 ---- * our own pri macros. */ + /* have __progname var */ + #undef HAVE_PROGNAME + + /* have PRI* marcos */ #undef HAVE_PRIMACROS_H |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv28683 Modified Files: THANKS acconfig.h config.h.in configure configure.in dhcp-agent.h dhcp-arp-discovery.c dhcp-arp.c dhcp-cache-entry.c dhcp-client-cache.c dhcp-client-conf.c dhcp-client-control.c dhcp-client-states.c dhcp-client.c dhcp-com.c dhcp-convert.c dhcp-daemon.c dhcp-eth.c dhcp-files.c dhcp-globconf.c dhcp-icmp-discovery.c dhcp-icmp.c dhcp-interface.c dhcp-ip.c dhcp-list.c dhcp-log.c dhcp-net.c dhcp-packet-build.c dhcp-print.c dhcp-route.c dhcp-rtt.c dhcp-sniff.c dhcp-sysconf.c dhcp-udp.c dhcp-util.c Log Message: __progname subsitution and getprogname() substitution; moved dhcp-util routines to their own header file Index: THANKS =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/THANKS,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** THANKS 3 Jun 2002 01:36:04 -0000 1.6 --- THANKS 6 Jun 2002 23:59:00 -0000 1.7 *************** *** 15,16 **** --- 15,19 ---- -- Bill Traynor for Solaris x86. + + -- Brian J. Kifiak for OpenBSD help/testing and helpful suggestions. + Index: acconfig.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acconfig.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** acconfig.h 5 Jun 2002 03:00:59 -0000 1.4 --- acconfig.h 6 Jun 2002 23:59:00 -0000 1.5 *************** *** 2,5 **** --- 2,9 ---- * our own pri macros. */ + /* have __progname var */ + #undef HAVE_PROGNAME + + /* have PRI* marcos */ #undef HAVE_PRIMACROS_H Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** config.h.in 5 Jun 2002 03:00:59 -0000 1.8 --- config.h.in 6 Jun 2002 23:59:00 -0000 1.9 *************** *** 23,26 **** --- 23,29 ---- #undef HAVE_GETOPT_H + /* Define if you have the `getprogname' function. */ + #undef HAVE_GETPROGNAME + /* Define if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** configure 6 Jun 2002 03:25:04 -0000 1.16 --- configure 6 Jun 2002 23:59:00 -0000 1.17 *************** *** 2555,2559 **** fi ! for ac_func in strdup uname calloc daemon rename sysconf getrusage do ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` --- 2555,2559 ---- fi ! for ac_func in strdup uname calloc daemon rename sysconf getrusage getprogname do ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` *************** *** 2703,2707 **** #line 2703 "configure" #include "confdefs.h" ! #include <sys/types> #include <sys/time.h> #include <sys/ioctl.h> --- 2703,2707 ---- #line 2703 "configure" #include "confdefs.h" ! #include <sys/types.h> #include <sys/time.h> #include <sys/ioctl.h> *************** *** 2748,2752 **** fi ! echo "$as_me:2750: checking for sig_atomic_t" >&5 echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 if test "${ac_cv_type_sig_atomic_t+set}" = set; then --- 2748,2796 ---- fi ! echo "$as_me:2750: checking for __progname" >&5 ! echo $ECHO_N "checking for __progname... $ECHO_C" >&6 ! cat >conftest.$ac_ext <<_ACEOF ! #line 2753 "configure" ! #include "confdefs.h" ! ! #include <stdlib.h> ! #include <stdio.h> ! ! int ! main () ! { ! ! const char *s = __progname; ! ! ; ! return 0; ! } ! _ACEOF ! rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2770: \"$ac_compile\"") >&5 ! (eval $ac_compile) 2>&5 ! ac_status=$? ! echo "$as_me:2773: \$? = $ac_status" >&5 ! (exit $ac_status); } && ! { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2776: \"$ac_try\"") >&5 ! (eval $ac_try) 2>&5 ! ac_status=$? ! echo "$as_me:2779: \$? = $ac_status" >&5 ! (exit $ac_status); }; }; then ! cat >>confdefs.h <<\EOF ! #define HAVE_PROGNAME 1 ! EOF ! , echo "$as_me:2784: result: yes" >&5 ! echo "${ECHO_T}yes" >&6 ! else ! echo "$as_me: failed program was:" >&5 ! cat conftest.$ac_ext >&5 ! echo "$as_me:2789: result: no" >&5 ! echo "${ECHO_T}no" >&6 ! fi ! rm -f conftest.$ac_objext conftest.$ac_ext; ! ! echo "$as_me:2794: checking for sig_atomic_t" >&5 echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 if test "${ac_cv_type_sig_atomic_t+set}" = set; then *************** *** 2754,2758 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2756 "configure" #include "confdefs.h" #include <signal.h> --- 2798,2802 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2800 "configure" #include "confdefs.h" #include <signal.h> *************** *** 2770,2783 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2772: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2775: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2778: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2781: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes --- 2814,2827 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2816: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2819: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2822: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2825: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes *************** *** 2789,2793 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2791: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then --- 2833,2837 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2835: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then *************** *** 2798,2802 **** fi ! echo "$as_me:2800: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then --- 2842,2846 ---- fi ! echo "$as_me:2844: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then *************** *** 2804,2808 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2806 "configure" #include "confdefs.h" #include <sys/types.h> --- 2848,2852 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2850 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2826,2839 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2828: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2831: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2834: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2837: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void --- 2870,2883 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2872: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2875: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2878: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2881: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void *************** *** 2845,2849 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2847: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 --- 2889,2893 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2891: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 *************** *** 2854,2858 **** if test -z "$pcap_prefix"; then ! echo "$as_me:2856: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" --- 2898,2902 ---- if test -z "$pcap_prefix"; then ! echo "$as_me:2900: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" *************** *** 2865,2869 **** if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2867: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2909,2913 ---- if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2911: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2874,2882 **** fi ! echo "$as_me:2876: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2880: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" --- 2918,2926 ---- fi ! echo "$as_me:2920: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2924: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" *************** *** 2889,2893 **** if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2891: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2933,2937 ---- if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2935: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2898,2902 **** fi ! echo "$as_me:2900: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" --- 2942,2946 ---- fi ! echo "$as_me:2944: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" *************** *** 2915,2919 **** # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2917: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then --- 2959,2963 ---- # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2961: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then *************** *** 2932,2936 **** if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2934: found $ac_dir/$ac_word" >&5 break fi --- 2976,2980 ---- if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2978: found $ac_dir/$ac_word" >&5 break fi *************** *** 2943,2950 **** if test -n "$DNET_PATH"; then ! echo "$as_me:2945: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:2948: result: no" >&5 echo "${ECHO_T}no" >&6 fi --- 2987,2994 ---- if test -n "$DNET_PATH"; then ! echo "$as_me:2989: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:2992: result: no" >&5 echo "${ECHO_T}no" >&6 fi *************** *** 2956,2960 **** if test $DNET_PATH = "no"; then ! echo "$as_me:2958: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then --- 3000,3004 ---- if test $DNET_PATH = "no"; then ! echo "$as_me:3002: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then *************** *** 2964,2968 **** LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 2966 "configure" #include "confdefs.h" --- 3008,3012 ---- LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 3010 "configure" #include "confdefs.h" *************** *** 2983,2996 **** _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:2985: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:2988: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:2991: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2994: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes --- 3027,3040 ---- _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:3029: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:3032: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:3035: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:3038: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes *************** *** 3003,3012 **** LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:3005: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:3010: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } --- 3047,3056 ---- LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:3049: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:3054: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } *************** *** 3115,3119 **** ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:3117: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF --- 3159,3163 ---- ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:3161: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF *************** *** 3291,3295 **** --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3293: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 --- 3335,3339 ---- --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3337: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 *************** *** 3315,3324 **** # This is an error. ! -*) { { echo "$as_me:3317: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3322: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; --- 3359,3368 ---- # This is an error. ! -*) { { echo "$as_me:3361: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3366: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; *************** *** 3561,3565 **** if test x"$ac_file" != x-; then ! { echo "$as_me:3563: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" --- 3605,3609 ---- if test x"$ac_file" != x-; then ! { echo "$as_me:3607: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" *************** *** 3579,3583 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3581: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3623,3627 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3625: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3592,3596 **** else # /dev/null tree ! { { echo "$as_me:3594: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3636,3640 ---- else # /dev/null tree ! { { echo "$as_me:3638: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3653,3657 **** esac ! test x"$ac_file" != x- && { echo "$as_me:3655: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} --- 3697,3701 ---- esac ! test x"$ac_file" != x- && { echo "$as_me:3699: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} *************** *** 3664,3668 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3666: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3708,3712 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3710: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3677,3681 **** else # /dev/null tree ! { { echo "$as_me:3679: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3721,3725 ---- else # /dev/null tree ! { { echo "$as_me:3723: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3794,3798 **** if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3796: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else --- 3838,3842 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3840: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** configure.in 5 Jun 2002 03:00:59 -0000 1.16 --- configure.in 6 Jun 2002 23:59:00 -0000 1.17 *************** *** 40,44 **** dnl check for functions ! AC_CHECK_FUNCS(strdup uname calloc daemon rename sysconf getrusage) AC_CHECK_FUNCS(sprintf vsnprintf, --- 40,44 ---- dnl check for functions ! AC_CHECK_FUNCS(strdup uname calloc daemon rename sysconf getrusage getprogname) AC_CHECK_FUNCS(sprintf vsnprintf, *************** *** 50,57 **** AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL)], [], ! [#include <sys/types> #include <sys/time.h> #include <sys/ioctl.h> #include <net/bpf.h> ]) AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T)], [], [#include <signal.h>]) --- 50,65 ---- AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL)], [], ! [#include <sys/types.h> #include <sys/time.h> #include <sys/ioctl.h> #include <net/bpf.h> ]) + + AC_MSG_CHECKING(for __progname) + AC_TRY_COMPILE([ + #include <stdlib.h> + #include <stdio.h> + ],[ + const char *s = __progname; + ], [ AC_DEFINE(HAVE_PROGNAME), AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no)]); AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T)], [], [#include <signal.h>]) Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** dhcp-agent.h 6 Jun 2002 03:27:25 -0000 1.49 --- dhcp-agent.h 6 Jun 2002 23:59:00 -0000 1.50 *************** *** 57,60 **** --- 57,65 ---- # include <config.h> + #if !defined(HAVE_PROGNAME) + /* must be placed in main source of each binary. */ + extern const char *__progname; + #endif + #if defined(HAVE_GETOPT_H) *************** *** 559,596 **** extern void setup_interrupt_handlers(void); - /* Utility functions. */ - - /* in case strdup is not available. */ - - # ifndef HAVE_STRDUP - extern char *strdup(char *s); - # endif /* HAVE_STRDUP */ - - extern void error_message(char *fmt, ...); - extern void fatal_error(char *fmt, ...); - extern void warn_message(char *fmt, ...); - extern void debug_message(char *fmt, ...); - - extern int get_verbosity_level(void); - extern int set_verbosity_level(int verbosity_level_to_set); - - extern void *xmalloc(size_t size); - extern void *xcalloc(size_t size); - extern void xfree(void *p); - extern int check_for_interrupts(void); - extern void suspend_for_interrupts(void); - extern void block_interrupts(void); - extern void add_interrupt_handler(int sigtype, void (*sighandler)(int)); - extern void info_message(char *fmt, ...); - extern char *splice_string(const char *s1, const char *s2); - extern char *splice_many_strings(int num, char *s, ...); - extern void trim_string(char *s); - extern int string_matches(const char *s1, const char *s2); - extern int hex_string_to_value(char *string, unsigned char *dst); - extern int is_string(const char *string, int len); - extern uint16_t get_random_uint16(void); - extern uint32_t get_random_uint32(void); - extern struct timeval timeval_diff(struct timeval begin, struct timeval end); - /* Replacement vsnprintf, snprintf if needed. */ --- 564,567 ---- *************** *** 820,824 **** /* Logging functions. */ ! extern void init_log(char *s); extern void close_log(void); extern void error_log(char *msg); --- 791,795 ---- /* Logging functions. */ ! extern void init_log(const char *s); extern void close_log(void); extern void error_log(char *msg); *************** *** 862,866 **** extern int interactive; - extern char *binname; extern char *workdirectory; extern int want_shutdown, want_hup; --- 833,836 ---- Index: dhcp-arp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp-discovery.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-arp-discovery.c 19 May 2002 17:53:28 -0000 1.3 --- dhcp-arp-discovery.c 6 Jun 2002 23:59:00 -0000 1.4 *************** *** 24,27 **** --- 24,28 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> /* Accept a list of arguments. Will contain rawnet first, and Index: dhcp-arp.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-arp.c 19 May 2002 16:24:37 -0000 1.8 --- dhcp-arp.c 6 Jun 2002 23:59:00 -0000 1.9 *************** *** 24,27 **** --- 24,28 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> /* constructor */ Index: dhcp-cache-entry.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-cache-entry.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-cache-entry.c 6 Jun 2002 03:27:25 -0000 1.5 --- dhcp-cache-entry.c 6 Jun 2002 23:59:00 -0000 1.6 *************** *** 28,31 **** --- 28,32 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> /* constructors. */ Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-client-cache.c 30 May 2002 06:44:05 -0000 1.8 --- dhcp-client-cache.c 6 Jun 2002 23:59:00 -0000 1.9 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-files.h> #include <dhcp-convert.h> Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-client-conf.c 29 May 2002 03:12:54 -0000 1.7 --- dhcp-client-conf.c 6 Jun 2002 23:59:00 -0000 1.8 *************** *** 24,27 **** --- 24,28 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-files.h> Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-client-control.c 25 May 2002 20:55:36 -0000 1.18 --- dhcp-client-control.c 6 Jun 2002 23:59:00 -0000 1.19 *************** *** 23,26 **** --- 23,27 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-globconf.h> Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dhcp-client-states.c 30 May 2002 06:44:05 -0000 1.21 --- dhcp-client-states.c 6 Jun 2002 23:59:00 -0000 1.22 *************** *** 27,30 **** --- 27,31 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-sysconf.h> Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dhcp-client.c 5 Jun 2002 12:59:58 -0000 1.22 --- dhcp-client.c 6 Jun 2002 23:59:00 -0000 1.23 *************** *** 24,34 **** #include <dhcp-agent.h> #include <dhcp-globconf.h> #include <dhcp-files.h> int interactive = 1; /* by default we begin interactive (messages on stdout/stderr). */ - char *binname = "dhcpclient"; /* we need a name. */ char *work_dir = CLIENT_WORK_DIR; /* our default working directory */ /* read up on our global conf. */ static void read_global_conf(const char *interface) --- 24,38 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-globconf.h> #include <dhcp-files.h> int interactive = 1; /* by default we begin interactive (messages on stdout/stderr). */ char *work_dir = CLIENT_WORK_DIR; /* our default working directory */ + #if !defined(HAVE_PROGNAME) + const char *__progname; + #endif /* HAVE_PROGNAME */ + /* read up on our global conf. */ static void read_global_conf(const char *interface) *************** *** 247,250 **** --- 251,258 ---- int promiscious = 0; + #if !defined(HAVE_PROGNAME) + __progname = argv[0]; + #endif /* HAVE_PROGNAME */ + while((c = getopt(argc, argv, "gcdavi:m:kwh:l:")) != -1) { *************** *** 252,256 **** case 'v': ! printf("%s version: %s\n", argv[0], VERSION); exit(0); --- 260,264 ---- case 'v': ! printf("%s version: %s\n", getprogname(), VERSION); exit(0); Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-com.c 19 May 2002 20:16:55 -0000 1.5 --- dhcp-com.c 6 Jun 2002 23:59:00 -0000 1.6 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> static const unsigned char dhcp_magic_cookie[4] = { 99, 130, 83, 99 }; Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-convert.c 30 May 2002 06:44:05 -0000 1.12 --- dhcp-convert.c 6 Jun 2002 23:59:00 -0000 1.13 *************** *** 32,35 **** --- 32,36 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-convert.h> Index: dhcp-daemon.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-daemon.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-daemon.c 14 Feb 2002 10:43:34 -0000 1.5 --- dhcp-daemon.c 6 Jun 2002 23:59:00 -0000 1.6 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> /* wrap for volatine integers, or proper sig_atomic_t types. */ *************** *** 225,229 **** /* initialize logging. */ ! init_log(binname); /* Now we're done. */ --- 226,230 ---- /* initialize logging. */ ! init_log(getprogname()); /* Now we're done. */ Index: dhcp-eth.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-eth.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-eth.c 1 Feb 2002 18:31:17 -0000 1.3 --- dhcp-eth.c 6 Jun 2002 23:59:00 -0000 1.4 *************** *** 27,30 **** --- 27,31 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> eth_obj *eth_create(void) Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-files.c 29 May 2002 03:12:54 -0000 1.9 --- dhcp-files.c 6 Jun 2002 23:59:00 -0000 1.10 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-files.h> Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-globconf.c 30 May 2002 06:44:05 -0000 1.3 --- dhcp-globconf.c 6 Jun 2002 23:59:00 -0000 1.4 *************** *** 29,32 **** --- 29,33 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-globconf.h> #include <dhcp-files.h> Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-icmp-discovery.c 30 May 2002 06:44:05 -0000 1.10 --- dhcp-icmp-discovery.c 6 Jun 2002 23:59:00 -0000 1.11 *************** *** 28,31 **** --- 28,32 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-globconf.h> #include <dhcp-convert.h> Index: dhcp-icmp.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-icmp.c 19 May 2002 17:53:28 -0000 1.6 --- dhcp-icmp.c 6 Jun 2002 23:59:00 -0000 1.7 *************** *** 24,27 **** --- 24,28 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> icmp_obj *icmp_create(void) Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-interface.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-interface.c 18 May 2002 18:10:09 -0000 1.14 --- dhcp-interface.c 6 Jun 2002 23:59:00 -0000 1.15 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> /* Internal utilities */ Index: dhcp-ip.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-ip.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-ip.c 8 Feb 2002 01:37:29 -0000 1.4 --- dhcp-ip.c 6 Jun 2002 23:59:00 -0000 1.5 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> ip_obj *ip_create(void) Index: dhcp-list.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-list.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-list.c 30 Jan 2002 09:26:03 -0000 1.2 --- dhcp-list.c 6 Jun 2002 23:59:00 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> list_t *add_to_list(list_t *head, void *datum) Index: dhcp-log.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-log.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-log.c 8 Feb 2002 01:37:29 -0000 1.2 --- dhcp-log.c 6 Jun 2002 23:59:00 -0000 1.3 *************** *** 27,31 **** #include <dhcp-agent.h> ! void init_log(char *s) { openlog(s, LOG_OPT, LOG_FACILITY); --- 27,31 ---- #include <dhcp-agent.h> ! void init_log(const char *s) { openlog(s, LOG_OPT, LOG_FACILITY); Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dhcp-net.c 5 Jun 2002 13:08:36 -0000 1.24 --- dhcp-net.c 6 Jun 2002 23:59:00 -0000 1.25 *************** *** 62,65 **** --- 62,66 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-rtt.h> Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-packet-build.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-packet-build.c 19 May 2002 17:53:28 -0000 1.3 --- dhcp-packet-build.c 6 Jun 2002 23:59:00 -0000 1.4 *************** *** 27,30 **** --- 27,31 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> /* constants we need. */ Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-print.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-print.c 31 Jan 2002 12:37:24 -0000 1.4 --- dhcp-print.c 6 Jun 2002 23:59:00 -0000 1.5 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> /* Print the fixed header verbosely. Index: dhcp-route.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-route.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-route.c 19 May 2002 23:03:16 -0000 1.2 --- dhcp-route.c 6 Jun 2002 23:59:00 -0000 1.3 *************** *** 30,33 **** --- 30,34 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> int route_find(rawnet_t *net, ip_addr_t addr, eth_addr_t *dest_mac) Index: dhcp-rtt.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-rtt.c 30 May 2002 06:44:06 -0000 1.5 --- dhcp-rtt.c 6 Jun 2002 23:59:00 -0000 1.6 *************** *** 23,26 **** --- 23,27 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-rtt.h> Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-sniff.c 3 Jun 2002 22:40:32 -0000 1.7 --- dhcp-sniff.c 6 Jun 2002 23:59:00 -0000 1.8 *************** *** 26,32 **** #include <dhcp-agent.h> int interactive = 1; ! char *binname = NULL; char *workdirectory = "."; --- 26,36 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> int interactive = 1; ! #if !defined(HAVE_PROGNAME) ! const char *__progname; ! #endif /* HAVE_PROGNAME */ ! char *workdirectory = "."; *************** *** 46,49 **** --- 50,57 ---- char filter_buff[GENERIC_BUFFSIZE]; + #if !defined(HAVE_PROGNAME) + __progname = argv[0]; + #endif /* HAVE_PROGNAME */ + while((c = getopt(argc, argv, "vi:")) != -1) { *************** *** 62,67 **** } } - - binname = argv[0]; /* Get port numbers from services db. */ --- 70,73 ---- Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-sysconf.c 30 May 2002 06:44:06 -0000 1.13 --- dhcp-sysconf.c 6 Jun 2002 23:59:00 -0000 1.14 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> #include <dhcp-files.h> #include <dhcp-convert.h> Index: dhcp-udp.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-udp.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-udp.c 30 Jan 2002 16:06:46 -0000 1.2 --- dhcp-udp.c 6 Jun 2002 23:59:00 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> udp_obj *udp_create(void) Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-util.c 29 May 2002 03:12:54 -0000 1.14 --- dhcp-util.c 6 Jun 2002 23:59:00 -0000 1.15 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> + #include <dhcp-util.h> static char msgbuff[MSG_BUFFER_SIZE]; *************** *** 59,63 **** if(interactive == 1) { ! fprintf(stderr, "%s: error: %s", binname, msgbuff); fprintf(stderr,"\n"); } else --- 60,64 ---- if(interactive == 1) { ! fprintf(stderr, "%s: error: %s", getprogname(), msgbuff); fprintf(stderr,"\n"); } else *************** *** 80,84 **** if(interactive == 1) { ! fprintf(stderr, "%s: fatal error: %s", binname, msgbuff); fprintf(stderr,"\n"); } else --- 81,85 ---- if(interactive == 1) { ! fprintf(stderr, "%s: fatal error: %s", getprogname(), msgbuff); fprintf(stderr,"\n"); } else *************** *** 102,106 **** if(interactive == 1) { ! fprintf(stdout, "%s: %s", binname, msgbuff); fprintf(stdout,"\n"); } else --- 103,107 ---- if(interactive == 1) { ! fprintf(stdout, "%s: %s", getprogname(), msgbuff); fprintf(stdout,"\n"); } else *************** *** 123,127 **** if(interactive == 1) { ! fprintf(stdout, "%s warning: %s", binname, msgbuff); fprintf(stdout,"\n"); } else --- 124,128 ---- if(interactive == 1) { ! fprintf(stdout, "%s warning: %s", getprogname(), msgbuff); fprintf(stdout,"\n"); } else *************** *** 144,148 **** if(interactive == 1) { ! fprintf(stdout, "%s: debug: %s", binname, msgbuff); fprintf(stdout,"\n"); } else --- 145,149 ---- if(interactive == 1) { ! fprintf(stdout, "%s: debug: %s", getprogname(), msgbuff); fprintf(stdout,"\n"); } else *************** *** 458,459 **** --- 459,481 ---- return difference; } + + #if !defined(HAVE_GETPROGNAME) + const char *getprogname(void) + { + /* + * Compatibility looks like this: + * if getprogname this will not be. + * if __progname is available use it here. + * if __progname is not available set it in main source, + * and use it here. + */ + + /* FIXME: do the system provided getprogname() do this? */ + if(__progname[0] == '.' && __progname[1] == '/') + return (__progname + 2); + else + return(__progname); + + } + + #endif /* HAVE_GETPROGNAME */ |
From: Thamer Al-H. <act...@us...> - 2002-06-06 03:27:28
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv21720 Modified Files: dhcp-agent.h dhcp-cache-entry.c Log Message: moved cache types/prototypes back into dhcp-agent.h for now Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** dhcp-agent.h 6 Jun 2002 03:25:04 -0000 1.48 --- dhcp-agent.h 6 Jun 2002 03:27:25 -0000 1.49 *************** *** 331,334 **** --- 331,346 ---- } client_conf_t; + /* Cache data types. */ + + typedef struct { + char *name; + char *value; + } cache_entry_t; + + typedef struct { + char *interface; /* points to dhcp_client_control->interface */ + list_t *vars; + } client_cache_t; + /* Client data object. */ *************** *** 451,454 **** --- 463,489 ---- * Function prototypes * * * * * * * * * * * * */ + + /* cache manipulation. */ + + extern client_cache_t *create_client_cache(dhcp_client_control_t *dc); + extern void client_cache_destroy(client_cache_t *cc); + extern int load_client_cache(client_cache_t *dc, unsigned char use_tmp); + extern int client_cache_is_empty(client_cache_t *cc); + extern void purge_cache(client_cache_t *cc); + extern int client_cache_dump_options(client_cache_t *cc, list_t *options); + extern list_t *client_cache_load_option_network_list(client_cache_t *cc, + unsigned char use_temp); + extern list_t *client_cache_load_option_string_list(client_cache_t *cc, + unsigned char use_tmp); + + extern void client_cache_update(client_cache_t *cc); + extern void client_cache_delete_cache(client_cache_t *cc); + extern void client_cache_delete_tmp_cache(client_cache_t *cc); + + /* cache object manipulation. */ + + extern cache_entry_t *make_cache_entry(char *name, char *value); + extern void destroy_cache_entry(cache_entry_t *cache); + extern void cache_entry_purge_list(list_t *cache_list); /* Net/Rawnet routines. */ Index: dhcp-cache-entry.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-cache-entry.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-cache-entry.c 6 Jun 2002 03:25:04 -0000 1.4 --- dhcp-cache-entry.c 6 Jun 2002 03:27:25 -0000 1.5 *************** *** 28,32 **** #include <dhcp-agent.h> - #include <dhcp-cache.h> /* constructors. */ --- 28,31 ---- |
From: Thamer Al-H. <act...@us...> - 2002-06-06 03:25:08
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv21360 Modified Files: TODO acinclude.m4 aclocal.m4 configure dhcp-agent.h dhcp-cache-entry.c Log Message: fix for peculiar openbsd sh escaping of \\ Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** TODO 5 Jun 2002 13:08:36 -0000 1.19 --- TODO 6 Jun 2002 03:25:04 -0000 1.20 *************** *** 17,21 **** -- autoconf script is getting ugly -- methinks its broken and is barely parsed - -- add test for kill(0, pid) to see if it correctly identifies the running process. --- 17,20 ---- Index: acinclude.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acinclude.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** acinclude.m4 5 Jun 2002 12:59:57 -0000 1.4 --- acinclude.m4 6 Jun 2002 03:25:04 -0000 1.5 *************** *** 97,101 **** if(size_table[i] == size) { ! fprintf(fp, "#define %s \"%s\"\n", sub_string, sub_table[i]); break; } --- 97,101 ---- if(size_table[i] == size) { ! fprintf(fp, "#define %s \\"%s\\"\n", sub_string, sub_table[i]); break; } *************** *** 111,115 **** fprintf(stderr, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"); ! fprintf(fp, "#define %s \"%s\"\n", sub_string, sub_table[0]); } --- 111,115 ---- fprintf(stderr, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"); ! fprintf(fp, "#define %s \\"%s\\"\n", sub_string, sub_table[0]); } Index: aclocal.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/aclocal.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** aclocal.m4 5 Jun 2002 12:59:57 -0000 1.4 --- aclocal.m4 6 Jun 2002 03:25:04 -0000 1.5 *************** *** 109,113 **** if(size_table[i] == size) { ! fprintf(fp, "#define %s \"%s\"\n", sub_string, sub_table[i]); break; } --- 109,113 ---- if(size_table[i] == size) { ! fprintf(fp, "#define %s \\"%s\\"\n", sub_string, sub_table[i]); break; } *************** *** 123,127 **** fprintf(stderr, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"); ! fprintf(fp, "#define %s \"%s\"\n", sub_string, sub_table[0]); } --- 123,127 ---- fprintf(stderr, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"); ! fprintf(fp, "#define %s \\"%s\\"\n", sub_string, sub_table[0]); } Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** configure 5 Jun 2002 12:59:57 -0000 1.15 --- configure 6 Jun 2002 03:25:04 -0000 1.16 *************** *** 2470,2474 **** if(size_table[i] == size) { ! fprintf(fp, "#define %s \"%s\"\n", sub_string, sub_table[i]); break; } --- 2470,2474 ---- if(size_table[i] == size) { ! fprintf(fp, "#define %s \\"%s\\"\n", sub_string, sub_table[i]); break; } *************** *** 2484,2488 **** fprintf(stderr, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"); ! fprintf(fp, "#define %s \"%s\"\n", sub_string, sub_table[0]); } --- 2484,2488 ---- fprintf(stderr, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"); ! fprintf(fp, "#define %s \\"%s\\"\n", sub_string, sub_table[0]); } Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** dhcp-agent.h 5 Jun 2002 13:08:36 -0000 1.47 --- dhcp-agent.h 6 Jun 2002 03:25:04 -0000 1.48 *************** *** 322,338 **** } rawnet_t; - /* Cache data types. */ - - typedef struct { - char *name; - char *value; - } cache_entry_t; - - typedef struct { - char *interface; /* points to dhcp_client_control->interface */ - list_t *vars; - } client_cache_t; - - typedef struct { char *conf_file; --- 322,325 ---- *************** *** 802,828 **** extern void error_log(char *msg); extern void info_log(char *msg); - - /* dhcp cache obj */ - - extern client_cache_t *create_client_cache(dhcp_client_control_t *dc); - extern void client_cache_destroy(client_cache_t *cc); - extern int load_client_cache(client_cache_t *dc, unsigned char use_tmp); - extern int client_cache_is_empty(client_cache_t *cc); - extern void purge_cache(client_cache_t *cc); - extern int client_cache_dump_options(client_cache_t *cc, list_t *options); - extern list_t *client_cache_load_option_network_list(client_cache_t *cc, - unsigned char use_temp); - extern list_t *client_cache_load_option_string_list(client_cache_t *cc, - unsigned char use_tmp); - - extern void client_cache_update(client_cache_t *cc); - extern void client_cache_delete_cache(client_cache_t *cc); - extern void client_cache_delete_tmp_cache(client_cache_t *cc); - - /* cache entry obj */ - - extern cache_entry_t *make_cache_entry(char *name, char *value); - extern void destroy_cache_entry(cache_entry_t *cache); - extern void cache_entry_purge_list(list_t *cache_list); /* dhcp client control */ --- 789,792 ---- Index: dhcp-cache-entry.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-cache-entry.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-cache-entry.c 3 Feb 2002 16:56:00 -0000 1.3 --- dhcp-cache-entry.c 6 Jun 2002 03:25:04 -0000 1.4 *************** *** 28,31 **** --- 28,32 ---- #include <dhcp-agent.h> + #include <dhcp-cache.h> /* constructors. */ |
From: Thamer Al-H. <act...@us...> - 2002-06-05 13:08:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv30141 Modified Files: TODO dhcp-agent.h dhcp-net.c Log Message: quick hack to get around OpenBSD bpf_timeval issue Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** TODO 3 Jun 2002 01:36:04 -0000 1.18 --- TODO 5 Jun 2002 13:08:36 -0000 1.19 *************** *** 15,18 **** --- 15,21 ---- other todo: + -- autoconf script is getting ugly -- methinks its broken and is + barely parsed + -- add test for kill(0, pid) to see if it correctly identifies the running process. Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** dhcp-agent.h 5 Jun 2002 12:59:58 -0000 1.46 --- dhcp-agent.h 5 Jun 2002 13:08:36 -0000 1.47 *************** *** 289,297 **** int packet_len; /* total length of packet. */ - #ifdef HAVE_BPF_TIMEVAL - struct bpf_timeval tstamp /* timestamp. */ - #else struct timeval tstamp; /* timestamp. */ - #endif eth_addr_t hw_addr; /* our hardware address. */ --- 289,293 ---- Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** dhcp-net.c 3 Jun 2002 22:40:32 -0000 1.23 --- dhcp-net.c 5 Jun 2002 13:08:36 -0000 1.24 *************** *** 414,419 **** /* Set timestamp. */ net->tstamp = pkthdr.ts; ! /* Read ethernet header and switch on type. * * Fails if malformed or insufficient length. */ --- 414,441 ---- /* Set timestamp. */ + #if defined(HAVE_BPF_TIMEVAL) + + /* This is an ugly hack -- why oh why did OpenBSD insist on + * creating its own bpf_timeval struct with unsigned values + * as opposed to the common UNIX timeval which has signed values. + * + * + * *sigh* + * + * There really isn't any clean way around this apart from grabbing + * our own timestamp instead of using the bpf one. This is inaccurate + * but until OpenBSD fixes their braindamage they'll just have to + * deal with the inaccuracy. Anything else would be too damaging + * to the other UNIX flavors. + */ + + gettimeofday(&net->tstamp, NULL); + + #else /* HAVE_BPF_TIMEVAL */ + net->tstamp = pkthdr.ts; ! ! #endif /* HAVE_BPF_TIMEVAL */ ! /* Read ethernet header and switch on type. * * Fails if malformed or insufficient length. */ |
From: Thamer Al-H. <act...@us...> - 2002-06-05 13:00:04
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv26309 Modified Files: acinclude.m4 aclocal.m4 configure dhcp-agent.h dhcp-client.c Log Message: second stab at generating our own primacros Index: acinclude.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acinclude.m4,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** acinclude.m4 5 Jun 2002 03:00:59 -0000 1.3 --- acinclude.m4 5 Jun 2002 12:59:57 -0000 1.4 *************** *** 74,85 **** /* substitutions as we know them. */ ! #define SUB_UNSIGNED_LONG "%lu" ! #define SUB_UNSIGNED_SHORT "%hu" ! #define SUB_LONG "%li" ! #define SUB_SHORT "%hi" ! #define SUB_INT "%d" ! #define SUB_UNSIGNED_INT "%du" ! #define SUB_CHAR "%d" /* same -- we're assuming int is always bigger than char */ ! #define SUB_UNSIGNED_CHAR "%du" /* which is an OK assumption. */ --- 74,85 ---- /* substitutions as we know them. */ ! #define SUB_UNSIGNED_LONG "lu" ! #define SUB_UNSIGNED_SHORT "hu" ! #define SUB_LONG "li" ! #define SUB_SHORT "hi" ! #define SUB_INT "d" ! #define SUB_UNSIGNED_INT "du" ! #define SUB_CHAR "d" /* same -- we're assuming int is always bigger than char */ ! #define SUB_UNSIGNED_CHAR "du" /* which is an OK assumption. */ Index: aclocal.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/aclocal.m4,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** aclocal.m4 5 Jun 2002 03:00:59 -0000 1.3 --- aclocal.m4 5 Jun 2002 12:59:57 -0000 1.4 *************** *** 86,97 **** /* substitutions as we know them. */ ! #define SUB_UNSIGNED_LONG "%lu" ! #define SUB_UNSIGNED_SHORT "%hu" ! #define SUB_LONG "%li" ! #define SUB_SHORT "%hi" ! #define SUB_INT "%d" ! #define SUB_UNSIGNED_INT "%du" ! #define SUB_CHAR "%d" /* same -- we're assuming int is always bigger than char */ ! #define SUB_UNSIGNED_CHAR "%du" /* which is an OK assumption. */ --- 86,97 ---- /* substitutions as we know them. */ ! #define SUB_UNSIGNED_LONG "lu" ! #define SUB_UNSIGNED_SHORT "hu" ! #define SUB_LONG "li" ! #define SUB_SHORT "hi" ! #define SUB_INT "d" ! #define SUB_UNSIGNED_INT "du" ! #define SUB_CHAR "d" /* same -- we're assuming int is always bigger than char */ ! #define SUB_UNSIGNED_CHAR "du" /* which is an OK assumption. */ Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** configure 5 Jun 2002 03:00:59 -0000 1.14 --- configure 5 Jun 2002 12:59:57 -0000 1.15 *************** *** 2450,2461 **** /* substitutions as we know them. */ ! #define SUB_UNSIGNED_LONG "%lu" ! #define SUB_UNSIGNED_SHORT "%hu" ! #define SUB_LONG "%li" ! #define SUB_SHORT "%hi" ! #define SUB_INT "%d" ! #define SUB_UNSIGNED_INT "%du" ! #define SUB_CHAR "%d" /* same -- we're assuming int is always bigger than char */ ! #define SUB_UNSIGNED_CHAR "%du" /* which is an OK assumption. */ static void output_type_substitution(FILE *fp, --- 2450,2461 ---- /* substitutions as we know them. */ ! #define SUB_UNSIGNED_LONG "lu" ! #define SUB_UNSIGNED_SHORT "hu" ! #define SUB_LONG "li" ! #define SUB_SHORT "hi" ! #define SUB_INT "d" ! #define SUB_UNSIGNED_INT "du" ! #define SUB_CHAR "d" /* same -- we're assuming int is always bigger than char */ ! #define SUB_UNSIGNED_CHAR "du" /* which is an OK assumption. */ static void output_type_substitution(FILE *fp, Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** dhcp-agent.h 5 Jun 2002 03:00:59 -0000 1.45 --- dhcp-agent.h 5 Jun 2002 12:59:58 -0000 1.46 *************** *** 35,46 **** # include <stdio.h> - #if defined(HAVE_GETOPT_H) - # include <getopt.h> - #endif - - #ifdef HAVE_PRIMACROS_H - #include <primacros.h> - #endif /* HAVE_PRIMACROS_H */ - # include <sys/types.h> # include <sys/time.h> --- 35,38 ---- *************** *** 64,67 **** --- 56,71 ---- # include <config.h> + + #if defined(HAVE_GETOPT_H) + + # include <getopt.h> + + #endif /* HAVE_GETOPT_H */ + + #ifdef HAVE_PRIMACROS_H + + #include <primacros.h> + + #endif /* HAVE_PRIMACROS_H */ #if defined(HAVE_STDARG_H) Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dhcp-client.c 3 Jun 2002 01:36:04 -0000 1.21 --- dhcp-client.c 5 Jun 2002 12:59:58 -0000 1.22 *************** *** 206,210 **** * the cache. We need a client cache structure though, pass * it a dummy structure with the interface. That's all it ! * needs. (this is the hack). */ --- 206,210 ---- * the cache. We need a client cache structure though, pass * it a dummy structure with the interface. That's all it ! * needs. (this a hack). */ |
From: Thamer Al-H. <act...@us...> - 2002-06-03 22:40:36
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv18662 Modified Files: configure configure.in dhcp-agent.h dhcp-net.c dhcp-sniff.c Log Message: possible fix for pcap-bpf problem which causes pcap_next to return NULL Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** configure 3 Jun 2002 01:36:04 -0000 1.12 --- configure 3 Jun 2002 22:40:32 -0000 1.13 *************** *** 2526,2529 **** --- 2526,2532 ---- #line 2526 "configure" #include "confdefs.h" + #include <sys/types> + #include <sys/time.h> + #include <sys/ioctl.h> #include <net/bpf.h> *************** *** 2540,2553 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2542: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2545: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2548: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2551: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_struct_bpf_timeval=yes --- 2543,2556 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2545: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2548: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2551: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2554: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_struct_bpf_timeval=yes *************** *** 2559,2563 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2561: result: $ac_cv_type_struct_bpf_timeval" >&5 echo "${ECHO_T}$ac_cv_type_struct_bpf_timeval" >&6 if test $ac_cv_type_struct_bpf_timeval = yes; then --- 2562,2566 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2564: result: $ac_cv_type_struct_bpf_timeval" >&5 echo "${ECHO_T}$ac_cv_type_struct_bpf_timeval" >&6 if test $ac_cv_type_struct_bpf_timeval = yes; then *************** *** 2568,2572 **** fi ! echo "$as_me:2570: checking for sig_atomic_t" >&5 echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 if test "${ac_cv_type_sig_atomic_t+set}" = set; then --- 2571,2575 ---- fi ! echo "$as_me:2573: checking for sig_atomic_t" >&5 echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 if test "${ac_cv_type_sig_atomic_t+set}" = set; then *************** *** 2574,2578 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2576 "configure" #include "confdefs.h" #include <signal.h> --- 2577,2581 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2579 "configure" #include "confdefs.h" #include <signal.h> *************** *** 2590,2603 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2592: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2595: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2598: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2601: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes --- 2593,2606 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2595: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2598: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2601: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2604: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes *************** *** 2609,2613 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2611: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then --- 2612,2616 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2614: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then *************** *** 2618,2622 **** fi ! echo "$as_me:2620: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then --- 2621,2625 ---- fi ! echo "$as_me:2623: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then *************** *** 2624,2628 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2626 "configure" #include "confdefs.h" #include <sys/types.h> --- 2627,2631 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2629 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2646,2659 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2648: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2651: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2654: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2657: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void --- 2649,2662 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2651: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2654: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2657: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2660: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void *************** *** 2665,2669 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2667: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 --- 2668,2672 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2670: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 *************** *** 2674,2678 **** if test -z "$pcap_prefix"; then ! echo "$as_me:2676: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" --- 2677,2681 ---- if test -z "$pcap_prefix"; then ! echo "$as_me:2679: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" *************** *** 2685,2689 **** if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2687: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2688,2692 ---- if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2690: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2694,2702 **** fi ! echo "$as_me:2696: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2700: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" --- 2697,2705 ---- fi ! echo "$as_me:2699: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2703: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" *************** *** 2709,2713 **** if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2711: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2712,2716 ---- if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2714: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2718,2722 **** fi ! echo "$as_me:2720: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" --- 2721,2725 ---- fi ! echo "$as_me:2723: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" *************** *** 2735,2739 **** # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2737: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then --- 2738,2742 ---- # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2740: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then *************** *** 2752,2756 **** if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2754: found $ac_dir/$ac_word" >&5 break fi --- 2755,2759 ---- if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2757: found $ac_dir/$ac_word" >&5 break fi *************** *** 2763,2770 **** if test -n "$DNET_PATH"; then ! echo "$as_me:2765: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:2768: result: no" >&5 echo "${ECHO_T}no" >&6 fi --- 2766,2773 ---- if test -n "$DNET_PATH"; then ! echo "$as_me:2768: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:2771: result: no" >&5 echo "${ECHO_T}no" >&6 fi *************** *** 2776,2780 **** if test $DNET_PATH = "no"; then ! echo "$as_me:2778: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then --- 2779,2783 ---- if test $DNET_PATH = "no"; then ! echo "$as_me:2781: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then *************** *** 2784,2788 **** LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 2786 "configure" #include "confdefs.h" --- 2787,2791 ---- LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 2789 "configure" #include "confdefs.h" *************** *** 2803,2816 **** _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:2805: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:2808: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:2811: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2814: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes --- 2806,2819 ---- _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:2808: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:2811: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:2814: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2817: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes *************** *** 2823,2832 **** LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:2825: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:2830: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } --- 2826,2835 ---- LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:2828: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:2833: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } *************** *** 2935,2939 **** ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:2937: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF --- 2938,2942 ---- ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:2940: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF *************** *** 3111,3115 **** --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3113: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 --- 3114,3118 ---- --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3116: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 *************** *** 3135,3144 **** # This is an error. ! -*) { { echo "$as_me:3137: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3142: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; --- 3138,3147 ---- # This is an error. ! -*) { { echo "$as_me:3140: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3145: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; *************** *** 3381,3385 **** if test x"$ac_file" != x-; then ! { echo "$as_me:3383: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" --- 3384,3388 ---- if test x"$ac_file" != x-; then ! { echo "$as_me:3386: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" *************** *** 3399,3403 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3401: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3402,3406 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3404: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3412,3416 **** else # /dev/null tree ! { { echo "$as_me:3414: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3415,3419 ---- else # /dev/null tree ! { { echo "$as_me:3417: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3473,3477 **** esac ! test x"$ac_file" != x- && { echo "$as_me:3475: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} --- 3476,3480 ---- esac ! test x"$ac_file" != x- && { echo "$as_me:3478: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} *************** *** 3484,3488 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3486: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3487,3491 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3489: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3497,3501 **** else # /dev/null tree ! { { echo "$as_me:3499: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3500,3504 ---- else # /dev/null tree ! { { echo "$as_me:3502: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3614,3618 **** if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3616: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else --- 3617,3621 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3619: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** configure.in 3 Jun 2002 01:36:04 -0000 1.14 --- configure.in 3 Jun 2002 22:40:32 -0000 1.15 *************** *** 41,45 **** dnl check for types ! AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL)], [], [#include <net/bpf.h>]) AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T)], [], [#include <signal.h>]) AC_TYPE_SIGNAL --- 41,50 ---- dnl check for types ! AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL)], [], ! [#include <sys/types> ! #include <sys/time.h> ! #include <sys/ioctl.h> ! #include <net/bpf.h> ]) ! AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T)], [], [#include <signal.h>]) AC_TYPE_SIGNAL Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** dhcp-agent.h 3 Jun 2002 01:36:04 -0000 1.43 --- dhcp-agent.h 3 Jun 2002 22:40:32 -0000 1.44 *************** *** 497,501 **** extern void rawnet_dhcp_update(rawnet_t *net, time_t seconds); ! extern int rawnet_wait(rawnet_t *net, struct timeval tm); extern int rawnet_is_dhcp_offer(rawnet_t *net); extern int rawnet_is_valid(rawnet_t *net); --- 497,501 ---- extern void rawnet_dhcp_update(rawnet_t *net, time_t seconds); ! extern int rawnet_wait(rawnet_t *net, struct timeval *tm); extern int rawnet_is_dhcp_offer(rawnet_t *net); extern int rawnet_is_valid(rawnet_t *net); Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dhcp-net.c 30 May 2002 06:44:05 -0000 1.22 --- dhcp-net.c 3 Jun 2002 22:40:32 -0000 1.23 *************** *** 407,412 **** packet = pcap_next(net->pcap, &pkthdr); ! if(packet == NULL) return RAWNET_PCAP_ERROR; /* Set timestamp. */ --- 407,414 ---- packet = pcap_next(net->pcap, &pkthdr); ! if(packet == NULL) { ! info_message("pcap_next: returned NULL"); return RAWNET_PCAP_ERROR; + } /* Set timestamp. */ *************** *** 524,528 **** /* Wait for next packet. */ ! int rawnet_wait(rawnet_t *net, struct timeval tm) { fd_set read_set; --- 526,530 ---- /* Wait for next packet. */ ! int rawnet_wait(rawnet_t *net, struct timeval *tm) { fd_set read_set; *************** *** 532,536 **** FD_SET(net->pcap_fd, &read_set); ! retval = select((net->pcap_fd + 1), &read_set, NULL, NULL, &tm); if(retval == 0) --- 534,538 ---- FD_SET(net->pcap_fd, &read_set); ! retval = select((net->pcap_fd + 1), &read_set, NULL, NULL, tm); if(retval == 0) *************** *** 540,544 **** return RAWNET_PCAP_ERROR; ! return 0; } --- 542,546 ---- return RAWNET_PCAP_ERROR; ! return RAWNET_OK; } *************** *** 582,585 **** --- 584,588 ---- int retval; unsigned char send_packet = 1; + struct timeval timeout; /* create rtt mechanism. */ *************** *** 603,607 **** } ! retval = rawnet_wait(net, rtt_get_timeout(rtt)); switch(retval) { --- 606,611 ---- } ! timeout = rtt_get_timeout(rtt); ! retval = rawnet_wait(net, &timeout); switch(retval) { Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-sniff.c 16 Feb 2002 17:54:33 -0000 1.6 --- dhcp-sniff.c 3 Jun 2002 22:40:32 -0000 1.7 *************** *** 90,94 **** while(1) { ! retval = rawnet_get_packet(net); --- 90,95 ---- while(1) { ! ! rawnet_wait(net, NULL); retval = rawnet_get_packet(net); |
From: Thamer Al-H. <act...@us...> - 2002-06-03 01:39:06
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv17432 Modified Files: acconfig.h config.h.in Log Message: template now with HAVE_BPF_TIMEVAL Index: acconfig.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acconfig.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** acconfig.h 31 Jan 2002 11:09:13 -0000 1.2 --- acconfig.h 3 Jun 2002 01:39:03 -0000 1.3 *************** *** 1,2 **** --- 1,4 ---- + /* have struct bpf_timeval */ + #undef HAVE_BPF_TIMEVAL /* have sig_atomic_t */ Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** config.h.in 14 Feb 2002 10:43:34 -0000 1.6 --- config.h.in 3 Jun 2002 01:39:03 -0000 1.7 *************** *** 1,3 **** --- 1,5 ---- /* config.h.in. Generated automatically from configure.in by autoheader. */ + /* have struct bpf_timeval */ + #undef HAVE_BPF_TIMEVAL /* have sig_atomic_t */ |
From: Thamer Al-H. <act...@us...> - 2002-06-03 01:36:07
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv16969 Modified Files: COST THANKS TODO configure configure.in dhcp-agent.h dhcp-client.c Log Message: some fixes for openbsd (more to come) thanks Brian J. Kifiak <bk...@rt...> Index: COST =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/COST,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** COST 19 May 2002 00:35:35 -0000 1.8 --- COST 3 Jun 2002 01:36:04 -0000 1.9 *************** *** 3,9 **** May - June 2001 ! 18 pots of coffee; 122 camel filter cigarretes; one sorry poser; ! cleaned up apartment 0 times; bought one futon; 12 measely rye ! beers; April - May 2001 --- 3,9 ---- May - June 2001 ! 32 pots of coffee; 201 camel filter cigarretes; one sorry poser; ! cleaned up apartment 3 times; bought one futon; 22 complete rye ! beers; one infliction of the flu; one burned ram module; April - May 2001 Index: THANKS =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/THANKS,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** THANKS 18 May 2002 18:17:59 -0000 1.5 --- THANKS 3 Jun 2002 01:36:04 -0000 1.6 *************** *** 15,18 **** -- Bill Traynor for Solaris x86. - - -- Stephanie Fox for the Mascot "Fangs" --- 15,16 ---- Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TODO 25 May 2002 20:55:36 -0000 1.17 --- TODO 3 Jun 2002 01:36:04 -0000 1.18 *************** *** 15,22 **** other todo: - -- add parse errors with line numbers (dhcp-client-conf.c dhcp-globconf.c at least) - -- make dhcp-agent use more goodies from libdnet - (1) use blob routines to convert data to different formats. - we ought to keep network data in a blob. -- add test for kill(0, pid) to see if it correctly identifies the running process. --- 15,18 ---- Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** configure 19 May 2002 16:24:37 -0000 1.11 --- configure 3 Jun 2002 01:36:04 -0000 1.12 *************** *** 2518,2524 **** done ! echo "$as_me:2520: checking for sig_atomic_t" >&5 ! echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 ! if test "${ac_cv_type_sig_atomic_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else --- 2518,2524 ---- done ! echo "$as_me:2520: checking for struct bpf_timeval" >&5 ! echo $ECHO_N "checking for struct bpf_timeval... $ECHO_C" >&6 ! if test "${ac_cv_type_struct_bpf_timeval+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else *************** *** 2526,2537 **** #line 2526 "configure" #include "confdefs.h" ! #include <signal.h> int main () { ! if ((sig_atomic_t *) 0) return 0; ! if (sizeof (sig_atomic_t)) return 0; ; --- 2526,2537 ---- #line 2526 "configure" #include "confdefs.h" ! #include <net/bpf.h> int main () { ! if ((struct bpf_timeval *) 0) return 0; ! if (sizeof (struct bpf_timeval)) return 0; ; *************** *** 2551,2554 **** --- 2551,2604 ---- echo "$as_me:2551: \$? = $ac_status" >&5 (exit $ac_status); }; }; then + ac_cv_type_struct_bpf_timeval=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_type_struct_bpf_timeval=no + fi + rm -f conftest.$ac_objext conftest.$ac_ext + fi + echo "$as_me:2561: result: $ac_cv_type_struct_bpf_timeval" >&5 + echo "${ECHO_T}$ac_cv_type_struct_bpf_timeval" >&6 + if test $ac_cv_type_struct_bpf_timeval = yes; then + cat >>confdefs.h <<\EOF + #define HAVE_BPF_TIMEVAL 1 + EOF + + fi + + echo "$as_me:2570: checking for sig_atomic_t" >&5 + echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6 + if test "${ac_cv_type_sig_atomic_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF + #line 2576 "configure" + #include "confdefs.h" + #include <signal.h> + + int + main () + { + if ((sig_atomic_t *) 0) + return 0; + if (sizeof (sig_atomic_t)) + return 0; + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:2592: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2595: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2598: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2601: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes else *************** *** 2559,2563 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2561: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then --- 2609,2613 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2611: result: $ac_cv_type_sig_atomic_t" >&5 echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6 if test $ac_cv_type_sig_atomic_t = yes; then *************** *** 2568,2572 **** fi ! echo "$as_me:2570: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then --- 2618,2622 ---- fi ! echo "$as_me:2620: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then *************** *** 2574,2578 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2576 "configure" #include "confdefs.h" #include <sys/types.h> --- 2624,2628 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2626 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2596,2609 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2598: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2601: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2604: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2607: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void --- 2646,2659 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2648: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2651: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2654: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2657: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void *************** *** 2615,2619 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2617: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 --- 2665,2669 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2667: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 *************** *** 2624,2628 **** if test -z "$pcap_prefix"; then ! echo "$as_me:2626: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" --- 2674,2678 ---- if test -z "$pcap_prefix"; then ! echo "$as_me:2676: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" *************** *** 2635,2639 **** if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2637: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2685,2689 ---- if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2687: error: I cannot find the pcap library anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2644,2652 **** fi ! echo "$as_me:2646: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2650: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" --- 2694,2702 ---- fi ! echo "$as_me:2696: result: $ac_pcap_lib_dir" >&5 echo "${ECHO_T}$ac_pcap_lib_dir" >&6 PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" ! echo "$as_me:2700: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" *************** *** 2659,2663 **** if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2661: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 --- 2709,2713 ---- if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2711: error: I cannot find the pcap header file anywhere. Perhaps you did not install the pcap package, or you did not install its development header files." >&5 *************** *** 2668,2672 **** fi ! echo "$as_me:2670: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" --- 2718,2722 ---- fi ! echo "$as_me:2720: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" *************** *** 2685,2689 **** # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2687: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then --- 2735,2739 ---- # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 ! echo "$as_me:2737: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_DNET_PATH+set}" = set; then *************** *** 2702,2706 **** if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2704: found $ac_dir/$ac_word" >&5 break fi --- 2752,2756 ---- if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2754: found $ac_dir/$ac_word" >&5 break fi *************** *** 2713,2720 **** if test -n "$DNET_PATH"; then ! echo "$as_me:2715: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:2718: result: no" >&5 echo "${ECHO_T}no" >&6 fi --- 2763,2770 ---- if test -n "$DNET_PATH"; then ! echo "$as_me:2765: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:2768: result: no" >&5 echo "${ECHO_T}no" >&6 fi *************** *** 2726,2730 **** if test $DNET_PATH = "no"; then ! echo "$as_me:2728: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then --- 2776,2780 ---- if test $DNET_PATH = "no"; then ! echo "$as_me:2778: checking for eth_open in -ldnet" >&5 echo $ECHO_N "checking for eth_open in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_eth_open+set}" = set; then *************** *** 2734,2738 **** LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 2736 "configure" #include "confdefs.h" --- 2784,2788 ---- LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 2786 "configure" #include "confdefs.h" *************** *** 2753,2766 **** _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:2755: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:2758: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:2761: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2764: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes --- 2803,2816 ---- _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:2805: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:2808: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:2811: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2814: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes *************** *** 2773,2782 **** LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:2775: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:2780: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } --- 2823,2832 ---- LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:2825: result: $ac_cv_lib_dnet_eth_open" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_eth_open" >&6 if test $ac_cv_lib_dnet_eth_open = yes; then DNET_LIB="-ldnet" else ! { { echo "$as_me:2830: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&5 echo "$as_me: error: \`libdnet not found http://libdnet.sourceforge.net/ to get a copy'" >&2;} { (exit 1); exit 1; }; } *************** *** 2784,2788 **** DNET_INC="" ! p else --- 2834,2838 ---- DNET_INC="" ! else *************** *** 2885,2889 **** ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:2887: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF --- 2935,2939 ---- ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:2937: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF *************** *** 3061,3065 **** --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3063: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 --- 3111,3115 ---- --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3113: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 *************** *** 3085,3094 **** # This is an error. ! -*) { { echo "$as_me:3087: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3092: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; --- 3135,3144 ---- # This is an error. ! -*) { { echo "$as_me:3137: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; ! *) { { echo "$as_me:3142: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; *************** *** 3331,3335 **** if test x"$ac_file" != x-; then ! { echo "$as_me:3333: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" --- 3381,3385 ---- if test x"$ac_file" != x-; then ! { echo "$as_me:3383: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" *************** *** 3349,3353 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3351: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3399,3403 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3401: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3362,3366 **** else # /dev/null tree ! { { echo "$as_me:3364: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3412,3416 ---- else # /dev/null tree ! { { echo "$as_me:3414: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3423,3427 **** esac ! test x"$ac_file" != x- && { echo "$as_me:3425: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} --- 3473,3477 ---- esac ! test x"$ac_file" != x- && { echo "$as_me:3475: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} *************** *** 3434,3438 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3436: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3484,3488 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3486: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3447,3451 **** else # /dev/null tree ! { { echo "$as_me:3449: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3497,3501 ---- else # /dev/null tree ! { { echo "$as_me:3499: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3564,3568 **** if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3566: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else --- 3614,3618 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3616: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** configure.in 29 May 2002 03:12:54 -0000 1.13 --- configure.in 3 Jun 2002 01:36:04 -0000 1.14 *************** *** 41,44 **** --- 41,45 ---- dnl check for types + AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL)], [], [#include <net/bpf.h>]) AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T)], [], [#include <signal.h>]) AC_TYPE_SIGNAL Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** dhcp-agent.h 30 May 2002 06:44:05 -0000 1.42 --- dhcp-agent.h 3 Jun 2002 01:36:04 -0000 1.43 *************** *** 281,285 **** --- 281,289 ---- int packet_len; /* total length of packet. */ + #ifdef HAVE_BPF_TIMEVAL + struct bpf_timeval tstamp /* timestamp. */ + #else struct timeval tstamp; /* timestamp. */ + #endif eth_addr_t hw_addr; /* our hardware address. */ Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-client.c 29 May 2002 03:12:54 -0000 1.20 --- dhcp-client.c 3 Jun 2002 01:36:04 -0000 1.21 *************** *** 28,32 **** int interactive = 1; /* by default we begin interactive (messages on stdout/stderr). */ ! char *binname = "dhcpclient"; /* we need a name. */char *work_dir = CLIENT_WORK_DIR; /* our default working directory */ /* read up on our global conf. */ --- 28,33 ---- int interactive = 1; /* by default we begin interactive (messages on stdout/stderr). */ ! char *binname = "dhcpclient"; /* we need a name. */ ! char *work_dir = CLIENT_WORK_DIR; /* our default working directory */ /* read up on our global conf. */ |
From: Thamer Al-H. <act...@us...> - 2002-05-30 06:44:09
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv14887 Modified Files: dhcp-agent.h dhcp-client-cache.c dhcp-client-states.c dhcp-convert.c dhcp-files.h dhcp-globconf.c dhcp-icmp-discovery.c dhcp-net.c dhcp-rtt.c dhcp-sysconf.c Added Files: dhcp-convert.h dhcp-rtt.h dhcp-sysconf.h Log Message: more header fileage --- NEW FILE: dhcp-convert.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.h,v 1.1 2002/05/30 06:44:05 actmodern Exp $ * * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef DHCP_CONVERT_H #define DHCP_CONVERT_H /* conversion handler. */ typedef struct option_convert_handler { char* (*serialize)(const unsigned char *data, int len); void* (*serialize_to_internal)(const char *string); void* (*serialize_to_network)(const char *string, unsigned char *retlen); void (*free_internal)(void *ptr); } option_convert_handler; /* global conversion handlers. */ extern option_convert_handler option_convert_handlers[]; /* conversion routines. */ /* byte routines. */ extern char *network_byte_to_string_byte(const unsigned char *data, int len); extern void *string_byte_to_byte(const char *s); extern void *string_byte_to_network(const char *s, unsigned char *ret_len); /* address routines. */ extern char *network_addr_to_string(const unsigned char *data, int len); extern char *network_addr_list_to_string(const unsigned char *data, int len); extern char *addr_list_to_string(const unsigned char *data, int len); extern void *string_to_addr_list(const char *string); extern void *string_to_addr(const char *string); extern void *string_addr_list_to_network(const char *string, unsigned char *len_ret); extern void *string_addr_to_network(const char *string, unsigned char *len_ret); extern char *network_addr_pair_list_to_string(const unsigned char *data, int len); extern void *string_to_addr_pair_list(const char *s); extern void *string_addr_pair_list_to_network(const char *s, unsigned char *retlen); /* integer routines. */ extern char *network_uint32_to_string(const unsigned char *data, int len); extern char *network_int32_to_string(const unsigned char *data, int len); extern char *network_uint16_to_string(const unsigned char *data, int len); extern char *network_int16_to_string(const unsigned char *data, int len); extern char *uint32_to_string(const unsigned char *data, int len); extern char *int32_to_string(const unsigned char *data, int len); extern char *uint16_to_string(const unsigned char *data, int len); extern char *int16_to_string(const unsigned char *data, int len); extern void *string_to_uint32(const char *s); extern void *string_to_int32(const char *s); extern void *string_to_uint16(const char *s); extern void *string_to_int16(const char *s); extern void *string_int32_to_network(const char *s, unsigned char *ret_len); extern void *string_uint32_to_network(const char *s, unsigned char *ret_len); extern void *string_int16_to_network(const char *s, unsigned char *ret_len); extern void *string_uint16_to_network(const char *s, unsigned char *ret_len); extern char *network_uint16_list_to_string(const unsigned char *data, int len); extern void *string_to_uint16_list(const char *s); extern void *string_uint16_list_to_network(const char *s, unsigned char *retlen); /* network to string */ extern char *validate_network_string_to_string(const unsigned char *data, int len); extern void *strdup_wrap(const char *s); extern void *strdup_wrap_net(const char *s, unsigned char *ret_len); /* static network address conversion routine */ extern char *network_address_to_string_static(uint32_t addr); #endif /* DHCP_CONVERT_H */ --- NEW FILE: dhcp-rtt.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.h,v 1.1 2002/05/30 06:44:06 actmodern Exp $ * * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef DHCP_RTT_H #define DHCP_RTT_H /* timeout as per rfc2131 */ #define MILLISECOND_TIMEOUT 4000 #define MILLISECOND_RAND_TIMEOUT 1000 #define MAX_SECS_WAIT 64 /* as mentioned in rfc2131, * 64 seconds is the upper limit of waiting time. */ /* Utility macros. */ #define SECS_TO_MSECS(x) (x * 1000) #define MSECS_TO_SECS(x) (x/1000) #define MSECS_TO_MSECS_REM(x) (x%1000) /* rtt struct. */ typedef struct rtt { struct timeval timeout; } rtt_t; /* prototypes. */ extern rtt_t *rtt_create(void); extern struct timeval rtt_get_timeout(rtt_t *rtt); extern void rtt_timeout(rtt_t *rtt); extern int rtt_can_retry(rtt_t *rtt); extern void rtt_destroy(rtt_t *rtt); #endif /* DHCP_RTT_H */ --- NEW FILE: dhcp-sysconf.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.h,v 1.1 2002/05/30 06:44:06 actmodern Exp $ * * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef SYSCONF_H #define SYSCONF_H /* Sysconf handler. */ typedef struct { int (*sysconf_handler)(void *value, dhcp_client_control_t *dc); } sysconf_handler; /* System configuration routines. */ extern int sysconf_routers(void *value, dhcp_client_control_t *dc); extern int sysconf_domain_name_servers(void *value, dhcp_client_control_t *dc); extern int sysconf_domain_name(void *value, dhcp_client_control_t *dc); extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); #endif /* SYSCONF_H */ Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** dhcp-agent.h 29 May 2002 03:12:54 -0000 1.41 --- dhcp-agent.h 30 May 2002 06:44:05 -0000 1.42 *************** *** 131,147 **** # define BYTE_STRING_SIZE 5 - /* timeout as per rfc2131 */ - - #define MILLISECOND_TIMEOUT 4000 - #define MILLISECOND_RAND_TIMEOUT 1000 - #define MAX_SECS_WAIT 64 /* as mentioned in rfc2131, - * 64 seconds is the upper limit of waiting time. */ - - /* Utility macros. */ - - #define SECS_TO_MSECS(x) (x * 1000) - #define MSECS_TO_SECS(x) (x/1000) - #define MSECS_TO_MSECS_REM(x) (x%1000) - /* Reasonable defaults in case services db isn't up to date. */ --- 131,134 ---- *************** *** 377,399 **** } option_handler; - /* Sysconf handler. */ - - typedef struct { - int (*sysconf_handler)(void *value, dhcp_client_control_t *dc); - } sysconf_handler; - - typedef struct option_convert_handler { - char* (*serialize)(const unsigned char *data, int len); - void* (*serialize_to_internal)(const char *string); - void* (*serialize_to_network)(const char *string, unsigned char *retlen); - void (*free_internal)(void *ptr); - } option_convert_handler; - - typedef struct rtt { - struct timeval timeout; - } rtt_t; - - /* to string handler. */ - /* * * * * * * * Constants * --- 364,367 ---- *************** *** 884,902 **** extern int client_setup(dhcp_client_control_t *dc); - /* System configuration routines. */ - - extern int sysconf_routers(void *value, dhcp_client_control_t *dc); - extern int sysconf_domain_name_servers(void *value, dhcp_client_control_t *dc); - extern int sysconf_domain_name(void *value, dhcp_client_control_t *dc); - extern void do_sysconf(list_t *options, dhcp_client_control_t *dc); - - /* RTT mechanism object. */ - - extern rtt_t *rtt_create(void); - extern struct timeval rtt_get_timeout(rtt_t *rtt); - extern void rtt_timeout(rtt_t *rtt); - extern int rtt_can_retry(rtt_t *rtt); - extern void rtt_destroy(rtt_t *rtt); - /* Global vars. */ --- 852,855 ---- *************** *** 907,971 **** extern char *dhcp_conf_options_strings[]; extern option_handler option_handlers[]; - extern option_convert_handler option_convert_handlers[]; extern char *dhcp_options_strings[]; - - /* conversion routines. */ - - /* serialization functions. */ - - /* byte routines. */ - - extern char *network_byte_to_string_byte(const unsigned char *data, int len); - extern void *string_byte_to_byte(const char *s); - extern void *string_byte_to_network(const char *s, unsigned char *ret_len); - - /* address routines. */ - - extern char *network_addr_to_string(const unsigned char *data, int len); - extern char *network_addr_list_to_string(const unsigned char *data, int len); - extern char *addr_list_to_string(const unsigned char *data, int len); - extern void *string_to_addr_list(const char *string); - extern void *string_to_addr(const char *string); - extern void *string_addr_list_to_network(const char *string, unsigned char *len_ret); - extern void *string_addr_to_network(const char *string, unsigned char *len_ret); - extern char *network_addr_pair_list_to_string(const unsigned char *data, int len); - extern void *string_to_addr_pair_list(const char *s); - extern void *string_addr_pair_list_to_network(const char *s, unsigned char *retlen); - - /* integer routines. */ - - extern char *network_uint32_to_string(const unsigned char *data, int len); - extern char *network_int32_to_string(const unsigned char *data, int len); - extern char *network_uint16_to_string(const unsigned char *data, int len); - extern char *network_int16_to_string(const unsigned char *data, int len); - - extern char *uint32_to_string(const unsigned char *data, int len); - extern char *int32_to_string(const unsigned char *data, int len); - extern char *uint16_to_string(const unsigned char *data, int len); - extern char *int16_to_string(const unsigned char *data, int len); - - extern void *string_to_uint32(const char *s); - extern void *string_to_int32(const char *s); - extern void *string_to_uint16(const char *s); - extern void *string_to_int16(const char *s); - - extern void *string_int32_to_network(const char *s, unsigned char *ret_len); - extern void *string_uint32_to_network(const char *s, unsigned char *ret_len); - extern void *string_int16_to_network(const char *s, unsigned char *ret_len); - extern void *string_uint16_to_network(const char *s, unsigned char *ret_len); - - extern char *network_uint16_list_to_string(const unsigned char *data, int len); - extern void *string_to_uint16_list(const char *s); - extern void *string_uint16_list_to_network(const char *s, unsigned char *retlen); - - /* network to string */ - - extern char *validate_network_string_to_string(const unsigned char *data, int len); - extern void *strdup_wrap(const char *s); - extern void *strdup_wrap_net(const char *s, unsigned char *ret_len); - - /* static network address conversion routine */ - - extern char *network_address_to_string_static(uint32_t addr); #endif /* DHCP_AGENT_H */ --- 860,864 ---- Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-client-cache.c 29 May 2002 03:12:54 -0000 1.7 --- dhcp-client-cache.c 30 May 2002 06:44:05 -0000 1.8 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> #include <dhcp-files.h> + #include <dhcp-convert.h> /* constructor. */ Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-client-states.c 19 May 2002 00:34:22 -0000 1.20 --- dhcp-client-states.c 30 May 2002 06:44:05 -0000 1.21 *************** *** 27,30 **** --- 27,31 ---- #include <dhcp-agent.h> + #include <dhcp-sysconf.h> /* alarm handling routine and variable. */ Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-convert.c 29 May 2002 03:12:54 -0000 1.11 --- dhcp-convert.c 30 May 2002 06:44:05 -0000 1.12 *************** *** 32,35 **** --- 32,36 ---- #include <dhcp-agent.h> + #include <dhcp-convert.h> /* We have four handlers: Index: dhcp-files.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-files.h 29 May 2002 03:12:54 -0000 1.1 --- dhcp-files.h 30 May 2002 06:44:05 -0000 1.2 *************** *** 1,2 **** --- 1,27 ---- + /* $Header$ + * Copyright 2001 Thamer Alharbash <tm...@wh...> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Handles our variable files. + * + */ + #ifndef DHCP_FILE #define DHCP_FILE Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-globconf.c 29 May 2002 03:12:54 -0000 1.2 --- dhcp-globconf.c 30 May 2002 06:44:05 -0000 1.3 *************** *** 31,34 **** --- 31,35 ---- #include <dhcp-globconf.h> #include <dhcp-files.h> + #include <dhcp-convert.h> /* change this before... */ Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-icmp-discovery.c 25 May 2002 20:55:36 -0000 1.9 --- dhcp-icmp-discovery.c 30 May 2002 06:44:05 -0000 1.10 *************** *** 29,32 **** --- 29,33 ---- #include <dhcp-agent.h> #include <dhcp-globconf.h> + #include <dhcp-convert.h> /* Check for icmp mask response. */ Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dhcp-net.c 25 May 2002 14:02:30 -0000 1.21 --- dhcp-net.c 30 May 2002 06:44:05 -0000 1.22 *************** *** 62,65 **** --- 62,66 ---- #include <dhcp-agent.h> + #include <dhcp-rtt.h> /* Get port number for named service. */ Index: dhcp-rtt.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-rtt.c 5 Feb 2002 13:47:38 -0000 1.4 --- dhcp-rtt.c 30 May 2002 06:44:06 -0000 1.5 *************** *** 23,26 **** --- 23,27 ---- #include <dhcp-agent.h> + #include <dhcp-rtt.h> static struct timeval make_timeval(time_t milliseconds) Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-sysconf.c 29 May 2002 03:12:54 -0000 1.12 --- dhcp-sysconf.c 30 May 2002 06:44:06 -0000 1.13 *************** *** 27,30 **** --- 27,32 ---- #include <dhcp-agent.h> #include <dhcp-files.h> + #include <dhcp-convert.h> + #include <dhcp-sysconf.h> /* Only use handlers here which can be done in any order. |
From: Thamer Al-H. <act...@us...> - 2002-05-29 03:12:57
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv25690 Modified Files: configure.in dhcp-agent.h dhcp-client-cache.c dhcp-client-conf.c dhcp-client.c dhcp-convert.c dhcp-files.c dhcp-globconf.c dhcp-sysconf.c dhcp-util.c Added Files: dhcp-files.h Log Message: added new varfile handling routines with line no errors on parse warnings/errrors. --- NEW FILE: dhcp-files.h --- #ifndef DHCP_FILE #define DHCP_FILE typedef struct { FILE *fp; /* file pointer. */ char *var_name; char *var_val; char *line_buff; int line_no; } varfile_t; /* file routines. */ extern varfile_t *varfile_open(const char *filename); extern void destroy_varfile(varfile_t *varfile); extern int file_parse_string(varfile_t *varfile, int type); extern int file_get_var_string(varfile_t *varfile); extern FILE *file_open_or_create_safe(const char *filename, char *mode); extern FILE *file_create_and_truncate_safe(const char *filename, char *mode); extern char *varfile_get_name(varfile_t *varfile); extern char *varfile_get_val(varfile_t *varfile); extern int varfile_get_lineno(varfile_t *varfile); extern int file_exists(char *fname); extern void move_file(char *fname, char *dest); extern void delete_file(char *fname); extern void make_file_public_read(char *fname); extern void create_pid_file(char *name); extern void delete_pid_file(char *name); extern int get_pid_file(char *name, pid_t *pid); #endif /* DHCP_FILE */ Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** configure.in 25 May 2002 20:55:36 -0000 1.12 --- configure.in 29 May 2002 03:12:54 -0000 1.13 *************** *** 26,30 **** AC_HEADER_STDC ! dnl check for inttypes.h AC_CHECK_HEADERS(inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h) --- 26,30 ---- AC_HEADER_STDC ! dnl check for inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h AC_CHECK_HEADERS(inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h) Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** dhcp-agent.h 25 May 2002 20:55:36 -0000 1.40 --- dhcp-agent.h 29 May 2002 03:12:54 -0000 1.41 *************** *** 884,903 **** extern int client_setup(dhcp_client_control_t *dc); - /* file routines. */ - - extern int file_parse_string(int type); - extern int file_get_var_string(FILE *fp); - extern FILE *file_open_or_create_safe(const char *filename, char *mode); - extern FILE *file_create_and_truncate_safe(const char *filename, char *mode); - extern char *file_get_var_name(void); - extern char *file_get_var_val(void); - extern int file_exists(char *fname); - extern void move_file(char *fname, char *dest); - extern void delete_file(char *fname); - extern void make_file_public_read(char *fname); - extern void create_pid_file(char *name); - extern void delete_pid_file(char *name); - extern int get_pid_file(char *name, pid_t *pid); - /* System configuration routines. */ --- 884,887 ---- Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-client-cache.c 8 Feb 2002 01:37:29 -0000 1.6 --- dhcp-client-cache.c 29 May 2002 03:12:54 -0000 1.7 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-agent.h> + #include <dhcp-files.h> /* constructor. */ *************** *** 70,82 **** /* read next cache entry from file. */ ! static cache_entry_t *read_next_cache_var(FILE *fp) { cache_entry_t *cache_entry; ! if(file_get_var_string(fp)) return NULL; ! if(file_parse_string(PARSE_DOUBLE_STRINGS)) ! fatal_error("corrupt cache! try removing it and restarting it."); /* as long as file_parse_string didn't return an error we're --- 71,83 ---- /* read next cache entry from file. */ ! static cache_entry_t *read_next_cache_var(varfile_t *varfile) { cache_entry_t *cache_entry; ! if(file_get_var_string(varfile)) return NULL; ! if(file_parse_string(varfile, PARSE_DOUBLE_STRINGS)) ! fatal_error("corrupt cache try removing it and restarting it: error line: %d", varfile_get_lineno(varfile)); /* as long as file_parse_string didn't return an error we're *************** *** 84,88 **** * file_get_var_val() */ ! cache_entry = make_cache_entry(file_get_var_name(), file_get_var_val()); return cache_entry; --- 85,89 ---- * file_get_var_val() */ ! cache_entry = make_cache_entry(varfile_get_name(varfile), varfile_get_val(varfile)); return cache_entry; *************** *** 92,108 **** static int load_client_cache_proc(client_cache_t *cc, char *filename) { ! FILE *fp; cache_entry_t *cache_entry; ! fp = file_open_or_create_safe(filename, "r"); ! if(fp == NULL) return -1; /* Read up any vars. */ ! while((cache_entry = read_next_cache_var(fp)) != NULL) cc->vars = add_to_list(cc->vars, cache_entry); ! fclose(fp); return 0; --- 93,109 ---- static int load_client_cache_proc(client_cache_t *cc, char *filename) { ! varfile_t *varfile; cache_entry_t *cache_entry; ! varfile = varfile_open(filename); ! if(varfile == NULL) return -1; /* Read up any vars. */ ! while((cache_entry = read_next_cache_var(varfile)) != NULL) cc->vars = add_to_list(cc->vars, cache_entry); ! destroy_varfile(varfile); return 0; Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-client-conf.c 25 May 2002 15:18:01 -0000 1.6 --- dhcp-client-conf.c 29 May 2002 03:12:54 -0000 1.7 *************** *** 24,27 **** --- 24,28 ---- #include <dhcp-agent.h> + #include <dhcp-files.h> /* Basic network configuration. *************** *** 71,75 **** FILE *fp; ! fp = file_open_or_create_safe(fname, "w"); if(fp == NULL) --- 72,76 ---- FILE *fp; ! fp = file_open_or_create_safe(fname, "a+"); if(fp == NULL) *************** *** 103,121 **** static int client_conf_load_options(client_conf_t *cc, char *fname) { ! FILE *fp; int i; ! fp = file_open_or_create_safe(fname, "r"); ! if(fp == NULL) return -1; ! while(!file_get_var_string(fp)) { ! if(file_parse_string(PARSE_SINGLE_STRING)) { ! fclose(fp); return -1; } for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { --- 104,124 ---- static int client_conf_load_options(client_conf_t *cc, char *fname) { ! varfile_t *varfile; int i; + unsigned char match; ! varfile = varfile_open(fname); ! if(varfile == NULL) return -1; ! while(!file_get_var_string(varfile)) { ! if(file_parse_string(varfile, PARSE_SINGLE_STRING)) { ! destroy_varfile(varfile); return -1; } + match = 0; for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { *************** *** 124,136 **** if(string_matches(dhcp_options_strings[i], ! file_get_var_name())) { cc->options[i] = 1; break; } } } ! fclose(fp); return 0; } --- 127,144 ---- if(string_matches(dhcp_options_strings[i], ! varfile_get_name(varfile))) { cc->options[i] = 1; + match = 1; break; } } + + if(match != 1) + warn_message("encountered illegal DHCP option in %s: %s : %d", fname, varfile_get_name(varfile), + varfile_get_lineno(varfile)); } ! destroy_varfile(varfile); return 0; } Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dhcp-client.c 25 May 2002 14:02:30 -0000 1.19 --- dhcp-client.c 29 May 2002 03:12:54 -0000 1.20 *************** *** 25,32 **** #include <dhcp-agent.h> #include <dhcp-globconf.h> int interactive = 1; /* by default we begin interactive (messages on stdout/stderr). */ ! char *binname = "dhcpclient"; /* we need a name. */ ! char *work_dir = CLIENT_WORK_DIR; /* our default working directory */ /* read up on our global conf. */ --- 25,32 ---- #include <dhcp-agent.h> #include <dhcp-globconf.h> + #include <dhcp-files.h> int interactive = 1; /* by default we begin interactive (messages on stdout/stderr). */ ! char *binname = "dhcpclient"; /* we need a name. */char *work_dir = CLIENT_WORK_DIR; /* our default working directory */ /* read up on our global conf. */ Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-convert.c 25 May 2002 20:55:36 -0000 1.10 --- dhcp-convert.c 29 May 2002 03:12:54 -0000 1.11 *************** *** 471,475 **** { char *string; - unsigned char *tmp; if(size > data_len) --- 471,474 ---- Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-files.c 25 May 2002 20:55:36 -0000 1.8 --- dhcp-files.c 29 May 2002 03:12:54 -0000 1.9 *************** *** 25,42 **** #include <dhcp-agent.h> ! #include <dhcp-file.h> ! static char *line_buff = NULL; ! static char *var_name = NULL; ! static char *var_val = NULL; ! char *file_get_var_name(void) { ! return var_name; } ! char *file_get_var_val(void) { ! return var_val; } --- 25,43 ---- #include <dhcp-agent.h> ! #include <dhcp-files.h> ! char *varfile_get_name(varfile_t *varfile) ! { ! return varfile->var_name; ! } ! char *varfile_get_val(varfile_t *varfile) { ! return varfile->var_val; } ! int varfile_get_lineno(varfile_t *varfile) { ! return varfile->line_no; } *************** *** 74,85 **** } ! int file_parse_string(int type) { char *s; switch(type) { case PARSE_DOUBLE_STRINGS: ! s = strchr(line_buff, '='); if(s == NULL) return -1; --- 75,118 ---- } ! varfile_t *varfile_open(const char *filename) ! { ! varfile_t *varfile; ! ! varfile = xmalloc(sizeof(varfile_t)); ! varfile->fp = file_open_or_create_safe(filename, "r"); ! if(varfile->fp == NULL) { ! xfree(varfile); ! return NULL; ! } ! ! varfile->var_name = NULL; ! varfile->var_val = NULL; ! varfile->line_buff = NULL; ! varfile->line_no = 0; ! ! return varfile; ! } ! ! void destroy_varfile(varfile_t *varfile) ! { ! fclose(varfile->fp); /* close file */ ! if(varfile->line_buff != NULL) ! xfree(varfile->line_buff); /* free line buffer. */ ! xfree(varfile); /* free struct. */ ! ! return; ! } ! ! int file_parse_string(varfile_t *varfile, int type) { char *s; + if(varfile->line_buff == NULL) + return -1; + switch(type) { case PARSE_DOUBLE_STRINGS: ! s = strchr(varfile->line_buff, '='); if(s == NULL) return -1; *************** *** 89,99 **** if(*s == '\0' || *s == '\n' || *s == '\r') return -1; ! var_name = line_buff; ! var_val = s; ! trim_string(var_name); ! trim_string(var_val); ! if(!isascii(*var_name) || !isascii(*var_val)) return -1; --- 122,132 ---- if(*s == '\0' || *s == '\n' || *s == '\r') return -1; ! varfile->var_name = varfile->line_buff; ! varfile->var_val = s; ! trim_string(varfile->var_name); ! trim_string(varfile->var_val); ! if(!isascii(*varfile->var_name) || !isascii(*varfile->var_val)) return -1; *************** *** 101,110 **** case PARSE_SINGLE_STRING: ! trim_string(line_buff); ! var_name = line_buff; ! if(!isascii(*var_name)) return -1; break; --- 134,145 ---- case PARSE_SINGLE_STRING: ! trim_string(varfile->line_buff); ! varfile->var_name = varfile->line_buff; ! if(!isascii(*varfile->var_name)) return -1; + trim_string(varfile->var_name); + break; *************** *** 130,149 **** */ ! int file_get_var_string(FILE *fp) { ! long begin_line_seek, end_line_seek; int c; unsigned char have_line = 0; size_t string_size; ! begin_line_seek = ftell(fp); ! if(line_buff != NULL) { /* free up old string. */ ! xfree(line_buff); ! line_buff = NULL; } ! while((c = fgetc(fp)) != EOF) { if(c == '\n') { have_line = 1; --- 165,184 ---- */ ! int file_get_var_string(varfile_t *varfile) { ! off_t begin_line_seek, end_line_seek; int c; unsigned char have_line = 0; size_t string_size; ! begin_line_seek = ftell(varfile->fp); ! if(varfile->line_buff != NULL) { /* free up old string. */ ! xfree(varfile->line_buff); ! varfile->line_buff = NULL; } ! while((c = fgetc(varfile->fp)) != EOF) { if(c == '\n') { have_line = 1; *************** *** 155,159 **** return 1; ! end_line_seek = ftell(fp); /* Our buffer needs to be as big as the line plus --- 190,194 ---- return 1; ! end_line_seek = ftell(varfile->fp); /* Our buffer needs to be as big as the line plus *************** *** 161,177 **** string_size = (end_line_seek - begin_line_seek); ! line_buff = xmalloc(string_size + 1); /* seek back. */ ! fseek(fp, begin_line_seek, SEEK_SET); /* all done. read up! */ ! if(fread(line_buff, sizeof(char), string_size, fp) != string_size) return 1; ! else { ! line_buff[string_size] = 0; ! return 0; ! } } --- 196,213 ---- string_size = (end_line_seek - begin_line_seek); ! varfile->line_buff = xmalloc(string_size + 1); /* seek back. */ ! fseek(varfile->fp, begin_line_seek, SEEK_SET); /* all done. read up! */ ! if(fread(varfile->line_buff, sizeof(char), string_size, varfile->fp) != string_size) return 1; ! ! /* null terminate. */ ! varfile->line_buff[string_size] = 0; ! return 0; ! } Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-globconf.c 25 May 2002 15:18:01 -0000 1.1 --- dhcp-globconf.c 29 May 2002 03:12:54 -0000 1.2 *************** *** 30,33 **** --- 30,34 ---- #include <dhcp-agent.h> #include <dhcp-globconf.h> + #include <dhcp-files.h> /* change this before... */ *************** *** 86,91 **** int init_glob_conf(unsigned char *filename) { ! FILE *fp; int i; /* we're ok. all config options are in directories only --- 87,93 ---- int init_glob_conf(unsigned char *filename) { ! varfile_t *varfile; int i; + unsigned char match; /* we're ok. all config options are in directories only *************** *** 98,119 **** } ! fp = file_open_or_create_safe(filename, "r"); ! if(fp == NULL) fatal_error("glob-conf: could not open configuration file: %s: %s", filename, strerror(errno)); ! while(!file_get_var_string(fp)) { ! if(file_parse_string(PARSE_DOUBLE_STRINGS)) { ! fclose(fp); /* fixme: add parse error. */ return -1; } for(i = 0;i < GLOBAL_OPTIONS_LEN;i++) { ! if(string_matches(global_config_options[i].name, file_get_var_name())) { /* we have a match. */ ! global_config_options[i].val = global_config_options[i].convert_option_to_internal(file_get_var_val()); if(global_config_options[i].val == NULL) ! fatal_error("glob-conf: unable to convert value for option %s -- munged variable?"); break; --- 100,124 ---- } ! varfile = varfile_open(filename); ! if(varfile == NULL) fatal_error("glob-conf: could not open configuration file: %s: %s", filename, strerror(errno)); ! while(!file_get_var_string(varfile)) { ! if(file_parse_string(varfile, PARSE_DOUBLE_STRINGS)) { ! destroy_varfile(varfile); /* fixme: add parse error. */ return -1; } + match = 0; for(i = 0;i < GLOBAL_OPTIONS_LEN;i++) { ! if(string_matches(global_config_options[i].name, varfile_get_name(varfile))) { /* we have a match. */ ! match = 1; ! global_config_options[i].val = global_config_options[i].convert_option_to_internal(varfile_get_val(varfile)); if(global_config_options[i].val == NULL) ! fatal_error("glob-conf: unable to convert value for option %s : line no: %d -- munged variable?", ! varfile_get_name(varfile), varfile_get_lineno(varfile)); break; *************** *** 121,127 **** } } ! fclose(fp); /* one more pass to convert defaults if needed. --- 126,136 ---- } + if(match != 1) + warn_message("glob-conf: unable to lookup variable name %s: line no: %d -- skipping", + varfile_get_name(varfile), varfile_get_lineno(varfile)); + } ! destroy_varfile(varfile); /* one more pass to convert defaults if needed. Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-sysconf.c 19 May 2002 23:07:53 -0000 1.11 --- dhcp-sysconf.c 29 May 2002 03:12:54 -0000 1.12 *************** *** 26,29 **** --- 26,30 ---- #include <dhcp-agent.h> + #include <dhcp-files.h> /* Only use handlers here which can be done in any order. Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-util.c 25 May 2002 14:02:30 -0000 1.13 --- dhcp-util.c 29 May 2002 03:12:54 -0000 1.14 *************** *** 28,32 **** static char msgbuff[MSG_BUFFER_SIZE]; ! static int verbosity_level = NORMAL_VERBOSITY_LEVEL; /* set the verbosity level. */ --- 28,32 ---- static char msgbuff[MSG_BUFFER_SIZE]; ! static int verbosity_level = WARNING_VERBOSITY_LEVEL; /* set the verbosity level. */ *************** *** 94,98 **** va_list ap; ! if(verbosity_level < ERROR_VERBOSITY_LEVEL) return; --- 94,98 ---- va_list ap; ! if(!(verbosity_level >= NORMAL_VERBOSITY_LEVEL)) return; *************** *** 115,119 **** va_list ap; ! if(verbosity_level < WARNING_VERBOSITY_LEVEL) return; --- 115,119 ---- va_list ap; ! if(!(verbosity_level >= WARNING_VERBOSITY_LEVEL)) return; *************** *** 136,140 **** va_list ap; ! if(verbosity_level < DEBUG_VERBOSITY_LEVEL) return; --- 136,140 ---- va_list ap; ! if(!(verbosity_level >= DEBUG_VERBOSITY_LEVEL)) return; |
From: Thamer Al-H. <act...@us...> - 2002-05-25 20:55:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv5307 Modified Files: TODO configure.in dhcp-agent.h dhcp-client-control.c dhcp-convert.c dhcp-files.c dhcp-icmp-discovery.c Log Message: fixed up conversion for integers to be proper for C99 Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TODO 25 May 2002 14:02:29 -0000 1.16 --- TODO 25 May 2002 20:55:36 -0000 1.17 *************** *** 35,46 **** unwanted packets. -- implement decline, and inform in the client. - -- fix up things which break data hiding. they're beginning to creep. - -- make option handlers point to global strings -- save space. -- add check in validate_to_string for conformity with DHCP RFC on character set. -- other minor optimizations which would be nice are noted in FIXMEs all over the code. - -- add icmp ping routines so that optimal routers/hosts can be - detected. -- make more uses of different xid. currently only one per reboot is chosen. this is compliant with the rfc, but not really good. --- 35,42 ---- *************** *** 57,66 **** dependencies. the sniffer for example, only needs the packet parsing routines. - -- net->hw_addr is broken. i don't like it being at that level. - we should always specify our hardware address at a higher - level on a per-use basis and thus give us control over - how much Marla is faking it. - -- would be nice to have more unpredictable random numbers - by using devices like /dev/urandom explicitly if available. - -- fix overflow issue in dhcp-icmp-discovery (icmp_do_echo) - -- add global config options which can be gotten anywhere in the code --- 53,54 ---- Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** configure.in 19 May 2002 00:35:35 -0000 1.11 --- configure.in 25 May 2002 20:55:36 -0000 1.12 *************** *** 83,87 **** AC_MSG_ERROR(`libdnet not found http://libdnet.sourceforge.net/ to get a copy', 1)) DNET_INC="" ! p else --- 83,87 ---- AC_MSG_ERROR(`libdnet not found http://libdnet.sourceforge.net/ to get a copy', 1)) DNET_INC="" ! else Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** dhcp-agent.h 25 May 2002 15:18:00 -0000 1.39 --- dhcp-agent.h 25 May 2002 20:55:36 -0000 1.40 *************** *** 30,33 **** --- 30,35 ---- # define DHCP_AGENT_H + #define __STDC_FORMAT_MACROS /* we need the stdint type macros. */ + # include <stdlib.h> # include <stdio.h> Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-client-control.c 25 May 2002 15:18:01 -0000 1.17 --- dhcp-client-control.c 25 May 2002 20:55:36 -0000 1.18 *************** *** 105,109 **** static void update_dhcp_xid(dhcp_client_control_t *dc) { ! dc->xid = dhcp_gen_xid(); /* this is redone at discover_request too */ return; } --- 105,109 ---- static void update_dhcp_xid(dhcp_client_control_t *dc) { ! dc->xid = dhcp_gen_xid(); return; } Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-convert.c 25 May 2002 14:02:30 -0000 1.9 --- dhcp-convert.c 25 May 2002 20:55:36 -0000 1.10 *************** *** 428,437 **** case sizeof(int32_t): string = xmalloc(INT32_T_STRING_SIZE); ! snprintf(string, INT32_T_STRING_SIZE, "%d", *(int32_t *)data); break; case sizeof(int16_t): string = xmalloc(INT16_T_STRING_SIZE); ! snprintf(string, INT16_T_STRING_SIZE, "%hd", *(int16_t *)data); break; --- 428,437 ---- case sizeof(int32_t): string = xmalloc(INT32_T_STRING_SIZE); ! snprintf(string, INT32_T_STRING_SIZE, "%"PRIi32"", *(int32_t *)data); break; case sizeof(int16_t): string = xmalloc(INT16_T_STRING_SIZE); ! snprintf(string, INT16_T_STRING_SIZE, "%"PRIi16"", *(int16_t *)data); break; *************** *** 448,457 **** case sizeof(uint32_t): string = xmalloc(UINT32_T_STRING_SIZE); ! snprintf(string, UINT32_T_STRING_SIZE, "%u", *(uint32_t *)data); break; case sizeof(uint16_t): string = xmalloc(UINT16_T_STRING_SIZE); ! snprintf(string, UINT16_T_STRING_SIZE, "%hu", *(uint16_t *)data); break; --- 448,457 ---- case sizeof(uint32_t): string = xmalloc(UINT32_T_STRING_SIZE); ! snprintf(string, UINT32_T_STRING_SIZE, "%"PRIu32"", *(uint32_t *)data); break; case sizeof(uint16_t): string = xmalloc(UINT16_T_STRING_SIZE); ! snprintf(string, UINT16_T_STRING_SIZE, "%"PRIu16"", *(uint16_t *)data); break; *************** *** 481,502 **** case sizeof(int32_t): ! ! tmp = malloc(sizeof(int32_t)); ! *tmp = ntohl(* (int32_t *)data); ! int_to_string(tmp, data_len, size, si); ! string = int_to_string(tmp, data_len, size, si); ! xfree(tmp); ! ! break; case sizeof(int16_t): ! ! tmp = malloc(sizeof(int16_t)); ! *tmp = ntohl(* (int16_t *)data); ! int_to_string(tmp, data_len, size, si); ! string = int_to_string(tmp, data_len, size, si); ! xfree(tmp); ! ! break; default: --- 481,498 ---- case sizeof(int32_t): ! { ! int32_t tmp; ! tmp = ntohl(* (int32_t *)data); ! string = int_to_string((void *)&tmp, data_len, size, si); ! break; ! } case sizeof(int16_t): ! { ! int16_t tmp; ! tmp = ntohl(* (int16_t *)data); ! string = int_to_string((void *)&tmp, data_len, size, si); ! break; ! } default: *************** *** 509,530 **** switch(size) { ! case sizeof(uint32_t): ! tmp = malloc(sizeof(uint32_t)); ! *tmp = ntohl(* (uint32_t *)data); ! int_to_string(tmp, data_len, size, si); ! string = int_to_string(tmp, data_len, size, si); ! xfree(tmp); ! break; case sizeof(uint16_t): ! ! tmp = malloc(sizeof(uint16_t)); ! *tmp = ntohl(* (uint16_t *)data); ! int_to_string(tmp, data_len, size, si); ! string = int_to_string(tmp, data_len, size, si); ! xfree(tmp); ! break; default: --- 505,525 ---- switch(size) { ! case sizeof(uint32_t): + { + uint32_t tmp; + tmp = ntohl(* (uint32_t *)data); + string = int_to_string((void *)&tmp, data_len, size, si); + break; ! } case sizeof(uint16_t): ! { ! uint16_t tmp; ! tmp = ntohl(* (uint16_t *)data); ! string = int_to_string((void *)&tmp, data_len, size, si); ! break; ! } default: *************** *** 568,572 **** char *uint16_to_string(const unsigned char *data, int len) { ! return(int_to_string(data, len, sizeof(int16_t), 0)); } char *int16_to_string(const unsigned char *data, int len) --- 563,567 ---- char *uint16_to_string(const unsigned char *data, int len) { ! return(int_to_string(data, len, sizeof(uint16_t), 0)); } char *int16_to_string(const unsigned char *data, int len) Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-files.c 25 May 2002 14:02:30 -0000 1.7 --- dhcp-files.c 25 May 2002 20:55:36 -0000 1.8 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-agent.h> + #include <dhcp-file.h> static char *line_buff = NULL; Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-icmp-discovery.c 25 May 2002 15:18:01 -0000 1.8 --- dhcp-icmp-discovery.c 25 May 2002 20:55:36 -0000 1.9 *************** *** 114,122 **** difference = timeval_diff(before, after); - /* milliseconds are accurate enough for us. - * FIXME: the integer may overflow if our - * rtt mechanism is setup to wait for too long before a - * timeout. */ - latency = (difference.tv_sec * 1000); latency += (difference.tv_usec/1000); --- 114,117 ---- *************** *** 142,146 **** eth_addr_t dest_mac; - /* FIXME:x get rid of this magic number -- global config options? */ int *sends = glob_conf_get_val(CLIENT_ICMP_RETRIES); --- 137,140 ---- *************** *** 185,190 **** * largest latency multiplied by two. This severely hurts * a host's average, but it's the right thing to do as ! * long as we're doing it fairly to everyone. ! * FIXME: we do need a better way to deal with this. */ /* check our latency if it's all -1 */ --- 179,183 ---- * largest latency multiplied by two. This severely hurts * a host's average, but it's the right thing to do as ! * long as we're doing it fairly to everyone. */ /* check our latency if it's all -1 */ |
From: Thamer Al-H. <act...@us...> - 2002-05-25 15:18:04
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv22957 Modified Files: dhcp-agent.h dhcp-client-conf.c dhcp-client-control.c dhcp-icmp-discovery.c Added Files: dhcp-globconf.c dhcp-globconf.h Log Message: linked in globconfig -- now uses two variables --- NEW FILE: dhcp-globconf.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v 1.1 2002/05/25 15:18:01 actmodern Exp $ * * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Global config options -- this breaks our usual order of doing things. * Usually we pass the datum instead of keeping a local copy and modifying it. * However, in the case of global defaults they are by definition global and should * only be accessed from one datum. Thus we keep a local copy we initialize. * */ #include <dhcp-agent.h> #include <dhcp-globconf.h> /* change this before... */ #define GLOBAL_OPTIONS_LEN 2 /* ... changing size of this */ /* array holding information on converting global config options and their defaults. * do not change order unless you change defines in dhcp-globconf.h! */ static glob_conf_t global_config_options[] = { { "client-dhcp-retries", string_to_int32, int32_to_string, sizeof(int32_t), DHCP_CLIENT_RETRIES_S, NULL }, { "client-icmp-retries", string_to_int32, int32_to_string, sizeof(int32_t), DHCP_CLIENT_RETRIES_S, NULL }, }; /* useful for dumping defaults. */ static int glob_conf_dump(const char *filename) { int i; FILE *fp; char *var_string; fp = file_open_or_create_safe(filename, "w"); if(fp == NULL) return -1; for(i = 0;i < GLOBAL_OPTIONS_LEN; i++) { var_string = global_config_options[i].convert_option_to_string(global_config_options[i].val, global_config_options[i].size); if(var_string == NULL) fatal_error("could not convert option to string -- this is a bug report it."); fprintf(fp,"%s=%s\n", global_config_options[i].name, var_string); xfree(var_string); } fclose(fp); return 0; } static void glob_conf_set_defaults(void) { int i; for(i = 0;i < GLOBAL_OPTIONS_LEN;i++) { if(global_config_options[i].val == NULL) { global_config_options[i].val = global_config_options[i].convert_option_to_internal(global_config_options[i].default_val); if(global_config_options[i].val == NULL) fatal_error("glob-conf: unable to convert value for option %s -- default! this is a bug. report it!"); } } return; } /* read configuration options in and set variables. */ int init_glob_conf(unsigned char *filename) { FILE *fp; int i; /* we're ok. all config options are in directories only * writable by us. */ if(!file_exists(filename)) { /* dump defaults if not available. */ glob_conf_set_defaults(); glob_conf_dump(filename); return 0; } fp = file_open_or_create_safe(filename, "r"); if(fp == NULL) fatal_error("glob-conf: could not open configuration file: %s: %s", filename, strerror(errno)); while(!file_get_var_string(fp)) { if(file_parse_string(PARSE_DOUBLE_STRINGS)) { fclose(fp); /* fixme: add parse error. */ return -1; } for(i = 0;i < GLOBAL_OPTIONS_LEN;i++) { if(string_matches(global_config_options[i].name, file_get_var_name())) { /* we have a match. */ global_config_options[i].val = global_config_options[i].convert_option_to_internal(file_get_var_val()); if(global_config_options[i].val == NULL) fatal_error("glob-conf: unable to convert value for option %s -- munged variable?"); break; } } } fclose(fp); /* one more pass to convert defaults if needed. * a user could always truncate the file we dumped. */ glob_conf_set_defaults(); return 0; } void *glob_conf_get_val(int val_index) { return global_config_options[val_index].val; } --- NEW FILE: dhcp-globconf.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.h,v 1.1 2002/05/25 15:18:01 actmodern Exp $ * * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Global configuration options. Accessible from anywhere through * glob-conf code. */ #ifndef GLOBAL_CONF_H #define GLOBAL_CONF_H typedef struct { const char *name; void *(*convert_option_to_internal)(const char *); char *(*convert_option_to_string)(const unsigned char *, int); size_t size; const char *default_val; void *val; } glob_conf_t; extern int init_glob_conf(unsigned char *filename); extern void *glob_conf_get_val(int val_index); /* indexes to values. */ #define CLIENT_DHCP_RETRIES 0 #define CLIENT_ICMP_RETRIES 1 /* default string values. */ #define DHCP_CLIENT_RETRIES_S "3" /* governs all retries. */ #endif /* GLOBAL_CONF_H */ Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** dhcp-agent.h 25 May 2002 14:02:30 -0000 1.38 --- dhcp-agent.h 25 May 2002 15:18:00 -0000 1.39 *************** *** 165,169 **** #define DISCOVER_OFFER_RETRIES 3 - #define DHCP_CLIENT_RETRIES_S "3" /* * * * * * * * * * * --- 165,168 ---- *************** *** 346,352 **** unsigned char options[MAX_OPTIONS_HANDLED]; /* which options should we handle. */ - int discover_offer_retries; /* amount of times we're willing to keep - * rediscovering before giving up. */ - } client_conf_t; --- 345,348 ---- *************** *** 368,372 **** unsigned char *class_id, *client_id; /* client_id, class_id */ int state; /* our current state. */ ! int discover_offer_retries; /* how many times we should discover/offer before giving up. */ } dhcp_client_control_t; --- 364,368 ---- unsigned char *class_id, *client_id; /* client_id, class_id */ int state; /* our current state. */ ! int discover_offer_retries; /* counter for retries on discover_offer */ } dhcp_client_control_t; Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-client-conf.c 11 Feb 2002 18:02:24 -0000 1.5 --- dhcp-client-conf.c 25 May 2002 15:18:01 -0000 1.6 *************** *** 53,57 **** client_conf_reset_options(cc); cc->interface = dc->interface; - cc->discover_offer_retries = DISCOVER_OFFER_RETRIES; return cc; } --- 53,56 ---- Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-client-control.c 19 May 2002 00:34:22 -0000 1.16 --- dhcp-client-control.c 25 May 2002 15:18:01 -0000 1.17 *************** *** 23,26 **** --- 23,27 ---- #include <dhcp-agent.h> + #include <dhcp-globconf.h> /* Utility routines to update counters and time stamps. */ *************** *** 49,54 **** int dhcp_client_discover_offer_can_retry(dhcp_client_control_t *dc) { dc->discover_offer_retries++; ! if(dc->discover_offer_retries > dc->conf->discover_offer_retries) return 1; --- 50,57 ---- int dhcp_client_discover_offer_can_retry(dhcp_client_control_t *dc) { + uint32_t *discover_offer_retries = glob_conf_get_val(CLIENT_DHCP_RETRIES); dc->discover_offer_retries++; ! ! if(dc->discover_offer_retries > *(discover_offer_retries)) return 1; Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-icmp-discovery.c 19 May 2002 23:07:53 -0000 1.7 --- dhcp-icmp-discovery.c 25 May 2002 15:18:01 -0000 1.8 *************** *** 28,31 **** --- 28,32 ---- #include <dhcp-agent.h> + #include <dhcp-globconf.h> /* Check for icmp mask response. */ *************** *** 142,146 **** /* FIXME:x get rid of this magic number -- global config options? */ ! int sends = 3; /* Our algorithm works as such: send out an ICMP echo request --- 143,147 ---- /* FIXME:x get rid of this magic number -- global config options? */ ! int *sends = glob_conf_get_val(CLIENT_ICMP_RETRIES); /* Our algorithm works as such: send out an ICMP echo request *************** *** 171,179 **** /* allocate latency array. */ ! latency = xmalloc(sizeof(int) * sends); send_count = 0; /* fill up our latency array. */ ! for(send_count = 0; send_count < sends; send_count++) latency[send_count] = icmp_do_echo(net, *(host_addr), dest_mac); --- 172,180 ---- /* allocate latency array. */ ! latency = xmalloc(sizeof(int) * *(sends)); send_count = 0; /* fill up our latency array. */ ! for(send_count = 0; send_count < *(sends); send_count++) latency[send_count] = icmp_do_echo(net, *(host_addr), dest_mac); *************** *** 189,193 **** /* check our latency if it's all -1 */ unreachable_count = 0; ! for(send_count = 0; send_count < sends; send_count++) { if(latency[send_count] == -1) unreachable_count++; --- 190,194 ---- /* check our latency if it's all -1 */ unreachable_count = 0; ! for(send_count = 0; send_count < *(sends); send_count++) { if(latency[send_count] == -1) unreachable_count++; *************** *** 209,213 **** /* get highest. */ highest_latency = 0; ! for(send_count = 0; send_count < sends; send_count++) { if(latency[send_count] > highest_latency) highest_latency = latency[send_count]; --- 210,214 ---- /* get highest. */ highest_latency = 0; ! for(send_count = 0; send_count < *(sends); send_count++) { if(latency[send_count] > highest_latency) highest_latency = latency[send_count]; *************** *** 215,219 **** /* replace unreachables with highest multiplied by two */ ! for(send_count = 0; send_count < sends; send_count++) { if(latency[send_count] == -1) latency[send_count] = highest_latency * 2; --- 216,220 ---- /* replace unreachables with highest multiplied by two */ ! for(send_count = 0; send_count < *(sends); send_count++) { if(latency[send_count] == -1) latency[send_count] = highest_latency * 2; *************** *** 224,232 **** *average_latency = 0; ! for(send_count = 0; send_count < sends; send_count++) { *average_latency += latency[send_count]; } ! *average_latency /= sends; } --- 225,233 ---- *average_latency = 0; ! for(send_count = 0; send_count < *(sends); send_count++) { *average_latency += latency[send_count]; } ! *average_latency /= *(sends); } |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv2292 Modified Files: Makefile.am Makefile.in TODO dhcp-agent.h dhcp-client.c dhcp-convert.c dhcp-files.c dhcp-net.c dhcp-util.c Log Message: added global config options; fixed up to const pointers in some places Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Makefile.am 19 May 2002 17:53:28 -0000 1.16 --- Makefile.am 25 May 2002 14:02:29 -0000 1.17 *************** *** 21,25 **** dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ ! dhcp-arp-discovery.c dhcp-route.c dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 21,25 ---- dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ ! dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Makefile.in 19 May 2002 17:53:28 -0000 1.16 --- Makefile.in 25 May 2002 14:02:29 -0000 1.17 *************** *** 83,87 **** dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ ! dhcpclient_SOURCES = dhcp-client.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c @DHCP_SNPRINTF@ dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c --- 83,87 ---- dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ ! dhcpclient_SOURCES = dhcp-client.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c @DHCP_SNPRINTF@ dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c *************** *** 117,121 **** dhcp-options-strings.o dhcp-convert.o dhcp-sysconf.o dhcp-rtt.o \ dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ ! dhcp-route.o dhcpclient_DEPENDENCIES = dhcpclient_LDFLAGS = --- 117,121 ---- dhcp-options-strings.o dhcp-convert.o dhcp-sysconf.o dhcp-rtt.o \ dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ ! dhcp-route.o dhcp-globconf.o dhcpclient_DEPENDENCIES = dhcpclient_LDFLAGS = *************** *** 143,152 **** .deps/dhcp-client-states.P .deps/dhcp-client.P .deps/dhcp-com.P \ .deps/dhcp-convert.P .deps/dhcp-daemon.P .deps/dhcp-eth.P \ ! .deps/dhcp-files.P .deps/dhcp-icmp-discovery.P .deps/dhcp-icmp.P \ ! .deps/dhcp-interface.P .deps/dhcp-ip.P .deps/dhcp-list.P \ ! .deps/dhcp-log.P .deps/dhcp-net.P .deps/dhcp-options-strings.P \ ! .deps/dhcp-packet-build.P .deps/dhcp-print.P .deps/dhcp-route.P \ ! .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ ! .deps/dhcp-sysconf.P .deps/dhcp-udp.P .deps/dhcp-util.P SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) --- 143,153 ---- .deps/dhcp-client-states.P .deps/dhcp-client.P .deps/dhcp-com.P \ .deps/dhcp-convert.P .deps/dhcp-daemon.P .deps/dhcp-eth.P \ ! .deps/dhcp-files.P .deps/dhcp-globconf.P .deps/dhcp-icmp-discovery.P \ ! .deps/dhcp-icmp.P .deps/dhcp-interface.P .deps/dhcp-ip.P \ ! .deps/dhcp-list.P .deps/dhcp-log.P .deps/dhcp-net.P \ ! .deps/dhcp-options-strings.P .deps/dhcp-packet-build.P \ ! .deps/dhcp-print.P .deps/dhcp-route.P .deps/dhcp-rtt.P \ ! .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P .deps/dhcp-sysconf.P \ ! .deps/dhcp-udp.P .deps/dhcp-util.P SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TODO 19 May 2002 23:03:15 -0000 1.15 --- TODO 25 May 2002 14:02:29 -0000 1.16 *************** *** 15,19 **** --- 15,22 ---- other todo: + -- add parse errors with line numbers (dhcp-client-conf.c dhcp-globconf.c at least) -- make dhcp-agent use more goodies from libdnet + (1) use blob routines to convert data to different formats. + we ought to keep network data in a blob. -- add test for kill(0, pid) to see if it correctly identifies the running process. Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** dhcp-agent.h 19 May 2002 23:03:16 -0000 1.37 --- dhcp-agent.h 25 May 2002 14:02:30 -0000 1.38 *************** *** 165,168 **** --- 165,169 ---- #define DISCOVER_OFFER_RETRIES 3 + #define DHCP_CLIENT_RETRIES_S "3" /* * * * * * * * * * * *************** *** 386,391 **** typedef struct option_convert_handler { char* (*serialize)(const unsigned char *data, int len); ! void* (*serialize_to_internal)(char *string); ! void* (*serialize_to_network)(char *string, unsigned char *retlen); void (*free_internal)(void *ptr); } option_convert_handler; --- 387,392 ---- typedef struct option_convert_handler { char* (*serialize)(const unsigned char *data, int len); ! void* (*serialize_to_internal)(const char *string); ! void* (*serialize_to_network)(const char *string, unsigned char *retlen); void (*free_internal)(void *ptr); } option_convert_handler; *************** *** 586,593 **** extern void add_interrupt_handler(int sigtype, void (*sighandler)(int)); extern void info_message(char *fmt, ...); ! extern char *splice_string(char *s1, char *s2); extern char *splice_many_strings(int num, char *s, ...); extern void trim_string(char *s); ! extern int string_matches(char *s1, char *s2); extern int hex_string_to_value(char *string, unsigned char *dst); extern int is_string(const char *string, int len); --- 587,594 ---- extern void add_interrupt_handler(int sigtype, void (*sighandler)(int)); extern void info_message(char *fmt, ...); ! extern char *splice_string(const char *s1, const char *s2); extern char *splice_many_strings(int num, char *s, ...); extern void trim_string(char *s); ! extern int string_matches(const char *s1, const char *s2); extern int hex_string_to_value(char *string, unsigned char *dst); extern int is_string(const char *string, int len); *************** *** 889,894 **** extern int file_parse_string(int type); extern int file_get_var_string(FILE *fp); ! extern FILE *file_open_or_create_safe(char *filename, char *mode); ! extern FILE *file_create_and_truncate_safe(char *filename, char *mode); extern char *file_get_var_name(void); extern char *file_get_var_val(void); --- 890,895 ---- extern int file_parse_string(int type); extern int file_get_var_string(FILE *fp); ! extern FILE *file_open_or_create_safe(const char *filename, char *mode); ! extern FILE *file_create_and_truncate_safe(const char *filename, char *mode); extern char *file_get_var_name(void); extern char *file_get_var_val(void); *************** *** 916,922 **** extern void rtt_destroy(rtt_t *rtt); - /* global conversion routines. */ - extern char *network_address_to_string_static(uint32_t addr); - /* Global vars. */ --- 917,920 ---- *************** *** 930,932 **** extern char *dhcp_options_strings[]; ! #endif /* DHCP_TOOL_H */ --- 928,989 ---- extern char *dhcp_options_strings[]; ! /* conversion routines. */ ! ! /* serialization functions. */ ! ! /* byte routines. */ ! ! extern char *network_byte_to_string_byte(const unsigned char *data, int len); ! extern void *string_byte_to_byte(const char *s); ! extern void *string_byte_to_network(const char *s, unsigned char *ret_len); ! ! /* address routines. */ ! ! extern char *network_addr_to_string(const unsigned char *data, int len); ! extern char *network_addr_list_to_string(const unsigned char *data, int len); ! extern char *addr_list_to_string(const unsigned char *data, int len); ! extern void *string_to_addr_list(const char *string); ! extern void *string_to_addr(const char *string); ! extern void *string_addr_list_to_network(const char *string, unsigned char *len_ret); ! extern void *string_addr_to_network(const char *string, unsigned char *len_ret); ! extern char *network_addr_pair_list_to_string(const unsigned char *data, int len); ! extern void *string_to_addr_pair_list(const char *s); ! extern void *string_addr_pair_list_to_network(const char *s, unsigned char *retlen); ! ! /* integer routines. */ ! ! extern char *network_uint32_to_string(const unsigned char *data, int len); ! extern char *network_int32_to_string(const unsigned char *data, int len); ! extern char *network_uint16_to_string(const unsigned char *data, int len); ! extern char *network_int16_to_string(const unsigned char *data, int len); ! ! extern char *uint32_to_string(const unsigned char *data, int len); ! extern char *int32_to_string(const unsigned char *data, int len); ! extern char *uint16_to_string(const unsigned char *data, int len); ! extern char *int16_to_string(const unsigned char *data, int len); ! ! extern void *string_to_uint32(const char *s); ! extern void *string_to_int32(const char *s); ! extern void *string_to_uint16(const char *s); ! extern void *string_to_int16(const char *s); ! ! extern void *string_int32_to_network(const char *s, unsigned char *ret_len); ! extern void *string_uint32_to_network(const char *s, unsigned char *ret_len); ! extern void *string_int16_to_network(const char *s, unsigned char *ret_len); ! extern void *string_uint16_to_network(const char *s, unsigned char *ret_len); ! ! extern char *network_uint16_list_to_string(const unsigned char *data, int len); ! extern void *string_to_uint16_list(const char *s); ! extern void *string_uint16_list_to_network(const char *s, unsigned char *retlen); ! ! /* network to string */ ! ! extern char *validate_network_string_to_string(const unsigned char *data, int len); ! extern void *strdup_wrap(const char *s); ! extern void *strdup_wrap_net(const char *s, unsigned char *ret_len); ! ! /* static network address conversion routine */ ! ! extern char *network_address_to_string_static(uint32_t addr); ! ! #endif /* DHCP_AGENT_H */ Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-client.c 19 May 2002 00:35:39 -0000 1.18 --- dhcp-client.c 25 May 2002 14:02:30 -0000 1.19 *************** *** 24,27 **** --- 24,28 ---- #include <dhcp-agent.h> + #include <dhcp-globconf.h> int interactive = 1; /* by default we begin interactive (messages on stdout/stderr). */ *************** *** 29,32 **** --- 30,45 ---- char *work_dir = CLIENT_WORK_DIR; /* our default working directory */ + /* read up on our global conf. */ + static void read_global_conf(const char *interface) + { + char *filename; + + filename = splice_string(interface, ".conf"); + if(init_glob_conf(filename)) + fatal_error("could not read nor create global configuration file: %s", filename); + + return; + } + /* do a graceful shutdown. */ static void do_shutdown(dhcp_client_control_t *dc) *************** *** 317,320 **** --- 330,336 ---- fatal_error("cannot enter work directory", work_dir); } + + /* We need to read our global configuration right after we change to work directory. */ + read_global_conf(interface); /* Now see if another client is running on the same interface. */ Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-convert.c 18 May 2002 18:10:09 -0000 1.8 --- dhcp-convert.c 25 May 2002 14:02:30 -0000 1.9 *************** *** 54,105 **** */ - /* serialization functions. */ - - /* byte routines. */ - - char *network_byte_to_string_byte(const unsigned char *data, int len); - void *string_byte_to_byte(char *s); - void *string_byte_to_network(char *s, unsigned char *ret_len); - - /* address routines. */ - - char *network_addr_to_string(const unsigned char *data, int len); - char *network_addr_list_to_string(const unsigned char *data, int len); - char *addr_list_to_string(const unsigned char *data, int len); - void *string_to_addr_list(char *string); - void *string_to_addr(char *string); - void *string_addr_list_to_network(char *string, unsigned char *len_ret); - void *string_addr_to_network(char *string, unsigned char *len_ret); - char *network_addr_pair_list_to_string(const unsigned char *data, int len); - void *string_to_addr_pair_list(char *s); - void *string_addr_pair_list_to_network(char *s, unsigned char *retlen); - - /* integer routines. */ - - char *network_uint32_to_string(const unsigned char *data, int len); - char *network_int32_to_string(const unsigned char *data, int len); - char *network_uint16_to_string(const unsigned char *data, int len); - char *network_int16_to_string(const unsigned char *data, int len); - - void *string_to_uint32(char *s); - void *string_to_int32(char *s); - void *string_to_uint16(char *s); - void *string_to_int16(char *s); - - void *string_int32_to_network(char *s, unsigned char *ret_len); - void *string_uint32_to_network(char *s, unsigned char *ret_len); - void *string_int16_to_network(char *s, unsigned char *ret_len); - void *string_uint16_to_network(char *s, unsigned char *ret_len); - - char *network_uint16_list_to_string(const unsigned char *data, int len); - void *string_to_uint16_list(char *s); - void *string_uint16_list_to_network(char *s, unsigned char *retlen); - - /* network to string */ - - char *validate_network_string_to_string(const unsigned char *data, int len); - void *strdup_wrap(char *s); - void *strdup_wrap_net(char *s, unsigned char *ret_len); - option_convert_handler option_convert_handlers[] = { { NULL, NULL, NULL, NULL }, /* 0 */ /* pad */ --- 54,57 ---- *************** *** 239,243 **** /* string to internal byte value. */ ! void *string_byte_to_byte(char *s) { unsigned char *b; --- 191,195 ---- /* string to internal byte value. */ ! void *string_byte_to_byte(const char *s) { unsigned char *b; *************** *** 251,255 **** /* string to network byte value. */ ! void *string_byte_to_network(char *s, unsigned char *ret_len) { *ret_len = 1; --- 203,207 ---- /* string to network byte value. */ ! void *string_byte_to_network(const char *s, unsigned char *ret_len) { *ret_len = 1; *************** *** 323,327 **** /* convert string address to internal address datum. */ ! void *string_to_addr(char *string) { uint32_t addr, *new_addr; --- 275,279 ---- /* convert string address to internal address datum. */ ! void *string_to_addr(const char *string) { uint32_t addr, *new_addr; *************** *** 336,340 **** /* convert list of string addresses to internal address datum. */ ! void *string_to_addr_list(char *string) { uint32_t *addr; --- 288,292 ---- /* convert list of string addresses to internal address datum. */ ! void *string_to_addr_list(const char *string) { uint32_t *addr; *************** *** 364,368 **** /* convert serialized address to network datum. */ ! void *string_addr_to_network(char *string, unsigned char *len_ret) { uint32_t *addr = string_to_addr(string); --- 316,320 ---- /* convert serialized address to network datum. */ ! void *string_addr_to_network(const char *string, unsigned char *len_ret) { uint32_t *addr = string_to_addr(string); *************** *** 373,377 **** /* convert serialized address list to network datum. */ ! void *string_addr_list_to_network(char *string, unsigned char *len_ret) { list_t *ptr; --- 325,329 ---- /* convert serialized address list to network datum. */ ! void *string_addr_list_to_network(const char *string, unsigned char *len_ret) { list_t *ptr; *************** *** 409,413 **** /* string to internal address pair list (wrapper). */ ! void *string_to_addr_pair_list(char *s) { return(string_to_addr_list(s)); --- 361,365 ---- /* string to internal address pair list (wrapper). */ ! void *string_to_addr_pair_list(const char *s) { return(string_to_addr_list(s)); *************** *** 415,419 **** /* string to network address pair list (wrapper). */ ! void *string_addr_pair_list_to_network(char *s, unsigned char *retlen) { return(string_addr_list_to_network(s, retlen)); --- 367,371 ---- /* string to network address pair list (wrapper). */ ! void *string_addr_pair_list_to_network(const char *s, unsigned char *retlen) { return(string_addr_list_to_network(s, retlen)); *************** *** 443,447 **** /* just copy. wrapper needed to be nice to the compiler. */ ! void *strdup_wrap(char *s) { return(strdup(s)); --- 395,399 ---- /* just copy. wrapper needed to be nice to the compiler. */ ! void *strdup_wrap(const char *s) { return(strdup(s)); *************** *** 449,453 **** /* call strdup_wrap but set the ret_len appropriately. */ ! void *strdup_wrap_net(char *s, unsigned char *ret_len) { unsigned char *val; --- 401,405 ---- /* call strdup_wrap but set the ret_len appropriately. */ ! void *strdup_wrap_net(const char *s, unsigned char *ret_len) { unsigned char *val; *************** *** 462,468 **** * More work is done here to convert to network or internal format. */ ! /* workhorse network int to string routine. */ ! char *network_int_to_string(const unsigned char *data, int data_len, ! size_t size, int si) { char *string; --- 414,419 ---- * More work is done here to convert to network or internal format. */ ! char *int_to_string(const unsigned char *data, int data_len, ! size_t size, int si) { char *string; *************** *** 477,486 **** case sizeof(int32_t): string = xmalloc(INT32_T_STRING_SIZE); ! snprintf(string, INT32_T_STRING_SIZE, "%ld", ntohl(*(int32_t *)data)); break; case sizeof(int16_t): string = xmalloc(INT16_T_STRING_SIZE); ! snprintf(string, INT16_T_STRING_SIZE, "%hd", ntohs(*(int16_t *)data)); break; --- 428,437 ---- case sizeof(int32_t): string = xmalloc(INT32_T_STRING_SIZE); ! snprintf(string, INT32_T_STRING_SIZE, "%d", *(int32_t *)data); break; case sizeof(int16_t): string = xmalloc(INT16_T_STRING_SIZE); ! snprintf(string, INT16_T_STRING_SIZE, "%hd", *(int16_t *)data); break; *************** *** 497,506 **** case sizeof(uint32_t): string = xmalloc(UINT32_T_STRING_SIZE); ! snprintf(string, UINT32_T_STRING_SIZE, "%lu", ntohl(*(uint32_t *)data)); break; case sizeof(uint16_t): string = xmalloc(UINT16_T_STRING_SIZE); ! snprintf(string, UINT16_T_STRING_SIZE, "%hu", ntohs(*(uint16_t *)data)); break; --- 448,457 ---- case sizeof(uint32_t): string = xmalloc(UINT32_T_STRING_SIZE); ! snprintf(string, UINT32_T_STRING_SIZE, "%u", *(uint32_t *)data); break; case sizeof(uint16_t): string = xmalloc(UINT16_T_STRING_SIZE); ! snprintf(string, UINT16_T_STRING_SIZE, "%hu", *(uint16_t *)data); break; *************** *** 513,520 **** return string; } ! /* interface to *int*_to_string */ char *network_uint32_to_string(const unsigned char *data, int len) { --- 464,543 ---- return string; + } + + /* workhorse int to string routine. */ + char *network_int_to_string(const unsigned char *data, int data_len, + size_t size, int si) + { + char *string; + unsigned char *tmp; + + if(size > data_len) + return NULL; + + if(si) { /* signed. */ + + switch(size) { + + case sizeof(int32_t): + + tmp = malloc(sizeof(int32_t)); + *tmp = ntohl(* (int32_t *)data); + int_to_string(tmp, data_len, size, si); + string = int_to_string(tmp, data_len, size, si); + xfree(tmp); + + break; + + case sizeof(int16_t): + + tmp = malloc(sizeof(int16_t)); + *tmp = ntohl(* (int16_t *)data); + int_to_string(tmp, data_len, size, si); + string = int_to_string(tmp, data_len, size, si); + xfree(tmp); + + break; + + default: + /* we should never get here but we should force ourselves + * to b0rk if we do. */ + fatal_error("illegal size passed to int_to_string()!"); + } + + } else { /* unsigned. */ + + switch(size) { + + case sizeof(uint32_t): + + tmp = malloc(sizeof(uint32_t)); + *tmp = ntohl(* (uint32_t *)data); + int_to_string(tmp, data_len, size, si); + string = int_to_string(tmp, data_len, size, si); + xfree(tmp); + break; + + case sizeof(uint16_t): + + tmp = malloc(sizeof(uint16_t)); + *tmp = ntohl(* (uint16_t *)data); + int_to_string(tmp, data_len, size, si); + string = int_to_string(tmp, data_len, size, si); + xfree(tmp); + break; + + default: + /* ditto on forced b0rking. */ + fatal_error("illegal size passed to int_to_string()!"); + + } + } + + return string; } ! /* interface to network_*int*_to_string */ char *network_uint32_to_string(const unsigned char *data, int len) { *************** *** 527,535 **** char *network_uint16_to_string(const unsigned char *data, int len) { ! return(network_int_to_string(data, len, sizeof(int32_t), 0)); } char *network_int16_to_string(const unsigned char *data, int len) { ! return(network_int_to_string(data, len, sizeof(int32_t), 1)); } --- 550,576 ---- char *network_uint16_to_string(const unsigned char *data, int len) { ! return(network_int_to_string(data, len, sizeof(int16_t), 0)); } char *network_int16_to_string(const unsigned char *data, int len) { ! return(network_int_to_string(data, len, sizeof(int16_t), 1)); ! } ! ! /* interface to *int*_to_string */ ! char *uint32_to_string(const unsigned char *data, int len) ! { ! return(int_to_string(data, len, sizeof(uint32_t), 0)); ! } ! char *int32_to_string(const unsigned char *data, int len) ! { ! return(int_to_string(data, len, sizeof(int32_t), 1)); ! } ! char *uint16_to_string(const unsigned char *data, int len) ! { ! return(int_to_string(data, len, sizeof(int16_t), 0)); ! } ! char *int16_to_string(const unsigned char *data, int len) ! { ! return(network_int_to_string(data, len, sizeof(int16_t), 1)); } *************** *** 567,575 **** } ! void *string_to_uint16_list(char *s) { list_t *list_ptr = NULL; void *val; ! char *cp, *ptr; cp = s; --- 608,617 ---- } ! void *string_to_uint16_list(const char *s) { list_t *list_ptr = NULL; void *val; ! const char *cp; ! char *ptr; cp = s; *************** *** 591,595 **** } ! void *string_uint16_list_to_network(char *s, unsigned char *retlen) { unsigned char *data, *data_ptr; --- 633,637 ---- } ! void *string_uint16_list_to_network(const char *s, unsigned char *retlen) { unsigned char *data, *data_ptr; *************** *** 597,601 **** int len = 0; char *ptr; ! char *cp; for(cp = s;ptr != NULL;ptr = strchr(cp, ';')) { --- 639,643 ---- int len = 0; char *ptr; ! const char *cp; for(cp = s;ptr != NULL;ptr = strchr(cp, ';')) { *************** *** 627,631 **** /* i'm worried about some of the type issues here. */ ! static void *string_to_int(char *s, int si, size_t size) { void *val; --- 669,673 ---- /* i'm worried about some of the type issues here. */ ! static void *string_to_int(const char *s, int si, size_t size) { void *val; *************** *** 677,693 **** /* Interface for string_to_*int* */ ! void *string_to_uint32(char *s) { return(string_to_int(s, 0, sizeof(uint32_t))); } ! void *string_to_int32(char *s) { return(string_to_int(s, 1, sizeof(uint32_t))); } ! void *string_to_uint16(char *s) { return(string_to_int(s, 0, sizeof(int16_t))); } ! void *string_to_int16(char *s) { return(string_to_int(s, 1, sizeof(uint16_t))); --- 719,735 ---- /* Interface for string_to_*int* */ ! void *string_to_uint32(const char *s) { return(string_to_int(s, 0, sizeof(uint32_t))); } ! void *string_to_int32(const char *s) { return(string_to_int(s, 1, sizeof(uint32_t))); } ! void *string_to_uint16(const char *s) { return(string_to_int(s, 0, sizeof(int16_t))); } ! void *string_to_int16(const char *s) { return(string_to_int(s, 1, sizeof(uint16_t))); *************** *** 695,699 **** /* string int to network. */ ! static void *string_int_to_network(char *s, unsigned char *ret_len, int si, size_t size) { --- 737,741 ---- /* string int to network. */ ! static void *string_int_to_network(const char *s, unsigned char *ret_len, int si, size_t size) { *************** *** 755,775 **** /* interface to string_*int*_to_network */ ! void *string_int32_to_network(char *s, unsigned char *ret_len) { return(string_int_to_network(s, ret_len, 1, sizeof(int32_t))); } ! void *string_uint32_to_network(char *s, unsigned char *ret_len) { return(string_int_to_network(s, ret_len, 0, sizeof(uint32_t))); } ! void *string_int16_to_network(char *s, unsigned char *ret_len) { return(string_int_to_network(s, ret_len, 1, sizeof(int16_t))); } ! void *string_uint16_to_network(char *s, unsigned char *ret_len) { return(string_int_to_network(s, ret_len, 0, sizeof(uint16_t))); } ! /* variation on network_addr_to_string in dhcp-convert.c we use * this when we don't want to run around freeing results up, and --- 797,817 ---- /* interface to string_*int*_to_network */ ! void *string_int32_to_network(const char *s, unsigned char *ret_len) { return(string_int_to_network(s, ret_len, 1, sizeof(int32_t))); } ! void *string_uint32_to_network(const char *s, unsigned char *ret_len) { return(string_int_to_network(s, ret_len, 0, sizeof(uint32_t))); } ! void *string_int16_to_network(const char *s, unsigned char *ret_len) { return(string_int_to_network(s, ret_len, 1, sizeof(int16_t))); } ! void *string_uint16_to_network(const char *s, unsigned char *ret_len) { return(string_int_to_network(s, ret_len, 0, sizeof(uint16_t))); } ! /* variation on network_addr_to_string in dhcp-convert.c we use * this when we don't want to run around freeing results up, and Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-files.c 19 May 2002 16:24:37 -0000 1.6 --- dhcp-files.c 25 May 2002 14:02:30 -0000 1.7 *************** *** 1,4 **** /* $Header$ ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,4 ---- /* $Header$ ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without *************** *** 40,44 **** } ! static FILE *file_open_proc(char *filename, char *cmode, int flags, mode_t mode) { FILE *fp; --- 40,44 ---- } ! static FILE *file_open_proc(const char *filename, char *cmode, int flags, mode_t mode) { FILE *fp; *************** *** 63,72 **** /* Assumes we're opening a directory only writable by us . */ ! FILE *file_open_or_create_safe(char *filename, char *mode) { return(file_open_proc(filename, mode, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)); } ! FILE *file_create_and_truncate_safe(char *filename, char *mode) { return(file_open_proc(filename, mode, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR)); --- 63,72 ---- /* Assumes we're opening a directory only writable by us . */ ! FILE *file_open_or_create_safe(const char *filename, char *mode) { return(file_open_proc(filename, mode, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)); } ! FILE *file_create_and_truncate_safe(const char *filename, char *mode) { return(file_open_proc(filename, mode, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR)); Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-net.c 19 May 2002 17:53:28 -0000 1.20 --- dhcp-net.c 25 May 2002 14:02:30 -0000 1.21 *************** *** 120,126 **** int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr) { - /* are we using a fake address? */ return(eth_get(net->eth, addr)); - } --- 120,124 ---- Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-util.c 19 May 2002 20:19:09 -0000 1.12 --- dhcp-util.c 25 May 2002 14:02:30 -0000 1.13 *************** *** 274,278 **** */ ! char *splice_string(char *s1, char *s2) { char *new_string; --- 274,278 ---- */ ! char *splice_string(const char *s1, const char *s2) { char *new_string; *************** *** 411,419 **** } ! /* check if two strings match using strlen and strcmp */ ! int string_matches(char *s1, char *s2) { ! if(strlen(s1) == strlen(s2) && ! !strcmp(s1, s2)) return 1; else --- 411,418 ---- } ! /* check if two strings match. */ ! int string_matches(const char *s1, const char *s2) { ! if(!strcmp(s1, s2)) return 1; else |
From: Thamer Al-H. <act...@us...> - 2002-05-19 23:08:33
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv19589 Removed Files: config.h Log Message: strike that config.h shouldn't be in there in the first place --- config.h DELETED --- |
From: Thamer Al-H. <act...@us...> - 2002-05-19 23:07:56
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv19374 Modified Files: dhcp-icmp-discovery.c dhcp-sysconf.c Log Message: added icmp discovery to sysconf_routers (works now) Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-icmp-discovery.c 19 May 2002 23:03:16 -0000 1.6 --- dhcp-icmp-discovery.c 19 May 2002 23:07:53 -0000 1.7 *************** *** 142,146 **** /* FIXME:x get rid of this magic number -- global config options? */ ! sends = 3; /* Our algorithm works as such: send out an ICMP echo request --- 142,146 ---- /* FIXME:x get rid of this magic number -- global config options? */ ! int sends = 3; /* Our algorithm works as such: send out an ICMP echo request Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-sysconf.c 19 May 2002 23:03:16 -0000 1.10 --- dhcp-sysconf.c 19 May 2002 23:07:53 -0000 1.11 *************** *** 123,129 **** latency = list_ptr->data; ! if(lowest_latency < latency) { lowest_latency = *latency; ! addr_val = list_ptr->data; } } --- 123,129 ---- latency = list_ptr->data; ! if(lowest_latency < *latency) { lowest_latency = *latency; ! addr_val = routers->data; } } |
From: Thamer Al-H. <act...@us...> - 2002-05-19 23:03:19
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv18572 Modified Files: TODO dhcp-agent.h dhcp-icmp-discovery.c dhcp-route.c dhcp-sysconf.c Added Files: config.h Log Message: forgot to add the config.h --- NEW FILE: config.h --- /* config.h. Generated automatically by configure. */ /* config.h.in. Generated automatically from configure.in by autoheader. */ /* have sig_atomic_t */ #define HAVE_SIG_ATOMIC_T 1 /* default client work directory */ #define CLIENT_WORK_DIR "/etc/dhcpclient" /* Define if you have the `calloc' function. */ #define HAVE_CALLOC 1 /* Define if you have the `daemon' function. */ #define HAVE_DAEMON 1 /* Define if you have the <getopt.h> header file. */ #define HAVE_GETOPT_H 1 /* Define if you have the `getrusage' function. */ #define HAVE_GETRUSAGE 1 /* Define if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define if you have the `rename' function. */ #define HAVE_RENAME 1 /* Define if you have the <signal.h> header file. */ #define HAVE_SIGNAL_H 1 /* Define if you have the `sprintf' function. */ #define HAVE_SPRINTF 1 /* Define if you have the <stdarg.h> header file. */ #define HAVE_STDARG_H 1 /* Define if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define if you have the <sys/utsname.h> header file. */ #define HAVE_SYS_UTSNAME_H 1 /* Define if you have the `uname' function. */ #define HAVE_UNAME 1 /* Define if you have the <varargs.h> header file. */ #define HAVE_VARARGS_H 1 /* Define if you have the `vsnprintf' function. */ #define HAVE_VSNPRINTF 1 /* Name of package */ #define PACKAGE "dhcp-agent" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "0.36" Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TODO 19 May 2002 20:16:55 -0000 1.14 --- TODO 19 May 2002 23:03:15 -0000 1.15 *************** *** 61,63 **** by using devices like /dev/urandom explicitly if available. -- fix overflow issue in dhcp-icmp-discovery (icmp_do_echo) ! --- 61,63 ---- by using devices like /dev/urandom explicitly if available. -- fix overflow issue in dhcp-icmp-discovery (icmp_do_echo) ! -- add global config options which can be gotten anywhere in the code Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** dhcp-agent.h 19 May 2002 20:16:55 -0000 1.36 --- dhcp-agent.h 19 May 2002 23:03:16 -0000 1.37 *************** *** 548,551 **** --- 548,552 ---- /* ICMP discovery routines. */ extern int icmp_subnet_mask_discovery(rawnet_t *net, int retries, uint32_t *subnet_mask); + extern list_t *icmp_rtt_discovery(rawnet_t *net, list_t *addresses); /* ARP discovery routines. */ Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-icmp-discovery.c 19 May 2002 20:16:55 -0000 1.5 --- dhcp-icmp-discovery.c 19 May 2002 23:03:16 -0000 1.6 *************** *** 133,138 **** */ ! /* FIXME: we need to underengineer this code. */ ! list_t *icmp_rtt_discovery(rawnet_t *net, list_t *addresses, int sends) { list_t *rtts = NULL; --- 133,137 ---- */ ! list_t *icmp_rtt_discovery(rawnet_t *net, list_t *addresses) { list_t *rtts = NULL; *************** *** 141,144 **** --- 140,146 ---- ip_addr_t *host_addr; eth_addr_t dest_mac; + + /* FIXME:x get rid of this magic number -- global config options? */ + sends = 3; /* Our algorithm works as such: send out an ICMP echo request Index: dhcp-route.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-route.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-route.c 19 May 2002 18:47:23 -0000 1.1 --- dhcp-route.c 19 May 2002 23:03:16 -0000 1.2 *************** *** 59,61 **** return(arp_discover_hardware_address(net, 3, entry.route_gw.addr_ip, dest_mac)); } - --- 59,60 ---- Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-sysconf.c 18 May 2002 18:10:09 -0000 1.9 --- dhcp-sysconf.c 19 May 2002 23:03:16 -0000 1.10 *************** *** 99,105 **** { struct route_entry r_entry; ! uint32_t *addr_val; route_t *rt; list_t *routers; /* FIXME: insert ICMP ping checks so we can find --- 99,108 ---- { struct route_entry r_entry; ! uint32_t *addr_val = NULL; route_t *rt; list_t *routers; + list_t *average_latencies, *list_ptr; + int lowest_latency = -1; + int *latency; /* FIXME: insert ICMP ping checks so we can find *************** *** 112,116 **** routers = value; ! addr_val = routers->data; r_entry.route_dst.addr_type = ADDR_TYPE_IP; --- 115,138 ---- routers = value; ! average_latencies = icmp_rtt_discovery(dc->rawnet, routers); ! ! /* Now pick best router and use it as default. */ ! for(list_ptr = average_latencies; ! list_ptr != NULL; ! list_ptr = list_ptr->next) { ! ! latency = list_ptr->data; ! if(lowest_latency < latency) { ! lowest_latency = *latency; ! addr_val = list_ptr->data; ! } ! } ! ! purge_list(average_latencies, NULL); ! ! if(addr_val == NULL) { ! error_message("sysconf_routers: could not add router as default route since none are responding!"); ! return -1; ! } r_entry.route_dst.addr_type = ADDR_TYPE_IP; *************** *** 123,129 **** rt = route_open(); ! if(rt == NULL) return -1; ! if(route_add(rt, &r_entry) < 0) { route_close(rt); --- 145,152 ---- rt = route_open(); ! if(rt == NULL) { return -1; ! } ! if(route_add(rt, &r_entry) < 0) { route_close(rt); |
From: Thamer Al-H. <act...@us...> - 2002-05-19 20:19:11
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv12594 Modified Files: dhcp-util.c Log Message: fixed small bug in random generator -- shouldn't coredump now :-) Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-util.c 19 May 2002 20:16:55 -0000 1.11 --- dhcp-util.c 19 May 2002 20:19:09 -0000 1.12 *************** *** 426,431 **** static void init_rand(void) { - static rand_t *ran_gen = NULL; - if(ran_gen == NULL) if((ran_gen = rand_open()) == NULL) --- 426,429 ---- |
From: Thamer Al-H. <act...@us...> - 2002-05-19 20:16:58
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv12223 Modified Files: TODO dhcp-agent.h dhcp-com.c dhcp-icmp-discovery.c dhcp-util.c Log Message: now using libdnet's random number generator Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TODO 18 May 2002 18:17:59 -0000 1.13 --- TODO 19 May 2002 20:16:55 -0000 1.14 *************** *** 48,61 **** clean up in areas where it seems prudent. or come up with guidelines we can stick to. - -- fixup error messages to use "name : name : name : error" - convention where name could be the name of the process, - module, or function. -- rawnet and the dhcp client control are foobared by a fake mac address. check, fix, clean. -- clean up dhcp-packet-build.c - -- need a proper rtt featured re/send/accept routine for raw packets. - -- in arp discovery we're using a list to pass two arguments. we - should use something else, or have list routines specific to - this. -- the rawnet routines should be a shared library due to too many dependencies. the sniffer for example, only needs the packet --- 48,54 ---- *************** *** 68,73 **** by using devices like /dev/urandom explicitly if available. -- fix overflow issue in dhcp-icmp-discovery (icmp_do_echo) - -- check if pcap prefixes its error messages if so remove pcap prefixes. - -- we need a proper error passing scheme for error strings so - that we wind up with a single string in the end. --- 61,63 ---- Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** dhcp-agent.h 19 May 2002 17:53:28 -0000 1.35 --- dhcp-agent.h 19 May 2002 20:16:55 -0000 1.36 *************** *** 591,595 **** extern int hex_string_to_value(char *string, unsigned char *dst); extern int is_string(const char *string, int len); ! extern int get_random(void); extern struct timeval timeval_diff(struct timeval begin, struct timeval end); --- 591,596 ---- extern int hex_string_to_value(char *string, unsigned char *dst); extern int is_string(const char *string, int len); ! extern uint16_t get_random_uint16(void); ! extern uint32_t get_random_uint32(void); extern struct timeval timeval_diff(struct timeval begin, struct timeval end); Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-com.c 8 Feb 2002 18:15:52 -0000 1.4 --- dhcp-com.c 19 May 2002 20:16:55 -0000 1.5 *************** *** 792,795 **** uint32_t dhcp_gen_xid(void) { ! return(get_random()); } --- 792,795 ---- uint32_t dhcp_gen_xid(void) { ! return(get_random_uint32()); } Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-icmp-discovery.c 19 May 2002 17:53:28 -0000 1.4 --- dhcp-icmp-discovery.c 19 May 2002 20:16:55 -0000 1.5 *************** *** 100,105 **** int latency; ! id = get_random(); ! seq = get_random(); build_icmp_echo_request(net, net->ip_addr, dest_addr, net->hw_addr, dest_mac, id, seq); --- 100,105 ---- int latency; ! id = get_random_uint32(); ! seq = get_random_uint32(); build_icmp_echo_request(net, net->ip_addr, dest_addr, net->hw_addr, dest_mac, id, seq); Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-util.c 18 May 2002 18:10:09 -0000 1.10 --- dhcp-util.c 19 May 2002 20:16:55 -0000 1.11 *************** *** 421,440 **** } /* initialize random seed. */ static void init_rand(void) { ! srandom(getpid() + time(NULL)); } ! int get_random(void) { ! static unsigned char have_init_random = 0; ! ! if(!have_init_random) { ! init_rand(); ! have_init_random = 1; ! } ! ! return(random()); } --- 421,448 ---- } + static rand_t *ran_gen = NULL; + /* initialize random seed. */ static void init_rand(void) { ! static rand_t *ran_gen = NULL; ! ! if(ran_gen == NULL) ! if((ran_gen = rand_open()) == NULL) ! fatal_error("unable to access random number generator"); ! ! return; } ! uint16_t get_random_uint16(void) { ! init_rand(); /* reinit if needed. */ ! return(rand_uint16(ran_gen)); ! } ! ! uint32_t get_random_uint32(void) ! { ! init_rand(); /* reinit if needed. */ ! return(rand_uint32(ran_gen)); } |
From: Thamer Al-H. <act...@us...> - 2002-05-19 18:47:26
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv24213 Added Files: dhcp-route.c Log Message: forgot to add the new route code --- NEW FILE: dhcp-route.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-route.c,v 1.1 2002/05/19 18:47:23 actmodern Exp $ * * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Routing manipulation: * * Here we can add/delete routes, and lookup routes. We return * mac addresses so packets can be sent out to the right MAC * address. * */ #include <dhcp-agent.h> int route_find(rawnet_t *net, ip_addr_t addr, eth_addr_t *dest_mac) { route_t *rt; struct route_entry entry; rt = route_open(); if(rt == NULL) { fatal_error("could not open routing table: %s", strerror(errno)); exit(1); } memset(&entry.route_dst, 0, sizeof(entry.route_dst)); memset(&entry.route_gw, 0, sizeof(entry.route_gw)); entry.route_dst.addr_type = ADDR_TYPE_IP; entry.route_dst.addr_bits = 0; entry.route_dst.addr_ip = addr; if(route_get(rt, &entry)) { /* not in routing table. do an arp for it then. */ return(arp_discover_hardware_address(net, 3, entry.route_dst.addr_ip, dest_mac)); } route_close(rt); /* arp for gateway address. */ return(arp_discover_hardware_address(net, 3, entry.route_gw.addr_ip, dest_mac)); } |