dhcp-agent-commits Mailing List for dhcp-agent (Page 14)
Status: Alpha
Brought to you by:
actmodern
You can subscribe to this list here.
2002 |
Jan
|
Feb
(33) |
Mar
|
Apr
|
May
(19) |
Jun
(61) |
Jul
(12) |
Aug
|
Sep
(5) |
Oct
(31) |
Nov
(24) |
Dec
(56) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(9) |
Feb
|
Mar
(16) |
Apr
(4) |
May
(68) |
Jun
(70) |
Jul
(100) |
Aug
(54) |
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(7) |
Jun
(12) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(8) |
Oct
(5) |
Nov
(6) |
Dec
(4) |
2008 |
Jan
(9) |
Feb
(20) |
Mar
(32) |
Apr
(18) |
May
(19) |
Jun
(12) |
Jul
(23) |
Aug
(7) |
Sep
(15) |
Oct
(22) |
Nov
(50) |
Dec
(68) |
2009 |
Jan
(63) |
Feb
(23) |
Mar
(43) |
Apr
(50) |
May
(110) |
Jun
(103) |
Jul
(71) |
Aug
(26) |
Sep
(16) |
Oct
(31) |
Nov
(8) |
Dec
(13) |
2010 |
Jan
(6) |
Feb
(6) |
Mar
(36) |
Apr
(57) |
May
(67) |
Jun
(70) |
Jul
(44) |
Aug
(46) |
Sep
(27) |
Oct
(2) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: <act...@us...> - 2003-07-06 17:28:25
|
Update of /cvsroot/dhcp-agent/dhcp-agent/doc In directory sc8-pr-cvs1:/tmp/cvs-serv3398/doc Modified Files: dhcp-client.texi introduction.texi Log Message: updated documentation to reflect command line changes; fixed up some wording Index: dhcp-client.texi =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/doc/dhcp-client.texi,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-client.texi 29 Jun 2003 01:33:19 -0000 1.6 --- dhcp-client.texi 6 Jul 2003 17:28:22 -0000 1.7 *************** *** 127,130 **** --- 127,136 ---- @item + -s + + Print out status information on the most recent lease acquired by + the client. + + @item -i @dfn{interface} Index: introduction.texi =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/doc/introduction.texi,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** introduction.texi 5 Jul 2003 18:53:37 -0000 1.5 --- introduction.texi 6 Jul 2003 17:28:22 -0000 1.6 *************** *** 92,96 **** @section System Specific Notes ! @subsection Linux The client under Linux may not be entirely happy when applied to an --- 92,96 ---- @section System Specific Notes ! @subsection GNU/Linux The client under Linux may not be entirely happy when applied to an *************** *** 198,200 **** seconds using the back-off algorithm mentioned above. This algorithm is mentioned in RFC2131 and implemented for compliance. It also makes ! good sense for ethernet networks with high collisions. --- 198,201 ---- seconds using the back-off algorithm mentioned above. This algorithm is mentioned in RFC2131 and implemented for compliance. It also makes ! good sense for ethernet networks that have high collisions or are ! congested enough to have heavy packet loss. |
From: <act...@us...> - 2003-07-06 17:14:46
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv2024/src Modified Files: dhcp-client.c Log Message: fixed multi line string literaly -- argh Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** dhcp-client.c 6 Jul 2003 17:07:48 -0000 1.34 --- dhcp-client.c 6 Jul 2003 17:14:43 -0000 1.35 *************** *** 359,364 **** } else { ! INFO_MESSAGE("This lease has been offered but has not been acquired yet, or the client has not been able to receive an acknowledgement from the ! server yet."); INFO_MESSAGE(" "); client_pretty_print_cache(cache, 1); --- 359,363 ---- } else { ! INFO_MESSAGE("This lease has been offered but has not been acquired yet, or the client has not been able to receive an acknowledgement from the server yet."); INFO_MESSAGE(" "); client_pretty_print_cache(cache, 1); |
From: <act...@us...> - 2003-07-06 17:10:26
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv1662/src Added Files: dhcp-server-defaults.h Log Message: added server defaults --- NEW FILE: dhcp-server-defaults.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-defaults.h,v 1.1 2003/07/06 17:10:23 actmodern Exp $ * * Copyright 2002 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_SERVER_DEFAULTS_H #define DHCP_SERVER_DEFAULTS_H /* default mtu setting: this is only used if the * * interface needs to be brought up (a dumb interface) */ #define SERVER_DEFAULT_MTU 1500 /* Percent of lease time to use as renew by default. */ #define SERVER_DEFAULT_RENEW_PERCENT 50 /* Percent of lease time to use as rebind by default. */ #define SERVER_DEFAULT_REBIND_PERCENT 80 #endif /* DHCP_SERVER_DEFAULTS_H */ |
From: <act...@us...> - 2003-07-06 17:09:01
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv1491 Modified Files: configure.ac Log Message: prettied up output from configure Index: configure.ac =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.ac,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** configure.ac 5 Jul 2003 19:33:27 -0000 1.13 --- configure.ac 6 Jul 2003 17:08:59 -0000 1.14 *************** *** 26,30 **** AC_ARG_ENABLE(fail-on-warning, ! [ --enable-fail-on-warning fail on compiler warning], [case "${enableval}" in yes | y) FAIL_ON_WARNING="yes" ;; --- 26,31 ---- AC_ARG_ENABLE(fail-on-warning, ! AC_HELP_STRING([--enable-fail-on-warning], ! [fail on compiler warning (default is NO)]), [case "${enableval}" in yes | y) FAIL_ON_WARNING="yes" ;; *************** *** 36,40 **** dnl allow user to pick HTML documentation AC_ARG_ENABLE(htmldoc, ! [ --enable-htmldoc Create HTML documentation], [case "${enableval}" in yes) htmldoc=true ;; --- 37,42 ---- dnl allow user to pick HTML documentation AC_ARG_ENABLE(htmldoc, ! AC_HELP_STRING([--enable-htmldoc], ! [generate html documentation (default is NO)]), [case "${enableval}" in yes) htmldoc=true ;; *************** *** 44,47 **** --- 46,51 ---- esac],[htmldoc=false]) AM_CONDITIONAL(HTMLDOC, test x$htmldoc = xtrue) + + dnl allow user to pick where dhcp-agent does its work dnl check for CC, INSTALL, and sane make |
From: <act...@us...> - 2003-07-06 17:07:52
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv1384/src Modified Files: dhcp-client.c Log Message: fixed up getopt to properly handle -h Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** dhcp-client.c 6 Jul 2003 05:34:36 -0000 1.33 --- dhcp-client.c 6 Jul 2003 17:07:48 -0000 1.34 *************** *** 508,512 **** INFO_MESSAGE(" "); ! while((c = getopt(argc, argv, "stpcdavi:m:kwh:l:H:")) != -1) { switch (c) { --- 508,512 ---- INFO_MESSAGE(" "); ! while((c = getopt(argc, argv, "stpcdavi:m:kwhl:")) != -1) { switch (c) { |
From: <act...@us...> - 2003-07-06 05:38:21
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv21292 Modified Files: TODO Log Message: more todo Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** TODO 5 Jul 2003 19:20:57 -0000 1.19 --- TODO 6 Jul 2003 05:38:15 -0000 1.20 *************** *** 60,61 **** --- 60,62 ---- scheme routine to bring it in line with the user setting. + -- make the hostname option settable via the command line. |
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv21226/src Modified Files: dhcp-lease.c dhcp-lease.h dhcp-server-conf.c dhcp-server-conf.h dhcp-server-control.c dhcp-server.c Log Message: more stuff for the server which still doesn't work Index: dhcp-lease.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-lease.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-lease.c 2 Jul 2003 15:23:30 -0000 1.1 --- dhcp-lease.c 6 Jul 2003 05:37:44 -0000 1.2 *************** *** 40,43 **** --- 40,45 ---- lease_constraint_t *constraint = xcalloc(sizeof(lease_constraint_t)); char *hostname; + list_t *address_range; + // ip_addr_t range_top, range_bottom; constraint->constraint_type = constraint_type; *************** *** 54,57 **** --- 56,66 ---- break; + case LEASE_CONSTRAINT_ADDRESS_RANGE: + address_range = data; + + hostname = data; + constraint->data.hostname = xstrdup(hostname); + break; + default: FATAL_MESSAGE("illegal constraint type passed. this is a bug report me."); *************** *** 69,74 **** break; ! case LEASE_CONSTRAINT_HARDWARE_ADDRESS: /* fall through. */ ! case LEASE_CONSTRAINT_NONE: /* fall through. */ default: break; --- 78,84 ---- break; ! case LEASE_CONSTRAINT_ADDRESS_RANGE: /* fall through. */ ! case LEASE_CONSTRAINT_HARDWARE_ADDRESS: /* fall through. */ ! case LEASE_CONSTRAINT_NONE: /* fall through. */ default: break; *************** *** 93,97 **** lease_def->constraint = constraint; ! lease_def->addr_range = ip_addr_range; /* copy our dhcp options we'll pass. */ --- 103,107 ---- lease_def->constraint = constraint; ! // lease_def->addr_range = ip_addr_range; /* copy our dhcp options we'll pass. */ Index: dhcp-lease.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-lease.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-lease.h 2 Jul 2003 15:23:30 -0000 1.1 --- dhcp-lease.h 6 Jul 2003 05:37:44 -0000 1.2 *************** *** 35,38 **** --- 35,42 ---- eth_addr_t hw_address; /* hardware address. */ char *hostname; /* hostname. */ + struct { + ip_addr_t bottom_range; + ip_addr_t top_range; + } range; /* range of addresses. */ } data; *************** *** 44,48 **** lease_constraint_t *constraint; /* constraints if any. */ ! ip_addr_t addr_range; /* address range. */ list_t *options; /* options to be passed. */ --- 48,54 ---- lease_constraint_t *constraint; /* constraints if any. */ ! ip_addr_t addr_net; /* network_address. */ ! ip_addr_t netmask; /* network netmask. */ ! list_t *options; /* options to be passed. */ *************** *** 65,69 **** /* constants. */ ! enum lease_constraint_type { LEASE_CONSTRAINT_NONE = 0, LEASE_CONSTRAINT_HARDWARE_ADDRESS, LEASE_CONSTRAINT_HOSTNAME }; /* prototypes. */ --- 71,75 ---- /* constants. */ ! enum lease_constraint_type { LEASE_CONSTRAINT_NONE = 0, LEASE_CONSTRAINT_HARDWARE_ADDRESS, LEASE_CONSTRAINT_HOSTNAME, LEASE_CONSTRAINT_ADDRESS_RANGE }; /* prototypes. */ Index: dhcp-server-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-server-conf.c 5 Jul 2003 19:17:48 -0000 1.1 --- dhcp-server-conf.c 6 Jul 2003 05:37:44 -0000 1.2 *************** *** 34,37 **** --- 34,38 ---- #include "dhcp-conf-var.h" #include "dhcp-server-conf.h" + #include "dhcp-server-defaults.h" static const char *var_strings[] = { *************** *** 49,52 **** --- 50,57 ---- static const arg_symbol_t *var_arg_symbols[] = { var_symbols, NULL, NULL }; + static const arg_type_t range_lease_arg_types[] = { CONF_IDENTIFIER, CONF_ADDRESS, CONF_ADDRESS, CONF_GROUP}; + static const char **range_lease_arg_strings[] = { var_strings, NULL, NULL }; + static const arg_symbol_t *range_lease_arg_symbols[] = { var_symbols, NULL, NULL }; + /* command structures. */ *************** *** 61,66 **** --- 66,82 ---- }; + /* set command. */ + static const command_t range_lease = { + DIRECTIVE_RANGE_LEASE, + "range-lease", + 4, + range_lease_arg_strings, + range_lease_arg_types, + range_lease_arg_symbols, + }; + static const command_t *commands[] = { &command_set, + &range_lease, NULL, }; *************** *** 68,72 **** /* forward declaration of directive handlers. */ ! static int directive_set_handler(server_conf_t *server_conf, directive_t *directive); /* indexed by directive types in dhcp-client-conf.h . */ --- 84,88 ---- /* forward declaration of directive handlers. */ ! static int directive_set_handler(server_conf_t *server_conf, directive_t *directive, void *group_data); /* indexed by directive types in dhcp-client-conf.h . */ *************** *** 180,184 **** /* read in the compiled directives. */ ! if(directive_handlers[directive->command_code](sc, directive)) return 1; } --- 196,200 ---- /* read in the compiled directives. */ ! if(directive_handlers[directive->command_code](sc, directive, NULL)) return 1; } *************** *** 191,195 **** * * * * * * * * * * * */ ! static int directive_set_handler(server_conf_t *server_conf, directive_t *directive) { list_t *args; --- 207,211 ---- * * * * * * * * * * * */ ! static int directive_set_handler(server_conf_t *server_conf, directive_t *directive, void *group_data) { list_t *args; *************** *** 214,218 **** * * * * * * * * * * */ ! server_conf_t *create_server_conf(const char *interface) { server_conf_t *sc; --- 230,234 ---- * * * * * * * * * * */ ! server_conf_t *server_conf_create(const char *interface) { server_conf_t *sc; *************** *** 221,227 **** sc->interface = interface; sc->conf_file = get_conf_options_fname(interface); ! ! sc->variables = list_create(); sc->lease_defs = list_create(); if(server_conf_load_options(sc)) { --- 237,247 ---- sc->interface = interface; sc->conf_file = get_conf_options_fname(interface); ! ! /* setup lease definitions. */ sc->lease_defs = list_create(); + + /* set defaults. */ + sc->default_rebind_percent = SERVER_DEFAULT_REBIND_PERCENT; + sc->default_renew_percent = SERVER_DEFAULT_RENEW_PERCENT; if(server_conf_load_options(sc)) { Index: dhcp-server-conf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-server-conf.h 5 Jul 2003 19:17:48 -0000 1.1 --- dhcp-server-conf.h 6 Jul 2003 05:37:44 -0000 1.2 *************** *** 30,34 **** typedef struct { - list_t *variables; /* variable settings. */ list_t *lease_defs; /* list of lease definitions. */ --- 30,33 ---- *************** *** 41,54 **** } server_conf_t; ! typedef int (*directive_handler_t)(server_conf_t *server_conf, directive_t *directive_data); /* constants. */ enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT }; ! enum directive_types { DIRECTIVE_SET = 0 }; /* prototypes. */ ! extern server_conf_t *create_server_conf(const char *interface); extern void server_conf_destroy(server_conf_t *sc); --- 40,53 ---- } server_conf_t; ! typedef int (*directive_handler_t)(server_conf_t *server_conf, directive_t *directive_data, void *group_data); /* constants. */ enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT }; ! enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE }; /* prototypes. */ ! extern server_conf_t *server_conf_create(const char *interface); extern void server_conf_destroy(server_conf_t *sc); Index: dhcp-server-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-control.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-server-control.c 5 Jul 2003 19:17:48 -0000 1.1 --- dhcp-server-control.c 6 Jul 2003 05:37:44 -0000 1.2 *************** *** 43,47 **** /* read configuration information. */ ! if((dhcp_server_control->server_conf = create_server_conf(interface)) == NULL) { FATAL_MESSAGE("could not read configuration file"); } --- 43,47 ---- /* read configuration information. */ ! if((dhcp_server_control->server_conf = server_conf_create(interface)) == NULL) { FATAL_MESSAGE("could not read configuration file"); } *************** *** 68,73 **** /* create rawnet handler. */ ! dhcp_server_control->rawnet = rawnet_create(interface, stringbuffer_getstring(filter), -1, sport, ! dport, 0, 0); return dhcp_server_control; } --- 68,78 ---- /* create rawnet handler. */ ! if((dhcp_server_control->rawnet = rawnet_create(interface, stringbuffer_getstring(filter), -1, sport, ! dport, 0, 0)) == NULL) { ! FATAL_MESSAGE("could not create raw network handler."); ! } ! ! stringbuffer_destroy(filter); ! return dhcp_server_control; } Index: dhcp-server.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-server.c 5 Jul 2003 19:17:48 -0000 1.2 --- dhcp-server.c 6 Jul 2003 05:37:44 -0000 1.3 *************** *** 159,162 **** --- 159,163 ---- commands[command_code](interface_name); + exit(0); } |
From: <act...@us...> - 2003-07-06 05:37:26
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv21212/src Modified Files: dhcp-rawnet.c Log Message: fix to dhcp-rawnet with mtu passing Index: dhcp-rawnet.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-rawnet.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-rawnet.c 5 Jul 2003 19:18:17 -0000 1.11 --- dhcp-rawnet.c 6 Jul 2003 05:37:23 -0000 1.12 *************** *** 219,223 **** net->device = xstrdup(device); net->pcap_filter = xstrdup(filter); - net->packet_data = xcalloc(mtu); net->promiscuous = promiscuous; net->mtu = mtu; --- 219,222 ---- *************** *** 265,268 **** --- 264,270 ---- net->mtu = rawnet_get_mtu(net); } + + /* now allocate packet data since we know the mtu. */ + net->packet_data = xcalloc(net->mtu); /* any other value of retval and the interface is already up. */ |
From: <act...@us...> - 2003-07-06 05:36:37
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server In directory sc8-pr-cvs1:/tmp/cvs-serv21149/conf/dhcp-server Modified Files: lease.conf.example Log Message: update to theoretical server conf example Index: lease.conf.example =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server/lease.conf.example,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lease.conf.example 5 Jul 2003 19:30:51 -0000 1.1 --- lease.conf.example 6 Jul 2003 05:36:35 -0000 1.2 *************** *** 8,30 **** # a lease defined on a range of IPs ! # ! # range-lease 10.0.0.40 10.0.0.50 { ! domain-name = "whitefang.com"; ! domain-name-servers = 10.0.0.1, 10.0.0.5; ! routers = 10.0.0.1; ! ip-address-lease-time = 86400; }; ! hostname-lease rage { ! domain-name "whitefang.com"; ! domain-name-servers = 10.0.0.1, 10.0.0.5; ! routers = 10.0.0.1; ! ip-address-lease-time = 86400; }; --- 8,51 ---- + # setup default percents for renew/rebind + + set default-renew-percent = 75; + set default-rebind-percent = 90; + # a lease defined on a range of IPs ! # this is passed to everyone who does not ! # match a hostname or mac lease. range-lease 10.0.0.40 10.0.0.50 { ! option domain-name = "whitefang.com"; ! option domain-name-servers = 10.0.0.1, 10.0.0.5; ! option routers = 10.0.0.1; ! option ip-address-lease-time = 86400; }; ! # a lease passed to a hostname ! hostname-lease "rage" 10.0.0.2 { ! ! option domain-name = "whitefang.com"; ! option domain-name-servers = 10.0.0.1, 10.0.0.5; ! option routers = 10.0.0.1; ! option ip-address-lease-time = 86400; }; + # lease locked down on mac + + mac-lease "00:ca:fe:ba:be:00" 10.0.0.51 { + + option domain-name = "whitefang.com"; + option domain-name-servers = 10.0.0.1, 10.0.0.5; + option routers = 10.0.0.1; + option ip-address-lease-time = 86400; + }; + + + # order is try hostname leases before mac-lease + + set lease-order = hostname, mac-lease; |
From: <act...@us...> - 2003-07-06 05:35:36
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv21062/src Modified Files: dhcp-client-defaults.h Log Message: fix to client-defaults on mtu Index: dhcp-client-defaults.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-defaults.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-client-defaults.h 23 Jun 2003 06:04:33 -0000 1.6 --- dhcp-client-defaults.h 6 Jul 2003 05:35:33 -0000 1.7 *************** *** 70,74 **** * only change this if you know what you're doing. */ ! #define CLIENT_DEFAULT_SNAPLEN DEFAULT_MTU /* Default hostname: defaults to none (NULL) */ --- 70,74 ---- * only change this if you know what you're doing. */ ! #define CLIENT_DEFAULT_SNAPLEN CLIENT_DEFAULT_MTU /* Default hostname: defaults to none (NULL) */ |
From: <act...@us...> - 2003-07-06 05:34:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv20954/src Modified Files: dhcp-client-cache.c dhcp-client-cache.h dhcp-client.c dhcp-client.h Log Message: added -s options to client (for status) Index: dhcp-client-cache.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-cache.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-client-cache.c 5 May 2003 01:23:37 -0000 1.16 --- dhcp-client-cache.c 6 Jul 2003 05:34:33 -0000 1.17 *************** *** 140,150 **** } ! /* check if cache is empty. */ ! int client_cache_is_empty(client_cache_t *cc) { int retval; char *fname; ! fname = get_fname(cc); if(file_exists(fname)) retval = 0; --- 140,153 ---- } ! static int client_cache_is_empty_proc(client_cache_t *cc, int tmp) { int retval; char *fname; ! if(tmp) ! fname = get_fname_tmp(cc); ! else ! fname = get_fname(cc); ! if(file_exists(fname)) retval = 0; *************** *** 157,160 **** --- 160,175 ---- } + /* check if cache is empty. */ + int client_cache_is_empty(client_cache_t *cc) + { + return client_cache_is_empty_proc(cc, 0); + } + + /* check if temporary cache is empty. */ + int client_cache_is_empty_tmp(client_cache_t *cc) + { + return client_cache_is_empty_proc(cc, 1); + } + /* check if a cache entry is for a timer option. */ static int is_timer_option(cache_entry_t *ce) *************** *** 332,333 **** --- 347,381 ---- return client_cache_load_options_proc(cc, use_tmp, is_timer_option); } + + void client_pretty_print_cache(client_cache_t *cc, uint8_t use_tmp) + { + dhcp_opt_t *option; + cache_entry_t *ce; + const char *name; + char *val; + list_t *options; + + if((options = client_cache_load_options_proc(cc, use_tmp, NULL)) == NULL) { + FATAL_MESSAGE("could not load cached lease"); + } + + INFO_MESSAGE("Lease contents:"); + + list_rewind(cc->vars); + while((ce = list_next(cc->vars)) != NULL) { + + + option = dhcp_opt_create_from_host_string(ce->tag, ce->value); + + name = dhcp_option_printable_string_get(dhcp_opt_get_tag(option)); + val = dhcp_opt_get_internal_string(option); + + INFO_MESSAGE("%s : %s", name, val); + + xfree(val); + } + + INFO_MESSAGE(" "); + return; + } + Index: dhcp-client-cache.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-cache.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-client-cache.h 4 May 2003 18:50:41 -0000 1.6 --- dhcp-client-cache.h 6 Jul 2003 05:34:36 -0000 1.7 *************** *** 41,47 **** --- 41,49 ---- extern void client_cache_delete_cache(client_cache_t *cc); extern int client_cache_is_empty(client_cache_t *cc); + extern int client_cache_is_empty_tmp(client_cache_t *cc); extern int client_cache_dump_options(client_cache_t *cc, list_t *options); extern list_t *client_cache_load_options(client_cache_t *cc, uint8_t use_tmp); extern list_t *client_cache_load_timer_options(client_cache_t *cc, uint8_t use_tmp); + extern void client_pretty_print_cache(client_cache_t *cc, uint8_t use_tmp); #endif /* DHCP_CLIENT_CACHE_H */ Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** dhcp-client.c 2 Jul 2003 15:18:22 -0000 1.32 --- dhcp-client.c 6 Jul 2003 05:34:36 -0000 1.33 *************** *** 43,46 **** --- 43,47 ---- static void do_clear_cache(char *interface); static void do_client(char *interface); + static void do_status(char *interface); /* command to string table. */ *************** *** 57,60 **** --- 58,62 ---- do_clear_cache, /* clear cache. */ do_client, /* initialize and run client. */ + do_status, /* get status info. */ }; *************** *** 74,77 **** --- 76,80 ---- interface_get_active, /* clear cache. */ interface_get_inactive, /* run client. */ + interface_get_active, /* get status. */ }; *************** *** 118,122 **** static void usage(char *s) { ! printf("usage: %s [-cpavkwt] [-l verbosity level] [-d directory]\n", s); printf("usage: %-*s [-i interface name] [ -m mac address ]\n", strlen(s), " "); exit(0); --- 121,125 ---- static void usage(char *s) { ! printf("usage: %s [-scpavkwt] [-l verbosity level] [-d directory]\n", s); printf("usage: %-*s [-i interface name] [ -m mac address ]\n", strlen(s), " "); exit(0); *************** *** 337,340 **** --- 340,377 ---- } + static void do_status(char *interface) + { + /* try to load up cache. */ + client_cache_t *cache; + + if((cache = client_cache_create(interface)) == NULL) { + FATAL_MESSAGE("could not create client cache"); + } + + if(client_cache_is_empty(cache)) { + + if(client_cache_is_empty_tmp(cache)) { + + + INFO_MESSAGE("No lease acquired for this interface."); + INFO_MESSAGE(" "); + + } else { + + INFO_MESSAGE("This lease has been offered but has not been acquired yet, or the client has not been able to receive an acknowledgement from the + server yet."); + INFO_MESSAGE(" "); + client_pretty_print_cache(cache, 1); + + } + + } else { + + client_pretty_print_cache(cache, 0); + } + + return; + } + /* do client: perform dhcp client proper functions. */ static void do_client(char *interface) *************** *** 471,475 **** INFO_MESSAGE(" "); ! while((c = getopt(argc, argv, "tpcdavi:m:kwh:l:H:")) != -1) { switch (c) { --- 508,512 ---- INFO_MESSAGE(" "); ! while((c = getopt(argc, argv, "stpcdavi:m:kwh:l:H:")) != -1) { switch (c) { *************** *** 513,516 **** --- 550,557 ---- } + break; + + case 's': + command_code = DO_STATUS; break; Index: dhcp-client.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-client.h 26 Jun 2003 23:56:42 -0000 1.20 --- dhcp-client.h 6 Jul 2003 05:34:36 -0000 1.21 *************** *** 71,75 **** /* client commands. */ ! enum client_commands { DO_VERSION = 0, DO_KILL, DO_WAKE, DO_CLEAR, DO_CLIENT }; /* DHCP client states. */ --- 71,75 ---- /* client commands. */ ! enum client_commands { DO_VERSION = 0, DO_KILL, DO_WAKE, DO_CLEAR, DO_CLIENT, DO_STATUS }; /* DHCP client states. */ |
From: <act...@us...> - 2003-07-05 19:37:46
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv22850/src Modified Files: Makefile.am Log Message: fix to server dir Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/Makefile.am,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Makefile.am 5 Jul 2003 19:17:01 -0000 1.27 --- Makefile.am 5 Jul 2003 19:37:43 -0000 1.28 *************** *** 6,12 **** INCLUDES = ${PCAP_INC} ${DNET_INC} ${GUILE_INC} CPPFLAGS = -DDHCPSYSCONFDIR=\"${dhcpsysconfdir}\" -DDHCPSYSCONF_CLIENTDIR=\"${dhcpsysconf_clientdir}\" \ ! -DDHCPSYSCONF_SERVERDIR=\"${dhcpsysconf_clientdir}\" \ -DDHCPLOCALSTATEDIR=\"${dhcplocalstatedir}\" -DDHCPLOCALSTATE_CLIENTDIR=\"${dhcplocalstate_clientdir}\" \ ! -DDHCPLOCALSTATE_SERVERDIR=\"${dhcplocalstate_clientdir}\" AUTOMAKE_OPTIONS = foreign --- 6,12 ---- INCLUDES = ${PCAP_INC} ${DNET_INC} ${GUILE_INC} CPPFLAGS = -DDHCPSYSCONFDIR=\"${dhcpsysconfdir}\" -DDHCPSYSCONF_CLIENTDIR=\"${dhcpsysconf_clientdir}\" \ ! -DDHCPSYSCONF_SERVERDIR=\"${dhcpsysconf_serverdir}\" \ -DDHCPLOCALSTATEDIR=\"${dhcplocalstatedir}\" -DDHCPLOCALSTATE_CLIENTDIR=\"${dhcplocalstate_clientdir}\" \ ! -DDHCPLOCALSTATE_SERVERDIR=\"${dhcplocalstate_serverdir}\" AUTOMAKE_OPTIONS = foreign |
From: <act...@us...> - 2003-07-05 19:33:30
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv22331 Modified Files: configure.ac Log Message: added configuration subdirectories Index: configure.ac =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.ac,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** configure.ac 5 Jul 2003 19:16:46 -0000 1.12 --- configure.ac 5 Jul 2003 19:33:27 -0000 1.13 *************** *** 253,257 **** AC_CONFIG_HEADERS([config.h]) ! AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile conf/Makefile doc/Makefile contrib/Makefile]) AC_OUTPUT --- 253,258 ---- AC_CONFIG_HEADERS([config.h]) ! AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile conf/Makefile ! conf/dhcp-client/Makefile conf/dhcp-server/Makefile doc/Makefile contrib/Makefile]) AC_OUTPUT |
From: <act...@us...> - 2003-07-05 19:32:40
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-client In directory sc8-pr-cvs1:/tmp/cvs-serv22200/dhcp-client Added Files: .cvsignore Log Message: adding cvsignore for conf subdirs --- NEW FILE: .cvsignore --- Makefile Makefile.in |
From: <act...@us...> - 2003-07-05 19:32:40
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server In directory sc8-pr-cvs1:/tmp/cvs-serv22200/dhcp-server Added Files: .cvsignore Log Message: adding cvsignore for conf subdirs --- NEW FILE: .cvsignore --- Makefile Makefile.in |
From: <act...@us...> - 2003-07-05 19:30:54
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server In directory sc8-pr-cvs1:/tmp/cvs-serv22027/dhcp-server Added Files: Makefile.am lease.conf.example Log Message: moved configuration files to subdirectories --- NEW FILE: Makefile.am --- # $Header: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server/Makefile.am,v 1.1 2003/07/05 19:30:51 actmodern Exp $ # # server configuration Makefile.am # SUBDIRS = . dhcpsysconf_server_DATA = lease.conf.example EXTRA_DIST = lease.conf.example --- NEW FILE: lease.conf.example --- # $Header: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server/lease.conf.example,v 1.1 2003/07/05 19:30:51 actmodern Exp $ # # Example lease configuration file. # # You probably don't want to use this verbatim. # # Thamer Alharbash <tm...@wh...> # a lease defined on a range of IPs # # range-lease 10.0.0.40 10.0.0.50 { domain-name = "whitefang.com"; domain-name-servers = 10.0.0.1, 10.0.0.5; routers = 10.0.0.1; ip-address-lease-time = 86400; }; hostname-lease rage { domain-name "whitefang.com"; domain-name-servers = 10.0.0.1, 10.0.0.5; routers = 10.0.0.1; ip-address-lease-time = 86400; }; |
From: <act...@us...> - 2003-07-05 19:30:54
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-client In directory sc8-pr-cvs1:/tmp/cvs-serv22027/dhcp-client Added Files: Makefile.am README default.conf default.sysconf Log Message: moved configuration files to subdirectories --- NEW FILE: Makefile.am --- # $Header: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-client/Makefile.am,v 1.1 2003/07/05 19:30:51 actmodern Exp $ # # client configuration Makefile.am # SUBDIRS = . dhcpsysconf_client_DATA = default.conf default.sysconf EXTRA_DIST = default.conf default.sysconf --- NEW FILE: README --- $Header: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-client/README,v 1.1 2003/07/05 19:30:51 actmodern Exp $ Default configuration files, and sysconf guile script. --- NEW FILE: default.conf --- # $Header: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-client/default.conf,v 1.1 2003/07/05 19:30:51 actmodern Exp $ # # Basic DHCP client configuration script. # We only ask for network setup parameters. # # Thamer Alharbash <tm...@wh...> # This will setup dhcp to accept the following configuration # parameters from any dhcp server: # # ip-address, subnet mask, lease time, renewal time, rebinding time, # interface mtu, domain name, dns server # # It will require all of the above. Otherwise uncomment below to be # more flexible # # IP address requests are implicit we just ask for the other options below. # request subnet-mask, ip-address-lease-time, renewal-time, rebinding-time, domain-name-servers, domain-name, interface-mtu, routers; # Additional variable settings. # # Interface MTU # Set up our default interface mtu in case the server does not # give us one. set default-interface-mtu = 1500; # # Router discovery -- should we use ICMP to find the best router? # enable do-measure-router-latency = no; # Default ARP settings are pretty generous. Unless you experience # problems this should suffice for most networks which don't have # excessive packet loss set arp-retries = 1; set arp-timeout-threshold = 10; --- NEW FILE: default.sysconf --- ; $Header: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-client/default.sysconf,v 1.1 2003/07/05 19:30:51 actmodern Exp $ ; ; dhcp sysconf recipe file. ; ; XXX IMPORTANT: ; You should not need to edit the interface setup ; below. Without this the client may not function properly at ; all since it relies on it to configure the interface. ; (define configure-interface #f) ; XXX -- no need for unconfigure interface, client will handle that internally. (let ((configured-ip-address #f)) (set! configure-interface (lambda () (if (defined? 'dhcp-requested-ip-address) (let ; if the mtu wasn't passed by the server, get the user configured one ((mtu (if (defined? 'dhcp-interface-mtu) dhcp-interface-mtu (client-get-default-mtu client-control))) ; if the subnet mask wasn't specified, get the user configured one (subnet-mask (if (defined? 'dhcp-subnet-mask) dhcp-subnet-mask (client-get-default-subnet-mask client-control)))) ; that's it we're ready to bring up the interface (client-info-message "bringing up interface...") (if (not (client-interface-up client-control dhcp-requested-ip-address subnet-mask mtu)) (client-fatal-message "could not bring up interface... exiting.") (set! configured-ip-address dhcp-requested-ip-address))))))) ; XXX ; Add option handling here. ; All configure-* functions are placed inside of closures. This ; allows seemless persistantance of old values and thus ; unconfigure-* can be written easily. ; ; Domain and domain-name servers (define configure-dns #f) (define unconfigure-dns #f) (let ((configured-domain-name #f) (configured-domain-name-servers #f) ; check to see if we really need to configure (do-configure (lambda() (and (client-configure? client-control 'dhcp-domain-name-servers) (client-configure? client-control 'dhcp-domain-name) (defined? 'dhcp-domain-name-servers) (defined? 'dhcp-domain-name))))) ; define this here since we'll be calling it from reconfigure as well. ; configure dns options (set! configure-dns (lambda () (if (do-configure) (let ((resolv-conf-file-port (open "/etc/resolv.conf" O_WRONLY 0644))) (client-info-message "configuring resolver") (map-in-order (lambda (dns-server) (simple-format resolv-conf-file-port "nameserver ~A\n" dns-server)) dhcp-domain-name-servers) (simple-format resolv-conf-file-port "search ~A\n" dhcp-domain-name) (close-port resolv-conf-file-port) ; now setup the options so we can use them again in unconfigure. (set! configured-domain-name dhcp-domain-name) (set! configured-domain-name-servers dhcp-domain-name-servers))))) ; unconfigure dns options (set! unconfigure-dns (lambda() ; We shouldn't really be doing anything. Any name server ; is a good server :-) #t))) ; Routers. We use client-set-default-route to add the route. (define configure-default-route #f) (define unconfigure-default-route #f) (let ((configured-default-route #f) ; check to see if really need to configure (do-configure (lambda() (and (client-configure? client-control 'dhcp-routers) (defined? 'dhcp-routers))))) (set! configure-default-route (lambda() (if (do-configure) (let ((routers (if (client-do-discover-icmp-latency? client-control) (sort (client-discover-icmp-latency client-control dhcp-routers) (lambda (x y) (< (car x) (car y)))) (list (list 1 (car dhcp-routers)))))) (if (null? routers) (begin (client-error-message "default routes not responding. defaulting to first one in list") (client-set-default-route client-control (car dhcp-routers)) (set! configured-default-route (car dhcp-routers))) (let ((default-route (car (cdr (car routers))))) (client-info-message (string-append "adding default route to: " default-route)) (client-set-default-route client-control default-route) (set! configured-default-route default-route))))))) (set! unconfigure-default-route (lambda() (if (do-configure) (if configured-default-route (begin (client-info-message (string-append "removing default route to: " configured-default-route)) (client-remove-default-route client-control configured-default-route))))))) ; After everything is defined set to hooks ; ; We have two hooks. dhcp-bind-hook, dhcp-release-hook, ; setup options on dhcp-bind (add-hook! dhcp-bind-hook configure-dns) (add-hook! dhcp-bind-hook configure-default-route) (add-hook! dhcp-bind-hook configure-interface) ; unconfigure options on dhcp-release-hook (add-hook! dhcp-release-hook unconfigure-dns) (add-hook! dhcp-release-hook unconfigure-default-route) |
From: <act...@us...> - 2003-07-05 19:30:53
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf In directory sc8-pr-cvs1:/tmp/cvs-serv22027 Modified Files: Makefile.am README Removed Files: default.conf default.sysconf Log Message: moved configuration files to subdirectories Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.am 18 May 2003 02:58:59 -0000 1.3 --- Makefile.am 5 Jul 2003 19:30:51 -0000 1.4 *************** *** 4,8 **** # ! SUBDIRS = . ! dhcpsysconf_client_DATA = default.conf default.sysconf ! EXTRA_DIST = default.conf default.sysconf --- 4,6 ---- # ! SUBDIRS = dhcp-client dhcp-server Index: README =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 11 May 2003 17:01:57 -0000 1.2 --- README 5 Jul 2003 19:30:51 -0000 1.3 *************** *** 1,3 **** $Header$ ! Default configuration files, and sysconf guile script. --- 1,7 ---- $Header$ ! Configuration files. ! ! dhcp-client : configuration files for the client. ! dhcp-server : configuration files for the server. ! --- default.conf DELETED --- --- default.sysconf DELETED --- |
From: <act...@us...> - 2003-07-05 19:29:53
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server In directory sc8-pr-cvs1:/tmp/cvs-serv21825/dhcp-server Log Message: Directory /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server added to the repository |
From: <act...@us...> - 2003-07-05 19:29:46
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-client In directory sc8-pr-cvs1:/tmp/cvs-serv21807/dhcp-client Log Message: Directory /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-client added to the repository |
From: <act...@us...> - 2003-07-05 19:21:00
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv20424 Modified Files: TODO Log Message: more todo Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** TODO 27 Jun 2003 03:17:28 -0000 1.18 --- TODO 5 Jul 2003 19:20:57 -0000 1.19 *************** *** 55,56 **** --- 55,61 ---- -- stringbuffer might be more useful it allowed marking of arbitrary characters with sentinels. + + -- "do-measure-router-latency" and + "client-do-discover-icmp-latency" seem to be misnamed. rename + scheme routine to bring it in line with the user setting. + |
From: <act...@us...> - 2003-07-05 19:20:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent/contrib In directory sc8-pr-cvs1:/tmp/cvs-serv20372/contrib Added Files: Makefile.am Log Message: added makefile for contrib to make sure it gets in the dist --- NEW FILE: Makefile.am --- # $Header: /cvsroot/dhcp-agent/dhcp-agent/contrib/Makefile.am,v 1.1 2003/07/05 19:20:36 actmodern Exp $ # # Contributions from other folks. EXTRA_DIST = default.conf.rogers-toronto |
From: <act...@us...> - 2003-07-05 19:20:05
|
Update of /cvsroot/dhcp-agent/dhcp-agent/contrib In directory sc8-pr-cvs1:/tmp/cvs-serv20258/contrib Added Files: .cvsignore Log Message: added cvsignore for contrib --- NEW FILE: .cvsignore --- Makefile Makefile.in |
From: <act...@us...> - 2003-07-05 19:18:22
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv20066/src Modified Files: dhcp-librawnet.h dhcp-rawnet.c dhcp-interface.h dhcp-interface.c Log Message: fixed mtu issue in interface handling code; added get_mtu Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-librawnet.h 27 Jun 2003 03:15:50 -0000 1.20 --- dhcp-librawnet.h 5 Jul 2003 19:18:17 -0000 1.21 *************** *** 370,377 **** extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr); extern ip_addr_t rawnet_get_ip_addr(rawnet_t *net); extern int rawnet_send_packet(rawnet_t *net); extern int rawnet_use_fake_hw_addr(rawnet_t *raw, char *mac_string); extern void reinitialize_rawnet(rawnet_t *net, int promiscuous); - extern int rawnet_up(rawnet_t *net); --- 370,377 ---- extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr); extern ip_addr_t rawnet_get_ip_addr(rawnet_t *net); + extern uint16_t rawnet_get_mtu(rawnet_t *net); extern int rawnet_send_packet(rawnet_t *net); extern int rawnet_use_fake_hw_addr(rawnet_t *raw, char *mac_string); extern void reinitialize_rawnet(rawnet_t *net, int promiscuous); extern int rawnet_up(rawnet_t *net); Index: dhcp-rawnet.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-rawnet.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-rawnet.c 25 Jun 2003 01:54:14 -0000 1.10 --- dhcp-rawnet.c 5 Jul 2003 19:18:17 -0000 1.11 *************** *** 124,127 **** --- 124,132 ---- } + uint16_t rawnet_get_mtu(rawnet_t *net) + { + return interface_get_mtu(net->intf_handle); + } + list_t *rawnet_list_active_interfaces(void) { *************** *** 254,257 **** --- 259,267 ---- return NULL; } + } + + if(net->mtu == -1) { /* were we passed an mtu? */ + /* if not get it from the interface that was just brought up. */ + net->mtu = rawnet_get_mtu(net); } Index: dhcp-interface.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-interface.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dhcp-interface.h 8 Jun 2003 22:42:45 -0000 1.4 --- dhcp-interface.h 5 Jul 2003 19:18:18 -0000 1.5 *************** *** 35,38 **** --- 35,39 ---- extern int interface_is_up(interface_control_t *ic); extern uint16_t interface_get_type(interface_control_t *ic); + extern uint16_t interface_get_mtu(interface_control_t *ic); #endif /* DHCP_INTERFACE_H */ Index: dhcp-interface.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-interface.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-interface.c 8 Jun 2003 22:42:45 -0000 1.8 --- dhcp-interface.c 5 Jul 2003 19:18:18 -0000 1.9 *************** *** 114,118 **** } ! ic->interface_entry->intf_mtu = 1500; ic->interface_entry->intf_flags |= INTF_FLAG_UP; --- 114,119 ---- } ! if(mtu != -1) ! ic->interface_entry->intf_mtu = mtu; ic->interface_entry->intf_flags |= INTF_FLAG_UP; *************** *** 265,268 **** --- 266,279 ---- return DLT_NULL; /* do our best. */ + } + + return ic->interface_entry->intf_type; + } + + uint16_t interface_get_mtu(interface_control_t *ic) + { + if(interface_get_info(ic)) { + ERROR_MESSAGE("could not get interface data link type %s : %s", + ic->interface_entry->intf_name, strerror(errno)); } |
From: <act...@us...> - 2003-07-05 19:17:50
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv20000/src Modified Files: dhcp-server.c dhcp-server.h Added Files: dhcp-server-conf.c dhcp-server-conf.h dhcp-server-control.c Log Message: added initial dhcp-server code --- NEW FILE: dhcp-server-conf.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.c,v 1.1 2003/07/05 19:17:48 actmodern Exp $ * * Copyright 2002 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. * */ #define MODULE_NAME "dhcp-server-conf" #include "dhcp-local.h" #include "dhcp-limits.h" #include "dhcp-libutil.h" #include "dhcp-librawnet.h" #include "dhcp-option.h" #include "dhcp-conf.h" #include "dhcp-conf-var.h" #include "dhcp-server-conf.h" static const char *var_strings[] = { "default-renew-percent", "default-rebind-percent", }; static const arg_symbol_t var_symbols[] = { SERVER_VAR_RENEW_PERCENT, SERVER_VAR_REBIND_PERCENT, }; static const arg_type_t var_arg_types[] = { CONF_IDENTIFIER, CONF_ASSIGNMENT, CONF_STRING }; static const char **var_arg_strings[] = { var_strings, NULL, NULL }; static const arg_symbol_t *var_arg_symbols[] = { var_symbols, NULL, NULL }; /* command structures. */ /* set command. */ static const command_t command_set = { DIRECTIVE_SET, "set", 3, var_arg_strings, var_arg_types, var_arg_symbols, }; static const command_t *commands[] = { &command_set, NULL, }; /* forward declaration of directive handlers. */ static int directive_set_handler(server_conf_t *server_conf, directive_t *directive); /* indexed by directive types in dhcp-client-conf.h . */ directive_handler_t directive_handlers[] = { directive_set_handler, }; /* * * * * * * * * * * * utility routines. * * * * * * * * * * * */ /* get name of configuration file for server. */ static char *get_conf_options_fname(const char *interface) { char *fname; stringbuffer_t *sb; sb = stringbuffer_create(); stringbuffer_aprintf(sb, "%s/default.conf", DHCPSYSCONF_SERVERDIR); if(file_exists(stringbuffer_getstring(sb))) { fname = xstrdup(stringbuffer_getstring(sb)); stringbuffer_destroy(sb); return fname; } stringbuffer_clear(sb); stringbuffer_aprintf(sb, "%s/%s.conf", DHCPSYSCONF_SERVERDIR, interface); if(file_exists(stringbuffer_getstring(sb))) { fname = xstrdup(stringbuffer_getstring(sb)); stringbuffer_destroy(sb); return fname; } /* otherwise there is no configuration file and this is * bad. signal a fatal error. */ FATAL_MESSAGE("configuration file missing -- looked for default.conf and <interface>.conf. exiting..."); exit(1); /* get rid of compiler warning. */ } /* set variable. */ static int server_conf_set_variable(server_conf_t *server_conf, arg_symbol_t var_symbol, const char *var_value) { switch(var_symbol) { case SERVER_VAR_RENEW_PERCENT: if(!is_unsigned_numeric(var_value)) { ERROR_MESSAGE("value not unsigned numeric as expected : %s\n", var_value); return 1; } sscanf(var_value, "%"SCNu16, &server_conf->default_renew_percent); if(server_conf->default_renew_percent > 100) { /* check if the percent is higher than it should be. */ FATAL_MESSAGE("value specified for default-renew-percent is an illegal percent (over 100)"); } break; case SERVER_VAR_REBIND_PERCENT: if(!is_unsigned_numeric(var_value)) { ERROR_MESSAGE("value not unsigned numeric as expected : %s", var_value); return 1; } sscanf(var_value, "%"SCNu16, &server_conf->default_rebind_percent); if(server_conf->default_renew_percent > 100) { /* check if the percent is higher than it should be. */ FATAL_MESSAGE("value specified for default-rebind-percent is an illegal percent (over 100)"); } break; default: ERROR_MESSAGE("unable to understand assignment value of : %s", var_value); return 1; } return 0; } /* load server options. */ static int server_conf_load_options(server_conf_t *sc) { conf_t *conf; list_t *directives; directive_t *directive; conf = conf_create(commands, sc->conf_file); if(conf_compile_directives(conf) == CONF_ERROR) { ERROR_MESSAGE("error reading conf file: %s at line %d", sc->conf_file, conf_get_line_no(conf)); conf_destroy(conf); return 1; } directives = conf_get_directives(conf); list_rewind(directives); while((directive = list_next(directives)) != NULL) { /* read in the compiled directives. */ if(directive_handlers[directive->command_code](sc, directive)) return 1; } return 0; } /* * * * * * * * * * * * * directive handlers. * * * * * * * * * * * * */ static int directive_set_handler(server_conf_t *server_conf, directive_t *directive) { list_t *args; arg_symbol_t *var_symbol; char *var_value; args = directive->arguments; var_symbol = list_get_by_index(args, 0); var_value = list_get_by_index(args, 2); if(server_conf_set_variable(server_conf, *var_symbol, var_value)) { ERROR_MESSAGE("configuration: error unable to set variable %s to %s", var_strings[*var_symbol], var_value); return 1; } return 0; } /* * * * * * * * * * * * public interface * * * * * * * * * * * */ server_conf_t *create_server_conf(const char *interface) { server_conf_t *sc; sc = xcalloc(sizeof(server_conf_t)); sc->interface = interface; sc->conf_file = get_conf_options_fname(interface); sc->variables = list_create(); sc->lease_defs = list_create(); if(server_conf_load_options(sc)) { server_conf_destroy(sc); return NULL; } return sc; } void server_conf_destroy(server_conf_t *sc) { /* not implemented yet. */ return; } --- NEW FILE: dhcp-server-conf.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.h,v 1.1 2003/07/05 19:17:48 actmodern Exp $ * * Copyright 2002 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_SERVER_CONF_H #define DHCP_SERVER_CONF_H /* data structures. */ typedef struct { list_t *variables; /* variable settings. */ list_t *lease_defs; /* list of lease definitions. */ const char *interface; /* interface name: read only. */ char *conf_file; /* path to configuration file. */ uint16_t default_rebind_percent; /* percent of expiry to assign as rebind time. */ uint16_t default_renew_percent; /* percent of expiry to assign as renew time. */ } server_conf_t; typedef int (*directive_handler_t)(server_conf_t *server_conf, directive_t *directive_data); /* constants. */ enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT }; enum directive_types { DIRECTIVE_SET = 0 }; /* prototypes. */ extern server_conf_t *create_server_conf(const char *interface); extern void server_conf_destroy(server_conf_t *sc); #endif /* DHCP_SERVER_CONF_H */ --- NEW FILE: dhcp-server-control.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-control.c,v 1.1 2003/07/05 19:17:48 actmodern Exp $ * * Copyright 2002 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. * */ #define MODULE_NAME "dhcp-server-control" #include "dhcp-local.h" #include "dhcp-libutil.h" #include "dhcp-librawnet.h" #include "dhcp-lease.h" #include "dhcp-server-conf.h" #include "dhcp-server.h" dhcp_server_control_t *dhcp_server_control_create(const char *interface) { int dport, sport; stringbuffer_t *filter; dhcp_server_control_t *dhcp_server_control; dhcp_server_control = xcalloc(sizeof(dhcp_server_control_t)); dhcp_server_control->interface_name = xstrdup(interface); /* read configuration information. */ if((dhcp_server_control->server_conf = create_server_conf(interface)) == NULL) { FATAL_MESSAGE("could not read configuration file"); } /* get the source port and destination port for BOOTP. */ dport = rawnet_port_for_service("bootps", "udp"); sport = rawnet_port_for_service("bootpc", "udp"); dport = ntohs(dport); sport = ntohs(sport); if(dport == -1 || sport == -1) { WARN_MESSAGE ("could not lookup dhcp services in service db (%s) will use reasonable defaults."); sport = BOOTP_CLIENT; dport = BOOTP_SERVER; } /* Create filter. */ filter = stringbuffer_create(); stringbuffer_aprintf(filter, "arp or icmp or (udp and src port %d)", sport); /* create rawnet handler. */ dhcp_server_control->rawnet = rawnet_create(interface, stringbuffer_getstring(filter), -1, sport, dport, 0, 0); return dhcp_server_control; } void dhcp_server_control_destroy(dhcp_server_control_t *dhcp_server_control) { INFO_MESSAGE("not implemented yet."); return; } Index: dhcp-server.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-server.c 2 Jul 2003 15:23:30 -0000 1.1 --- dhcp-server.c 5 Jul 2003 19:17:48 -0000 1.2 *************** *** 23,26 **** --- 23,28 ---- */ + #define MODULE_NAME "dhcp-server" + #include "dhcp-local.h" #include "dhcp-libutil.h" *************** *** 28,31 **** --- 30,34 ---- #include "dhcp-lease.h" + #include "dhcp-server-conf.h" #include "dhcp-server.h" #include "dhcp-server-guile.h" *************** *** 84,87 **** --- 87,94 ---- static void do_server(char *interface_name) { + dhcp_server_control_t *dhcp_server_control; + + dhcp_server_control = dhcp_server_control_create(interface_name); + INFO_MESSAGE("not implemented yet."); return; *************** *** 152,156 **** commands[command_code](interface_name); - exit(0); } --- 159,162 ---- Index: dhcp-server.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-server.h 2 Jul 2003 15:23:30 -0000 1.1 --- dhcp-server.h 5 Jul 2003 19:17:48 -0000 1.2 *************** *** 26,44 **** #define DHCP_SERVER_H ! enum command_codes { DO_VERSION = 0, DO_KILL, DO_STATUS, DO_SERVER }; ! typedef void (*server_command) (char *interface); typedef struct { ! rawnet_t *rawnet; /* raw network handle * ! / char *interface_name; /* name of interface */ ! } dhcp_server_control_t; ! #endif /* DHCP_SERVER_H */ --- 26,47 ---- #define DHCP_SERVER_H ! /* type definitions. */ typedef void (*server_command) (char *interface); typedef struct { ! rawnet_t *rawnet; /* raw network handle */ char *interface_name; /* name of interface */ ! server_conf_t *server_conf; /* server configuration. */ } dhcp_server_control_t; ! /* constants. */ ! enum command_codes { DO_VERSION = 0, DO_KILL, DO_STATUS, DO_SERVER }; + /* prototypes. */ + extern dhcp_server_control_t *dhcp_server_control_create(const char *interface); + + #endif /* DHCP_SERVER_H */ |