dhcp-agent-commits Mailing List for dhcp-agent (Page 28)
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
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv17725 Modified Files: Makefile.am Makefile.in dhcp-agent.h dhcp-align.c 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-client.h dhcp-com.c dhcp-convert.c dhcp-convert.h dhcp-daemon.c dhcp-eth.c dhcp-files.c dhcp-files.h dhcp-globconf.c dhcp-globconf.h dhcp-icmp-discovery.c dhcp-icmp.c dhcp-interface.c dhcp-ip.c dhcp-list.c dhcp-log.c dhcp-net.c dhcp-options-strings.c dhcp-packet-build.c dhcp-parser.c dhcp-parser.h dhcp-print.c dhcp-route.c dhcp-rtt.c dhcp-rtt.h dhcp-sniff.c dhcp-sniffer-ohandlers.c dhcp-stringbuffer.c dhcp-stringbuffer.h dhcp-sysconf.c dhcp-sysconf.h dhcp-udp.c dhcp-util.c dhcp-util.h dhcp-varfile.c dhcp-varfile.h Log Message: copyright/license date updated. Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile.am 17 Jun 2002 02:41:19 -0000 1.21 --- Makefile.am 17 Jun 2002 13:23:07 -0000 1.22 *************** *** 1,3 **** ! CFLAGS = -Wall -g AUTOMAKE_OPTIONS = gnu --- 1,3 ---- ! CFLAGS = -Wall -O2 -s AUTOMAKE_OPTIONS = gnu Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Makefile.in 17 Jun 2002 02:26:38 -0000 1.20 --- Makefile.in 17 Jun 2002 13:23:07 -0000 1.21 *************** *** 68,72 **** VERSION = @VERSION@ ! CFLAGS = -Wall -g AUTOMAKE_OPTIONS = foreign --- 68,72 ---- VERSION = @VERSION@ ! CFLAGS = -Wall -O2 -s AUTOMAKE_OPTIONS = foreign *************** *** 104,108 **** man_MANS = dhcpsniff.1 dhcpclient.1 ! EXTRA_DIST = $(man_MANS) COMMENTS TODO LICENSE COST CAVEATS ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs --- 104,108 ---- man_MANS = dhcpsniff.1 dhcpclient.1 ! EXTRA_DIST = $(man_MANS) TODO LICENSE CAVEATS UPGRADING ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** dhcp-agent.h 17 Jun 2002 02:26:39 -0000 1.58 --- dhcp-agent.h 17 Jun 2002 13:23:07 -0000 1.59 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-align.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-align.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-align.c 19 May 2002 16:24:37 -0000 1.5 --- dhcp-align.c 17 Jun 2002 13:23:07 -0000 1.6 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-arp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp-discovery.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-arp-discovery.c 6 Jun 2002 23:59:00 -0000 1.4 --- dhcp-arp-discovery.c 17 Jun 2002 13:23:07 -0000 1.5 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-arp.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-arp.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-arp.c 6 Jun 2002 23:59:00 -0000 1.9 --- dhcp-arp.c 17 Jun 2002 13:23:07 -0000 1.10 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-cache-entry.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-cache-entry.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-cache-entry.c 17 Jun 2002 02:26:39 -0000 1.7 --- dhcp-cache-entry.c 17 Jun 2002 13:23:07 -0000 1.8 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-client-cache.c 17 Jun 2002 02:26:39 -0000 1.11 --- dhcp-client-cache.c 17 Jun 2002 13:23:07 -0000 1.12 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-client-conf.c 17 Jun 2002 02:50:08 -0000 1.10 --- dhcp-client-conf.c 17 Jun 2002 13:23:07 -0000 1.11 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-client-control.c 8 Jun 2002 06:00:32 -0000 1.20 --- dhcp-client-control.c 17 Jun 2002 13:23:07 -0000 1.21 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dhcp-client-states.c 15 Jun 2002 18:23:28 -0000 1.26 --- dhcp-client-states.c 17 Jun 2002 13:23:07 -0000 1.27 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** dhcp-client.c 17 Jun 2002 02:26:39 -0000 1.29 --- dhcp-client.c 17 Jun 2002 13:23:07 -0000 1.30 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-client.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-client.h 15 Jun 2002 17:08:34 -0000 1.2 --- dhcp-client.h 17 Jun 2002 13:23:07 -0000 1.3 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-com.c 15 Jun 2002 18:23:28 -0000 1.8 --- dhcp-com.c 17 Jun 2002 13:23:07 -0000 1.9 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-convert.c 15 Jun 2002 17:07:08 -0000 1.14 --- dhcp-convert.c 17 Jun 2002 13:23:07 -0000 1.15 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-convert.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-convert.h 30 May 2002 06:44:05 -0000 1.1 --- dhcp-convert.h 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-daemon.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-daemon.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-daemon.c 6 Jun 2002 23:59:00 -0000 1.6 --- dhcp-daemon.c 17 Jun 2002 13:23:08 -0000 1.7 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-eth.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-eth.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-eth.c 6 Jun 2002 23:59:00 -0000 1.4 --- dhcp-eth.c 17 Jun 2002 13:23:08 -0000 1.5 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-files.c 17 Jun 2002 02:26:39 -0000 1.11 --- dhcp-files.c 17 Jun 2002 13:23:08 -0000 1.12 *************** *** 1,4 **** /* $Header$ ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,4 ---- /* $Header$ ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-files.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-files.h 17 Jun 2002 02:26:39 -0000 1.3 --- dhcp-files.h 17 Jun 2002 13:23:08 -0000 1.4 *************** *** 1,4 **** /* $Header$ ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,4 ---- /* $Header$ ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-globconf.c 17 Jun 2002 02:26:39 -0000 1.7 --- dhcp-globconf.c 17 Jun 2002 13:23:08 -0000 1.8 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-globconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-globconf.h 15 Jun 2002 18:23:28 -0000 1.3 --- dhcp-globconf.h 17 Jun 2002 13:23:08 -0000 1.4 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-icmp-discovery.c 17 Jun 2002 02:23:55 -0000 1.14 --- dhcp-icmp-discovery.c 17 Jun 2002 13:23:08 -0000 1.15 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-icmp.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-icmp.c 6 Jun 2002 23:59:00 -0000 1.7 --- dhcp-icmp.c 17 Jun 2002 13:23:08 -0000 1.8 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-interface.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-interface.c 11 Jun 2002 01:50:28 -0000 1.17 --- dhcp-interface.c 17 Jun 2002 13:23:08 -0000 1.18 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-ip.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-ip.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-ip.c 6 Jun 2002 23:59:00 -0000 1.5 --- dhcp-ip.c 17 Jun 2002 13:23:08 -0000 1.6 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-list.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-list.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-list.c 6 Jun 2002 23:59:00 -0000 1.3 --- dhcp-list.c 17 Jun 2002 13:23:08 -0000 1.4 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-log.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-log.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-log.c 6 Jun 2002 23:59:00 -0000 1.3 --- dhcp-log.c 17 Jun 2002 13:23:08 -0000 1.4 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-net.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-net.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dhcp-net.c 8 Jun 2002 06:00:32 -0000 1.26 --- dhcp-net.c 17 Jun 2002 13:23:08 -0000 1.27 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-options-strings.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-options-strings.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dhcp-options-strings.c 29 Jan 2002 18:05:05 -0000 1.1.1.1 --- dhcp-options-strings.c 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-packet-build.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-packet-build.c 6 Jun 2002 23:59:00 -0000 1.4 --- dhcp-packet-build.c 17 Jun 2002 13:23:08 -0000 1.5 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-parser.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-parser.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-parser.c 17 Jun 2002 02:25:09 -0000 1.1 --- dhcp-parser.c 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-parser.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-parser.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-parser.h 17 Jun 2002 02:25:09 -0000 1.1 --- dhcp-parser.h 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-print.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-print.c 11 Jun 2002 03:06:39 -0000 1.6 --- dhcp-print.c 17 Jun 2002 13:23:08 -0000 1.7 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-route.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-route.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-route.c 6 Jun 2002 23:59:00 -0000 1.3 --- dhcp-route.c 17 Jun 2002 13:23:08 -0000 1.4 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-rtt.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-rtt.c 6 Jun 2002 23:59:00 -0000 1.6 --- dhcp-rtt.c 17 Jun 2002 13:23:08 -0000 1.7 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-rtt.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-rtt.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-rtt.h 30 May 2002 06:44:06 -0000 1.1 --- dhcp-rtt.h 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-sniff.c 6 Jun 2002 23:59:00 -0000 1.8 --- dhcp-sniff.c 17 Jun 2002 13:23:08 -0000 1.9 *************** *** 3,7 **** * dhcp-tool Sniffing routines. * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 3,7 ---- * dhcp-tool Sniffing routines. * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-sniffer-ohandlers.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniffer-ohandlers.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dhcp-sniffer-ohandlers.c 29 Jan 2002 18:05:06 -0000 1.1.1.1 --- dhcp-sniffer-ohandlers.c 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-stringbuffer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-stringbuffer.c 17 Jun 2002 02:24:19 -0000 1.3 --- dhcp-stringbuffer.c 17 Jun 2002 13:23:08 -0000 1.4 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-stringbuffer.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-stringbuffer.h 17 Jun 2002 02:24:19 -0000 1.3 --- dhcp-stringbuffer.h 17 Jun 2002 13:23:08 -0000 1.4 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-sysconf.c 17 Jun 2002 02:23:55 -0000 1.18 --- dhcp-sysconf.c 17 Jun 2002 13:23:08 -0000 1.19 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-sysconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-sysconf.h 30 May 2002 06:44:06 -0000 1.1 --- dhcp-sysconf.h 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-udp.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-udp.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dhcp-udp.c 6 Jun 2002 23:59:00 -0000 1.3 --- dhcp-udp.c 17 Jun 2002 13:23:08 -0000 1.4 *************** *** 1,4 **** /* $Header$ ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,4 ---- /* $Header$ ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-util.c 6 Jun 2002 23:59:00 -0000 1.15 --- dhcp-util.c 17 Jun 2002 13:23:08 -0000 1.16 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-util.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-util.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-util.h 7 Jun 2002 12:51:13 -0000 1.2 --- dhcp-util.h 17 Jun 2002 13:23:08 -0000 1.3 *************** *** 1,5 **** /* $Header$ * ! * Copyright 2001 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* $Header$ * ! * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without Index: dhcp-varfile.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-varfile.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-varfile.c 17 Jun 2002 02:25:09 -0000 1.1 --- dhcp-varfile.c 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,4 **** /* $Header$ ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,4 ---- /* $Header$ ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without Index: dhcp-varfile.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-varfile.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-varfile.h 17 Jun 2002 02:25:09 -0000 1.1 --- dhcp-varfile.h 17 Jun 2002 13:23:08 -0000 1.2 *************** *** 1,4 **** /* $Header$ ! * Copyright 2001 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without --- 1,4 ---- /* $Header$ ! * Copyright 2002 Thamer Alharbash <tm...@wh...> * * Redistribution and use in source and binary forms, with or without |
From: <act...@us...> - 2002-06-17 02:50:15
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv17948 Modified Files: dhcp-client-conf.c Log Message: fix so that the dumping of options outputs properly Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-client-conf.c 17 Jun 2002 02:26:39 -0000 1.9 --- dhcp-client-conf.c 17 Jun 2002 02:50:08 -0000 1.10 *************** *** 83,88 **** for(i = 0;i < default_config_options_len; i++) { ! if((fputs(dhcp_options_strings[default_config_options[i]], fp) == EOF)|| ! (fputs("\n", fp) == EOF)) { warn_message("could not dump options to file. I'm going to continue anyway."); fclose(fp); --- 83,87 ---- for(i = 0;i < default_config_options_len; i++) { ! if(fprintf(fp, "\"%s\"\n",dhcp_options_strings[default_config_options[i]]) < 0) { warn_message("could not dump options to file. I'm going to continue anyway."); fclose(fp); |
From: <act...@us...> - 2002-06-17 02:41:21
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv13104 Modified Files: Makefile.am TODO Added Files: UPGRADING Removed Files: COMMENTS COST Log Message: added UPGRADING file; delete COMMENTS and COST :-) --- NEW FILE: UPGRADING --- Notes on upgrading ------------------ From dhcp-0.36 -------------- dhcpclient: The new parser requires strings with spaces to be wrapped in quotes. You can either hand edit the files in /etc/dhcpclient (or where the work directory is defined), and add these quotes or delete the files so they are regenerated. This affects the cache too. -- Thamer Alharbash <tm...@wh...> Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Makefile.am 17 Jun 2002 02:26:38 -0000 1.20 --- Makefile.am 17 Jun 2002 02:41:19 -0000 1.21 *************** *** 45,48 **** AUTOMAKE_OPTIONS = foreign ! EXTRA_DIST = $(man_MANS) COMMENTS TODO LICENSE COST CAVEATS --- 45,48 ---- AUTOMAKE_OPTIONS = foreign ! EXTRA_DIST = $(man_MANS) TODO LICENSE CAVEATS UPGRADING Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** TODO 15 Jun 2002 18:23:28 -0000 1.27 --- TODO 17 Jun 2002 02:41:19 -0000 1.28 *************** *** 77,82 **** -- be nice to servers. sort the list according to option tag value. the highest value first seems about right. - -- rawnet and the dhcp client control are foobared by a fake mac - address. check, fix, clean. -- clean up dhcp-packet-build.c -- the rawnet routines should be a shared library due to too many --- 77,80 ---- *************** *** 97,100 **** the applicable dhcp-convert and then build the option wirh create_dhcp_option(data, len, tag) - --- 95,97 ---- --- COMMENTS DELETED --- --- COST DELETED --- |
From: <act...@us...> - 2002-06-17 02:26:44
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv5321 Modified Files: Makefile.am Makefile.in dhcp-agent.h dhcp-cache-entry.c dhcp-client-cache.c dhcp-client-conf.c dhcp-client.c dhcp-files.c dhcp-files.h dhcp-globconf.c dhcpclient.1 Log Message: integrated new parser into main code Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Makefile.am 15 Jun 2002 14:59:20 -0000 1.19 --- Makefile.am 17 Jun 2002 02:26:38 -0000 1.20 *************** *** 5,9 **** DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient #dhcptest dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ --- 5,9 ---- DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ *************** *** 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 dhcp-stringbuffer.c #dhcptest_SOURCES = dhcp-test.c dhcp-util.c \ --- 21,26 ---- 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 dhcp-stringbuffer.c \ ! dhcp-parser.c dhcp-varfile.c #dhcptest_SOURCES = dhcp-test.c dhcp-util.c \ *************** *** 30,34 **** #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 dhcp-stringbuffer.c #dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 31,36 ---- #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 dhcp-stringbuffer.c \ ! #dhcp-parser.c dhcp-varfile.c #dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Makefile.in 15 Jun 2002 14:59:20 -0000 1.19 --- Makefile.in 17 Jun 2002 02:26:38 -0000 1.20 *************** *** 75,79 **** DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient #dhcptest dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.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_SNPRINTF@ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c --- 75,79 ---- DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.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_SNPRINTF@ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c *************** *** 82,86 **** 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 dhcp-stringbuffer.c --- 82,86 ---- 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 dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c *************** *** 92,96 **** #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 dhcp-stringbuffer.c #dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ --- 92,97 ---- #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 dhcp-stringbuffer.c \ ! #dhcp-parser.c dhcp-varfile.c #dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ *************** *** 126,130 **** 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 dhcp-stringbuffer.o dhcpclient_DEPENDENCIES = dhcpclient_LDFLAGS = --- 127,132 ---- 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 dhcp-stringbuffer.o dhcp-parser.o \ ! dhcp-varfile.o dhcpclient_DEPENDENCIES = dhcpclient_LDFLAGS = *************** *** 156,163 **** .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-stringbuffer.P .deps/dhcp-sysconf.P .deps/dhcp-udp.P \ ! .deps/dhcp-util.P SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) --- 158,165 ---- .deps/dhcp-list.P .deps/dhcp-log.P .deps/dhcp-net.P \ .deps/dhcp-options-strings.P .deps/dhcp-packet-build.P \ ! .deps/dhcp-parser.P .deps/dhcp-print.P .deps/dhcp-route.P \ ! .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P .deps/dhcp-udp.P \ ! .deps/dhcp-util.P .deps/dhcp-varfile.P SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** dhcp-agent.h 15 Jun 2002 18:23:28 -0000 1.57 --- dhcp-agent.h 17 Jun 2002 02:26:39 -0000 1.58 *************** *** 488,492 **** /* 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); --- 488,492 ---- /* cache object manipulation. */ ! extern cache_entry_t *make_cache_entry(const char *name, const char *value); extern void destroy_cache_entry(cache_entry_t *cache); extern void cache_entry_purge_list(list_t *cache_list); Index: dhcp-cache-entry.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-cache-entry.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-cache-entry.c 6 Jun 2002 23:59:00 -0000 1.6 --- dhcp-cache-entry.c 17 Jun 2002 02:26:39 -0000 1.7 *************** *** 31,35 **** /* constructors. */ ! cache_entry_t *make_cache_entry(char *name, char *value) { cache_entry_t *cache; --- 31,35 ---- /* constructors. */ ! cache_entry_t *make_cache_entry(const char *name, const char *value) { cache_entry_t *cache; Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-client-cache.c 11 Jun 2002 03:06:39 -0000 1.10 --- dhcp-client-cache.c 17 Jun 2002 02:26:39 -0000 1.11 *************** *** 27,30 **** --- 27,33 ---- #include <dhcp-util.h> #include <dhcp-files.h> + #include <dhcp-stringbuffer.h> + #include <dhcp-parser.h> + #include <dhcp-varfile.h> #include <dhcp-convert.h> *************** *** 76,93 **** { 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 ! * guaranteed proper strings with file_get_var_name(), ! * file_get_var_val() */ ! cache_entry = make_cache_entry(varfile_get_name(varfile), varfile_get_val(varfile)); ! return cache_entry; } --- 79,104 ---- { cache_entry_t *cache_entry; ! int retval; ! retval = varfile_get_next_var(varfile); ! switch(retval) { ! case VARFILE_PARSE_ERROR: ! fatal_error("client-cache: parse error in cache: %s : line %d", ! varfile_get_filename(varfile), varfile_get_lineno(varfile)); ! case VARFILE_EOF: ! return NULL; + case VARFILE_SUCCESS: + cache_entry = make_cache_entry(varfile_get_name(varfile), varfile_get_val(varfile)); + return cache_entry; + + default: + fatal_error("client-cache: read_next_cache_var: internal error -- please report this."); + } + + /* we never get here. */ + return NULL; } *************** *** 98,102 **** cache_entry_t *cache_entry; ! varfile = varfile_open(filename); if(varfile == NULL) return -1; --- 109,113 ---- cache_entry_t *cache_entry; ! varfile = create_varfile(filename, VARFILE_VARVAL_MODE); if(varfile == NULL) return -1; *************** *** 270,274 **** } ! fprintf(fp, "%s=%s\n", name, val); xfree(val); } --- 281,285 ---- } ! fprintf(fp, "\"%s\"=%s\n", name, val); xfree(val); } Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-conf.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-client-conf.c 6 Jun 2002 23:59:00 -0000 1.8 --- dhcp-client-conf.c 17 Jun 2002 02:26:39 -0000 1.9 *************** *** 26,29 **** --- 26,32 ---- #include <dhcp-util.h> #include <dhcp-files.h> + #include <dhcp-stringbuffer.h> + #include <dhcp-parser.h> + #include <dhcp-varfile.h> /* Basic network configuration. *************** *** 108,146 **** 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++) { ! /* as long as no error was returned from file_parse_string ! * we can just do a file_get_var_name() safely. */ ! 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; } --- 111,160 ---- int i; unsigned char match; + int retval; ! varfile = create_varfile(fname, VARFILE_VARNAMES_MODE); if(varfile == NULL) return -1; ! while(1) { ! retval = varfile_get_next_var(varfile); ! switch(retval) { ! case VARFILE_SUCCESS: ! match = 0; ! for(i = 0;i < MAX_OPTIONS_HANDLED;i++) { ! /* as long as no error was returned from file_parse_string ! * we can just do a file_get_var_name() safely. */ ! ! 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)); + break; + + case VARFILE_EOF: + destroy_varfile(varfile); + return 0; + + case VARFILE_PARSE_ERROR: + fatal_error("client-conf: parse error in opts file: %s : %d", + varfile_get_filename(varfile), varfile_get_lineno(varfile)); + default: + fatal_error("client-conf: load_options: internal error -- please report this."); + } } } Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** dhcp-client.c 15 Jun 2002 18:23:28 -0000 1.28 --- dhcp-client.c 17 Jun 2002 02:26:39 -0000 1.29 *************** *** 410,420 **** fflush(stdout); fflush(stderr); ! /* Go in background now before main loop. */ if(want_background) { /* are we interactive? if so stay in foreground. * ... otherwise ... */ ! destroy_dhcp_client_control(dc); ! interactive = 0; go_background(work_dir); --- 410,420 ---- fflush(stdout); fflush(stderr); ! /* Go in background now before main loop. */ if(want_background) { /* are we interactive? if so stay in foreground. * ... otherwise ... */ ! destroy_dhcp_client_control(dc); ! interactive = 0; go_background(work_dir); Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-files.c 6 Jun 2002 23:59:00 -0000 1.10 --- dhcp-files.c 17 Jun 2002 02:26:39 -0000 1.11 *************** *** 28,46 **** #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; - } - static FILE *file_open_proc(const char *filename, char *cmode, int flags, mode_t mode) { --- 28,31 ---- *************** *** 66,69 **** --- 51,55 ---- /* Assumes we're opening a directory only writable by us . */ + /* create file or open it if it exists. */ FILE *file_open_or_create_safe(const char *filename, char *mode) { *************** *** 71,74 **** --- 57,61 ---- } + /* create file or open if it exists, and always truncate. */ FILE *file_create_and_truncate_safe(const char *filename, char *mode) { *************** *** 76,216 **** } ! 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; ! ! *s = '\0'; ! s++; ! 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; ! ! break; ! ! 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; ! ! default: ! break; ! } ! ! return 0; ! } ! ! /* Get the next string from the file. ! * In order to do this for variable length strings which may be ! * very long or very short we do a walk ahead till we find the ! * newline character and then read everything up to it. ! * We need to do this to support options which are larger ! * than 255 octets which we may receive. ! * ! * Should we worry about size limits? No. An IP packet cannot be ! * bigger than 65535 bytes, and we're most likely receiving a ! * little under 600 bytes from the UDP packet. We can handle both ! * such sizes reasonably well. ! * ! */ ! ! 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; ! break; ! } ! } ! ! if(!have_line) ! return 1; ! ! end_line_seek = ftell(varfile->fp); ! ! /* Our buffer needs to be as big as the line plus ! * one for the null termination. */ ! ! 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; ! ! } ! void delete_file(char *fname) { --- 63,67 ---- } ! /* delete a file. */ void delete_file(char *fname) { *************** *** 218,221 **** --- 69,73 ---- } + /* move a file. */ void move_file(char *fname, char *dest) { *************** *** 230,237 **** --- 82,92 ---- } + /* check if a file exists. -- achtung: watch out for race + * conditions */ int file_exists(char *fname) { FILE *fp; + /* use stdio. fixme: should we stat()?*/ fp = fopen(fname, "r"); if(fp != NULL) { *************** *** 242,245 **** --- 97,101 ---- } + /* change mode on a file so its publicaly readable. */ void make_file_public_read(char *fname) { *************** *** 247,250 **** --- 103,107 ---- } + /* grab our pid file. <name>.pid */ static char *get_pid_file_name(char *name) { *************** *** 252,255 **** --- 109,113 ---- } + /* create a pid file <name>.pid */ void create_pid_file(char *name) { *************** *** 269,272 **** --- 127,131 ---- } + /* delete a pid file <name>.pid */ void delete_pid_file(char *name) { Index: dhcp-files.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-files.h 30 May 2002 06:44:05 -0000 1.2 --- dhcp-files.h 17 Jun 2002 02:26:39 -0000 1.3 *************** *** 27,53 **** #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); --- 27,32 ---- Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-globconf.c 15 Jun 2002 18:23:28 -0000 1.6 --- dhcp-globconf.c 17 Jun 2002 02:26:39 -0000 1.7 *************** *** 33,36 **** --- 33,39 ---- #include <dhcp-files.h> #include <dhcp-convert.h> + #include <dhcp-stringbuffer.h> + #include <dhcp-parser.h> + #include <dhcp-varfile.h> /* change this before... */ *************** *** 100,103 **** --- 103,107 ---- int i; unsigned char match; + int retval; /* we're ok. all config options are in directories only *************** *** 110,160 **** } ! 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; ! /* skip options which have been set, since some of these may be set ! on the command line. */ ! if(global_config_options[i].val != NULL) ! break; ! 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; ! } ! } ! 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. ! * a user could always truncate the file we dumped. */ ! glob_conf_set_defaults(); - return 0; } --- 114,174 ---- } ! varfile = create_varfile(filename, VARFILE_VARVAL_MODE); if(varfile == NULL) fatal_error("glob-conf: could not open configuration file: %s: %s", filename, strerror(errno)); ! while(1) { ! retval = varfile_get_next_var(varfile); ! switch(retval) { ! case VARFILE_SUCCESS: ! 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; ! /* skip options which have been set, since some of these may be set ! on the command line. */ ! if(global_config_options[i].val != NULL) ! break; ! 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; ! } ! } ! ! 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)); ! break; ! ! case VARFILE_PARSE_ERROR: ! fatal_error("glob-conf: parse error in %s: line %d", ! varfile_get_filename(varfile), varfile_get_lineno(varfile)); ! case VARFILE_EOF: ! destroy_varfile(varfile); ! /* one more pass to convert defaults if needed. ! * a user could always truncate the file we dumped. */ ! glob_conf_set_defaults(); ! return 0; ! default: ! fatal_error("glob-conf: internal error -- please report this bug."); ! } ! } } Index: dhcpclient.1 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcpclient.1,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcpclient.1 16 Jun 2002 19:55:47 -0000 1.11 --- dhcpclient.1 17 Jun 2002 02:26:39 -0000 1.12 *************** *** 108,112 **** .Xr pcap 3 .Sh AUTHORS ! .An Thamer Al-Harbash .Aq tm...@wh... .An Brian J. Kifiak --- 108,112 ---- .Xr pcap 3 .Sh AUTHORS ! .An Thamer Al-Harbash .Aq tm...@wh... .An Brian J. Kifiak |
From: <act...@us...> - 2002-06-17 02:25:12
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv4639 Added Files: dhcp-parser.c dhcp-parser.h dhcp-varfile.c dhcp-varfile.h Log Message: new parser --- NEW FILE: dhcp-parser.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-parser.c,v 1.1 2002/06/17 02:25:09 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. * * Parser driver. Here we can build custom parsers by plugging in * the applicable functions for each single character token. A * default parser with a 0 for a character is used as a fallback * (and to mark the end of the parser driver) * * This parser will b0rk on something that's not printable and not even * call the parse function. * * We build from the parser utility routines or we can pass our * own. * */ #include <dhcp-agent.h> #include <dhcp-util.h> #include <dhcp-stringbuffer.h> #include <dhcp-files.h> #include <dhcp-parser.h> static int is_valid_string_char(int c) { if(ispunct(c) || isalnum(c)) return 1; else return 0; } static token_t check_eof(parser_t *input) { if(feof(input->fp)) return PARSER_TOKEN_EOF; else return PARSER_TOKEN_ERROR; } /* just gobble up till the end of the newline */ static token_t parse_gobble_line(parser_t *input) { int c; while(1) { c = fgetc(input->fp); switch(c) { case EOF: return check_eof(input); case '\n': input->line_no++; return PARSER_TOKEN_NEWLINE; default: break; } } } static token_t parse_get_quoted_string(parser_t *input) { int c; while(1) { c = fgetc(input->fp); switch(c) { case EOF: return check_eof(input); case '\"': return PARSER_TOKEN_QUOTED_STRING; case '\n': return PARSER_TOKEN_ERROR; /* error to have newline in string constant. */ case ' ': case '\t': default: if(is_valid_string_char(c) || c == ' ' || c == '\t') stringbuffer_append_c(input->data_buff, (char)c); else { ungetc(c, input->fp); return PARSER_TOKEN_ERROR; } } } } static token_t parse_get_string(parser_t *input) { int c; while(1) { c = fgetc(input->fp); switch(c) { case EOF: return check_eof(input); case '\n': ungetc(c, input->fp); return PARSER_TOKEN_STRING; /* newline terminates string. */ case '\t': case ' ': ungetc(c, input->fp); return PARSER_TOKEN_STRING; /* newline terminates string. */ case '=': ungetc(c, input->fp); return PARSER_TOKEN_STRING; /* newline terminates string. */ default: if(is_valid_string_char(c)) stringbuffer_append_c(input->data_buff, (char)c); else { ungetc(c, input->fp); return PARSER_TOKEN_ERROR; /* anything else and we've been terminated. */ } } } } atom_t get_next_atom(parser_t *input) { int c; token_t token; stringbuffer_clear(input->data_buff); while(1) { c = fgetc(input->fp); switch(c) { case EOF: return PARSER_ATOM_EOF; case '#': token = parse_gobble_line(input); if(token == PARSER_TOKEN_NEWLINE || token == PARSER_TOKEN_EOF) return PARSER_ATOM_END_OF_STATEMENT; /* anything else is an error. */ return PARSER_ATOM_ERROR; case '\n': input->line_no++; return PARSER_ATOM_END_OF_STATEMENT; case '=': return PARSER_ATOM_ASSIGNMENT; case '\t': case ' ': break; case '\"': token = parse_get_quoted_string(input); if(token == PARSER_TOKEN_ERROR) return PARSER_ATOM_ERROR; return PARSER_ATOM_STRING; default: /* if we have an alphanumeric it's a string. read it in. */ if(is_valid_string_char(c)) { ungetc(c, input->fp); token = parse_get_string(input); if(token == PARSER_TOKEN_ERROR) return PARSER_ATOM_ERROR; return PARSER_ATOM_STRING; } return PARSER_ATOM_ERROR; } } } parser_t *create_parser(const char *filename) { FILE *fp; parser_t *parser; fp = file_open_or_create_safe(filename, "r"); if(fp == NULL) return NULL; parser = xmalloc(sizeof(parser_t)); parser->fp = fp; parser->line_no = 1; parser->data_buff = create_stringbuffer(); return parser; } void destroy_parser(parser_t *parser) { fclose(parser->fp); destroy_stringbuffer(parser->data_buff); xfree(parser); return; } int parser_get_line_no(parser_t *parser) { return parser->line_no; } const char *parser_get_data(parser_t *parser) { return stringbuffer_getstring(parser->data_buff); } --- NEW FILE: dhcp-parser.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-parser.h,v 1.1 2002/06/17 02:25:09 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. * * Parser for varfiles. * */ #ifndef DHCP_PARSER_H #define DHCP_PARSER_H #define PARSER_TOKEN_ERROR 0 #define PARSER_TOKEN_NEWLINE 1 #define PARSER_TOKEN_EOF 2 #define PARSER_TOKEN_QUOTED_STRING 3 #define PARSER_TOKEN_STRING 4 #define PARSER_TOKEN_ASSIGNMENT 5 #define PARSER_ATOM_ERROR 0 #define PARSER_ATOM_STRING 1 #define PARSER_ATOM_ASSIGNMENT 2 #define PARSER_ATOM_END_OF_STATEMENT 3 #define PARSER_ATOM_EOF 4 typedef uint8_t token_t; typedef uint8_t atom_t; typedef struct { FILE *fp; int line_no; stringbuffer *data_buff; } parser_t; extern void destroy_parser(parser_t *parser); extern parser_t *create_parser(const char *filename); extern atom_t get_next_atom(parser_t *input); extern const char *parser_get_data(parser_t *input); extern int parser_get_line_no(parser_t *parser); #endif /* DHCP_PARSER_H */ --- NEW FILE: dhcp-varfile.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-varfile.c,v 1.1 2002/06/17 02:25:09 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. * * varfiles -- variable files. All the files which we read are varfiles. * */ #include <dhcp-agent.h> #include <dhcp-util.h> #include <dhcp-stringbuffer.h> #include <dhcp-files.h> #include <dhcp-parser.h> #include <dhcp-varfile.h> const char *varfile_get_name(varfile_t *varfile) { return stringbuffer_getstring(varfile->var_name); } const char *varfile_get_val(varfile_t *varfile) { return stringbuffer_getstring(varfile->var_val); } int varfile_get_lineno(varfile_t *varfile) { return parser_get_line_no(varfile->parser); } varfile_t *create_varfile(const char *filename, uint8_t mode) { varfile_t *varfile; varfile = xmalloc(sizeof(varfile_t)); varfile->filename = strdup(filename); varfile->var_name = create_stringbuffer(); varfile->var_val = create_stringbuffer(); varfile->parser = create_parser(filename); varfile->mode = mode; return varfile; } void destroy_varfile(varfile_t *varfile) { destroy_parser(varfile->parser); destroy_stringbuffer(varfile->var_name); destroy_stringbuffer(varfile->var_val); xfree(varfile->filename); xfree(varfile); return; } const char *varfile_get_filename(varfile_t *varfile) { return varfile->filename; } int varfile_get_next_varnames(varfile_t *varfile) { atom_t atom; while(1) { atom = get_next_atom(varfile->parser); if(atom == PARSER_ATOM_END_OF_STATEMENT) /* skip empty lines/comments. */ continue; if(atom == PARSER_ATOM_EOF) return VARFILE_EOF; if(atom != PARSER_ATOM_STRING) return VARFILE_PARSE_ERROR; /* copy string out into varname */ stringbuffer_set(varfile->var_name, parser_get_data(varfile->parser)); atom = get_next_atom(varfile->parser); /* if we don't get an end of statement or eof here it's a parse error. */ if(atom != PARSER_ATOM_END_OF_STATEMENT && atom != PARSER_ATOM_EOF) return VARFILE_PARSE_ERROR; return VARFILE_SUCCESS; } } int varfile_get_next_varval(varfile_t *varfile) { atom_t atom; /* get the name first. */ while(1) { atom = get_next_atom(varfile->parser); if(atom == PARSER_ATOM_END_OF_STATEMENT) /* skip empty lines/comments. */ continue; if(atom == PARSER_ATOM_EOF) return VARFILE_EOF; if(atom != PARSER_ATOM_STRING) return VARFILE_PARSE_ERROR; /* copy string out into varname */ stringbuffer_set(varfile->var_name, parser_get_data(varfile->parser)); break; } /* the rest should be ASSIGNMENT STRING END_OF_STATEMENT; */ atom = get_next_atom(varfile->parser); if(atom != PARSER_ATOM_ASSIGNMENT) return VARFILE_PARSE_ERROR; atom = get_next_atom(varfile->parser); if(atom != PARSER_ATOM_STRING) return VARFILE_PARSE_ERROR; /* copy string out into var val */ stringbuffer_set(varfile->var_val, parser_get_data(varfile->parser)); /* now we need a clean end of statement. */ atom = get_next_atom(varfile->parser); if(atom != PARSER_ATOM_END_OF_STATEMENT && atom != PARSER_ATOM_EOF) return VARFILE_PARSE_ERROR; return VARFILE_SUCCESS; } /* Get the next var statement from file. */ int varfile_get_next_var(varfile_t *varfile) { switch(varfile->mode) { case VARFILE_VARNAMES_MODE: return(varfile_get_next_varnames(varfile)); case VARFILE_VARVAL_MODE: return(varfile_get_next_varval(varfile)); default: fatal_error("varfile: file_get_next_var: encountered a fatal bug -- please report this."); } /* should never get here. */ return 0; } --- NEW FILE: dhcp-varfile.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-varfile.h,v 1.1 2002/06/17 02:25:09 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. * * Parser for varfiles. * */ #ifndef DHCP_VARFILE_H #define DHCP_VARFILE_H typedef struct { char *filename; parser_t *parser; stringbuffer *var_name; stringbuffer *var_val; uint8_t mode; } varfile_t; /* open/close a varfile. */ extern varfile_t *create_varfile(const char *filename, uint8_t mode); extern void destroy_varfile(varfile_t *varfile); /* get variables and variable names. */ extern const char *varfile_get_name(varfile_t *varfile); extern const char *varfile_get_val(varfile_t *varfile); extern int varfile_get_lineno(varfile_t *varfile); extern const char *varfile_get_filename(varfile_t *varfile); /* get the next var */ int varfile_get_next_var(varfile_t *varfile); /* modes for varfiles. */ #define VARFILE_VARNAMES_MODE 0 /* just names. */ #define VARFILE_VARVAL_MODE 1 /* names and values. */ /* return values for get_next_var */ #define VARFILE_PARSE_ERROR -1 /* parse error. */ #define VARFILE_EOF 0 /* end of file. */ #define VARFILE_SUCCESS 1 /* success */ #endif /* DHCP_VARFILE_H */ |
From: <act...@us...> - 2002-06-17 02:24:21
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv4164 Modified Files: dhcp-stringbuffer.h dhcp-stringbuffer.c Log Message: more stringbufferage including bug fixes Index: dhcp-stringbuffer.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-stringbuffer.h 15 Jun 2002 14:59:20 -0000 1.2 --- dhcp-stringbuffer.h 17 Jun 2002 02:24:19 -0000 1.3 *************** *** 43,46 **** --- 43,49 ---- extern void stringbuffer_aprintf_align(stringbuffer *sb, int begin, int end, char *fmt, ...); extern void stringbuffer_avprintf(stringbuffer *sb, char *fmt, va_list ap); + extern void stringbuffer_append_c(stringbuffer *sb, char c); + extern void stringbuffer_clear(stringbuffer *sb); + extern void stringbuffer_set(stringbuffer *dest, const char *s); #endif /* DHCP_STRINGBUFFER_H */ Index: dhcp-stringbuffer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-stringbuffer.c 15 Jun 2002 14:59:20 -0000 1.2 --- dhcp-stringbuffer.c 17 Jun 2002 02:24:19 -0000 1.3 *************** *** 123,126 **** --- 123,146 ---- } + void stringbuffer_clear(stringbuffer *sb) + { + sb->len = 0; + sb->buf[sb->len] = 0; + } + + /* append character to stringbuffer */ + void stringbuffer_append_c(stringbuffer *sb, char c) + { + if(sb->capacity <= (1 + sb->capacity)) { + sb->buf = extend_string(sb->buf, sb->len, 1); + sb->len++; + sb->capacity = sb->len; + } else + sb->len++; + + sb->buf[sb->len - 1] = c; + sb->buf[sb->len] = 0; + } + /* append string to stringbuffer */ void stringbuffer_append(stringbuffer *sb, const char *s) *************** *** 128,136 **** int len = strlen(s); ! if(sb->capacity <= (len + sb->capacity)) { sb->buf = extend_string(sb->buf, sb->len, len); sb->len += len; sb->capacity = sb->len; ! } strcat(sb->buf, s); --- 148,157 ---- int len = strlen(s); ! if(sb->capacity <= (len + sb->len)) { sb->buf = extend_string(sb->buf, sb->len, len); sb->len += len; sb->capacity = sb->len; ! } else ! sb->len += len; strcat(sb->buf, s); *************** *** 229,239 **** } ! void stringbuffer_copy(stringbuffer *dest, stringbuffer *src) { ! destroy_stringbuffer(dest); /* zap */ ! dest = create_stringbuffer(); /* make new */ ! /* append -- simplicity is grand! :-) */ ! stringbuffer_append(dest, stringbuffer_getstring(src)); } --- 250,262 ---- } ! void stringbuffer_set(stringbuffer *dest, const char *s) { ! stringbuffer_clear(dest); /* zap */ ! stringbuffer_append(dest, s); ! } ! void stringbuffer_copy(stringbuffer *dest, stringbuffer *src) ! { ! stringbuffer_set(dest, stringbuffer_getstring(src)); } |
From: <act...@us...> - 2002-06-17 02:23:58
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv3898 Modified Files: dhcp-sysconf.c dhcp-icmp-discovery.c Log Message: fixed changes to dhcp-sysconf/dhcp-icmp-discovery; host addresses were being freed() twice because one copy was used; order in which address were gotten was wrong; bunch of other small things Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-sysconf.c 16 Jun 2002 00:57:32 -0000 1.17 --- dhcp-sysconf.c 17 Jun 2002 02:23:55 -0000 1.18 *************** *** 119,132 **** * we still want to use one of them. * (See RFC 1812, section 4.3.3.6.) */ ! addr_val = average_latencies->next->data; ! latency = list_ptr->data; ! lowest_latency = *latency; /* 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(*latency != -1 && *latency < lowest_latency) { lowest_latency = *latency; --- 119,131 ---- * we still want to use one of them. * (See RFC 1812, section 4.3.3.6.) */ ! addr_val = average_latencies->data; ! lowest_latency = *(int *)average_latencies->next->data; /* Now pick best router and use it as default. */ for(list_ptr = average_latencies; list_ptr != NULL; ! list_ptr = list_ptr->next->next) { ! latency = list_ptr->next->data; if(*latency != -1 && *latency < lowest_latency) { lowest_latency = *latency; *************** *** 135,140 **** } - purge_list(average_latencies, NULL); - r_entry.route_dst.addr_type = ADDR_TYPE_IP; r_entry.route_dst.addr_bits = 0; --- 134,137 ---- *************** *** 144,147 **** --- 141,146 ---- r_entry.route_gw.addr_bits = 0; memcpy(&r_entry.route_gw.addr_ip, addr_val, IP_ADDR_LEN); + + purge_list(average_latencies, NULL); rt = route_open(); Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-icmp-discovery.c 16 Jun 2002 00:57:32 -0000 1.13 --- dhcp-icmp-discovery.c 17 Jun 2002 02:23:55 -0000 1.14 *************** *** 137,141 **** int *latency, *average_latency; int send_count, unreachable_count, highest_latency; ! ip_addr_t *host_addr; eth_addr_t dest_mac; --- 137,141 ---- int *latency, *average_latency; int send_count, unreachable_count, highest_latency; ! ip_addr_t *host_addr, *host_addr_copy; eth_addr_t dest_mac; *************** *** 225,229 **** xfree(latency); /* free our latency array. */ rtts = add_to_list(rtts, average_latency); ! rtts = add_to_list(rtts, host_addr); } --- 225,236 ---- xfree(latency); /* free our latency array. */ rtts = add_to_list(rtts, average_latency); ! ! /* we need to copy the host address so ! when this list is purged it doesn't affect ! the list we were passed. */ ! host_addr_copy = xmalloc(sizeof(ip_addr_t)); ! memcpy(host_addr_copy, host_addr, sizeof(ip_addr_t)); ! ! rtts = add_to_list(rtts, host_addr_copy); } |
From: <bk...@us...> - 2002-06-16 19:55:52
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv30874 Modified Files: dhcpclient.1 dhcpsniff.1 Log Message: Make dhcpsniff.1 consistant with dhcpclient.1, and some other minor touchups. Index: dhcpclient.1 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcpclient.1,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcpclient.1 15 Jun 2002 18:23:28 -0000 1.10 --- dhcpclient.1 16 Jun 2002 19:55:47 -0000 1.11 *************** *** 16,21 **** .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 --- 16,20 ---- .Nm is a DHCP client daemon. ! It currently only configures basic networking: the interface's IP address; the routing table; and the domain name system using the DHCP-provided settings. .Pp *************** *** 32,36 **** A single .Nm ! deals with a single interface. .Pp The options are as follows: --- 31,35 ---- A single .Nm ! manages a single interface. .Pp The options are as follows: *************** *** 49,62 **** 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 H Ar hostname Use --- 48,58 ---- The directory is created readable and writable to root (the usual user of ! .Nm dhcpclient ) ! to ensure security. .It Fl h Help. .It Fl i Ar interface ! Perform DHCP transactions on ! .Ar interface . .It Fl H Ar hostname Use Index: dhcpsniff.1 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcpsniff.1,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dhcpsniff.1 29 Jan 2002 18:05:07 -0000 1.1.1.1 --- dhcpsniff.1 16 Jun 2002 19:55:47 -0000 1.2 *************** *** 1,24 **** .Dd December, 17, 2001 ! .Dt DHCPSNIFF .Sh NAME .Nm dhcpsniff ! -- DHCP Diagnostic Sniffer .Sh SYNOPSIS ! .Nm dhcpsniff ! .Op Ar -i interface name .Sh DESCRIPTION ! .I ! dhcpsniff is a DHCP protocol sniffer. The sniffer will read DHCP packets ! off the network and provide output DHCP packet details. ! .Sh OPTIONS ! .Bl -tag ! .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" .El .Sh BUGS - .Pp We hope none. - .Pp .Sh SEE ALSO .Xr dhcpclient 1 --- 1,25 ---- + .\" $Header$ .Dd December, 17, 2001 ! .Dt DHCPSNIFF 1 .Sh NAME .Nm dhcpsniff ! .Nd DHCP (Dynamic Host Configuration Protocol) Sniffer .Sh SYNOPSIS ! .Nm ! .Op Fl i Ar interface .Sh DESCRIPTION ! .Nm ! is a DHCP sniffer. ! It observes DHCP packets on the network and outputs diagnostic-quality ! details of said packets. ! .Pp ! The options are as follows: ! .Bl -tag -width Ds ! .It Fl i Ar interface ! Sniff for DHCP packets on ! .Ar interface . .El .Sh BUGS We hope none. .Sh SEE ALSO .Xr dhcpclient 1 |
From: <bk...@us...> - 2002-06-16 00:57:35
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv18416 Modified Files: dhcp-icmp-discovery.c dhcp-sysconf.c Log Message: Fix my last patch, I mishandled a couple pointers. Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-icmp-discovery.c 15 Jun 2002 21:53:46 -0000 1.12 --- dhcp-icmp-discovery.c 16 Jun 2002 00:57:32 -0000 1.13 *************** *** 225,229 **** xfree(latency); /* free our latency array. */ rtts = add_to_list(rtts, average_latency); ! rtts = add_to_list(rtts, *host_addr); } --- 225,229 ---- xfree(latency); /* free our latency array. */ rtts = add_to_list(rtts, average_latency); ! rtts = add_to_list(rtts, host_addr); } Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-sysconf.c 15 Jun 2002 21:53:46 -0000 1.16 --- dhcp-sysconf.c 16 Jun 2002 00:57:32 -0000 1.17 *************** *** 120,124 **** * (See RFC 1812, section 4.3.3.6.) */ addr_val = average_latencies->next->data; ! lowest_latency = average_latencies->data; /* Now pick best router and use it as default. */ --- 120,125 ---- * (See RFC 1812, section 4.3.3.6.) */ addr_val = average_latencies->next->data; ! latency = list_ptr->data; ! lowest_latency = *latency; /* Now pick best router and use it as default. */ |
From: <bk...@us...> - 2002-06-15 21:53:49
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv20722 Modified Files: dhcp-icmp-discovery.c dhcp-sysconf.c Log Message: Modify usage of icmp_rtt_discovery(). Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-icmp-discovery.c 6 Jun 2002 23:59:00 -0000 1.11 --- dhcp-icmp-discovery.c 15 Jun 2002 21:53:46 -0000 1.12 *************** *** 126,131 **** * Here we're interested in how long it takes to * get a response from a list of addresses. ! * We return a list of unsigned integers giving ! * us the average rtt time for each address. * */ --- 126,132 ---- * Here we're interested in how long it takes to * get a response from a list of addresses. ! * We return a list of alternating unsigned integers ! * and IP addresses, the uint giving the rtt for the ! * following address. * */ *************** *** 158,170 **** if(route_find(net, *host_addr, &dest_mac)) { ! error_message("icmp rtt discovery: could not find route for address for %s -- skipping", network_address_to_string_static(*host_addr)); continue; } - /* We have the MAC address here. Run - * icmp_get_echo_latency to get latency. This also tells - * us if the host is up. */ - - /* allocate latency array. */ latency = xmalloc(sizeof(int) * *(sends)); --- 159,166 ---- if(route_find(net, *host_addr, &dest_mac)) { ! error_message("icmp_rtt_discovery: could not find route for address for %s -- skipping", network_address_to_string_static(*host_addr)); continue; } /* allocate latency array. */ latency = xmalloc(sizeof(int) * *(sends)); *************** *** 176,180 **** /* This part is a little tricky. We want to make sure ! * the host is actually up first. So if we got al -1's * we know it wasn't. Then if it is up we set the -1 * latencies (indicating we never got an answer) to the --- 172,176 ---- /* This part is a little tricky. We want to make sure ! * the host is actually up first. So if we got all -1's * we know it wasn't. Then if it is up we set the -1 * latencies (indicating we never got an answer) to the *************** *** 229,232 **** --- 225,229 ---- xfree(latency); /* free our latency array. */ rtts = add_to_list(rtts, average_latency); + rtts = add_to_list(rtts, *host_addr); } Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-sysconf.c 12 Jun 2002 01:47:09 -0000 1.15 --- dhcp-sysconf.c 15 Jun 2002 21:53:46 -0000 1.16 *************** *** 107,111 **** list_t *routers; list_t *average_latencies, *list_ptr; ! int lowest_latency = -1; int *latency; --- 107,111 ---- list_t *routers; list_t *average_latencies, *list_ptr; ! int lowest_latency; int *latency; *************** *** 116,119 **** --- 116,125 ---- average_latencies = icmp_rtt_discovery(dc->rawnet, routers); + /* Even if all routers fail to respond to the ICMP echo query, + * we still want to use one of them. + * (See RFC 1812, section 4.3.3.6.) */ + addr_val = average_latencies->next->data; + lowest_latency = average_latencies->data; + /* Now pick best router and use it as default. */ for(list_ptr = average_latencies; *************** *** 122,137 **** latency = list_ptr->data; ! if(lowest_latency < *latency) { lowest_latency = *latency; ! addr_val = routers->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; --- 128,138 ---- latency = list_ptr->data; ! if(*latency != -1 && *latency < lowest_latency) { lowest_latency = *latency; ! addr_val = list_ptr->next->data; } } purge_list(average_latencies, NULL); r_entry.route_dst.addr_type = ADDR_TYPE_IP; |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv13516 Modified Files: TODO dhcp-agent.h dhcp-client-states.c dhcp-client.c dhcp-com.c dhcp-globconf.c dhcp-globconf.h dhcpclient.1 Log Message: added hostname option to client as well as adding it to command line and globconf code. Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** TODO 15 Jun 2002 14:59:20 -0000 1.26 --- TODO 15 Jun 2002 18:23:28 -0000 1.27 *************** *** 89,90 **** --- 89,100 ---- -- fix stringbuffer trimwhitespace to use last_occurance routine, and add first occurance for finding initial whitespace too. + -- we may need to change the dhcp_build_* routines to use the + dhcp-convert driver to generate the network data. it's not an + issue in the client since our option generation is minimal but + will be in the server where we'll have lots of internal data + to pack into the dhcp responses. right now we have a handful of + routines that do. we need an array of generic routines to call + the applicable dhcp-convert and then build the option wirh + create_dhcp_option(data, len, tag) + + Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** dhcp-agent.h 15 Jun 2002 14:59:20 -0000 1.56 --- dhcp-agent.h 15 Jun 2002 18:23:28 -0000 1.57 *************** *** 411,414 **** --- 411,415 ---- # define TAG_DHCP_SUBNET_MASK 1 + # define TAG_DHCP_HOSTNAME 12 # define TAG_DHCP_REQUEST_IP_ADDRESS 50 # define TAG_DHCP_OPTION_OVERLOAD 52 *************** *** 662,665 **** --- 663,667 ---- extern dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address); extern dhcp_option_t *dhcp_build_server_identifier(uint32_t address); + extern dhcp_option_t *dhcp_build_hostname(char *hostname); extern uint32_t dhcp_gen_xid(void); Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** dhcp-client-states.c 11 Jun 2002 21:36:40 -0000 1.25 --- dhcp-client-states.c 15 Jun 2002 18:23:28 -0000 1.26 *************** *** 29,32 **** --- 29,33 ---- #include <dhcp-util.h> #include <dhcp-sysconf.h> + #include <dhcp-globconf.h> /* alarm handling routine and variable. */ *************** *** 58,61 **** --- 59,63 ---- list_t *options = NULL; dhcp_option_t *option; + char *hostname; if(opts != NULL) { *************** *** 83,87 **** option = dhcp_build_class_id(class_id); options = add_to_list(options, option); ! return options; } --- 85,97 ---- option = dhcp_build_class_id(class_id); options = add_to_list(options, option); ! ! /* hostname if available */ ! hostname = glob_conf_get_val(CLIENT_HOSTNAME); ! if(hostname != NULL) { ! /* if we have one set it. */ ! option = dhcp_build_hostname(hostname); ! options = add_to_list(options, option); ! } ! return options; } Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-client.c 13 Jun 2002 15:25:36 -0000 1.27 --- dhcp-client.c 15 Jun 2002 18:23:28 -0000 1.28 *************** *** 355,359 **** dhcp_client_control_t *dc; int state; ! info_message("starting for interface %s", interface); --- 355,359 ---- dhcp_client_control_t *dc; int state; ! info_message("starting for interface %s", interface); *************** *** 449,453 **** info_message(" "); ! while((c = getopt(argc, argv, "gcdavi:m:kwh:l:")) != -1) { switch(c) { --- 449,453 ---- info_message(" "); ! while((c = getopt(argc, argv, "gcdavi:m:kwh:l:H:")) != -1) { switch(c) { *************** *** 499,502 **** --- 499,507 ---- case 'p': promiscuous = 1; + break; + + /* dhcp options which can be set on the command line. */ + case 'H': + glob_conf_set_val(optarg, CLIENT_HOSTNAME); break; Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-com.c 11 Jun 2002 03:06:39 -0000 1.7 --- dhcp-com.c 15 Jun 2002 18:23:28 -0000 1.8 *************** *** 28,32 **** static const unsigned char dhcp_magic_cookie[4] = { 99, 130, 83, 99 }; ! /* create new dhcp object. */ --- 28,32 ---- static const unsigned char dhcp_magic_cookie[4] = { 99, 130, 83, 99 }; ! /* create new dhcp object. */ *************** *** 556,559 **** --- 556,564 ---- { return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_SERVER_IDENTIFIER)); + } + + dhcp_option_t *dhcp_build_hostname(char *hostname) + { + return(create_dhcp_option((unsigned char *)hostname, (strlen(hostname) + 1), TAG_DHCP_HOSTNAME)); } Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-globconf.c 15 Jun 2002 17:07:08 -0000 1.5 --- dhcp-globconf.c 15 Jun 2002 18:23:28 -0000 1.6 *************** *** 123,129 **** --- 123,136 ---- 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; + + /* skip options which have been set, since some of these may be set + on the command line. */ + if(global_config_options[i].val != NULL) + break; + global_config_options[i].val = global_config_options[i].convert_option_to_internal(varfile_get_val(varfile)); *************** *** 157,158 **** --- 164,169 ---- } + void glob_conf_set_val(void *val, int option) + { + global_config_options[option].val = global_config_options[option].convert_option_to_internal(val); + } Index: dhcp-globconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-globconf.h 15 Jun 2002 17:07:08 -0000 1.2 --- dhcp-globconf.h 15 Jun 2002 18:23:28 -0000 1.3 *************** *** 39,42 **** --- 39,43 ---- extern int init_glob_conf(unsigned char *filename); extern void *glob_conf_get_val(int val_index); + extern void glob_conf_set_val(void *val, int option); /* indexes to values. */ Index: dhcpclient.1 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcpclient.1,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcpclient.1 7 Jun 2002 13:14:47 -0000 1.9 --- dhcpclient.1 15 Jun 2002 18:23:28 -0000 1.10 *************** *** 12,15 **** --- 12,16 ---- .Op Fl l Ar level .Op Fl m Ar mac_addr + .Op Fl H Ar hostname .Sh DESCRIPTION .Nm *************** *** 58,61 **** --- 59,67 ---- downed ethernet interface it finds, or the first ethernet interface it finds. + .It Fl H Ar hostname + Use + .Ar hostname , + for hostname option in query otherwise no hostname is passed. + This may be needed for @home DHCP servers. .It Fl k Kill |
From: <act...@us...> - 2002-06-15 17:08:37
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv29134 Modified Files: dhcp-client.h Log Message: wops forgot to add it Index: dhcp-client.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-client.h 13 Jun 2002 15:25:36 -0000 1.1 --- dhcp-client.h 15 Jun 2002 17:08:34 -0000 1.2 *************** *** 29,34 **** typedef char *(*interface_lister)(void); - /* client command codes: index to command array */ - #define DO_VERSION 0 #define DO_KILL 1 --- 29,32 ---- *************** *** 37,39 **** #define DO_CLIENT 4 ! #endif /* DHCP_CLIENT_H */ --- 35,38 ---- #define DO_CLIENT 4 ! #endif ! |
From: <act...@us...> - 2002-06-15 17:07:11
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv28754 Modified Files: dhcp-convert.c dhcp-globconf.c dhcp-globconf.h Log Message: added hostname to config options; fixed dhcp-client.h -- no idea how it got truncated Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dhcp-convert.c 6 Jun 2002 23:59:00 -0000 1.13 --- dhcp-convert.c 15 Jun 2002 17:07:08 -0000 1.14 *************** *** 396,399 **** --- 396,409 ---- } + /* validate internal strings -- e.g. conf and cache file. */ + char *validate_string_to_string(const unsigned char *data, int len) + { + /* we don't validate or do much with internal strings. + * however we need to maintain the prototype to plug this + * into the right places. */ + + return strdup(data); + } + /* just copy. wrapper needed to be nice to the compiler. */ void *strdup_wrap(const char *s) Index: dhcp-globconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-globconf.c 6 Jun 2002 23:59:00 -0000 1.4 --- dhcp-globconf.c 15 Jun 2002 17:07:08 -0000 1.5 *************** *** 35,39 **** /* change this before... */ ! #define GLOBAL_OPTIONS_LEN 2 /* ... changing size of this */ --- 35,39 ---- /* change this before... */ ! #define GLOBAL_OPTIONS_LEN 3 /* ... changing size of this */ *************** *** 43,46 **** --- 43,47 ---- { "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 }, + { "client-hostname", strdup_wrap, validate_network_string_to_string, 0, NULL, NULL }, }; *************** *** 59,62 **** --- 60,66 ---- for(i = 0;i < GLOBAL_OPTIONS_LEN; i++) { + if(global_config_options[i].val == NULL) + continue; + var_string = global_config_options[i].convert_option_to_string(global_config_options[i].val, global_config_options[i].size); if(var_string == NULL) *************** *** 76,79 **** --- 80,87 ---- for(i = 0;i < GLOBAL_OPTIONS_LEN;i++) { + + if(global_config_options[i].default_val == NULL) + continue; + 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); Index: dhcp-globconf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-globconf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-globconf.h 25 May 2002 15:18:01 -0000 1.1 --- dhcp-globconf.h 15 Jun 2002 17:07:08 -0000 1.2 *************** *** 44,47 **** --- 44,48 ---- #define CLIENT_DHCP_RETRIES 0 #define CLIENT_ICMP_RETRIES 1 + #define CLIENT_HOSTNAME 2 /* default string values. */ |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv1508 Modified Files: Makefile.am Makefile.in TODO config.h.in configure configure.in dhcp-agent.h dhcp-stringbuffer.c dhcp-stringbuffer.h Log Message: update stringbuffer routines; using patrick powell's snprintf instead of system one due to needed semantics -- returns total regardless of what's been written Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Makefile.am 11 Jun 2002 02:10:32 -0000 1.18 --- Makefile.am 15 Jun 2002 14:59:20 -0000 1.19 *************** *** 5,9 **** DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ --- 5,9 ---- DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient #dhcptest dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ *************** *** 23,26 **** --- 23,36 ---- dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c + #dhcptest_SOURCES = dhcp-test.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.c 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 dhcp-stringbuffer.c + + #dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Makefile.in 11 Jun 2002 02:10:32 -0000 1.18 --- Makefile.in 15 Jun 2002 14:59:20 -0000 1.19 *************** *** 59,63 **** POST_UNINSTALL = : CC = @CC@ - DHCP_SNPRINTF = @DHCP_SNPRINTF@ DNET_INC = @DNET_INC@ DNET_LIB = @DNET_LIB@ --- 59,62 ---- *************** *** 76,80 **** DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.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_SNPRINTF@ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c --- 75,79 ---- DEFS = @DEFS@ ! bin_PROGRAMS = dhcpsniff dhcpclient #dhcptest dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.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_SNPRINTF@ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c *************** *** 86,89 **** --- 85,98 ---- + #dhcptest_SOURCES = dhcp-test.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.c 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 dhcp-stringbuffer.c + + #dhcptest_LDADD = @PCAP_LIB@ @DNET_LIB@ dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** TODO 11 Jun 2002 03:07:43 -0000 1.25 --- TODO 15 Jun 2002 14:59:20 -0000 1.26 *************** *** 87,88 **** --- 87,90 ---- -- get stringbuffer used in places where strings are being manipulated heavily. + -- fix stringbuffer trimwhitespace to use last_occurance routine, and + add first occurance for finding initial whitespace too. Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** config.h.in 10 Jun 2002 23:15:20 -0000 1.11 --- config.h.in 15 Jun 2002 14:59:20 -0000 1.12 *************** *** 45,51 **** #undef HAVE_SIGNAL_H - /* Define if you have the `sprintf' function. */ - #undef HAVE_SPRINTF - /* Define if you have the <stdarg.h> header file. */ #undef HAVE_STDARG_H --- 45,48 ---- *************** *** 65,71 **** /* Define if you have the <varargs.h> header file. */ #undef HAVE_VARARGS_H - - /* Define if you have the `vsnprintf' function. */ - #undef HAVE_VSNPRINTF /* Name of package */ --- 62,65 ---- Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** configure 11 Jun 2002 01:58:53 -0000 1.20 --- configure 15 Jun 2002 14:59:20 -0000 1.21 *************** *** 2624,2707 **** done ! for ac_func in sprintf vsnprintf ! do ! ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` ! echo "$as_me:2629: checking for $ac_func" >&5 ! echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 ! if eval "test \"\${$ac_ac_var+set}\" = set"; then ! echo $ECHO_N "(cached) $ECHO_C" >&6 ! else ! cat >conftest.$ac_ext <<_ACEOF ! #line 2635 "configure" ! #include "confdefs.h" ! /* System header to define __stub macros and hopefully few prototypes, ! which can conflict with char $ac_func (); below. */ ! #include <assert.h> ! /* Override any gcc2 internal prototype to avoid an error. */ ! #ifdef __cplusplus ! extern "C" ! #endif ! /* We use char because int might match the return type of a gcc2 ! builtin and then its argument prototype would still apply. */ ! char $ac_func (); ! char (*f) (); ! ! int ! main () ! { ! /* The GNU C library defines this for functions which it implements ! to always fail with ENOSYS. Some functions are actually named ! something starting with __ and the normal name is an alias. */ ! #if defined (__stub_$ac_func) || defined (__stub___$ac_func) ! choke me ! #else ! f = $ac_func; ! #endif ! ! ; ! return 0; ! } ! _ACEOF ! rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:2666: \"$ac_link\"") >&5 ! (eval $ac_link) 2>&5 ! ac_status=$? ! echo "$as_me:2669: \$? = $ac_status" >&5 ! (exit $ac_status); } && ! { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:2672: \"$ac_try\"") >&5 ! (eval $ac_try) 2>&5 ! ac_status=$? ! echo "$as_me:2675: \$? = $ac_status" >&5 ! (exit $ac_status); }; }; then ! eval "$ac_ac_var=yes" ! else ! echo "$as_me: failed program was:" >&5 ! cat conftest.$ac_ext >&5 ! eval "$ac_ac_var=no" ! fi ! rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ! fi ! echo "$as_me:2685: result: `eval echo '${'$ac_ac_var'}'`" >&5 ! echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 ! if test `eval echo '${'$ac_ac_var'}'` = yes; then ! cat >>confdefs.h <<EOF ! #define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 ! EOF ! DHCP_SNPRINTF="dhcp-snprintf.c" ! else ! DHCP_SNPRINTF="" ! fi ! done ! ! echo "$as_me:2697: checking if kill(0, pid) can be used to detect a process" >&5 echo $ECHO_N "checking if kill(0, pid) can be used to detect a process... $ECHO_C" >&6 if test "$cross_compiling" = yes; then ! { { echo "$as_me:2700: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF ! #line 2705 "configure" #include "confdefs.h" --- 2624,2636 ---- done ! echo "$as_me:2626: checking if kill(0, pid) can be used to detect a process" >&5 echo $ECHO_N "checking if kill(0, pid) can be used to detect a process... $ECHO_C" >&6 if test "$cross_compiling" = yes; then ! { { echo "$as_me:2629: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF ! #line 2634 "configure" #include "confdefs.h" *************** *** 2753,2770 **** _ACEOF rm -f 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='./conftest$ac_exeext' ! { (eval echo "$as_me:2760: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2763: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF #define KILL_SIGNAL_DETECT 1 EOF ! echo "$as_me:2768: result: yes" >&5 echo "${ECHO_T}yes" >&6 else --- 2682,2699 ---- _ACEOF rm -f conftest$ac_exeext ! if { (eval echo "$as_me:2684: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:2687: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' ! { (eval echo "$as_me:2689: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2692: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF #define KILL_SIGNAL_DETECT 1 EOF ! echo "$as_me:2697: result: yes" >&5 echo "${ECHO_T}yes" >&6 else *************** *** 2772,2776 **** echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! echo "$as_me:2774: result: no" >&5 echo "${ECHO_T}no" >&6 fi --- 2701,2705 ---- echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! echo "$as_me:2703: result: no" >&5 echo "${ECHO_T}no" >&6 fi *************** *** 2778,2782 **** fi ! echo "$as_me:2780: 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 --- 2707,2711 ---- fi ! echo "$as_me:2709: 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 *************** *** 2784,2788 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2786 "configure" #include "confdefs.h" #include <sys/types.h> --- 2713,2717 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2715 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2803,2816 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2805: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2808: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (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_type_struct_bpf_timeval=yes --- 2732,2745 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2734: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2737: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2740: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2743: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_struct_bpf_timeval=yes *************** *** 2822,2826 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2824: 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 --- 2751,2755 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2753: 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 *************** *** 2831,2838 **** fi ! echo "$as_me:2833: checking for __progname" >&5 echo $ECHO_N "checking for __progname... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF ! #line 2836 "configure" #include "confdefs.h" --- 2760,2767 ---- fi ! echo "$as_me:2762: checking for __progname" >&5 echo $ECHO_N "checking for __progname... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF ! #line 2765 "configure" #include "confdefs.h" *************** *** 2852,2865 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2854: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2857: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2860: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2863: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF --- 2781,2794 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2783: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2786: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2789: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2792: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF *************** *** 2867,2881 **** EOF ! echo "$as_me:2869: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! echo "$as_me:2874: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext; ! echo "$as_me:2879: 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 --- 2796,2810 ---- EOF ! echo "$as_me:2798: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! echo "$as_me:2803: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext; ! echo "$as_me:2808: 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 *************** *** 2883,2887 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2885 "configure" #include "confdefs.h" #include <signal.h> --- 2812,2816 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2814 "configure" #include "confdefs.h" #include <signal.h> *************** *** 2899,2912 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2901: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2904: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2907: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2910: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes --- 2828,2841 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2830: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2833: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2836: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2839: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_sig_atomic_t=yes *************** *** 2918,2922 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2920: 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 --- 2847,2851 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2849: 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 *************** *** 2927,2931 **** fi ! echo "$as_me:2929: 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 --- 2856,2860 ---- fi ! echo "$as_me:2858: 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 *************** *** 2933,2937 **** else cat >conftest.$ac_ext <<_ACEOF ! #line 2935 "configure" #include "confdefs.h" #include <sys/types.h> --- 2862,2866 ---- else cat >conftest.$ac_ext <<_ACEOF ! #line 2864 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 2955,2968 **** _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2957: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2960: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2963: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2966: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void --- 2884,2897 ---- _ACEOF rm -f conftest.$ac_objext ! if { (eval echo "$as_me:2886: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? ! echo "$as_me:2889: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:2892: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:2895: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void *************** *** 2974,2978 **** rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2976: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 --- 2903,2907 ---- rm -f conftest.$ac_objext conftest.$ac_ext fi ! echo "$as_me:2905: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 *************** *** 2983,2987 **** if test -z "$pcap_prefix"; then ! echo "$as_me:2985: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" --- 2912,2916 ---- if test -z "$pcap_prefix"; then ! echo "$as_me:2914: checking for pcap library directory" >&5 echo $ECHO_N "checking for pcap library directory... $ECHO_C" >&6 ac_pcap_lib_dir="none" *************** *** 2994,2998 **** if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2996: 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 --- 2923,2927 ---- if test $ac_pcap_lib_dir = "none" ; then ! { { echo "$as_me:2925: 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 *************** *** 3003,3011 **** fi ! echo "$as_me:3005: 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:3009: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" --- 2932,2940 ---- fi ! echo "$as_me:2934: 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:2938: checking for pcap header directory" >&5 echo $ECHO_N "checking for pcap header directory... $ECHO_C" >&6 ac_pcap_header_dir="none" *************** *** 3018,3022 **** if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:3020: 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 --- 2947,2951 ---- if test $ac_pcap_header_dir = "none" ; then ! { { echo "$as_me:2949: 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 *************** *** 3027,3031 **** fi ! echo "$as_me:3029: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" --- 2956,2960 ---- fi ! echo "$as_me:2958: result: $ac_pcap_header_dir" >&5 echo "${ECHO_T}$ac_pcap_header_dir" >&6 PCAP_INC="-I$ac_pcap_header_dir" *************** *** 3044,3048 **** # 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:3046: 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 --- 2973,2977 ---- # 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:2975: 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 *************** *** 3061,3065 **** if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:3063: found $ac_dir/$ac_word" >&5 break fi --- 2990,2994 ---- if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_DNET_PATH="$ac_dir/$ac_word" ! echo "$as_me:2992: found $ac_dir/$ac_word" >&5 break fi *************** *** 3072,3079 **** if test -n "$DNET_PATH"; then ! echo "$as_me:3074: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:3077: result: no" >&5 echo "${ECHO_T}no" >&6 fi --- 3001,3008 ---- if test -n "$DNET_PATH"; then ! echo "$as_me:3003: result: $DNET_PATH" >&5 echo "${ECHO_T}$DNET_PATH" >&6 else ! echo "$as_me:3006: result: no" >&5 echo "${ECHO_T}no" >&6 fi *************** *** 3085,3089 **** if test $DNET_PATH = "no"; then ! echo "$as_me:3087: 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 --- 3014,3018 ---- if test $DNET_PATH = "no"; then ! echo "$as_me:3016: 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 *************** *** 3093,3097 **** LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 3095 "configure" #include "confdefs.h" --- 3022,3026 ---- LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF ! #line 3024 "configure" #include "confdefs.h" *************** *** 3112,3125 **** _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:3114: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:3117: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:3120: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:3123: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes --- 3041,3054 ---- _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:3043: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? ! echo "$as_me:3046: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:3049: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? ! echo "$as_me:3052: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_eth_open=yes *************** *** 3132,3141 **** LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:3134: 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:3139: 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; }; } --- 3061,3070 ---- LIBS=$ac_check_lib_save_LIBS fi ! echo "$as_me:3063: 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:3068: 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; }; } *************** *** 3244,3248 **** ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:3246: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF --- 3173,3177 ---- ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" ! { echo "$as_me:3175: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF *************** *** 3420,3424 **** --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3422: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 --- 3349,3353 ---- --he | --h) # Conflict between --help and --header ! { { echo "$as_me:3351: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 *************** *** 3444,3453 **** # This is an error. ! -*) { { echo "$as_me:3446: 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:3451: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; --- 3373,3382 ---- # This is an error. ! -*) { { echo "$as_me:3375: 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:3380: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; *************** *** 3570,3574 **** s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t - s,@DHCP_SNPRINTF@,$DHCP_SNPRINTF,;t t s,@DNET_PATH@,$DNET_PATH,;t t s,@PCAP_LIB@,$PCAP_LIB,;t t --- 3499,3502 ---- *************** *** 3690,3694 **** if test x"$ac_file" != x-; then ! { echo "$as_me:3692: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" --- 3618,3622 ---- if test x"$ac_file" != x-; then ! { echo "$as_me:3620: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" *************** *** 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; }; } --- 3636,3640 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { 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; }; } *************** *** 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; }; } --- 3649,3653 ---- else # /dev/null tree ! { { echo "$as_me:3651: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3782,3786 **** esac ! test x"$ac_file" != x- && { echo "$as_me:3784: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} --- 3710,3714 ---- esac ! test x"$ac_file" != x- && { echo "$as_me:3712: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} *************** *** 3793,3797 **** [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { echo "$as_me:3795: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3721,3725 ---- [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) ! test -f "$f" || { { 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; }; } *************** *** 3806,3810 **** else # /dev/null tree ! { { echo "$as_me:3808: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } --- 3734,3738 ---- else # /dev/null tree ! { { echo "$as_me:3736: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 3923,3927 **** if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3925: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else --- 3851,3855 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3853: $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.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** configure.in 11 Jun 2002 01:50:27 -0000 1.20 --- configure.in 15 Jun 2002 14:59:20 -0000 1.21 *************** *** 42,50 **** AC_CHECK_FUNCS(strdup uname calloc daemon rename sysconf getrusage getprogname) - AC_CHECK_FUNCS(sprintf vsnprintf, - [DHCP_SNPRINTF="dhcp-snprintf.c"], - [DHCP_SNPRINTF=""]) - AC_SUBST(DHCP_SNPRINTF) - dnl check if kill(pid, 0) can be used to detect a process --- 42,45 ---- Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** dhcp-agent.h 11 Jun 2002 03:06:39 -0000 1.55 --- dhcp-agent.h 15 Jun 2002 14:59:20 -0000 1.56 *************** *** 110,114 **** /* log string buffer */ ! # define MSG_BUFFER_SIZE 128 /* Snaplen. Use the largest size since DHCP packets could --- 110,114 ---- /* log string buffer */ ! # define MSG_BUFFER_SIZE 256 /* Snaplen. Use the largest size since DHCP packets could *************** *** 563,575 **** extern void setup_interrupt_handlers(void); ! /* Replacement vsnprintf, snprintf if needed. */ - #if !defined(HAVE_SNPRINTF) extern int snprintf (char *str, size_t count, const char *fmt, ...); - #endif - - #if !defined(HAVE_VSNPRINTF) extern int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); - #endif /* Printing functions. */ --- 563,570 ---- extern void setup_interrupt_handlers(void); ! /* Replacement vsnprintf, snprintf that work the way we want them to. */ extern int snprintf (char *str, size_t count, const char *fmt, ...); extern int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); /* Printing functions. */ Index: dhcp-stringbuffer.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-stringbuffer.c 11 Jun 2002 02:10:32 -0000 1.1 --- dhcp-stringbuffer.c 15 Jun 2002 14:59:20 -0000 1.2 *************** *** 25,39 **** #include <dhcp-agent.h> #include <dhcp-stringbuffer.h> /* create a new stringbuffer */ ! stringbuffer *make_stringbuffer(void) { stringbuffer *sb; ! sb = malloc(sizeof(stringbuffer)); sb->len = 0; sb->capacity = 0; ! sb->buf = malloc(sizeof(char) * 1); ! sb->buf[0] = 0; return sb; --- 25,115 ---- #include <dhcp-agent.h> #include <dhcp-stringbuffer.h> + #include <dhcp-util.h> + + /* * * * * * * * * * * * * + * raw string routines. * + * * * * * * * * * * * * */ + + /* just malloc out a string. */ + static char *allocate_string(int len) + { + char *s; + s = xmalloc(sizeof(char) * len + 1); /* add for null termination. */ + s[len] = 0; + return s; + } + + /* extend a string. */ + static char *extend_string(char *str, int cur_len, int ex_len) + { + int len = strlen(str); + + str = realloc(str, (sizeof(char) * (len + ex_len + 1))); + str[len + ex_len] = 0; /* make sure it's null terminated. */ + + return str; + } + + /* get a substring. */ + static char *substring(char *begin, int len) + { + char *new_string; + + new_string = allocate_string(len); + strncpy(new_string, begin, len); + new_string[len] = 0; + + return new_string; + } + + /* used in aligning -- we try to get words up to end. */ + static char *get_string_align(char *s, int end, int *len) + { + char *cur_ptr; + + if(s == 0 || *s == 0) /* end of string or no string. */ + return NULL; + + /* if strlen is smaller than len go ahead and just return it. */ + if(strlen(s) < end) { + *len = strlen(s); + return strdup(s); + } + + /* otherwise we need to hop to len */ + cur_ptr = &s[end - 1]; + + /* now check to see if we have a whitespace behind cur_ptr + * if we do return at that point. */ + + for(;cur_ptr != s;cur_ptr--) { + if(*cur_ptr == ' ' || + *cur_ptr == '\t') { + /* copy here and return. */ + *len = (cur_ptr - s) + 1; + return(substring(s, *len)); + } + } + + /* keep walking till we find whitspace or end. */ + for(cur_ptr = &s[end - 1];*cur_ptr != 0 && *cur_ptr != ' ' && *cur_ptr != '\t';cur_ptr++); + + *len = (cur_ptr - s) + 1; + return(substring(s, *len)); + } + + /* * * * * * * * * * * * * * * + * stringbuffer routines. * + * * * * * * * * * * * * * * */ /* create a new stringbuffer */ ! stringbuffer *create_stringbuffer(void) { stringbuffer *sb; ! sb = xmalloc(sizeof(stringbuffer)); sb->len = 0; sb->capacity = 0; ! sb->buf = allocate_string(0); return sb; *************** *** 48,59 **** /* append string to stringbuffer */ ! void stringbuffer_append(stringbuffer *sb, char *s) { int len = strlen(s); ! sb->len += len; ! if(sb->capacity < sb->len) { ! sb->buf = realloc(sb->buf, sizeof(char) * (sb->len + 1)); ! sb->capacity = sb->len; } --- 124,135 ---- /* append string to stringbuffer */ ! void stringbuffer_append(stringbuffer *sb, const char *s) { int len = strlen(s); ! if(sb->capacity <= (len + sb->capacity)) { ! sb->buf = extend_string(sb->buf, sb->len, len); ! sb->len += len; ! sb->capacity = sb->len; } *************** *** 68,78 **** char *end, *begin; char *newbuf; if(sb->len == 0) /* empty string. */ return sb; - /* create a new string */ - newbuf = malloc(sizeof(sb->len + 1) * sizeof(char)); - for(begin = &sb->buf[0]; *begin != '\0' && (*begin == ' ' || *begin == '\t'); --- 144,152 ---- char *end, *begin; char *newbuf; + int len; if(sb->len == 0) /* empty string. */ return sb; for(begin = &sb->buf[0]; *begin != '\0' && (*begin == ' ' || *begin == '\t'); *************** *** 86,102 **** end--); - if(end == begin) { - - /* all spaces! */ - /* zip this string to nothing */ - - destroy_stringbuffer(sb); - free(newbuf); - return make_stringbuffer(); - - } else { ! /* there's something in between. ! * copy out. */ ptr = newbuf; --- 160,167 ---- end--); ! len = (sb->len + 1); /* save old length. */ ! /* create a new string */ ! newbuf = xmalloc(len * sizeof(char)); ptr = newbuf; *************** *** 107,121 **** *ptr = 0; ! free(sb->buf); sb->buf = newbuf; ! ! } } else { /* zap beginning of string. since its all whitespace. */ - free(newbuf); sb->buf[0] = 0; sb->len = 0; ! } ! return sb; --- 172,187 ---- *ptr = 0; ! xfree(sb->buf); sb->buf = newbuf; ! sb->len = strlen(newbuf); ! sb->capacity = len; ! ! } else { + /* zap beginning of string. since its all whitespace. */ sb->buf[0] = 0; sb->len = 0; ! } return sb; *************** *** 161,163 **** --- 227,344 ---- { return sb->buf; + } + + void stringbuffer_copy(stringbuffer *dest, stringbuffer *src) + { + destroy_stringbuffer(dest); /* zap */ + dest = create_stringbuffer(); /* make new */ + + /* append -- simplicity is grand! :-) */ + stringbuffer_append(dest, stringbuffer_getstring(src)); + } + + + /* align a stringbuffer on begin and end columns. */ + void stringbuffer_align(stringbuffer *sb, int begin, int end) + { + char *ptr, *word_string; + stringbuffer *aligned_string; + int len, i; + + + aligned_string = create_stringbuffer(); + ptr = sb->buf; + + while(1) { + + word_string = get_string_align(ptr, end, &len); + + if(word_string == NULL) + break; + + ptr += len; + + for(i = 0;i < begin;i++) + stringbuffer_append(aligned_string, " "); + + stringbuffer_append(aligned_string, word_string); + stringbuffer_append(aligned_string, "\n"); + xfree(word_string); + + } + + stringbuffer_copy(sb, aligned_string); + destroy_stringbuffer(aligned_string); + + return; + } + + /* stringbuffer_*printf* these all use snprintf/snvprintf internally */ + + /* append vprintf with alignment. */ + void stringbuffer_avprintf_align(stringbuffer *sb, int start, int end, char *fmt, va_list ap) + { + stringbuffer *tmp_sb; + char *str; + int total, len; + + /* our first malloc is bogus. */ + len = 1; + str = xmalloc(sizeof(char) * len); + total = vsnprintf(str, len, fmt, ap); + + /* total is the real length needed. */ + xfree(str); + len = total + 1; + str = xmalloc(sizeof(char) * len); + vsnprintf(str, len, fmt, ap); + + /* now align if we want to align. */ + if(start != 0 && end != 0) { + + tmp_sb = create_stringbuffer(); + + stringbuffer_append(tmp_sb, str); + stringbuffer_align(tmp_sb, start, end); + stringbuffer_append(sb, stringbuffer_getstring(tmp_sb)); + + destroy_stringbuffer(tmp_sb); + + } else { + stringbuffer_append(sb, str); + } + + xfree(str); + + return; + } + + /* append printf. */ + void stringbuffer_aprintf(stringbuffer *sb, char *fmt, ...) + { + va_list ap; + + va_start(ap, fmt); + + stringbuffer_avprintf(sb, fmt, ap); + + va_end(ap); + } + + /* append printf with alignment. */ + void stringbuffer_aprintf_align(stringbuffer *sb, int start, int end, char *fmt, ...) + { + va_list ap; + + va_start(ap, fmt); + + stringbuffer_avprintf_align(sb, start, end, fmt, ap); + + va_end(ap); + } + + /* append vprintf. */ + void stringbuffer_avprintf(stringbuffer *sb, char *fmt, va_list ap) + { + stringbuffer_avprintf_align(sb, 0, 0, fmt, ap); } Index: dhcp-stringbuffer.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-stringbuffer.h 11 Jun 2002 02:10:32 -0000 1.1 --- dhcp-stringbuffer.h 15 Jun 2002 14:59:20 -0000 1.2 *************** *** 33,43 **** } stringbuffer; ! extern stringbuffer *make_stringbuffer(void); extern void destroy_stringbuffer(stringbuffer *sb); ! extern void stringbuffer_append(stringbuffer *sb, char *s); extern stringbuffer *stringbuffer_trim_whitespace(stringbuffer *sb); extern char *stringbuffer_get_last_occurance(stringbuffer *sb, char c); extern void stringbuffer_trim_newline(stringbuffer *sb); extern const char *stringbuffer_getstring(stringbuffer *sb); #endif /* DHCP_STRINGBUFFER_H */ --- 33,46 ---- } stringbuffer; ! extern stringbuffer *create_stringbuffer(void); extern void destroy_stringbuffer(stringbuffer *sb); ! extern void stringbuffer_append(stringbuffer *sb, const char *s); extern stringbuffer *stringbuffer_trim_whitespace(stringbuffer *sb); extern char *stringbuffer_get_last_occurance(stringbuffer *sb, char c); extern void stringbuffer_trim_newline(stringbuffer *sb); extern const char *stringbuffer_getstring(stringbuffer *sb); + extern void stringbuffer_aprintf(stringbuffer *sb, char *fmt, ...); + extern void stringbuffer_aprintf_align(stringbuffer *sb, int begin, int end, char *fmt, ...); + extern void stringbuffer_avprintf(stringbuffer *sb, char *fmt, va_list ap); #endif /* DHCP_STRINGBUFFER_H */ |
From: <act...@us...> - 2002-06-13 15:25:41
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv30574 Modified Files: dhcp-client.c Added Files: dhcp-client.h Log Message: added dhcp-client.h and moved some definitions there --- NEW FILE: dhcp-client.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.h,v 1.1 2002/06/13 15:25:36 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. * */ #ifndef DHCP_CLIENT_H #define DHCP_CLIENT_H typedef void (*client_command)(char *interface); typedef char *(*interface_lister)(void); /* client command codes: index to command array */ #define DO_VERSION 0 #define DO_KILL 1 #define DO_WAKE 2 #define DO_CLEAR 3 #define DO_CLIENT 4 #endif /* DHCP_CLIENT_H */ Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dhcp-client.c 11 Jun 2002 02:05:52 -0000 1.26 --- dhcp-client.c 13 Jun 2002 15:25:36 -0000 1.27 *************** *** 27,46 **** #include <dhcp-globconf.h> #include <dhcp-files.h> ! ! /* client command codes: index to command array */ ! ! #define DO_VERSION 0 ! #define DO_KILL 1 ! #define DO_WAKE 2 ! #define DO_CLEAR 3 ! #define DO_CLIENT 4 ! ! const char *command_string[] = { ! "version", "kill", ! "wake", "clear", "client" ! }; ! ! typedef void (*client_command)(char *interface); ! typedef char *(*interface_lister)(void); /* forward declarations of do_ routines. */ --- 27,31 ---- #include <dhcp-globconf.h> #include <dhcp-files.h> ! #include <dhcp-client.h> /* forward declarations of do_ routines. */ *************** *** 52,55 **** --- 37,46 ---- static void do_client(char *interface); + /* command to string table. */ + const char *command_string[] = { + "version", "kill", + "wake", "clear", "client" + }; + /* table of functions indexed by command codes. */ client_command commands[] = { *************** *** 443,447 **** do_client_dhcp_loop(0, dc, state); /* perform infinite waiting loop. */ ! exit(0); /* should never get here. */ } --- 434,438 ---- do_client_dhcp_loop(0, dc, state); /* perform infinite waiting loop. */ ! exit(0); } |
From: <bk...@us...> - 2002-06-12 05:26:07
|
Update of /cvsroot/dhcp-agent/dhcp-agent/doc In directory usw-pr-cvs1:/tmp/cvs-serv20249 Added Files: rfc2132.txt Removed Files: rfc1533.txt Log Message: RFC 2132 obsoletes RFC 1533. --- NEW FILE: rfc2132.txt --- Network Working Group S. Alexander Request for Comments: 2132 Silicon Graphics, Inc. Obsoletes: 1533 R. Droms Category: Standards Track Bucknell University March 1997 DHCP Options and BOOTP Vendor Extensions Status of this memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet [...1868 lines suppressed...] Alexander & Droms Standards Track [Page 34] --- rfc1533.txt DELETED --- |
From: <bk...@us...> - 2002-06-12 01:47:12
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv7985 Modified Files: dhcp-sysconf.c Log Message: We check router ICMP RTT's now. Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sysconf.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dhcp-sysconf.c 6 Jun 2002 23:59:00 -0000 1.14 --- dhcp-sysconf.c 12 Jun 2002 01:47:09 -0000 1.15 *************** *** 110,118 **** int *latency; - /* FIXME: insert ICMP ping checks so we can find - * the best router and use it. - * For now get the first and use it (precedence). - */ - memset(&r_entry.route_dst, 0, sizeof(r_entry.route_dst)); memset(&r_entry.route_gw, 0, sizeof(r_entry.route_gw)); --- 110,113 ---- |
From: <bk...@us...> - 2002-06-11 21:36:43
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv7559 Modified Files: dhcp-client-states.c Log Message: Stick to the naming scheme with *_check_*, instead of *_*_check. Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dhcp-client-states.c 11 Jun 2002 20:06:19 -0000 1.24 --- dhcp-client-states.c 11 Jun 2002 21:36:40 -0000 1.25 *************** *** 105,109 **** /* check for valid discover responses. */ ! static int client_discover_check(void *arg) { dhcp_client_control_t *dc = arg; --- 105,109 ---- /* check for valid discover responses. */ ! static int client_check_discover(void *arg) { dhcp_client_control_t *dc = arg; *************** *** 118,122 **** /* check for valid request responses. */ ! static int client_request_check(void *arg) { dhcp_client_control_t *dc = arg; --- 118,122 ---- /* check for valid request responses. */ ! static int client_check_request(void *arg) { dhcp_client_control_t *dc = arg; *************** *** 197,201 **** if(rawnet_packet_transact(dc->rawnet, dc, client_update_packet, ! client_discover_check)) { error_message("timeout on DHCP DISCOVER."); return STATE_FATAL_ERROR; --- 197,201 ---- if(rawnet_packet_transact(dc->rawnet, dc, client_update_packet, ! client_check_discover)) { error_message("timeout on DHCP DISCOVER."); return STATE_FATAL_ERROR; *************** *** 248,252 **** build_dhcp_request(dc->rawnet, dc->xid, dc->secs, options); ! if(rawnet_packet_transact(dc->rawnet, dc, NULL, client_request_check)) { error_message("timeout on DHCP REQUEST."); return STATE_FATAL_ERROR; --- 248,252 ---- build_dhcp_request(dc->rawnet, dc->xid, dc->secs, options); ! if(rawnet_packet_transact(dc->rawnet, dc, NULL, client_check_request)) { error_message("timeout on DHCP REQUEST."); return STATE_FATAL_ERROR; |
From: <bk...@us...> - 2002-06-11 20:06:26
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv9002 Modified Files: dhcp-client-states.c Log Message: Use STATE_FATAL_ERROR here, too. Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** dhcp-client-states.c 11 Jun 2002 03:06:39 -0000 1.23 --- dhcp-client-states.c 11 Jun 2002 20:06:19 -0000 1.24 *************** *** 199,203 **** client_discover_check)) { error_message("timeout on DHCP DISCOVER."); ! return -1; } --- 199,203 ---- client_discover_check)) { error_message("timeout on DHCP DISCOVER."); ! return STATE_FATAL_ERROR; } *************** *** 218,222 **** if(client_cache_dump_options(dc->cache, dc->rawnet->dhcp_p->options)) { error_message("could not create temporary cache"); ! return -1; } --- 218,222 ---- if(client_cache_dump_options(dc->cache, dc->rawnet->dhcp_p->options)) { error_message("could not create temporary cache"); ! return STATE_FATAL_ERROR; } *************** *** 238,242 **** if(cache_options == NULL) { error_message("Could not load cache! This is not good!"); ! return -1; } --- 238,242 ---- if(cache_options == NULL) { error_message("Could not load cache! This is not good!"); ! return STATE_FATAL_ERROR; } *************** *** 250,254 **** if(rawnet_packet_transact(dc->rawnet, dc, NULL, client_request_check)) { error_message("timeout on DHCP REQUEST."); ! return -1; } --- 250,254 ---- if(rawnet_packet_transact(dc->rawnet, dc, NULL, client_request_check)) { error_message("timeout on DHCP REQUEST."); ! return STATE_FATAL_ERROR; } *************** *** 271,275 **** if(options == NULL) { error_message("received empty configuration cache! cannot configure host"); ! return -1; } --- 271,275 ---- if(options == NULL) { error_message("received empty configuration cache! cannot configure host"); ! return STATE_FATAL_ERROR; } *************** *** 331,335 **** /* if we have no cache we probably timed out * somewhere. Just return. */ ! return -1; options = join_lists(options, cache_options); --- 331,335 ---- /* if we have no cache we probably timed out * somewhere. Just return. */ ! return STATE_FATAL_ERROR; options = join_lists(options, cache_options); *************** *** 342,346 **** if(rawnet_send_packet(dc->rawnet) < 0) { error_message("could not send packet: %s", strerror(errno)); ! return -1; } --- 342,346 ---- if(rawnet_send_packet(dc->rawnet) < 0) { error_message("could not send packet: %s", strerror(errno)); ! return STATE_FATAL_ERROR; } |
From: <bk...@us...> - 2002-06-11 03:07:46
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv28585 Modified Files: TODO Log Message: The kill(pid, 0) test is in now. Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** TODO 11 Jun 2002 03:06:39 -0000 1.24 --- TODO 11 Jun 2002 03:07:43 -0000 1.25 *************** *** 26,31 **** -- 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. -- check for duplicates in configure.in and compress them (for example -I and -L flags should not be repeated.) --- 26,29 ---- |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv28267 Modified Files: TODO dhcp-agent.h dhcp-client-cache.c dhcp-client-states.c dhcp-com.c dhcp-print.c Log Message: Rename dhcp_option to dhcp_option_t. Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** TODO 11 Jun 2002 02:10:32 -0000 1.23 --- TODO 11 Jun 2002 03:06:39 -0000 1.24 *************** *** 51,55 **** -- add a isascii() and a strcasecmp() for portability - -- dhcp_option should be called dhcp_option_t -- rawnet_is_valid needs more checks. --- 51,54 ---- Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** dhcp-agent.h 11 Jun 2002 01:50:27 -0000 1.54 --- dhcp-agent.h 11 Jun 2002 03:06:39 -0000 1.55 *************** *** 216,220 **** unsigned char len; unsigned char *data; ! } dhcp_option; /* DHCP object * --- 216,220 ---- unsigned char len; unsigned char *data; ! } dhcp_option_t; /* DHCP object * *************** *** 647,654 **** extern void dhcp_reset_option_seek(dhcp_obj *dhcp); ! extern dhcp_option *dhcp_get_next_option(dhcp_obj *dhcp); ! extern dhcp_option *create_dhcp_option(const unsigned char *opt_data, unsigned char len, unsigned char tag); ! extern void destroy_dhcp_option(dhcp_option *option); extern uint16_t dhcp_get_options_len(list_t *options); extern int dhcp_valid_magic_cookie(dhcp_obj *dhcp); --- 647,654 ---- extern void dhcp_reset_option_seek(dhcp_obj *dhcp); ! extern dhcp_option_t *dhcp_get_next_option(dhcp_obj *dhcp); ! extern dhcp_option_t *create_dhcp_option(const unsigned char *opt_data, unsigned char len, unsigned char tag); ! extern void destroy_dhcp_option(dhcp_option_t *option); extern uint16_t dhcp_get_options_len(list_t *options); extern int dhcp_valid_magic_cookie(dhcp_obj *dhcp); *************** *** 660,670 **** extern int dhcp_is_sname_overload(dhcp_obj *dhcp); ! extern dhcp_option *dhcp_build_parameter_request_list_option(unsigned char *requested_options); ! extern dhcp_option *dhcp_build_max_message_size_option(uint16_t max); ! extern dhcp_option *dhcp_build_message_type(unsigned char type); ! extern dhcp_option *dhcp_build_class_id(unsigned char *class_id); ! extern dhcp_option *dhcp_build_client_id(unsigned char *client_id, unsigned char len); ! extern dhcp_option *dhcp_build_requested_ip_address(uint32_t address); ! extern dhcp_option *dhcp_build_server_identifier(uint32_t address); extern uint32_t dhcp_gen_xid(void); --- 660,670 ---- extern int dhcp_is_sname_overload(dhcp_obj *dhcp); ! extern dhcp_option_t *dhcp_build_parameter_request_list_option(unsigned char *requested_options); ! extern dhcp_option_t *dhcp_build_max_message_size_option(uint16_t max); ! extern dhcp_option_t *dhcp_build_message_type(unsigned char type); ! extern dhcp_option_t *dhcp_build_class_id(unsigned char *class_id); ! extern dhcp_option_t *dhcp_build_client_id(unsigned char *client_id, unsigned char len); ! extern dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address); ! extern dhcp_option_t *dhcp_build_server_identifier(uint32_t address); extern uint32_t dhcp_gen_xid(void); Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-cache.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-client-cache.c 6 Jun 2002 23:59:00 -0000 1.9 --- dhcp-client-cache.c 11 Jun 2002 03:06:39 -0000 1.10 *************** *** 167,171 **** { void *data; ! dhcp_option *opt; unsigned char len; --- 167,171 ---- { void *data; ! dhcp_option_t *opt; unsigned char len; *************** *** 237,241 **** char *name; char *val; ! dhcp_option *opt; name = get_fname_tmp(cc); --- 237,241 ---- char *name; char *val; ! dhcp_option_t *opt; name = get_fname_tmp(cc); Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dhcp-client-states.c 6 Jun 2002 23:59:00 -0000 1.22 --- dhcp-client-states.c 11 Jun 2002 03:06:39 -0000 1.23 *************** *** 57,61 **** { list_t *options = NULL; ! dhcp_option *option; if(opts != NULL) { --- 57,61 ---- { list_t *options = NULL; ! dhcp_option_t *option; if(opts != NULL) { Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-com.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-com.c 6 Jun 2002 23:59:00 -0000 1.6 --- dhcp-com.c 11 Jun 2002 03:06:39 -0000 1.7 *************** *** 47,51 **** { list_t *list_ptr, *tmp; ! dhcp_option *option; /* Free up options. */ --- 47,51 ---- { list_t *list_ptr, *tmp; ! dhcp_option_t *option; /* Free up options. */ *************** *** 92,100 **** /* create option. */ ! dhcp_option *create_dhcp_option(const unsigned char *opt_data, unsigned char len, unsigned char tag) { ! dhcp_option *option; ! option = xmalloc(sizeof(dhcp_option)); option->tag = tag; option->len = len; --- 92,100 ---- /* create option. */ ! dhcp_option_t *create_dhcp_option(const unsigned char *opt_data, unsigned char len, unsigned char tag) { ! dhcp_option_t *option; ! option = xmalloc(sizeof(dhcp_option_t)); option->tag = tag; option->len = len; *************** *** 107,111 **** /* destroy dhcp option. */ ! void destroy_dhcp_option(dhcp_option *option) { xfree(option->data); --- 107,111 ---- /* destroy dhcp option. */ ! void destroy_dhcp_option(dhcp_option_t *option) { xfree(option->data); *************** *** 116,123 **** /* copy DHCP option safely. */ ! static dhcp_option *process_next_dhcp_option(const unsigned char *opt_data, int len, unsigned char *optlen) { ! dhcp_option *option; /* Check for malformed option. */ --- 116,123 ---- /* copy DHCP option safely. */ ! static dhcp_option_t *process_next_dhcp_option(const unsigned char *opt_data, int len, unsigned char *optlen) { ! dhcp_option_t *option; /* Check for malformed option. */ *************** *** 136,140 **** { unsigned char optlen; ! dhcp_option *option; /* Try and copy all the options. --- 136,140 ---- { unsigned char optlen; ! dhcp_option_t *option; /* Try and copy all the options. *************** *** 332,338 **** /* Return the next option or NULL if at the end. */ ! dhcp_option *dhcp_get_next_option(dhcp_obj *dhcp) { ! dhcp_option *rval; if(dhcp->options_seek == NULL) --- 332,338 ---- /* Return the next option or NULL if at the end. */ ! dhcp_option_t *dhcp_get_next_option(dhcp_obj *dhcp) { ! dhcp_option_t *rval; if(dhcp->options_seek == NULL) *************** *** 362,366 **** int dhcp_is_type(dhcp_obj *dhcp, unsigned char type) { ! dhcp_option *opt; dhcp_reset_option_seek(dhcp); --- 362,366 ---- int dhcp_is_type(dhcp_obj *dhcp, unsigned char type) { ! dhcp_option_t *opt; dhcp_reset_option_seek(dhcp); *************** *** 394,398 **** int dhcp_have_option(dhcp_obj *dhcp, unsigned char tag) { ! dhcp_option *option; /* Check for a option by tag. */ --- 394,398 ---- int dhcp_have_option(dhcp_obj *dhcp, unsigned char tag) { ! dhcp_option_t *option; /* Check for a option by tag. */ *************** *** 410,414 **** static unsigned char dhcp_get_overload_option(dhcp_obj *dhcp) { ! dhcp_option *option; dhcp_reset_option_seek(dhcp); --- 410,414 ---- static unsigned char dhcp_get_overload_option(dhcp_obj *dhcp) { ! dhcp_option_t *option; dhcp_reset_option_seek(dhcp); *************** *** 474,478 **** uint16_t len = 0; list_t *opts; ! dhcp_option *opt; int padding; --- 474,478 ---- uint16_t len = 0; list_t *opts; ! dhcp_option_t *opt; int padding; *************** *** 493,501 **** /* accept bit array telling us which options to build the request option. */ ! dhcp_option *dhcp_build_parameter_request_list_option(unsigned char *requested_options) { unsigned char i, j; unsigned char len = 0; ! dhcp_option *option; /* Grab length so we can just malloc all at once. */ --- 493,501 ---- /* accept bit array telling us which options to build the request option. */ ! dhcp_option_t *dhcp_build_parameter_request_list_option(unsigned char *requested_options) { unsigned char i, j; unsigned char len = 0; ! dhcp_option_t *option; /* Grab length so we can just malloc all at once. */ *************** *** 510,514 **** } ! option = xmalloc(sizeof(dhcp_option)); option->len = len; option->tag = TAG_PARAMETERS; --- 510,514 ---- } ! option = xmalloc(sizeof(dhcp_option_t)); option->len = len; option->tag = TAG_PARAMETERS; *************** *** 526,530 **** } ! dhcp_option *dhcp_build_max_message_size_option(uint16_t max) { max = htons(max); --- 526,530 ---- } ! dhcp_option_t *dhcp_build_max_message_size_option(uint16_t max) { max = htons(max); *************** *** 532,541 **** } ! dhcp_option *dhcp_build_message_type(unsigned char type) { return(create_dhcp_option((unsigned char *)&type, sizeof(unsigned char), TAG_DHCP_MESSAGE_TYPE)); } ! dhcp_option *dhcp_build_class_id(unsigned char *class_id) { unsigned char len = strlen(class_id); --- 532,541 ---- } ! dhcp_option_t *dhcp_build_message_type(unsigned char type) { return(create_dhcp_option((unsigned char *)&type, sizeof(unsigned char), TAG_DHCP_MESSAGE_TYPE)); } ! dhcp_option_t *dhcp_build_class_id(unsigned char *class_id) { unsigned char len = strlen(class_id); *************** *** 543,557 **** } ! dhcp_option *dhcp_build_client_id(unsigned char *client_id, unsigned char len) { return(create_dhcp_option(client_id, len, TAG_DHCP_CLIENT_ID)); } ! dhcp_option *dhcp_build_requested_ip_address(uint32_t address) { return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_REQUEST_IP_ADDRESS)); } ! dhcp_option *dhcp_build_server_identifier(uint32_t address) { return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_SERVER_IDENTIFIER)); --- 543,557 ---- } ! dhcp_option_t *dhcp_build_client_id(unsigned char *client_id, unsigned char len) { return(create_dhcp_option(client_id, len, TAG_DHCP_CLIENT_ID)); } ! dhcp_option_t *dhcp_build_requested_ip_address(uint32_t address) { return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_REQUEST_IP_ADDRESS)); } ! dhcp_option_t *dhcp_build_server_identifier(uint32_t address) { return(create_dhcp_option((unsigned char *)&address, IP_ADDR_LEN, TAG_DHCP_SERVER_IDENTIFIER)); *************** *** 694,698 **** void dhcp_write_options(dhcp_obj *dhcp, unsigned char *packet) { ! dhcp_option *option; int padding, len = 0; --- 694,698 ---- void dhcp_write_options(dhcp_obj *dhcp, unsigned char *packet) { ! dhcp_option_t *option; int padding, len = 0; Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-print.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-print.c 6 Jun 2002 23:59:00 -0000 1.5 --- dhcp-print.c 11 Jun 2002 03:06:39 -0000 1.6 *************** *** 571,575 **** void print_options_verbose(dhcp_obj *dhcp) { ! dhcp_option *option; unsigned char tag; int print_val; --- 571,575 ---- void print_options_verbose(dhcp_obj *dhcp) { ! dhcp_option_t *option; unsigned char tag; int print_val; |
From: <act...@us...> - 2002-06-11 02:10:35
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv16798 Modified Files: Makefile.am Makefile.in TODO Added Files: dhcp-stringbuffer.c dhcp-stringbuffer.h Log Message: added stringbuffer object -- need to use this extensively in exception stack --- NEW FILE: dhcp-stringbuffer.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.c,v 1.1 2002/06/11 02:10:32 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. * */ #include <dhcp-agent.h> #include <dhcp-stringbuffer.h> /* create a new stringbuffer */ stringbuffer *make_stringbuffer(void) { stringbuffer *sb; sb = malloc(sizeof(stringbuffer)); sb->len = 0; sb->capacity = 0; sb->buf = malloc(sizeof(char) * 1); sb->buf[0] = 0; return sb; } /* destroy the stringbuffer */ void destroy_stringbuffer(stringbuffer *sb) { free(sb->buf); free(sb); } /* append string to stringbuffer */ void stringbuffer_append(stringbuffer *sb, char *s) { int len = strlen(s); sb->len += len; if(sb->capacity < sb->len) { sb->buf = realloc(sb->buf, sizeof(char) * (sb->len + 1)); sb->capacity = sb->len; } strcat(sb->buf, s); sb->buf[sb->len] = 0; } /* remove whitespace */ stringbuffer *stringbuffer_trim_whitespace(stringbuffer *sb) { char *ptr, *curptr; char *end, *begin; char *newbuf; if(sb->len == 0) /* empty string. */ return sb; /* create a new string */ newbuf = malloc(sizeof(sb->len + 1) * sizeof(char)); for(begin = &sb->buf[0]; *begin != '\0' && (*begin == ' ' || *begin == '\t'); begin++); if(*begin != '\0') { /* we do have whitespace in the beginning so find the end. */ for(end = &sb->buf[sb->len -1]; *end == ' ' || *end == '\t'; end--); if(end == begin) { /* all spaces! */ /* zip this string to nothing */ destroy_stringbuffer(sb); free(newbuf); return make_stringbuffer(); } else { /* there's something in between. * copy out. */ ptr = newbuf; for(curptr = begin;curptr != end;curptr++) { *ptr = *curptr; ptr++; } *ptr = 0; free(sb->buf); sb->buf = newbuf; } } else { /* zap beginning of string. since its all whitespace. */ free(newbuf); sb->buf[0] = 0; sb->len = 0; } return sb; } /* get the last occurance of a specific character. useful for slicing. */ char *stringbuffer_get_last_occurance(stringbuffer *sb, char c) { char *ptr, *ptrend = NULL; ptr = sb->buf; while((ptr = strchr(ptr, '\n')) != NULL) { ptrend = ptr; ptr++; } return ptrend; } /* remove the last newline character. */ void stringbuffer_trim_newline(stringbuffer *sb) { char *ptr; ptr = stringbuffer_get_last_occurance(sb, '\n'); if(ptr != NULL) *ptr = 0; ptr = stringbuffer_get_last_occurance(sb, '\r'); if(ptr != NULL) *ptr = 0; sb->len = strlen(sb->buf); return; } /* return the C string from the buffer. */ const char *stringbuffer_getstring(stringbuffer *sb) { return sb->buf; } --- NEW FILE: dhcp-stringbuffer.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-stringbuffer.h,v 1.1 2002/06/11 02:10:32 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_STRINGBUFFER_H #define DHCP_STRINGBUFFER_H /* string buffer object. */ typedef struct { int len; int capacity; char *buf; } stringbuffer; extern stringbuffer *make_stringbuffer(void); extern void destroy_stringbuffer(stringbuffer *sb); extern void stringbuffer_append(stringbuffer *sb, char *s); extern stringbuffer *stringbuffer_trim_whitespace(stringbuffer *sb); extern char *stringbuffer_get_last_occurance(stringbuffer *sb, char c); extern void stringbuffer_trim_newline(stringbuffer *sb); extern const char *stringbuffer_getstring(stringbuffer *sb); #endif /* DHCP_STRINGBUFFER_H */ Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Makefile.am 25 May 2002 14:02:29 -0000 1.17 --- Makefile.am 11 Jun 2002 02:10:32 -0000 1.18 *************** *** 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@ --- 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 dhcp-stringbuffer.c dhcpclient_LDADD = @PCAP_LIB@ @DNET_LIB@ Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Makefile.in 25 May 2002 14:02:29 -0000 1.17 --- Makefile.in 11 Jun 2002 02:10:32 -0000 1.18 *************** *** 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 --- 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 dhcp-stringbuffer.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 dhcp-globconf.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 dhcp-stringbuffer.o dhcpclient_DEPENDENCIES = dhcpclient_LDFLAGS = *************** *** 148,153 **** .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) --- 148,154 ---- .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-stringbuffer.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.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** TODO 11 Jun 2002 02:05:52 -0000 1.22 --- TODO 11 Jun 2002 02:10:32 -0000 1.23 *************** *** 88,89 **** --- 88,91 ---- -- dhcpsniff needs as brief mode as well as some fixes to its current output (timestamps aren't looking too good) + -- get stringbuffer used in places where strings are being manipulated + heavily. |
From: <act...@us...> - 2002-06-11 02:06:02
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv15702 Modified Files: TODO dhcp-client.c Log Message: fix to make -v (version) work :) Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** TODO 11 Jun 2002 01:50:27 -0000 1.21 --- TODO 11 Jun 2002 02:05:52 -0000 1.22 *************** *** 85,87 **** -- the rawnet routines should be a shared library due to too many dependencies. the sniffer for example, only needs the packet ! parsing routines. --- 85,89 ---- -- the rawnet routines should be a shared library due to too many dependencies. the sniffer for example, only needs the packet ! parsing routines. ! -- dhcpsniff needs as brief mode as well as some fixes to its ! current output (timestamps aren't looking too good) Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** dhcp-client.c 11 Jun 2002 01:50:27 -0000 1.25 --- dhcp-client.c 11 Jun 2002 02:05:52 -0000 1.26 *************** *** 519,526 **** do_change_work_dir(); - if(interface == NULL) /* get interface if not specified. */ - interface = get_interface[command_code](); ! if(interface == NULL) {/* if we were unable to attain an interface. */ error_message("unable to retrieve suitable interface"); error_message("for this operation: %s", command_string[command_code]); --- 519,531 ---- do_change_work_dir(); ! /* get interface if not specified. */ ! if(interface == NULL) { ! if(get_interface[command_code] != NULL) ! interface = get_interface[command_code](); ! } ! ! if(interface == NULL && command_code != DO_VERSION) { ! /* if we were unable to attain an interface. */ error_message("unable to retrieve suitable interface"); error_message("for this operation: %s", command_string[command_code]); |
From: <act...@us...> - 2002-06-11 01:58:56
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv13857 Modified Files: acinclude.m4 aclocal.m4 configure Log Message: rebuilt script, and fixed minor typo in acinclude Index: acinclude.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acinclude.m4,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** acinclude.m4 11 Jun 2002 01:50:27 -0000 1.7 --- acinclude.m4 11 Jun 2002 01:58:53 -0000 1.8 *************** *** 156,160 **** AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, ! [AC_MSG_CHECKING('if kill(0, pid) can be used to detect a process) AC_TRY_RUN([ /* Check the behaviour of kill(pid, 0). --- 156,160 ---- AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, ! [AC_MSG_CHECKING(if kill(0, pid) can be used to detect a process) AC_TRY_RUN([ /* Check the behaviour of kill(pid, 0). Index: aclocal.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/aclocal.m4,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** aclocal.m4 11 Jun 2002 01:50:27 -0000 1.7 --- aclocal.m4 11 Jun 2002 01:58:53 -0000 1.8 *************** *** 168,172 **** AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, ! [AC_MSG_CHECKING('if kill(0, pid) can be used to detect a process) AC_TRY_RUN([ /* Check the behaviour of kill(pid, 0). --- 168,172 ---- AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, ! [AC_MSG_CHECKING(if kill(0, pid) can be used to detect a process) AC_TRY_RUN([ /* Check the behaviour of kill(pid, 0). Index: configure =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** configure 10 Jun 2002 23:15:20 -0000 1.19 --- configure 11 Jun 2002 01:58:53 -0000 1.20 *************** *** 1,5 **** #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated by Autoconf 2.52 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.50 for dhcp-agent 0.36. # [...3162 lines suppressed...] { (exit 1); exit 1; }; } --- 3806,3810 ---- else # /dev/null tree ! { { echo "$as_me:3808: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } *************** *** 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 --- 3923,3927 ---- if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then ! { echo "$as_me:3925: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else |
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv11220 Modified Files: THANKS TODO acinclude.m4 aclocal.m4 configure.in dhcp-agent.h dhcp-client.c dhcp-interface.c Log Message: revamped dhcp-client.c to be able to retrieve interfaces automatically; changed message in kill(0,pid) test; added more to dhcp-interface.c; added more to TODO list; Index: THANKS =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/THANKS,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** THANKS 6 Jun 2002 23:59:00 -0000 1.7 --- THANKS 11 Jun 2002 01:50:27 -0000 1.8 *************** *** 16,19 **** -- Bill Traynor for Solaris x86. ! -- Brian J. Kifiak for OpenBSD help/testing and helpful suggestions. ! --- 16,18 ---- -- Bill Traynor for Solaris x86. ! -- Brian J. Kifiak for assisting in development. Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** TODO 6 Jun 2002 03:25:04 -0000 1.20 --- TODO 11 Jun 2002 01:50:27 -0000 1.21 *************** *** 6,15 **** extend over 255 octets) major todos: ! -- make dhcpclient relay agent friendly. -- write dhcpserver -- write dhcpstat -- write dhcpdiscover other todo: --- 6,24 ---- extend over 255 octets) + probably many more to come once the rest of the todos are + complete. currently the client seems to be behaving properly. + major todos: ! -- make dhcpclient relay agent friendly ! -- check rfcs for any catch 22s -- write dhcpserver + -- need a seperate machine to do proper testing. -- write dhcpstat + a command line utility to perform pretty output on + the dhcp client's cache and status. -- write dhcpdiscover + a scanner to output information on servers/relay agents + responding other todo: *************** *** 21,36 **** -- check for duplicates in configure.in and compress them (for example -I and -L flags should not be repeated.) -- add cleanup handlers to down routes, interfaces, etc. ! -- good idea to add config file handlers in sysconf array so ! config files can be handled. instead of doing it explicitly. ! -- proper error handling in packet objects. possibly generic codes with ! an error buff (?). -- add a isascii() and a strcasecmp() for portability - -- redo dhcp-client-conf to be better. -- dhcp_option should be called dhcp_option_t -- rawnet_is_valid needs more checks. -- client_discover_offer() should update its timeout when receiving unwanted packets. -- implement decline, and inform in the client. -- add check in validate_to_string for conformity with DHCP RFC on character set. --- 30,75 ---- -- check for duplicates in configure.in and compress them (for example -I and -L flags should not be repeated.) + -- add cleanup handlers to down routes, interfaces, etc. ! dhcp-sysconf needs to be redone to allow the following: ! ! * configure an option for the system. ! * register a routine to be run after the initial ! configuration is done -- ! useful for copying files around or delaying ! a certain setting till an earlier one is complete. ! * clean up the option for the system. ! useful for deleting or removing settings ! which are persistant (config files no longer valid) ! ! * add ability to run external program with option string ! passed to it via exec() ! ! * add special minimalist shell which has few and well defined ! metacharacters called dhcpsysconf. and allow system configuration ! to be done through it. ! -- add a isascii() and a strcasecmp() for portability -- dhcp_option should be called dhcp_option_t -- rawnet_is_valid needs more checks. + + * actually this needs to be reviewed more carefully. + we're currently using a lot of validity checks + in many places which is good, but they should all be + complete in their own domain. these domains need to be + defined. + -- client_discover_offer() should update its timeout when receiving unwanted packets. + + the rawnet_transact() routine should be replaced with something + that is more flexible in timing out while not even considering + invalid packets. Mayhaps reading the next packet could be done + with a high level filter. + -- implement decline, and inform in the client. + + as per RFC2131 + -- add check in validate_to_string for conformity with DHCP RFC on character set. *************** *** 41,48 **** -- be nice to servers. sort the list according to option tag value. the highest value first seems about right. - -- current rule is to malloc to keep local copies in each - data structure/module. this isn't too effecient. - clean up in areas where it seems prudent. or come up - with guidelines we can stick to. -- rawnet and the dhcp client control are foobared by a fake mac address. check, fix, clean. --- 80,83 ---- Index: acinclude.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/acinclude.m4,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** acinclude.m4 10 Jun 2002 23:15:20 -0000 1.6 --- acinclude.m4 11 Jun 2002 01:50:27 -0000 1.7 *************** *** 156,160 **** 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). --- 156,160 ---- AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, ! [AC_MSG_CHECKING('if kill(0, pid) can be used to detect a process) AC_TRY_RUN([ /* Check the behaviour of kill(pid, 0). Index: aclocal.m4 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/aclocal.m4,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** aclocal.m4 10 Jun 2002 23:15:20 -0000 1.6 --- aclocal.m4 11 Jun 2002 01:50:27 -0000 1.7 *************** *** 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, --- 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, *************** *** 168,172 **** 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). --- 168,172 ---- AC_DEFUN(AC_WF_CHECK_KILL_SIGNAL_DETECT, ! [AC_MSG_CHECKING('if kill(0, pid) can be used to detect a process) AC_TRY_RUN([ /* Check the behaviour of kill(pid, 0). *************** *** 225,229 **** 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] *************** *** 253,257 **** # ! 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 *************** *** 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 --- 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 *************** *** 310,314 **** # 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: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** configure.in 10 Jun 2002 23:15:20 -0000 1.19 --- configure.in 11 Jun 2002 01:50:27 -0000 1.20 *************** *** 47,51 **** 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 --- 47,51 ---- AC_SUBST(DHCP_SNPRINTF) ! dnl check if kill(pid, 0) can be used to detect a process AC_WF_CHECK_KILL_SIGNAL_DETECT Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** dhcp-agent.h 8 Jun 2002 17:35:02 -0000 1.53 --- dhcp-agent.h 11 Jun 2002 01:50:27 -0000 1.54 *************** *** 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 */ --- 820,825 ---- 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_active_interfaces(void); ! extern list_t *interface_get_inactive_interfaces(void); /* client states */ Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dhcp-client.c 8 Jun 2002 06:00:32 -0000 1.24 --- dhcp-client.c 11 Jun 2002 01:50:27 -0000 1.25 *************** *** 28,31 **** --- 28,82 ---- #include <dhcp-files.h> + /* client command codes: index to command array */ + + #define DO_VERSION 0 + #define DO_KILL 1 + #define DO_WAKE 2 + #define DO_CLEAR 3 + #define DO_CLIENT 4 + + const char *command_string[] = { + "version", "kill", + "wake", "clear", "client" + }; + + typedef void (*client_command)(char *interface); + typedef char *(*interface_lister)(void); + + /* forward declarations of do_ routines. */ + + static void do_version(char *interface); + static void do_kill_client(char *interface); + static void do_wake_client(char *interface); + static void do_clear_cache(char *interface); + static void do_client(char *interface); + + /* table of functions indexed by command codes. */ + client_command commands[] = { + do_version, /* print out version information. */ + do_kill_client, /* kill client. */ + do_wake_client, /* wake client. */ + do_clear_cache, /* clear cache. */ + do_client, /* initialize and run client. */ + }; + + /* forward declaration for interface routines. */ + static char *interface_get_active(void); + static char *interface_get_inactive(void); + + /* Our get interface sister routine. + Different command codes will want + to select interface on different + criteria. We use this to manage it. */ + + interface_lister get_interface[] = { + NULL, /* version output needs nothing. */ + interface_get_active, /* kill client. */ + interface_get_active, /* wake client. */ + interface_get_active, /* clear cache. */ + interface_get_inactive, /* run client. */ + }; + + /* global vars affecting other code. */ int interactive = 1; /* by default we begin interactive (messages on stdout/stderr). */ char *work_dir = CLIENT_WORK_DIR; /* our default working directory */ *************** *** 35,38 **** --- 86,97 ---- #endif /* HAVE_PROGNAME */ + /* local vars for dhcpclient. */ + static char *interface = NULL; /* the interface we're concerned with. */ + static unsigned char want_background = 1; /* whether we should go into the background. */ + static char *fake_hw_addr = NULL; /* if using fake hardware address set here. */ + static int promiscuous = 0; /* whether or not we're running in promiscious mode. */ + + /* Utility routines. */ + /* read up on our global conf. */ static void read_global_conf(const char *interface) *************** *** 47,50 **** --- 106,131 ---- } + /* initialize state per contents of cache. */ + static int initialize_client_state(dhcp_client_control_t *dc) + { + if(client_cache_is_empty(dc->cache)) { + return STATE_DISCOVER_OFFER; + } else /* if not empty we assume we can request the options. */ + return STATE_REQUEST_ACK; + } + + /* print usage info. */ + static void usage(char *s) + { + printf("usage: %s [-cavkw] [-d directory] [-i interface name] [ -m mac address ]\n", s); + exit(0); + } + + /* print out version information and exit. */ + static void do_version(char *interface) + { + info_message("%s version: %s\n", getprogname(), VERSION); + } + /* do a graceful shutdown. */ static void do_shutdown(dhcp_client_control_t *dc) *************** *** 61,90 **** } ! /* ! * Our initialize client state function. ! * We can be in two states. ! * ! * The discover/offer state, or we can ! * be in the request state where we ! * already have a configuration. ! * ! * We always ask for configuration info on ! * startup so we can't begin in any other ! * state except these two. ! */ ! static int initialize_client_state(dhcp_client_control_t *dc) { ! if(client_cache_is_empty(dc->cache)) { ! return STATE_DISCOVER_OFFER; ! } else /* if not empty we assume we can request the options. */ ! return STATE_REQUEST_ACK; } ! /* print usage info. */ ! static void usage(char *s) { ! printf("usage: %s [-cavkw] [-d directory] [-i interface name] [ -m mac address ]\n", s); ! exit(0); } --- 142,197 ---- } ! /* check for existing client. */ ! static int client_process_exists(char *interface) ! { ! pid_t pid; ! if(!get_pid_file(interface, &pid)) ! return 0; /* no pid file -- therefore no process. */ ! ! #if !defined(KILL_SIGNAL_DETECT) ! ! /* if we can't detect it assume it is up since the PID file exists :| ! * issue warning though. */ ! warn_message("%s PID file exists please delete and kill process.", getprogname()); ! return 0; ! ! #else ! if(!kill(pid, 0)) ! return 1; ! else { ! delete_pid_file(interface); ! return 0; ! } ! #endif ! ! } ! ! static char *interface_get_proc(int active) { ! char *first_interface; ! list_t *interface_list; ! ! if(active) ! interface_list = interface_get_active_interfaces(); ! else ! interface_list = interface_get_inactive_interfaces(); ! ! if(interface_list == NULL) ! return NULL; ! ! first_interface = strdup(interface_list->data); ! purge_list(interface_list, NULL); ! return first_interface; } ! static char *interface_get_active(void) { ! return(interface_get_proc(1)); ! } ! ! static char *interface_get_inactive(void) ! { ! return(interface_get_proc(0)); } *************** *** 156,161 **** pid_t pid; if(get_pid_file(interface, &pid)) { ! error_message("could not get dhcpclient PID."); error_message("maybe it's not running?"); return; --- 263,270 ---- pid_t pid; + info_message("killing %s running on interface: %s", getprogname(), interface); + if(get_pid_file(interface, &pid)) { ! error_message("could not get %s PID.", getprogname()); error_message("maybe it's not running?"); return; *************** *** 163,167 **** if(kill(pid, SIGTERM) < 0) { ! error_message("could not send signal to dhcpclient process."); error_message("maybe it's not running?"); return; --- 272,276 ---- if(kill(pid, SIGTERM) < 0) { ! error_message("could not send signal to %s process.", getprogname()); error_message("maybe it's not running?"); return; *************** *** 178,182 **** if(get_pid_file(interface, &pid)) { ! error_message("could not get dhcpclient PID."); error_message("maybe it's not running?"); return; --- 287,291 ---- if(get_pid_file(interface, &pid)) { ! error_message("could not get %s PID.", getprogname()); error_message("maybe it's not running?"); return; *************** *** 184,188 **** if(kill(pid, SIGALRM) < 0) { ! error_message("could not send signal to dhcpclient process."); error_message("maybe it's not running?"); return; --- 293,297 ---- if(kill(pid, SIGALRM) < 0) { ! error_message("could not send signal to %s process.", getprogname()); error_message("maybe it's not running?"); return; *************** *** 202,207 **** /* A race condition exists between the discover and request state. * And we can't hup the client and tell it the cache has been deleted. */ ! error_message("dhcpclient already running."); ! error_message("i won't delete cache until it's shutdown."); return; } --- 311,316 ---- /* A race condition exists between the discover and request state. * And we can't hup the client and tell it the cache has been deleted. */ ! error_message("%s already running.", getprogname()); ! error_message("I won't delete cache until it's shutdown."); return; } *************** *** 227,324 **** } ! /* check for existing client. */ ! static int client_process_exists(char *interface) ! { ! pid_t pid; ! ! if(!get_pid_file(interface, &pid) && ! !kill(pid, 0)) { /* FIXME: add test to make sure 0 works. */ ! return 1; ! } else { ! delete_pid_file(interface); ! return 0; ! } ! } ! ! int main(int argc, char *argv[]) { - int c; - dhcp_client_control_t *dc; - char *interface = "eth0"; - int state; - unsigned char want_background = 1; - char *fake_hw_addr = NULL; - int promiscuous = 0; - - #if !defined(HAVE_PROGNAME) - __progname = argv[0]; - #endif /* HAVE_PROGNAME */ - - while((c = getopt(argc, argv, "gcdavi:m:kwh:l:")) != -1) { - - switch(c) { - - case 'v': - printf("%s version: %s\n", getprogname(), VERSION); - exit(0); - - case 'd': - work_dir = strdup(optarg); - break; - - case 'a': - want_background = 0; - break; - - case 'i': - printf("%s\n",optarg); - interface = strdup(optarg); - break; - - case 'm': - fake_hw_addr = strdup(optarg); - break; - - case 'k': /* kill client. */ - chdir(work_dir); - do_kill_client(interface); - exit(0); - - case 'w': /* wake client. */ - chdir(work_dir); - do_wake_client(interface); - exit(0); - - case 'c': - chdir(work_dir); - do_clear_cache(interface); - exit(0); - - case 'l': - - if(set_verbosity_level(atoi(optarg))) { - error_message("illegal verbosity level: %s", optarg); - exit(1); - } - - break; - - case 'p': - - promiscuous = 1; - break; - - case 'h': /* fall through. */ - default: - usage(argv[0]); - break; - } - } - - info_message("(C) 2001 Thamer Al-Harbash <tm...@wh...>"); - info_message("See LICENSE file for details."); - info_message(" "); - info_message("starting for interface %s", interface); - /* Switch into our work directory */ --- 336,341 ---- } ! static void do_change_work_dir(void) { /* Switch into our work directory */ *************** *** 340,343 **** --- 357,370 ---- } + return; + } + + static void do_client(char *interface) + { + dhcp_client_control_t *dc; + int state; + + info_message("starting for interface %s", interface); + /* We need to read our global configuration right after we change to work directory. */ read_global_conf(interface); *************** *** 418,419 **** --- 445,534 ---- exit(0); /* should never get here. */ } + + int main(int argc, char *argv[]) + { + int c, command_code = DO_CLIENT; + + #if !defined(HAVE_PROGNAME) + __progname = argv[0]; + #endif /* HAVE_PROGNAME */ + + info_message("(C) 2001 Thamer Al-Harbash <tm...@wh...>"); + info_message("See LICENSE file for details."); + info_message(" "); + + while((c = getopt(argc, argv, "gcdavi:m:kwh:l:")) != -1) { + + switch(c) { + + /* check for command codes. */ + case 'v': /* print version. */ + command_code = DO_VERSION; + break; + + case 'k': /* kill client. */ + command_code = DO_KILL; + break; + + case 'w': /* wake client. */ + command_code = DO_WAKE; + break; + + case 'c': /* clear up cache. */ + command_code = DO_CLEAR; + break; + + case 'd': + work_dir = strdup(optarg); + break; + + /* setup options. */ + + case 'a': + want_background = 0; + break; + + case 'i': + interface = strdup(optarg); + break; + + case 'm': + fake_hw_addr = strdup(optarg); + break; + + case 'l': + + if(set_verbosity_level(atoi(optarg))) { + error_message("illegal verbosity level: %s", optarg); + exit(1); + } + + break; + + case 'p': + promiscuous = 1; + break; + + case 'h': /* fall through. */ + default: + usage(argv[0]); + break; + } + } + + do_change_work_dir(); + + if(interface == NULL) /* get interface if not specified. */ + interface = get_interface[command_code](); + + if(interface == NULL) {/* if we were unable to attain an interface. */ + error_message("unable to retrieve suitable interface"); + error_message("for this operation: %s", command_string[command_code]); + exit(1); /* can't use fatal_error for multiline error message. */ + /* fixme: this stupidity will go with exception stack. */ + } + + commands[command_code](interface); + exit(0); + } + Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-interface.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-interface.c 8 Jun 2002 17:35:02 -0000 1.16 --- dhcp-interface.c 11 Jun 2002 01:50:28 -0000 1.17 *************** *** 143,162 **** } ! /* 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) { --- 143,150 ---- } ! /* utility check function for looping on interface list. ! * check whether is down or does not have an IP assigned to it. */ ! static int check_interface_down(const struct intf_entry *entry) { if(entry->intf_type == INTF_TYPE_ETH) { *************** *** 165,185 **** || (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(); --- 153,206 ---- || (entry->intf_addr.addr_type == ADDR_TYPE_NONE)) /* or true if no address set. */ ! return 1; } ! return 0; ! } ! /* utility check function for looping on interface list. ! * check whether is down or does not have an IP assigned to it. */ ! static int check_interface_up(const struct intf_entry *entry) ! { ! ! if(entry->intf_type == INTF_TYPE_ETH && ! (entry->intf_flags&INTF_FLAG_UP)) ! return 1; return 0; } ! /* utility to get interface list and place it in a list. */ ! static int list_interfaces(const struct intf_entry *entry, void *arg) ! { ! list_t *interfaces; ! int (*check)(const struct intf_entry *entry); ! char *intf_name = NULL; ! ! interfaces = arg; ! check = interfaces->data; /* first is always the routine to ! check routine. */ ! ! /* 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(check(entry)) { ! intf_name = strdup(entry->intf_name); ! interfaces = add_to_end_of_list(interfaces, intf_name); ! } ! ! return 0; ! } ! ! static list_t *interfaces_get_proc(int (*check)(const struct intf_entry *entry)) { intf_t *interfaces; ! list_t *interface_list = NULL; ! list_t *returned_list; ! ! /* add check as first datum. */ ! interface_list = add_to_end_of_list(interface_list, check); interfaces = intf_open(); *************** *** 188,202 **** 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; } --- 209,236 ---- 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(interface_list); /* fixme: this isn't really ! * good. we should have a way to destroy a list but not its ! * datums if we want to. */ intf_close(interfaces); return NULL; } ! intf_loop(interfaces, list_interfaces, interface_list); intf_close(interfaces); ! returned_list = interface_list->next; ! xfree(interface_list); ! ! return returned_list; ! } ! ! list_t *interface_get_active_interfaces(void) ! { ! return(interfaces_get_proc(check_interface_up)); ! } ! ! list_t *interface_get_inactive_interfaces(void) ! { ! return(interfaces_get_proc(check_interface_down)); } |