dhcp-agent-commits Mailing List for dhcp-agent (Page 16)
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-06-27 23:14:42
|
Update of /cvsroot/dhcp-agent/dhcp-agent/man In directory sc8-pr-cvs1:/tmp/cvs-serv12348/man Modified Files: Makefile.am Log Message: dhcp-sniff.1 was incorrectly being built Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/man/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.am 9 Jun 2003 02:01:28 -0000 1.3 --- Makefile.am 27 Jun 2003 23:14:39 -0000 1.4 *************** *** 15,19 **** sed < dhcp-sniff.1.in > dhcp-sniff.1 \ -e s:@-infodir-@:${infodir}: \ ! -e s:@-dhcpdocdir-@:${dhcpdocdir}: dhcp-client.1: dhcp-client.1.in --- 15,19 ---- sed < dhcp-sniff.1.in > dhcp-sniff.1 \ -e s:@-infodir-@:${infodir}: \ ! -e s:@-dhcpdocdir-@:${prefix}${dhcpdocdir}: dhcp-client.1: dhcp-client.1.in |
From: <act...@us...> - 2003-06-27 23:11:32
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv11902/src Modified Files: dhcp-print.c Log Message: fixed up sniffer print routines Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-print.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-print.c 2 May 2003 02:34:42 -0000 1.6 --- dhcp-print.c 27 Jun 2003 23:11:29 -0000 1.7 *************** *** 508,512 **** memcpy(&val, data, 4); - val = ntohl(val); printf("%d", val); --- 508,511 ---- *************** *** 526,530 **** memcpy(&val, data, 4); - val = ntohl(val); printf("%u", val); --- 525,528 ---- *************** *** 544,548 **** memcpy(&val, data, 2); - val = ntohs(val); printf("%u", val); --- 542,545 ---- *************** *** 688,692 **** print_val += printf(": "); option_handlers[tag].handle_option(dhcp_opt_get_host_data(option), ! dhcp_opt_get_mem_len(option), print_val); printf("\n"); --- 685,689 ---- print_val += printf(": "); option_handlers[tag].handle_option(dhcp_opt_get_host_data(option), ! dhcp_opt_get_total_len(option), print_val); printf("\n"); |
From: <act...@us...> - 2003-06-27 20:59:47
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv23929/src Modified Files: dhcp-sysconf.c dhcp-option.h dhcp-client-states.c Log Message: now not using dhcp option marcos outside of dhcp-option*.c Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-sysconf.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dhcp-sysconf.c 27 Jun 2003 03:16:27 -0000 1.21 --- dhcp-sysconf.c 27 Jun 2003 20:59:17 -0000 1.22 *************** *** 61,68 **** while((orig = list_next(options)) != NULL) { ! if(DHCP_OPT_GET_TAG(override) == DHCP_OPT_GET_TAG(orig)) { list_remove_by_datum(options, orig); ! DHCP_OPT_DESTROY(orig); list_add(options, dhcp_option_copy(override)); --- 61,68 ---- while((orig = list_next(options)) != NULL) { ! if(dhcp_opt_get_tag(override) == dhcp_opt_get_tag(orig)) { list_remove_by_datum(options, orig); ! dhcp_opt_destroy(orig); list_add(options, dhcp_option_copy(override)); *************** *** 87,91 **** while((add_opt = list_next(add_options)) != NULL) { ! if(DHCP_OPT_GET_TAG(orig) == DHCP_OPT_GET_TAG(add_opt)) { /* we already know that the conf code guarantees --- 87,91 ---- while((add_opt = list_next(add_options)) != NULL) { ! if(dhcp_opt_get_tag(orig) == dhcp_opt_get_tag(add_opt)) { /* we already know that the conf code guarantees Index: dhcp-option.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-option.h 27 Jun 2003 03:16:27 -0000 1.6 --- dhcp-option.h 27 Jun 2003 20:59:17 -0000 1.7 *************** *** 67,71 **** /* convenience macros. this makes accessing what's under the attr structure easier. */ - #define DHCP_OPT_GET_TYPE(x) (x->opt_attr->type) #define DHCP_OPT_GET_VAL_TYPE(x) (x->opt_attr->val_type) --- 67,70 ---- Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** dhcp-client-states.c 27 Jun 2003 03:15:25 -0000 1.42 --- dhcp-client-states.c 27 Jun 2003 20:59:17 -0000 1.43 *************** *** 383,388 **** while((option = list_next(options)) != NULL) { ! if(DHCP_OPT_GET_TAG(option) == TAG_DHCP_REQUESTED_IP_ADDRESS) { ! passed_ip = DHCP_OPT_TO_INTERNAL_DATA(option); break; } --- 383,388 ---- while((option = list_next(options)) != NULL) { ! if(dhcp_opt_get_tag(option) == TAG_DHCP_REQUESTED_IP_ADDRESS) { ! passed_ip = dhcp_opt_get_host_data(option); break; } *************** *** 1056,1061 **** while((option = list_next(cache_options)) != NULL) { ! if(DHCP_OPT_GET_TAG(option) == TAG_DHCP_REQUESTED_IP_ADDRESS) { ! my_addr = DHCP_OPT_TO_INTERNAL_DATA(option); break; } --- 1056,1061 ---- while((option = list_next(cache_options)) != NULL) { ! if(dhcp_opt_get_tag(option) == TAG_DHCP_REQUESTED_IP_ADDRESS) { ! my_addr = dhcp_opt_get_host_data(option); break; } *************** *** 1141,1146 **** while((option = list_next(options)) != NULL) { ! if(DHCP_OPT_GET_TAG(option) == TAG_DHCP_REQUESTED_IP_ADDRESS) { ! passed_ip = DHCP_OPT_TO_INTERNAL_DATA(option); break; } --- 1141,1146 ---- while((option = list_next(options)) != NULL) { ! if(dhcp_opt_get_tag(option) == TAG_DHCP_REQUESTED_IP_ADDRESS) { ! passed_ip = dhcp_opt_get_host_data(option); break; } |
From: <act...@us...> - 2003-06-27 16:46:50
|
Update of /cvsroot/dhcp-agent/dhcp-agent/doc In directory sc8-pr-cvs1:/tmp/cvs-serv15300/doc Modified Files: Makefile.am dhcp-client.texi introduction.texi Log Message: updated documentation Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/doc/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 20 May 2003 00:32:30 -0000 1.2 --- Makefile.am 27 Jun 2003 16:46:46 -0000 1.3 *************** *** 14,18 **** index.html: dhcp-agent.texi $(dhcp_agent_TEXINFOS) ! texi2html -toc_file index.html -split chapter dhcp-agent.texi endif --- 14,20 ---- index.html: dhcp-agent.texi $(dhcp_agent_TEXINFOS) ! texi2html -split chapter -top_file index.html dhcp-agent.texi endif + + CLEANFILES=*.html Index: dhcp-client.texi =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/doc/dhcp-client.texi,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-client.texi 27 Jun 2003 04:05:40 -0000 1.2 --- dhcp-client.texi 27 Jun 2003 16:46:46 -0000 1.3 *************** *** 93,100 **** interface the client is configuring. For example, if the name of our interface is ``xl0'' then the configuration file to be checked will be ! @file{/usr/local/etc/xl0.conf} If this file does not exist then the default configuration file is ! @file{/usr/local/etc/default.conf} This allows dhcp-client to accept configuration per interface, and use --- 93,100 ---- interface the client is configuring. For example, if the name of our interface is ``xl0'' then the configuration file to be checked will be ! @file{/usr/local/etc/dhcp-agent/dhcp-client/xl0.conf} If this file does not exist then the default configuration file is ! @file{/usr/local/etc/dhcp-agent/dhcp-client/default.conf} This allows dhcp-client to accept configuration per interface, and use *************** *** 107,112 **** The configuration file is made up of directives. Each directive can take up one line or fall on multiple lines . Each directive is ! terminated by a ';' character. Whitespace is ignored unless it is ! found in a quoted sting. Newlines are always ignored. @example --- 107,112 ---- The configuration file is made up of directives. Each directive can take up one line or fall on multiple lines . Each directive is ! terminated by a semicolon. Whitespace is ignored unless it is found in ! a quoted sting. Newlines are always ignored. @example *************** *** 165,169 **** @deffn {Client Configuration Directive} request ! request : The ``request'' directive instructs the client to request a set of dhcp options. The request directive accepts a list of strings which name the options to be requested: --- 165,170 ---- @deffn {Client Configuration Directive} request ! ! This directive instructs the client to request a set of dhcp options. The request directive accepts a list of strings which name the options to be requested: *************** *** 179,183 **** @deffn {Client Configuration Directive} require ! The ``require'' directive instructs the client to require a set of dhcp options to be passed before accepting the lease. This is useful to make sure you receive a minimum of desired options. If these --- 180,184 ---- @deffn {Client Configuration Directive} require ! This directive instructs the client to require a set of dhcp options to be passed before accepting the lease. This is useful to make sure you receive a minimum of desired options. If these *************** *** 193,197 **** @deffn {Client Configuration Directive} configure ! The ``configure'' directive instructs the client to only configure a set of dhcp options. This is useful if the server is passing you options you would rather not configure but implicitly --- 194,198 ---- @deffn {Client Configuration Directive} configure ! This directive instructs the client to only configure a set of dhcp options. This is useful if the server is passing you options you would rather not configure but implicitly *************** *** 208,214 **** ! @deffn {Client Configuration Directive} configure ! append : the ``append'' directive instructs the client to append a value to a DHCP option prior to system configuration. If this option is a list of values, the value specified is merely appended. If this --- 209,215 ---- ! @deffn {Client Configuration Directive} append ! This directive instructs the client to append a value to a DHCP option prior to system configuration. If this option is a list of values, the value specified is merely appended. If this *************** *** 225,229 **** @deffn {Client Configuration Directive} prepend ! The ``prepend'' directive works the same as the append directive only the values are placed at the beginning of the list or string. You should not use prepend on single datum options and should --- 226,230 ---- @deffn {Client Configuration Directive} prepend ! This directive works the same as the append directive only the values are placed at the beginning of the list or string. You should not use prepend on single datum options and should *************** *** 238,242 **** @deffn {Client Configuration Directive} override ! override : the ``override'' directive instructs the client to overwrite a DHCP option with a specified value prior to system configuration. This is useful to for clients that wish to use an --- 239,243 ---- @deffn {Client Configuration Directive} override ! This directive instructs the client to overwrite a DHCP option with a specified value prior to system configuration. This is useful to for clients that wish to use an *************** *** 254,258 **** @deffn {Client Configuration Directive} set ! set : the ``set'' directive instructs the client to set a variable to a defined value. --- 255,259 ---- @deffn {Client Configuration Directive} set ! This directive instructs the client to set a variable to a defined value. *************** *** 265,269 **** @deffn {Client Configuration Directive} enable ! enable: the ``enable'' directive instructs the client to set a boolean variable to a defined value. The boolean variable only accepts ``yes'' or ``no'' for values. --- 266,270 ---- @deffn {Client Configuration Directive} enable ! This directive instructs the client to set a boolean variable to a defined value. The boolean variable only accepts ``yes'' or ``no'' for values. *************** *** 282,286 **** @defvr {Client Configuration Variable} hostname ! The ``hostname'' variable can be set to a string which is passed as the hostname DHCP option to the server. This allows servers to pass configuration based on a hostname passed by the client. It will also --- 283,287 ---- @defvr {Client Configuration Variable} hostname ! This variable can be set to a string which is passed as the hostname DHCP option to the server. This allows servers to pass configuration based on a hostname passed by the client. It will also *************** *** 299,303 **** @defvr {Client Configuration Variable} dhcp-discovery-retries ! The ``dhcp-discovery-retries'' variable can be set to an integer value which instructs the client on how many times it should retry a DHCP discover before it gives up. --- 300,304 ---- @defvr {Client Configuration Variable} dhcp-discovery-retries ! This variable can be set to an integer value which instructs the client on how many times it should retry a DHCP discover before it gives up. *************** *** 311,315 **** @defvr {Client Configuration Variable} icmp-retries ! The ``icmp-retries'' variable can be set to an integer value which instructs the client on how many times it should retry an ICMP operation. This affects operations such as router latency discovery, --- 312,316 ---- @defvr {Client Configuration Variable} icmp-retries ! This variable can be set to an integer value which instructs the client on how many times it should retry an ICMP operation. This affects operations such as router latency discovery, *************** *** 324,328 **** @defvr {Client Configuration Variable} default-interface-mtu ! The ``default-interface-mtu'' variable can be set to an integer value which instructs the client on what it's default interface MTU should be. This MTU is used during the initial DHCP discovery messages, and --- 325,329 ---- @defvr {Client Configuration Variable} default-interface-mtu ! This variable can be set to an integer value which instructs the client on what it's default interface MTU should be. This MTU is used during the initial DHCP discovery messages, and *************** *** 338,342 **** @defvr {Client Configuration Variable} default-subnet-mask ! The ``default-subnet-mask'' variable can be set to a netmask value to specify a default subnet mask in case none is provided by the DHCP operation. Unlike the ``override'' directive this provides a fallback --- 339,343 ---- @defvr {Client Configuration Variable} default-subnet-mask ! This variable can be set to a netmask value to specify a default subnet mask in case none is provided by the DHCP operation. Unlike the ``override'' directive this provides a fallback *************** *** 351,355 **** @defvr {Client Configuration Variable} do-measure-router-latency ! The ``do-measure-router-latency'' variable can be set to a boolean value to indicate whether or not the client should attempt to send ICMP ECHO requests to routers passed by the DHCP server and determine --- 352,356 ---- @defvr {Client Configuration Variable} do-measure-router-latency ! This variable can be set to a boolean value to indicate whether or not the client should attempt to send ICMP ECHO requests to routers passed by the DHCP server and determine *************** *** 372,376 **** familiar with the Scheme programming language. If you are not familiar with the Scheme programming language then you cannot extend the client ! to configure options it cannot handle. [ TODO ] --- 373,638 ---- familiar with the Scheme programming language. If you are not familiar with the Scheme programming language then you cannot extend the client ! to configure options is not programmed to handle. ! ! @subsection The Sysconf Script ! ! dhcp-client calls a sysconf script which is placed in the same ! directory as the configuration file. This script, like the ! configuration file, can be named either ``default.sysconf'' or after ! an interface name. ! ! @subsection Looking At The Sysconf Script ! ! The default sysconf script which is shipped with dhcp-agent is made up ! of several lambda expressions which are placed inside closures. If ! you're not familiar with the concept of closures, refer to the guile ! documentation. ! ! Under each closure is a configure/unconfigure lambda expression which ! are bound to top level symbols. These symbols are then placed in two ! hooks, one for the bound state, and one for the release state. ! ! @subsection The DNS Configuration: An Example ! ! We'll walk through the DNS configuration (a very simple example) to ! see how it was written. After this example a more in-depth discussion ! follows. If you notice some details are skipped over, don't worry. It ! will become clear later. ! ! @example ! (define configure-dns #f) ! (define unconfigure-dns #f) ! @end example ! ! First we define two top level symbols to false. We'll later bind ! against these in the closure. ! ! @example ! (let ((configured-domain-name #f) ! (configured-domain-name-servers #f) ! @end example ! ! We begin the closure by defining two variables which will be used to ! hold any configured domain name and domain name servers. For DNS ! configuration these aren't useful, but for other sysconf code keeping ! the values of configured data is useful when it comes time to ! unconfigure the system on a DHCP RELEASE. ! ! @example ! ; 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))))) ! @end example ! ! Here we define a lambda expression which will tell us whether or not ! we should be performing any configuration for dns. The expression will ! return true if the options ``domain-name-servers'' and ``domain-name'' ! have been passed to us by the DHCP server. Also it checks if the user ! has requested that we configure these options. ! ! @example ! ; 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))))) ! ! @end example ! ! The ``configure-dns'' function will first check if ``do-configure'' ! returns true. It will then open ``/etc/resolv.conf'' and notify the ! user that the resolver is being configured. It then writes out the ! contents of the string list ``dhcp-domain-name-servers'' to the file ! prefixing each string with the keyword ``nameserver.'' Finally the ! ``search'' keyword is written with the domain name. ! ! After the configuration is complete, the values are stored in ! ``configured-domain-name'' and ``configured-domain-name-servers.'' ! This allows us to remember the values in the event of unconfiguring ! the system. ! ! @example ! ; unconfigure dns options ! (set! unconfigure-dns ! (lambda() ! ! ; We shouldn't really be doing anything. Any name server ! ; is a good server :-) ! ! #t))) ! @end example ! ! As mentioned in the comment there's no need to do any ! unconfiguration. We'd rather have a resolv.conf than delete it. You ! can always modify this to delete the file, or insert a different set ! of values. ! ! @example ! ! (add-hook! dhcp-bind-hook configure-dns) ! (add-hook! dhcp-release-hook unconfigure-dns) ! ! @end example ! ! Finally the two routines are bound to the DHCP BIND and DHCP RELEASE ! hooks. It is important to add the option handlers in reverse ! order. You'll notice ``configure-interface'' is added last so that the ! interface is configured first. ! ! @subsection The DHCP BOUND and DHCP RELEASE hooks ! ! Two hooks are defined at the top level by the ! client. ``dhcp-bind-hook'' and ``dhcp-release-hook.'' When the client ! wants to configure itself it will call ``dhcp-bind-hook'' and when it ! releases its lease it will call ``dhcp-release-hook.'' ! ! @subsection How DHCP Options Are Passed To The Sysconf Script ! ! When the DHCP BOUND hook is called, all the options are defined as ! top level symbols which refer to either a string, or a list of strings ! depending on whether the option is a single atom, or a list of atoms ! [ TODO: make list of handled options along with their types. ] ! ! In order to check for the existance of an option, simple use ! ``defined?'' to check if the symbol is bound. ! ! @example ! ! ; check for the routers option ! ! (defined? 'dhcp-routers) ! ! @end example ! ! This will return a boolean value of true of false depending on whether ! the DHCP option has been bound at the top level. ! ! @subsection Scheme Routines Provided By The Client ! ! At the top level a ``client-control'' symbol is bound to a control ! object which is used in every invocation of routines provided by the ! client. ! ! @deffn {Client Sysconf Routine} client-configure? client-control option-symbol ! ! Returns #t of #f depending on whether or not the user has explicitly ! stated that the dhcp option should be configured. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-interface-up client-control ip-address netmask mtu ! ! Initializes the network interface the client is handling and assigns ! the requested @var{ip-address}, the @var{netmask} and @var{mtu}. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-set-default-route client-control ip-address ! ! Sets the default route to the @var{ip-address} specified. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-remove-default-route client-control ip-address ! ! Removes the default route to the @var{ip-address} specified. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-get-default-mtu client-control ! ! Returns the default mtu specified by the user. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-get-default-subnet-mask client-control ! ! Returns the default subnet-mask specified by the user. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-info-message string ! ! Prints out the string using the client's @dfn{info_message} routine. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-error-message string ! ! Prints out the string using the client's @dfn{error_message} routine. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-fatal-message string ! ! Prints out the string using the client's @dfn{fatal_message} ! routine. This exits after passing the message to the user. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-shutdown client-control ! ! Invokes the @dfn{shutdown} routine in the client and causes the ! client to exit as cleanly as possible, relinquishing any leases it ! has. Warning! This should not be called from within a release hook. ! ! @end deffn ! ! @deffn {Client Sysconf Routine} client-discover-icmp-latency client-control address-list ! ! Accepts an @var{address-list} and performs ICMP ECHO latency tests to ! determine which host is responding fastest. A list is returned with ! the quickest responders first. ! ! @end deffn ! ! @subsection Why Not Just Use A Shell Script? ! ! Traditionally the UNIX initialization process is programmed with ! simple shell scripts. This is fine because all the variables are ! passed from the local system (usually set by the administrator or ! vendor). ! ! In the case of DHCP configuration data is passed from a server which ! ought to be handled as untrustworthy data unless you're willing to use ! it in a certain way. ! ! For example, assuming you wish to configure your hostname according to ! the DHCP server, you will receive the hostname as a string and use ! that string for your hostname. You don't, though, want the hostname ! passed to be arbitrary shell code which is run inadvertently from your ! shell script. ! ! Most DHCP clients in the wild have fixed this problem by quoting the ! DHCP options as they are passed to the shell. I still foresee this as ! problematic, and a security hazard. ! ! Guile offers the Scheme programming language which is an incredibly ! small subset of Lisp. It's easy to pick up. The DHCP options are ! passed to the Scheme system configuration script as strings or lists ! of strings. These strings are harmless unless you are specifically ! asking the Scheme interpreter to evaluate them. ! ! On the other hand most casual users just want basic networking up, and ! the ability to tweak certain options. The DHCP client already offers ! this to anyone, irregardless of their knowledge of Scheme. ! ! @section Advanced Client Use [ TODO ] Index: introduction.texi =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/doc/introduction.texi,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** introduction.texi 18 May 2003 03:18:10 -0000 1.1 --- introduction.texi 27 Jun 2003 16:46:46 -0000 1.2 *************** *** 94,104 **** @subsection Linux ! [ TODO ] @subsection FreeBSD ! [ TODO ] @subsection Solaris ! [ TODO ] --- 94,130 ---- @subsection Linux ! The client under Linux may not be entirely happy when applied to an ! aliased interface. You will see some error messages, however things ! should proceed OK. @subsection FreeBSD ! Under FreeBSD the client will make use of two bpf devices. This is ! because of a limitation in dnet. If you run out of bpf devices you may ! need to compile a kernel with more bpf devices. @subsection Solaris ! No major issues so far. Building the package may become ! ``interesting'' if you have not setup your build environment properly. ! ! @subsection NetBSD ! ! NetBSD ships with a pcap which does not come with @dfn{pcap_freecode} ! this results in a small mem leak when the client reinitializes its raw ! network code. To avoid this upgrade to the latest version of pcap and ! nuke your old pcap library. ! ! @subsection OpenBSD ! ! OpenBSD has some brain damage with its bpf structure. Unlike the other ! BSD flavors it insists on using unsigned instead of signed integers ! for the number of seconds in its timestamp. This results in some ! inaccuracy when calculating timeouts. Lobby your OpenBSD developers to ! stop the brain damage. ! ! ! ! ! ! |
From: <act...@us...> - 2003-06-27 04:05:43
|
Update of /cvsroot/dhcp-agent/dhcp-agent/doc In directory sc8-pr-cvs1:/tmp/cvs-serv12525/doc Modified Files: dhcp-client.texi Log Message: prettied up client manual Index: dhcp-client.texi =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/doc/dhcp-client.texi,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dhcp-client.texi 18 May 2003 03:18:10 -0000 1.1 --- dhcp-client.texi 27 Jun 2003 04:05:40 -0000 1.2 *************** *** 2,6 **** @node dhcp-client @chapter dhcp-client - @cindex dhcp-client dhcp-client is a highly configurable and extendable DHCP client. Out --- 2,5 ---- *************** *** 68,71 **** --- 67,75 ---- configuration it had done before. + Although you can run the client in the foreground, if you do not, the + client will send the rest of its messages to syslogd. Currently it + logs to the daemon service [ FIXME: in the future the syslog service + will be configurable ]. + @section Client Configuration *************** *** 147,152 **** quoted strings will result in an error unless preceeded by the '\' character. There should be no need to put newlines in quoted strings ! and expect them to be evaluated. If you want newlines to be evaluated ! you need to convince the author that they should be :-) The '\' character can be used to escape double quotes too. --- 151,157 ---- quoted strings will result in an error unless preceeded by the '\' character. There should be no need to put newlines in quoted strings ! and expect them to be evaluated without the backslash (much like a ! Makefile). If you want newlines to be silently ignored you need to ! convince the author that they should be :-) The '\' character can be used to escape double quotes too. *************** *** 158,175 **** The following directives affect DHCP option handling by the client - @itemize bullet ! @item request : The ``request'' directive instructs the client to request a set of dhcp options. The request directive accepts a list of strings which name the options to be requested: @example request subnet-mask, ip-address-lease-time, renewal-time, ! rebinding-time, interface-mtu, domain-name, domain-name-servers; @end example ! @item ! require : the ``require'' directive instructs the client to require a set of dhcp options to be passed before accepting the lease. This is useful to make sure you receive a minimum of desired options. If these --- 163,183 ---- The following directives affect DHCP option handling by the client ! @deffn {Client Configuration Directive} request request : The ``request'' directive instructs the client to request a set of dhcp options. The request directive accepts a list of strings which name the options to be requested: + @example request subnet-mask, ip-address-lease-time, renewal-time, ! rebinding-time, interface-mtu, domain-name, domain-name-servers; @end example ! @end deffn ! ! @deffn {Client Configuration Directive} require ! ! The ``require'' directive instructs the client to require a set of dhcp options to be passed before accepting the lease. This is useful to make sure you receive a minimum of desired options. If these *************** *** 181,191 **** @end example ! @item ! configure : the ``configure'' directive instructs the client to only configure a set of dhcp options. This is useful if the server is passing you options you would rather not configure but implicitly claim to configure by accepting the lease. This directive does not ! define how options are configured [TODO write up extending the client ! with guile]. @example --- 189,202 ---- @end example ! @end deffn ! ! @deffn {Client Configuration Directive} configure ! ! The ``configure'' directive instructs the client to only configure a set of dhcp options. This is useful if the server is passing you options you would rather not configure but implicitly claim to configure by accepting the lease. This directive does not ! define how options are configured. In order to define how ! configuration is done see ``Writing Client Extensions,'' for more info. @example *************** *** 194,198 **** @end example ! @item append : the ``append'' directive instructs the client to append a --- 205,212 ---- @end example ! @end deffn ! ! ! @deffn {Client Configuration Directive} configure append : the ``append'' directive instructs the client to append a *************** *** 207,213 **** @end example ! @item ! prepend : the ``prepend'' directive works the same as the append directive only the values are placed at the beginning of the list or string. You should not use prepend on single datum options and should --- 221,229 ---- @end example ! @end deffn ! @deffn {Client Configuration Directive} prepend ! ! The ``prepend'' directive works the same as the append directive only the values are placed at the beginning of the list or string. You should not use prepend on single datum options and should *************** *** 218,222 **** @end example ! @item override : the ``override'' directive instructs the client to --- 234,240 ---- @end example ! @end deffn ! ! @deffn {Client Configuration Directive} override override : the ``override'' directive instructs the client to *************** *** 230,240 **** @end example ! @end itemize @subheading Variable Settings ! @itemize - @item set : the ``set'' directive instructs the client to set a variable to a defined value. --- 248,257 ---- @end example ! @end deffn @subheading Variable Settings ! @deffn {Client Configuration Directive} set set : the ``set'' directive instructs the client to set a variable to a defined value. *************** *** 244,248 **** @end example ! @item enable: the ``enable'' directive instructs the client to set a boolean --- 261,267 ---- @end example ! @end deffn ! ! @deffn {Client Configuration Directive} enable enable: the ``enable'' directive instructs the client to set a boolean *************** *** 254,258 **** @end example ! @end itemize @subheading Configurable Variables --- 273,277 ---- @end example ! @end deffn @subheading Configurable Variables *************** *** 261,275 **** values passed to the server, and control some of its behaviour. ! @itemize ! ! @item ! hostname : the ``hostname'' variable can be set to a string which is ! passed as the hostname DHCP option to the server. This allows servers ! to pass configuration based on a hostname passed by the client. It ! will also instruct the client to set the hostname to that ! variable. If you want to pass a hostname to the server you should set ! this variable and not use the ``override'' directive because the ! ``override'' directive only affects system configuration. @example --- 280,292 ---- values passed to the server, and control some of its behaviour. ! @defvr {Client Configuration Variable} hostname ! The ``hostname'' variable can be set to a string which is passed as ! the hostname DHCP option to the server. This allows servers to pass ! configuration based on a hostname passed by the client. It will also ! instruct the client to set the hostname to that variable. If you want ! to pass a hostname to the server you should set this variable and not ! use the ``override'' directive because the ``override'' directive only ! affects system configuration. @example *************** *** 277,284 **** @end example ! @item ! dhcp-discovery-retries: the ``dhcp-discovery-retries'' variable ! can be set to an integer value which instructs the client on how many ! times it should retry a DHCP discover before it gives up. @example --- 294,305 ---- @end example ! ! @end defvr ! ! @defvr {Client Configuration Variable} dhcp-discovery-retries ! ! The ``dhcp-discovery-retries'' variable can be set to an integer value ! which instructs the client on how many times it should retry a DHCP ! discover before it gives up. @example *************** *** 286,294 **** @end example ! @item ! icmp-retries: the ``icmp-retries'' variable ! can be set to an integer value which instructs the client on how many ! times it should retry an ICMP operation. This affects operations such ! as router latency discovery, ICMP netmask discovery etc. @example --- 307,318 ---- @end example ! @end defvr ! ! @defvr {Client Configuration Variable} icmp-retries ! ! The ``icmp-retries'' variable can be set to an integer value which ! instructs the client on how many times it should retry an ICMP ! operation. This affects operations such as router latency discovery, ! ICMP netmask discovery etc. @example *************** *** 296,305 **** @end example ! @item ! default-interface-mtu: the ``default-interface-mtu'' variable can be ! set to an integer value which instructs the client on what it's ! default interface MTU should be. This MTU is used during the initial ! DHCP discovery messages, and later used to configure the interface MTU ! if no MTU was specified by the DHCP server. @example --- 320,332 ---- @end example ! @end defvr ! ! @defvr {Client Configuration Variable} default-interface-mtu ! ! The ``default-interface-mtu'' variable can be set to an integer value ! which instructs the client on what it's default interface MTU should ! be. This MTU is used during the initial DHCP discovery messages, and ! later used to configure the interface MTU if no MTU was specified by ! the DHCP server. @example *************** *** 307,315 **** @end example ! @item ! default-subnet-mask: the ``default-subnet-mask'' variable can be set ! to a netmask value to specify a default subnet mask in case none is ! provided by the DHCP operation. Unlike the ``override'' directive this ! provides a fallback in case no subnet-mask is provided by the server. @example --- 334,345 ---- @end example ! @end defvr ! ! @defvr {Client Configuration Variable} default-subnet-mask ! ! The ``default-subnet-mask'' variable can be set to a netmask value to ! specify a default subnet mask in case none is provided by the DHCP ! operation. Unlike the ``override'' directive this provides a fallback ! in case no subnet-mask is provided by the server. @example *************** *** 317,328 **** @end example ! @item ! do-measure-router-latency: the ``do-measure-router-latency'' variable ! can be set to a boolean value to indicate whether or not the client ! should attempt to send ICMP ECHO requests to routers passed by the ! DHCP server and determine which is one has the least latency to become ! the default route. Disabling this variable stops this operation from ! taking place, and the first router is used as the default route. This ! is useful if the routers cannot be reached by ICMP ECHO requests. @example --- 347,361 ---- @end example ! @end defvr ! ! @defvr {Client Configuration Variable} do-measure-router-latency ! ! The ``do-measure-router-latency'' variable can be set to a boolean ! value to indicate whether or not the client should attempt to send ! ICMP ECHO requests to routers passed by the DHCP server and determine ! which is one has the least latency to become the default ! route. Disabling this variable stops this operation from taking place, ! and the first router is used as the default route. This is useful if ! the routers cannot be reached by ICMP ECHO requests. @example *************** *** 330,334 **** @end example ! @end itemize @section Writing Client Extensions --- 363,367 ---- @end example ! @end defvr @section Writing Client Extensions *************** *** 342,344 **** [ TODO ] - --- 375,376 ---- |
From: <act...@us...> - 2003-06-27 03:25:16
|
Update of /cvsroot/dhcp-agent/dhcp-agent/man In directory sc8-pr-cvs1:/tmp/cvs-serv8198/man Modified Files: .cvsignore Log Message: cvsignore now ignoring man pages Index: .cvsignore =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/man/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 29 Oct 2002 17:16:46 -0000 1.1 --- .cvsignore 27 Jun 2003 03:25:13 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- Makefile.in Makefile stamp-h1 + *.1 |
From: <act...@us...> - 2003-06-27 03:19:00
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf In directory sc8-pr-cvs1:/tmp/cvs-serv7385/conf Modified Files: default.conf Log Message: arp timeout threshold slightly higher by default Index: default.conf =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/default.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** default.conf 8 Jun 2003 22:16:10 -0000 1.2 --- default.conf 27 Jun 2003 03:18:45 -0000 1.3 *************** *** 50,52 **** set arp-retries = 1; ! set arp-timeout-threshold = 1; --- 50,52 ---- set arp-retries = 1; ! set arp-timeout-threshold = 10; |
From: <act...@us...> - 2003-06-27 03:17:33
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv7301 Modified Files: TODO Log Message: update to TODO Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TODO 27 Jun 2003 00:02:26 -0000 1.17 --- TODO 27 Jun 2003 03:17:28 -0000 1.18 *************** *** 14,18 **** -- 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 --- 14,17 ---- *************** *** 56,58 **** -- stringbuffer might be more useful it allowed marking of arbitrary characters with sentinels. - --- 55,56 ---- |
From: <act...@us...> - 2003-06-27 03:17:09
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv7280 Modified Files: CAVEATS Log Message: update to caveats Index: CAVEATS =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/CAVEATS,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CAVEATS 29 Oct 2002 17:11:02 -0000 1.1.1.1 --- CAVEATS 27 Jun 2003 03:17:04 -0000 1.2 *************** *** 1,15 **** ! Sorry folks, still lots of caveats to watch out for. ! -- dhcpclient may act funny with interfaces with mtu's larger or smaller than 1500. this will be fixed in future releases. ! -- dhcpclient may exceed the recommended udp size of 576 bytes. this ! needs to be fixed. It currently does not overload bootp fields to ! make up for this. ! ! -- dhcpclient spoofing mac address may not work on all systems or NICs. test to be sure. ! -- dhcpclient's icmp mask discovery has not been tested. Please report success if you use this feature (send me a patch too for any bugs). --- 1,11 ---- ! Sorry folks, still lots of caveats to watch out for: ! -- dhcp-client may act funny with interfaces with mtu's larger or smaller than 1500. this will be fixed in future releases. ! -- dhcp-client spoofing mac address may not work on all systems or NICs. test to be sure. ! -- dhcp-client's icmp mask discovery has not been tested. Please report success if you use this feature (send me a patch too for any bugs). |
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv7174/src Modified Files: dhcp-client-conf.c dhcp-client-conf.h dhcp-option-convert.c dhcp-option.c dhcp-option.h dhcp-sysconf.c Log Message: prepend, append, override now hooked into sysconf Index: dhcp-client-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** dhcp-client-conf.c 23 Jun 2003 06:04:33 -0000 1.28 --- dhcp-client-conf.c 27 Jun 2003 03:16:27 -0000 1.29 *************** *** 734,737 **** --- 734,755 ---- * * * * * * */ + /* get options to override. */ + list_t *client_conf_get_override_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr) + { + return cc->params->override_options; + } + + /* get options to append. */ + list_t *client_conf_get_append_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr) + { + return cc->params->append_options; + } + + /* get options to prepend. */ + list_t *client_conf_get_prepend_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr) + { + return cc->params->prepend_options; + } + /* get parameters to request: this is always from the top level. */ uint8_t *client_conf_get_request_opt_bit_array(client_conf_t *cc) *************** *** 1013,1018 **** } ! static int directive_user_defined_option_handler_proc(client_conf_params_t *params, void *directive_data, directive_group_t group_type, void *group_data, ! int var_type) { char *option_name; --- 1031,1037 ---- } ! static int directive_user_defined_option_handler_proc(client_conf_params_t *params, void *directive_data, ! directive_group_t group_type, void *group_data, ! int var_type) { char *option_name; Index: dhcp-client-conf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-client-conf.h 23 Jun 2003 06:04:33 -0000 1.18 --- dhcp-client-conf.h 27 Jun 2003 03:16:27 -0000 1.19 *************** *** 96,99 **** --- 96,102 ---- extern int client_conf_reread(client_conf_t *cc); + extern list_t *client_conf_get_override_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr); + extern list_t *client_conf_get_append_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr); + extern list_t *client_conf_get_prepend_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr); extern uint8_t *client_conf_get_request_opt_bit_array(client_conf_t *cc); extern int client_conf_get_dhcp_discovery_retries(client_conf_t *cc); Index: dhcp-option-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option-convert.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-option-convert.c 17 Jun 2003 07:34:16 -0000 1.5 --- dhcp-option-convert.c 27 Jun 2003 03:16:27 -0000 1.6 *************** *** 1685,1689 **** count = count_internal_string_atoms_and_mark(string_copy); ! opt->val = internal_string_list_ip_addr_to_internal(input, count); opt->num = count; --- 1685,1689 ---- count = count_internal_string_atoms_and_mark(string_copy); ! opt->val = internal_string_list_ip_addr_to_internal(string_copy, count); opt->num = count; Index: dhcp-option.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-option.c 17 Jun 2003 07:34:16 -0000 1.5 --- dhcp-option.c 27 Jun 2003 03:16:27 -0000 1.6 *************** *** 1440,1443 **** --- 1440,1444 ---- } + /* copy a dhcp option. */ dhcp_opt_t *dhcp_option_copy(dhcp_opt_t *option) { *************** *** 1447,1448 **** --- 1448,1498 ---- } + /* append to a dhcp list datum. */ + void dhcp_option_append(dhcp_opt_t *orig, dhcp_opt_t *data) + { + + uint8_t *new_data, *orig_data; + list_t *orig_list, *append_list; + dhcp_opt_len_t len; + + orig_list = dhcp_opt_get_host_data(orig); + append_list = dhcp_opt_get_host_data(data); + len = dhcp_opt_get_mem_len(orig); + + list_rewind(append_list); + while((orig_data = list_next(append_list)) != NULL) { + + new_data = xmalloc(len); + memcpy(new_data, orig_data, len); + + list_add_to_end(orig_list, new_data); + orig->num++; + } + + return; + } + + /* prepend to a dhcp list datum. */ + void dhcp_option_prepend(dhcp_opt_t *orig, dhcp_opt_t *data) + { + + uint8_t *new_data, *orig_data; + list_t *orig_list, *prepend_list; + dhcp_opt_len_t len; + + orig_list = dhcp_opt_get_host_data(orig); + prepend_list = dhcp_opt_get_host_data(data); + len = dhcp_opt_get_mem_len(orig); + + list_rewind(prepend_list); + while((orig_data = list_next(prepend_list)) != NULL) { + + new_data = xmalloc(len); + memcpy(new_data, orig_data, len); + + list_add(orig_list, new_data); + orig->num++; + } + + return; + } Index: dhcp-option.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dhcp-option.h 17 Jun 2003 07:34:16 -0000 1.5 --- dhcp-option.h 27 Jun 2003 03:16:27 -0000 1.6 *************** *** 49,52 **** --- 49,55 ---- extern dhcp_opt_t *dhcp_opt_create_parameter_request_list(uint8_t *requested_options); + extern void dhcp_option_append(dhcp_opt_t *orig, dhcp_opt_t *data); + extern void dhcp_option_prepend(dhcp_opt_t *orig, dhcp_opt_t *data); + /* constants. */ *************** *** 83,85 **** #endif /* DHCP_OPTION_H */ - --- 86,87 ---- Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-sysconf.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dhcp-sysconf.c 25 Jun 2003 02:38:02 -0000 1.20 --- dhcp-sysconf.c 27 Jun 2003 03:16:27 -0000 1.21 *************** *** 41,44 **** --- 41,119 ---- #include "dhcp-client-guile.h" + /* override, prepend, and append to options. */ + + /* do overrides. */ + static void sysconf_override(list_t *options, list_t *overrides) + { + dhcp_opt_t *orig, *override; + + /* walk down list and override where necessary. since we're + * overriding the options list and will be rewriting it we + * need to loop on overrides in order to avoid looping + * indefinetly. unfortunately this gives us the worest case + * scenario in terms of cpu time. FIXME: write a + * list_replace_datum routine */ + + list_rewind(overrides); + while((override = list_next(overrides)) != NULL) { + + list_rewind(options); + while((orig = list_next(options)) != NULL) { + + if(DHCP_OPT_GET_TAG(override) == DHCP_OPT_GET_TAG(orig)) { + + list_remove_by_datum(options, orig); + DHCP_OPT_DESTROY(orig); + + list_add(options, dhcp_option_copy(override)); + break; + } + } + } + + return; + } + + static void sysconf_prepend_or_append_proc(list_t *options, list_t *add_options, + void (*add)(dhcp_opt_t *orig, dhcp_opt_t *add)) + { + dhcp_opt_t *orig, *add_opt; + + /* walk down list and do addition where necessary. */ + list_rewind(options); + while((orig = list_next(options)) != NULL) { + + list_rewind(add_options); + while((add_opt = list_next(add_options)) != NULL) { + + if(DHCP_OPT_GET_TAG(orig) == DHCP_OPT_GET_TAG(add_opt)) { + + /* we already know that the conf code guarantees + * we're only dealing with list types. no need to + * double check here. */ + + add(orig, add_opt); + break; + } + } + } + + return; + } + + /* do prepends. */ + static void sysconf_prepend(list_t *options, list_t *prepends) + { + sysconf_prepend_or_append_proc(options, prepends, dhcp_option_prepend); + return; + } + + /* do appends. */ + static void sysconf_append(list_t *options, list_t *appends) + { + sysconf_prepend_or_append_proc(options, appends, dhcp_option_append); + return; + } + /* * * * * * * * * * * * * Sysconf interface. * *************** *** 47,50 **** --- 122,144 ---- void do_sysconf(list_t *options, dhcp_client_control_t *dc, int state) { + list_t *overrides, *prepends, *appends; + + overrides = client_conf_get_override_options(dc->conf, + dhcp_client_get_server_ip_address(dc), + dhcp_client_get_server_hw_address(dc)); + + sysconf_override(options, overrides); + + prepends = client_conf_get_append_options(dc->conf, + dhcp_client_get_server_ip_address(dc), + dhcp_client_get_server_hw_address(dc)); + sysconf_prepend(options, prepends); + + appends = client_conf_get_prepend_options(dc->conf, + dhcp_client_get_server_ip_address(dc), + dhcp_client_get_server_hw_address(dc)); + sysconf_append(options, appends); + + return dhcp_sysconf_guile(dc, options, state); } |
From: <act...@us...> - 2003-06-27 03:15:59
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv7104/src Modified Files: dhcp-librawnet.h Log Message: using size_t to keep track of option length Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dhcp-librawnet.h 26 Jun 2003 23:56:42 -0000 1.19 --- dhcp-librawnet.h 27 Jun 2003 03:15:50 -0000 1.20 *************** *** 29,33 **** typedef uint8_t dhcp_opt_tag_t; ! typedef uint8_t dhcp_opt_len_t; typedef uint16_t dhcp_opt_type_t; typedef uint16_t dhcp_opt_val_type_t; --- 29,33 ---- typedef uint8_t dhcp_opt_tag_t; ! typedef size_t dhcp_opt_len_t; typedef uint16_t dhcp_opt_type_t; typedef uint16_t dhcp_opt_val_type_t; |
From: <act...@us...> - 2003-06-27 03:15:29
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv7064/src Modified Files: dhcp-client-states.c Log Message: no race condition in timer handling Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** dhcp-client-states.c 26 Jun 2003 23:56:41 -0000 1.41 --- dhcp-client-states.c 27 Jun 2003 03:15:25 -0000 1.42 *************** *** 986,990 **** } ! /* wait for any interrupts. */ suspend_for_interrupts(); --- 986,993 ---- } ! /* wait for any interrupts: we're OK. there is no race ! * condition here since our suspension will unmask us ! * and allow any previous signals to affect us here. */ ! suspend_for_interrupts(); |
From: <act...@us...> - 2003-06-27 00:02:29
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv18196 Modified Files: TODO Log Message: more done, less todo :-) Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TODO 23 Jun 2003 06:07:22 -0000 1.16 --- TODO 27 Jun 2003 00:02:26 -0000 1.17 *************** *** 32,37 **** defined. ! -- implement decline, and inform in the client. ! as per RFC2131 --- 32,36 ---- defined. ! -- implement in inform the client. as per RFC2131 *************** *** 43,51 **** -- document output from dhcpsniff -- especially how brief mode is layed out. - -- check for race condition -- even if it is tiny -- in client_wait - - -- make a distinction between SELECT and INIT-REBOOT. right now we have a - single client_request_ack routine - -- check if we handle 0xffffffff timers right. --- 42,45 ---- *************** *** 62,74 **** -- stringbuffer might be more useful it allowed marking of arbitrary characters with sentinels. - - -- fix dhcp-com.c to ignore options which are not within the - handled option range, but not stop processing packets when an - out of range option is encountered. - - -- fix renew/rebind -- it broke again. rfc indicates what options - need to be in and what need to be out. - - -- make sure the timer values passed to us from the server don't - overflow our internal timer. --- 56,58 ---- |
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv17179/src Modified Files: dhcp-client-states.c dhcp-client.c dhcp-client.h dhcp-librawnet.h dhcp-libutil.h dhcp-packet-build.c dhcp-util.c Log Message: added dhcp-decline Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** dhcp-client-states.c 25 Jun 2003 03:08:09 -0000 1.40 --- dhcp-client-states.c 26 Jun 2003 23:56:41 -0000 1.41 *************** *** 151,154 **** --- 151,176 ---- } + static list_t *client_build_decline_option_list(dhcp_client_control_t *dc, ip_addr_t ip_address) + { + list_t *options; + dhcp_opt_t *option; + + options = list_create(); + + /* client_id: RFC2131 says we MAY */ + option = dhcp_opt_create_from_internal_data(TAG_DHCP_CLIENT_ID, dc->client_id, (ETH_ADDR_LEN + 1)); + list_add(options, option); + + /* requested ip address: RFC2131 MUST. */ + option = dhcp_opt_create_from_internal_data(TAG_DHCP_REQUESTED_IP_ADDRESS, &ip_address, IP_ADDR_LEN); + list_add(options, option); + + /* dhcp message type. */ + option = dhcp_opt_create_message_type(DHCP_DECLINE_TM); + list_add(options, option); + + return options; + } + /* create DHCP RENEW option list. */ static list_t *client_build_renew_option_list(dhcp_client_control_t *dc) *************** *** 377,381 **** ð_addr)) { ERROR_MESSAGE("DHCP server assigned us a used address. Declining."); ! return STATE_DECLINE; } --- 399,411 ---- ð_addr)) { ERROR_MESSAGE("DHCP server assigned us a used address. Declining."); ! client_decline(dc); ! ! /* sleep for up to ten seconds: fixme: make this configurable. */ ! INFO_MESSAGE("sleeping before retry (for %"PRIu16" seconds)", 10); ! ! client_cache_delete_cache(dc->cache); ! sleep_random(10); ! ! return STATE_INIT; } *************** *** 750,755 **** client_cache_delete_tmp_cache(dc->cache); ! /* sleep for up to ten seconds: FIXME: make configurable. */ ! sleep((get_random_uint16()%11) + 1); INFO_MESSAGE("retrying."); --- 780,786 ---- client_cache_delete_tmp_cache(dc->cache); ! /* sleep for up to ten seconds: fixme: make this configurable. */ ! INFO_MESSAGE("sleeping before retry (for %"PRIu16" seconds)", 10); ! sleep_random(10); INFO_MESSAGE("retrying."); *************** *** 1010,1028 **** int client_release(dhcp_client_control_t *dc) { ! list_t *options; ! ip_addr_t my_addr; INFO_MESSAGE("sending DHCP RELEASE"); ! my_addr = rawnet_get_ip_addr(dc->rawnet); options = client_build_release_option_list(dc); ! build_dhcp_release(dc->rawnet, dc->xid, options, my_addr, dhcp_client_get_server_ip_address(dc), dhcp_client_get_server_hw_address(dc)); if(rawnet_send_packet(dc->rawnet) < 0) { ! ERROR_MESSAGE("could not send release."); return STATE_FATAL_ERROR; } --- 1041,1078 ---- int client_release(dhcp_client_control_t *dc) { ! list_t *cache_options, *options; ! ip_addr_t *my_addr = NULL; ! ip_addr_t ciaddr; ! dhcp_opt_t *option; INFO_MESSAGE("sending DHCP RELEASE"); ! cache_options = client_cache_load_options(dc->cache, 0); ! ! list_rewind(cache_options); ! while((option = list_next(cache_options)) != NULL) { ! ! if(DHCP_OPT_GET_TAG(option) == TAG_DHCP_REQUESTED_IP_ADDRESS) { ! my_addr = DHCP_OPT_TO_INTERNAL_DATA(option); ! break; ! } ! } ! ! if(my_addr == NULL) { /* if empty, don't release. */ ! dhcp_opt_destroy_option_list(cache_options); ! return STATE_FATAL_ERROR; ! } ! ! ciaddr = *my_addr; ! dhcp_opt_destroy_option_list(cache_options); options = client_build_release_option_list(dc); ! build_dhcp_release(dc->rawnet, dc->xid, options, ciaddr, dhcp_client_get_server_ip_address(dc), dhcp_client_get_server_hw_address(dc)); if(rawnet_send_packet(dc->rawnet) < 0) { ! ERROR_MESSAGE("could not send RELEASE."); return STATE_FATAL_ERROR; } *************** *** 1072,1074 **** --- 1122,1164 ---- exit(0); + } + + /* decline a lease. */ + int client_decline(dhcp_client_control_t *dc) + { + list_t *options, *decline_options; + dhcp_opt_t *option; + ip_addr_t *passed_ip = NULL; + + INFO_MESSAGE("performing DHCP decline"); + + options = client_cache_load_options(dc->cache, 0); + + list_rewind(options); + while((option = list_next(options)) != NULL) { + + if(DHCP_OPT_GET_TAG(option) == TAG_DHCP_REQUESTED_IP_ADDRESS) { + passed_ip = DHCP_OPT_TO_INTERNAL_DATA(option); + break; + } + } + + if(passed_ip == NULL) { + FATAL_MESSAGE("no address assigned and we're trying to decline. this is a bug, report me."); + } + + decline_options = client_build_decline_option_list(dc, *passed_ip); + dhcp_opt_destroy_option_list(options); + + build_dhcp_decline(dc->rawnet, dc->xid, dc->secs, decline_options); + if(rawnet_send_packet(dc->rawnet) < 0) { + ERROR_MESSAGE("could not send DECLINE."); + return STATE_FATAL_ERROR; + } + + /* a lot like release, our return here shouldn't matter since + * we are most likely called within a state. if not then the + * state simply shouldn't be handled. */ + + return STATE_FATAL_ERROR; } Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** dhcp-client.c 17 Jun 2003 07:34:16 -0000 1.30 --- dhcp-client.c 26 Jun 2003 23:56:42 -0000 1.31 *************** *** 87,90 **** --- 87,92 ---- client_inform, client_shutdown, + client_release, + client_decline, }; Index: dhcp-client.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dhcp-client.h 25 Jun 2003 03:08:32 -0000 1.19 --- dhcp-client.h 26 Jun 2003 23:56:42 -0000 1.20 *************** *** 95,98 **** --- 95,99 ---- extern int client_shutdown(dhcp_client_control_t *dc); extern int client_reinitialize(dhcp_client_control_t *dc); + extern int client_decline(dhcp_client_control_t *dc); /* client control. */ Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-librawnet.h 26 Jun 2003 13:55:09 -0000 1.18 --- dhcp-librawnet.h 26 Jun 2003 23:56:42 -0000 1.19 *************** *** 403,406 **** --- 403,407 ---- extern void build_dhcp_release(rawnet_t *net, uint32_t xid, list_t *options, ip_addr_t cip_addr, ip_addr_t sip_addr, eth_addr_t shw_addr); + extern void build_dhcp_decline(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); /* arp packet routines. */ Index: dhcp-libutil.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-libutil.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dhcp-libutil.h 25 May 2003 03:37:36 -0000 1.26 --- dhcp-libutil.h 26 Jun 2003 23:56:42 -0000 1.27 *************** *** 195,198 **** --- 195,199 ---- extern char *eth_addr_to_string(eth_addr_t eth_addr); extern char *ip_addr_to_string(ip_addr_t ip_addr); + extern void sleep_random(uint16_t max_sleep); /* type check routines */ Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-packet-build.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-packet-build.c 25 Jun 2003 02:28:02 -0000 1.8 --- dhcp-packet-build.c 26 Jun 2003 23:56:42 -0000 1.9 *************** *** 429,432 **** --- 429,439 ---- } + void build_dhcp_decline(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) + { + build_dhcp(net, xid, secs, 0, 0, 0, 0, ip_addr_broadcast, eth_broadcast, + 0, options, DHCP_BOOTP_REQUEST); + } + + /* * * * * * * * * * * ICMP routines. * Index: dhcp-util.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-util.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dhcp-util.c 9 Jun 2003 02:03:12 -0000 1.15 --- dhcp-util.c 26 Jun 2003 23:56:42 -0000 1.16 *************** *** 582,583 **** --- 582,588 ---- } + + void sleep_random(uint16_t max_sleep) + { + sleep((get_random_uint16()%(max_sleep + 1)) + 1); + } |
From: <act...@us...> - 2003-06-26 13:55:15
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv14579/src Modified Files: dhcp-com.c dhcp-librawnet.h Log Message: unhandled dhcp options are now ignored instead of causing processing to stop Index: dhcp-com.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-com.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dhcp-com.c 4 May 2003 18:52:19 -0000 1.11 --- dhcp-com.c 26 Jun 2003 13:55:09 -0000 1.12 *************** *** 78,86 **** dhcp_opt_t *option; ! /* Check for malformed option. */ ! if(len < 2 || /* is len smaller than 2? (it can never be) */ ! !dhcp_option_is_valid(opt_data[0], opt_data[1]) /* is the tag and len valid? */ ! || len < opt_data[1]) /* finally is there as much space as is claimed? */ return NULL; --- 78,85 ---- dhcp_opt_t *option; ! /* Make sure the current packet length is big enough to hold ! * the whole option. */ ! if(len < 2 || (len - 2) < opt_data[1]) return NULL; *************** *** 94,97 **** --- 93,106 ---- } + static int skip_option(const uint8_t *opt_data, int len, uint8_t *optlen) + { + if(len < 2 || (len - 2) < opt_data[1]) + return 1; + + *optlen = opt_data[1]; + return 0; + } + + static void dhcp_read_options_image(dhcp_obj * dhcp, const uint8_t *dhcp_packet, int len) { *************** *** 125,135 **** break; ! /* If not PAD or END we copy the data out. */ ! option = process_next_dhcp_option(dhcp_packet, len, &optlen); ! if(option == NULL) ! break; ! list_add_to_end(dhcp->options, option); len -= (optlen + 2); --- 134,151 ---- break; ! /* ignore options we cannot handle. */ ! if(*dhcp_packet > MAX_OPTIONS_HANDLED) { ! if(skip_option(dhcp_packet, len, &optlen)) ! break; ! } else { ! ! option = process_next_dhcp_option(dhcp_packet, len, &optlen); ! if(option == NULL) ! break; ! ! list_add_to_end(dhcp->options, option); ! } len -= (optlen + 2); *************** *** 475,487 **** return 0; - } - - /* test for option validity. */ - int dhcp_option_is_valid(uint8_t tag, uint8_t tag_len) - { - if(tag_len < 1 || tag > MAX_OPTIONS_HANDLED) - return 0; - else - return 1; } --- 491,494 ---- Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-librawnet.h 25 Jun 2003 01:54:14 -0000 1.17 --- dhcp-librawnet.h 26 Jun 2003 13:55:09 -0000 1.18 *************** *** 473,477 **** extern int dhcp_valid_magic_cookie(dhcp_obj * dhcp); extern int dhcp_is_type(dhcp_obj * dhcp, uint8_t type); - extern int dhcp_option_is_valid(uint8_t tag, uint8_t tag_len); extern int dhcp_have_option(dhcp_obj *dhcp, uint8_t tag); extern int dhcp_is_file_overload(dhcp_obj * dhcp); --- 473,476 ---- |
From: <act...@us...> - 2003-06-25 03:08:35
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv22611/src Modified Files: dhcp-client-control.c dhcp-client.h Log Message: removed old discover_offer_retries Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-control.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-client-control.c 23 Jun 2003 06:05:03 -0000 1.18 --- dhcp-client-control.c 25 Jun 2003 03:08:32 -0000 1.19 *************** *** 51,60 **** } - /* dhcp reset discover offer retries. */ - void dhcp_client_reset_discover_offer_retries(dhcp_client_control_t *dc) - { - dc->discover_offer_retries = 0; - } - /* dhcp set lease time to be infinite. */ void dhcp_client_lease_time_is_infinite(dhcp_client_control_t *dc) --- 51,54 ---- *************** *** 69,84 **** } - /* dhcp increment and check whether we should give up on discover offer retries. */ - int dhcp_client_discover_offer_can_retry(dhcp_client_control_t *dc) - { - uint32_t discover_offer_retries = client_conf_get_dhcp_discovery_retries(dc->conf); - dc->discover_offer_retries++; - - if(dc->discover_offer_retries > discover_offer_retries); - return 1; - - return 0; - } - /* create client id from a string in the format of xx:xx:xx:xx:xx:xx */ static unsigned char *create_fake_client_id(unsigned char *mac_string) --- 63,66 ---- *************** *** 206,212 **** dhcp_client_update_secs(dc); - /* discover offer retries. */ - dhcp_client_reset_discover_offer_retries(dc); - #ifdef HAVE_UNAME sb = stringbuffer_create(); --- 188,191 ---- *************** *** 231,235 **** dc->client_id = create_client_id(interface_addr); - dc->discover_offer_retries = 0; /* reset discover offer. */ dc->lease_time_is_infinite = 0; /* reset lease time infinite bit. */ --- 210,213 ---- Index: dhcp-client.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dhcp-client.h 23 Jun 2003 06:05:03 -0000 1.18 --- dhcp-client.h 25 Jun 2003 03:08:32 -0000 1.19 *************** *** 54,58 **** unsigned char *class_id, *client_id; /* client_id, class_id */ int state; /* our current state. */ - int discover_offer_retries; /* counter for retries on discover_offer */ uint8_t lease_time_is_infinite; /* whether or not the lease time is infinite. */ --- 54,57 ---- *************** *** 104,109 **** extern void dhcp_client_update_secs(dhcp_client_control_t *dc); extern void dhcp_client_reset_secs(dhcp_client_control_t *dc); - extern void dhcp_client_reset_discover_offer_retries(dhcp_client_control_t *dc); - extern int dhcp_client_discover_offer_can_retry(dhcp_client_control_t *dc); extern void dhcp_client_update_xid(dhcp_client_control_t *dc); extern void dhcp_client_control_use_fake_hw_addr(dhcp_client_control_t *dc, char *fake_hw_addr); --- 103,106 ---- |
From: <act...@us...> - 2003-06-25 03:08:12
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv22585/src Modified Files: dhcp-client-states.c Log Message: implemented init-reboot Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** dhcp-client-states.c 25 Jun 2003 02:27:42 -0000 1.39 --- dhcp-client-states.c 25 Jun 2003 03:08:09 -0000 1.40 *************** *** 668,687 **** } ! /* init-reboot state: lease exists, try to acquire it. */ ! int client_init_reboot(dhcp_client_control_t *dc) ! { ! /* not implemented. */ ! return client_init(dc); ! } ! ! /* inform: we've assigned ourselves an IP address, try to inform a dhcp server. */ ! int client_inform(dhcp_client_control_t *dc) ! { ! /* not implemented. */ ! return 0; ! } ! ! /* request: request a lease. */ ! int client_requesting(dhcp_client_control_t *dc) { list_t *options, *cache_options; --- 668,672 ---- } ! static int client_requesting_proc(dhcp_client_control_t *dc, int state) { list_t *options, *cache_options; *************** *** 700,711 **** options = client_build_request_option_list(dc); - cache_options = client_cache_load_options(dc->cache, 1); /* get temporary cache. */ ! if(list_get_len(cache_options) == 0) { ! ! ERROR_MESSAGE("could not load cache, or cache is empty."); ! ERROR_MESSAGE("try running with -c option to delete cache."); ! return STATE_FATAL_ERROR; ! } list_join(options, cache_options); /* destroys cache_options. */ --- 685,693 ---- options = client_build_request_option_list(dc); ! if(state == STATE_INIT_REBOOT) ! cache_options = client_cache_load_options(dc->cache, 0); /* get cache. */ ! else ! cache_options = client_cache_load_options(dc->cache, 1); /* get temporary cache. */ list_join(options, cache_options); /* destroys cache_options. */ *************** *** 751,755 **** if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! client_cache_update(dc->cache); return STATE_SETUP; --- 733,745 ---- if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! /* if init-reboot then record the server which replied. */ ! if(state == STATE_INIT_REBOOT) { ! ! dhcp_client_set_server_ip_address(dc, ip_get_src_addr(dc->rawnet->ip_p)); ! dhcp_client_set_server_hw_address(dc, eth_get_src_addr(dc->rawnet->ether_p)); ! ! } else ! client_cache_update(dc->cache); ! return STATE_SETUP; *************** *** 776,779 **** --- 766,788 ---- return STATE_INIT; } + } + + /* init-reboot state: lease exists, try to acquire it. */ + int client_init_reboot(dhcp_client_control_t *dc) + { + return client_requesting_proc(dc, STATE_INIT_REBOOT); + } + + /* request: request a lease. */ + int client_requesting(dhcp_client_control_t *dc) + { + return client_requesting_proc(dc, STATE_INIT); + } + + /* inform: we've assigned ourselves an IP address, try to inform a dhcp server. */ + int client_inform(dhcp_client_control_t *dc) + { + /* not implemented. */ + return 0; } |
From: <act...@us...> - 2003-06-25 02:38:04
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv19238/src Modified Files: dhcp-sysconf.c Log Message: correct bug in setting the same timer twice Index: dhcp-sysconf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-sysconf.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dhcp-sysconf.c 23 Jun 2003 06:05:03 -0000 1.19 --- dhcp-sysconf.c 25 Jun 2003 02:38:02 -0000 1.20 *************** *** 129,133 **** INFO_MESSAGE("setting renew time to: %"PRIu32" seconds", renew_time); ! timer_add_trigger(dc->context->timer, renew_time, TIMER_REBIND); if(!have_rebind) { --- 129,133 ---- INFO_MESSAGE("setting renew time to: %"PRIu32" seconds", renew_time); ! timer_add_trigger(dc->context->timer, renew_time, TIMER_RENEW); if(!have_rebind) { |
From: <act...@us...> - 2003-06-25 02:31:46
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf In directory sc8-pr-cvs1:/tmp/cvs-serv18516/conf Modified Files: default.sysconf Log Message: removed erroneous newline/display Index: default.sysconf =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/default.sysconf,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** default.sysconf 17 Jun 2003 07:34:36 -0000 1.7 --- default.sysconf 25 Jun 2003 02:31:43 -0000 1.8 *************** *** 117,122 **** (let ((default-route (car (cdr (car routers))))) - (display default-route) - (newline) (client-info-message (string-append "adding default route to: " default-route)) (client-set-default-route client-control default-route) --- 117,120 ---- |
From: <act...@us...> - 2003-06-25 02:28:06
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv18000/src Modified Files: dhcp-packet-build.c Log Message: fixed unarp construction to correctly construct packet Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-packet-build.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-packet-build.c 25 Jun 2003 01:54:14 -0000 1.7 --- dhcp-packet-build.c 25 Jun 2003 02:28:02 -0000 1.8 *************** *** 237,241 **** { build_eth_broadcast(net, source_hw_addr, ETH_TYPE_ARP); ! build_arp(net, ARP_OP_REPLY, eth_null, source_addr, eth_null, ip_addr_broadcast, 0); net->type = RAWNET_ARP; --- 237,241 ---- { build_eth_broadcast(net, source_hw_addr, ETH_TYPE_ARP); ! build_arp(net, ARP_OP_REPLY, source_hw_addr, 0, eth_broadcast, ip_addr_broadcast, ETH_ADDR_LEN); net->type = RAWNET_ARP; |
From: <act...@us...> - 2003-06-25 02:27:44
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv17921/src Modified Files: dhcp-client-states.c Log Message: fixed arp reply to use correct address Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** dhcp-client-states.c 25 Jun 2003 02:21:04 -0000 1.38 --- dhcp-client-states.c 25 Jun 2003 02:27:42 -0000 1.39 *************** *** 188,194 **** */ ! static int client_broadcast_arp_reply(dhcp_client_control_t *dc) { - ip_addr_t client_ip_addr; eth_addr_t client_hw_addr; --- 188,193 ---- */ ! static int client_broadcast_arp_reply(dhcp_client_control_t *dc, ip_addr_t client_ip_addr) { eth_addr_t client_hw_addr; *************** *** 386,390 **** * and let everyone know we're using it. */ ! if(client_broadcast_arp_reply(dc) < 0) { return STATE_FATAL_ERROR; } --- 385,389 ---- * and let everyone know we're using it. */ ! if(client_broadcast_arp_reply(dc, *passed_ip) < 0) { return STATE_FATAL_ERROR; } |
From: <act...@us...> - 2003-06-25 02:21:07
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv17182/src Modified Files: dhcp-client-states.c Log Message: now sending arp reply beforing doing sysconf Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** dhcp-client-states.c 25 Jun 2003 01:54:14 -0000 1.37 --- dhcp-client-states.c 25 Jun 2003 02:21:04 -0000 1.38 *************** *** 383,394 **** } ! client_setup_timers(dc); ! do_sysconf(options, dc, STATE_SETUP); ! ! dhcp_opt_destroy_option_list(options); if(client_broadcast_arp_reply(dc) < 0) { return STATE_FATAL_ERROR; } return STATE_BOUND; --- 383,397 ---- } ! /* since we're going to use this address, let's reply for it ! * and let everyone know we're using it. */ if(client_broadcast_arp_reply(dc) < 0) { return STATE_FATAL_ERROR; } + + client_setup_timers(dc); + do_sysconf(options, dc, STATE_SETUP); + + dhcp_opt_destroy_option_list(options); return STATE_BOUND; |
From: <act...@us...> - 2003-06-25 02:20:47
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv17124/src Modified Files: dhcp-client-guile.c Log Message: fixed issue with icmp latency with muddled retries/timeout Index: dhcp-client-guile.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-guile.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-client-guile.c 17 Jun 2003 07:34:15 -0000 1.8 --- dhcp-client-guile.c 25 Jun 2003 02:20:44 -0000 1.9 *************** *** 431,435 **** address_list = guile_address_list_to_internal_list(scm_address_list); ! latency_list = icmp_rtt_discovery(dc->rawnet, timeout, retries, arp_retries, arp_timeout, address_list); scm_latency_list = internal_latency_list_to_guile_latency_list(latency_list); --- 431,435 ---- address_list = guile_address_list_to_internal_list(scm_address_list); ! latency_list = icmp_rtt_discovery(dc->rawnet, retries, timeout, arp_retries, arp_timeout, address_list); scm_latency_list = internal_latency_list_to_guile_latency_list(latency_list); |
From: <act...@us...> - 2003-06-25 01:54:45
|
Update of /cvsroot/dhcp-agent/dhcp-agent/tests In directory sc8-pr-cvs1:/tmp/cvs-serv13951/tests Modified Files: Makefile.am Log Message: added option for enable failure on warning Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/tests/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 2 Jan 2003 04:23:02 -0000 1.2 --- Makefile.am 25 Jun 2003 01:54:43 -0000 1.3 *************** *** 4,8 **** AUTOMAKE_OPTIONS = foreign ! AM_CFLAGS = -Wall -Werror check_PROGRAMS = stringbuffertest listtest INCLUDES = -I../src --- 4,8 ---- AUTOMAKE_OPTIONS = foreign ! AM_CFLAGS = -Wall check_PROGRAMS = stringbuffertest listtest INCLUDES = -I../src |
From: <act...@us...> - 2003-06-25 01:54:17
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv13884/src Modified Files: dhcp-librawnet.h dhcp-client-states.c dhcp-packet-build.c dhcp-rawnet.c Log Message: corrected rebind/renew problem with ciaddr Index: dhcp-librawnet.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-librawnet.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dhcp-librawnet.h 17 Jun 2003 07:34:16 -0000 1.16 --- dhcp-librawnet.h 25 Jun 2003 01:54:14 -0000 1.17 *************** *** 369,373 **** extern int rawnet_get_hw_addr(rawnet_t *net, eth_addr_t *addr); extern int rawnet_get_real_hw_addr(rawnet_t *net, eth_addr_t *addr); ! extern int rawnet_get_ip_addr(rawnet_t *net, ip_addr_t *addr); extern int rawnet_send_packet(rawnet_t *net); extern int rawnet_use_fake_hw_addr(rawnet_t *raw, char *mac_string); --- 369,373 ---- extern int rawnet_get_hw_addr(rawnet_t *net, eth_addr_t *addr); 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); *************** *** 397,405 **** /* dhcp packet routines. */ extern void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); ! extern void build_dhcp_request_unicast(rawnet_t *net, uint32_t xid, time_t secs, list_t *options, ! ip_addr_t sip_addr, eth_addr_t shw_addr); ! extern void build_dhcp_request_broadcast(rawnet_t *net, uint32_t xid, time_t secs, ip_addr_t cip_addr, ip_addr_t sip_addr, list_t *options); ! extern void build_dhcp_release(rawnet_t *net, uint32_t xid, list_t *options, ip_addr_t sip_addr, ! eth_addr_t shw_addr); /* arp packet routines. */ --- 397,406 ---- /* dhcp packet routines. */ extern void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options); ! extern void build_dhcp_request_unicast(rawnet_t *net, uint32_t xid, time_t secs, list_t *options, ip_addr_t cip_addr, ! ip_addr_t sip_addr, ip_addr_t gip_addr, eth_addr_t shw_addr); ! extern void build_dhcp_request_broadcast(rawnet_t *net, uint32_t xid, time_t secs, ip_addr_t cip_addr, ! ip_addr_t sip_addr, list_t *options); ! extern void build_dhcp_release(rawnet_t *net, uint32_t xid, list_t *options, ip_addr_t cip_addr, ! ip_addr_t sip_addr, eth_addr_t shw_addr); /* arp packet routines. */ Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** dhcp-client-states.c 23 Jun 2003 06:05:03 -0000 1.36 --- dhcp-client-states.c 25 Jun 2003 01:54:14 -0000 1.37 *************** *** 193,197 **** eth_addr_t client_hw_addr; ! rawnet_get_ip_addr(dc->rawnet, &client_ip_addr); rawnet_get_real_hw_addr(dc->rawnet, &client_hw_addr); --- 193,197 ---- eth_addr_t client_hw_addr; ! client_ip_addr = rawnet_get_ip_addr(dc->rawnet); rawnet_get_real_hw_addr(dc->rawnet, &client_hw_addr); *************** *** 211,215 **** eth_addr_t client_hw_addr; ! rawnet_get_ip_addr(dc->rawnet, &client_ip_addr); rawnet_get_real_hw_addr(dc->rawnet, &client_hw_addr); --- 211,215 ---- eth_addr_t client_hw_addr; ! client_ip_addr = rawnet_get_ip_addr(dc->rawnet); rawnet_get_real_hw_addr(dc->rawnet, &client_hw_addr); *************** *** 320,327 **** dhcp_opt_destroy_option_list(options); ! /* get what our current IP address is. */ ! if(rawnet_get_ip_addr(dc->rawnet, &ip_addr)) { ! FATAL_MESSAGE("could not get ip address from interface."); ! } /* check if we have a real address or not. */ --- 320,324 ---- dhcp_opt_destroy_option_list(options); ! ip_addr = rawnet_get_ip_addr(dc->rawnet); /* check if we have a real address or not. */ *************** *** 360,366 **** * in our lease cache.*/ ! if(rawnet_get_ip_addr(dc->rawnet, &interface_ip)) { ! FATAL_MESSAGE("error retrieving our current IP address."); ! } list_rewind(options); --- 357,361 ---- * in our lease cache.*/ ! interface_ip = rawnet_get_ip_addr(dc->rawnet); list_rewind(options); *************** *** 786,794 **** list_t *options; int retval; INFO_MESSAGE("attempting DHCP REBIND"); options = client_build_rebind_option_list(dc); ! build_dhcp_request_broadcast(dc->rawnet, dc->xid, dc->secs, 0, 0, options); retval = --- 781,792 ---- list_t *options; int retval; + ip_addr_t my_addr; INFO_MESSAGE("attempting DHCP REBIND"); + my_addr = rawnet_get_ip_addr(dc->rawnet); + options = client_build_rebind_option_list(dc); ! build_dhcp_request_broadcast(dc->rawnet, dc->xid, dc->secs, my_addr, 0, options); retval = *************** *** 818,822 **** if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! /* our lease is OK. */ client_setup_timers(dc); return STATE_BOUND; --- 816,820 ---- if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! /* our lease is OK. reconfigure timers. */ client_setup_timers(dc); return STATE_BOUND; *************** *** 847,855 **** list_t *options; int retval; INFO_MESSAGE("attempting DHCP RENEW"); options = client_build_renew_option_list(dc); ! build_dhcp_request_unicast(dc->rawnet, dc->xid, dc->secs, options, dc->context->sip_addr, dc->context->shw_addr); /* find out how much time we have until the next timer. --- 845,859 ---- list_t *options; int retval; + ip_addr_t my_addr; INFO_MESSAGE("attempting DHCP RENEW"); + my_addr = rawnet_get_ip_addr(dc->rawnet); + options = client_build_renew_option_list(dc); ! build_dhcp_request_unicast(dc->rawnet, dc->xid, dc->secs, options, my_addr, ! dhcp_client_get_server_ip_address(dc), ! 0, ! dhcp_client_get_server_hw_address(dc)); /* find out how much time we have until the next timer. *************** *** 884,888 **** if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! /* our lease is OK. run reconfigure in case some values changed. */ client_setup_timers(dc); return STATE_BOUND; --- 888,892 ---- if(dhcp_is_type(dc->rawnet->dhcp_p, DHCP_DHCPACK_TM)) { ! /* our lease is OK. reconfigure timers. */ client_setup_timers(dc); return STATE_BOUND; *************** *** 996,1005 **** { list_t *options; INFO_MESSAGE("sending DHCP RELEASE"); options = client_build_release_option_list(dc); ! build_dhcp_release(dc->rawnet, dc->xid, options, dc->context->sip_addr, dc->context->shw_addr); if(rawnet_send_packet(dc->rawnet) < 0) { --- 1000,1014 ---- { list_t *options; + ip_addr_t my_addr; INFO_MESSAGE("sending DHCP RELEASE"); + my_addr = rawnet_get_ip_addr(dc->rawnet); + options = client_build_release_option_list(dc); ! build_dhcp_release(dc->rawnet, dc->xid, options, my_addr, ! dhcp_client_get_server_ip_address(dc), ! dhcp_client_get_server_hw_address(dc)); if(rawnet_send_packet(dc->rawnet) < 0) { Index: dhcp-packet-build.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-packet-build.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dhcp-packet-build.c 8 Jun 2003 22:42:45 -0000 1.6 --- dhcp-packet-build.c 25 Jun 2003 01:54:14 -0000 1.7 *************** *** 405,432 **** void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) { ! build_dhcp(net, xid, secs, 0, 0, 0, 0, (ip_addr_t)0, eth_null, 1, options, DHCP_BOOTP_REQUEST); } /* Create dhcp request message: unicast */ ! void build_dhcp_request_unicast(rawnet_t *net, uint32_t xid, time_t secs, list_t *options, ! ip_addr_t sip_addr, eth_addr_t shw_addr) { ! build_dhcp(net, xid, secs, net->cip_addr, 0, 0, 0, sip_addr, shw_addr, 0, options, ! DHCP_BOOTP_REQUEST); } /* Create dhcp request message: broadcast */ ! void build_dhcp_request_broadcast(rawnet_t *net, uint32_t xid, time_t secs, ip_addr_t cip_addr, ip_addr_t sip_addr, list_t *options) { ! build_dhcp(net, xid, secs, 0, cip_addr, sip_addr, 0, (ip_addr_t)0, eth_null, 1, options, ! DHCP_BOOTP_REQUEST); } /* Create dhcp release message. */ ! void build_dhcp_release(rawnet_t *net, uint32_t xid, list_t *options, ip_addr_t sip_addr, ! eth_addr_t shw_addr) { ! build_dhcp(net, xid, 0, net->cip_addr, 0, 0, 0, ! sip_addr, shw_addr, 1, options, DHCP_BOOTP_REQUEST); } --- 405,430 ---- void build_dhcp_discover(rawnet_t *net, uint32_t xid, time_t secs, list_t *options) { ! build_dhcp(net, xid, secs, 0, 0, 0, 0, 0, eth_null, 1, options, DHCP_BOOTP_REQUEST); } /* Create dhcp request message: unicast */ ! void build_dhcp_request_unicast(rawnet_t *net, uint32_t xid, time_t secs, list_t *options, ip_addr_t cip_addr, ! ip_addr_t sip_addr, ip_addr_t gip_addr, eth_addr_t shw_addr) { ! build_dhcp(net, xid, secs, cip_addr, 0, sip_addr, gip_addr, sip_addr, shw_addr, ! 0, options, DHCP_BOOTP_REQUEST); } /* Create dhcp request message: broadcast */ ! void build_dhcp_request_broadcast(rawnet_t *net, uint32_t xid, time_t secs, ip_addr_t cip_addr, ! ip_addr_t sip_addr, list_t *options) { ! build_dhcp(net, xid, secs, cip_addr, 0, sip_addr, 0, ip_addr_broadcast, eth_broadcast, 0, options, DHCP_BOOTP_REQUEST); } /* Create dhcp release message. */ ! void build_dhcp_release(rawnet_t *net, uint32_t xid, list_t *options, ip_addr_t cip_addr, ip_addr_t sip_addr, eth_addr_t shw_addr) { ! build_dhcp(net, xid, 0, cip_addr, 0, sip_addr, 0, sip_addr, shw_addr, 0, options, DHCP_BOOTP_REQUEST); } Index: dhcp-rawnet.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-rawnet.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-rawnet.c 9 Jun 2003 02:04:48 -0000 1.9 --- dhcp-rawnet.c 25 Jun 2003 01:54:14 -0000 1.10 *************** *** 39,45 **** /* get IP address. */ ! int rawnet_get_ip_addr(rawnet_t *net, ip_addr_t *addr) { ! return (interface_get_ip_addr(net->intf_handle, addr)); } --- 39,45 ---- /* get IP address. */ ! ip_addr_t rawnet_get_ip_addr(rawnet_t *net) { ! return net->cip_addr; } *************** *** 81,88 **** /* are we using a fake address? */ if(net->fake_hw_addr != NULL) { ! memcpy(addr, net->fake_hw_addr->data, ETH_ADDR_LEN); return 0; } else { ! return (eth_get(net->eth, addr)); } } --- 81,89 ---- /* are we using a fake address? */ if(net->fake_hw_addr != NULL) { ! memcpy(addr, &net->fake_hw_addr, ETH_ADDR_LEN); return 0; } else { ! memcpy(addr, &net->chw_addr, ETH_ADDR_LEN); ! return 0; } } *************** *** 103,108 **** } ! /* now set our address, whether we set it earlier or not. */ ! rawnet_get_ip_addr(net, &net->cip_addr); xfree(net->packet_data); --- 104,108 ---- } ! interface_get_ip_addr(net->intf_handle, &net->cip_addr); xfree(net->packet_data); *************** *** 282,291 **** } ! /* When we first initialize we use a real hardware ! * address. This can be changed later to a fake hardware ! * address if the system supports it. */ ! rawnet_get_hw_addr(net, &net->chw_addr); ! rawnet_get_ip_addr(net, &net->cip_addr); /* Packet handler objects. --- 282,289 ---- } ! /* store a copy of our hardware and ip address. */ ! eth_get(net->eth, &net->chw_addr); ! interface_get_ip_addr(net->intf_handle, &net->cip_addr); /* Packet handler objects. |