dhcp-agent-commits Mailing List for dhcp-agent (Page 11)
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-08-05 04:58:34
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv26252/src
Modified Files:
dhcp-net.c
Log Message:
fixed error checking
Index: dhcp-net.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-net.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** dhcp-net.c 26 Jul 2003 23:46:16 -0000 1.6
--- dhcp-net.c 5 Aug 2003 04:58:31 -0000 1.7
***************
*** 89,94 ****
retval = recvfrom(sd, buff, buffsize, 0, (struct sockaddr *)&in, &len);
! if(retval < 0)
return -1;
*src_addr = in.sin_addr.s_addr;
--- 89,96 ----
retval = recvfrom(sd, buff, buffsize, 0, (struct sockaddr *)&in, &len);
! if(retval < 0) {
! ERROR_MESSAGE("error during recv() from udp socket: %s", strerror(errno));
return -1;
+ }
*src_addr = in.sin_addr.s_addr;
***************
*** 110,115 ****
retval = select((udp_sock + 1), NULL, &send_set, NULL, NULL);
! if(retval == -1)
return 1;
in.sin_family = PF_INET;
--- 112,119 ----
retval = select((udp_sock + 1), NULL, &send_set, NULL, NULL);
! if(retval == -1) {
! ERROR_MESSAGE("error during select() on udp socket: %s", strerror(errno));
return 1;
+ }
in.sin_family = PF_INET;
***************
*** 119,124 ****
retval = sendto(udp_sock, msg, size, 0, (struct sockaddr *)&in, len);
! if(retval != size)
return 1;
return 0;
--- 123,135 ----
retval = sendto(udp_sock, msg, size, 0, (struct sockaddr *)&in, len);
! if(retval != size) {
! ERROR_MESSAGE("did not send complete packet on udp socket: %s", strerror(errno));
! return 1;
! }
!
! if(retval == -1) {
! ERROR_MESSAGE("error during send() on udp socket: %s", strerror(errno));
return 1;
+ }
return 0;
|
|
From: <act...@us...> - 2003-08-05 04:57:41
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv26079/src
Modified Files:
dhcp-option.c dhcp-option.h
Log Message:
dhcp_option_added copy_list
Index: dhcp-option.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** dhcp-option.c 27 Jun 2003 03:16:27 -0000 1.6
--- dhcp-option.c 5 Aug 2003 04:57:38 -0000 1.7
***************
*** 1448,1451 ****
--- 1448,1469 ----
}
+ /* copy a list of options. */
+ list_t *dhcp_option_copy_list(list_t *option_list)
+ {
+ list_t *new_list;
+ dhcp_opt_t *option;
+
+ new_list = list_create();
+
+ list_rewind(option_list);
+ while((option = list_next(option_list)) != NULL) {
+
+ list_add(new_list, option);
+
+ }
+
+ return new_list;
+ }
+
/* append to a dhcp list datum. */
void dhcp_option_append(dhcp_opt_t *orig, dhcp_opt_t *data)
Index: dhcp-option.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** dhcp-option.h 27 Jun 2003 20:59:17 -0000 1.7
--- dhcp-option.h 5 Aug 2003 04:57:38 -0000 1.8
***************
*** 45,48 ****
--- 45,49 ----
extern void dhcp_opt_destroy_option_list(list_t *list);
extern dhcp_opt_t *dhcp_option_copy(dhcp_opt_t *option);
+ extern list_t *dhcp_option_copy_list(list_t *option_list);
extern dhcp_opt_t *dhcp_opt_create_message_type(uint8_t message_type);
***************
*** 51,54 ****
--- 52,56 ----
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. */
|
|
From: <act...@us...> - 2003-08-05 04:57:05
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv25994/src Modified Files: dhcp-local.h Log Message: added missing comment Index: dhcp-local.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-local.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-local.h 27 Jul 2003 00:30:08 -0000 1.8 --- dhcp-local.h 5 Aug 2003 04:57:02 -0000 1.9 *************** *** 111,115 **** #ifndef HAVE_IN_ADDR_T typedef uint32_t in_addr_t; ! #endif /* Some operating systems don't have SCNu8/SCNd8 but will have --- 111,115 ---- #ifndef HAVE_IN_ADDR_T typedef uint32_t in_addr_t; ! #endif /* HAVE_IN_ADDR_T */ /* Some operating systems don't have SCNu8/SCNd8 but will have |
|
From: <act...@us...> - 2003-08-05 04:55:34
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25771/src
Modified Files:
dhcp-com.c
Log Message:
optimized with get_type instead of is_type; now not sequentially searching on each test
Index: dhcp-com.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-com.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** dhcp-com.c 26 Jun 2003 13:55:09 -0000 1.12
--- dhcp-com.c 5 Aug 2003 04:55:31 -0000 1.13
***************
*** 468,473 ****
}
! /* test for type. */
! int dhcp_is_type(dhcp_obj * dhcp, uint8_t type)
{
dhcp_opt_t *opt;
--- 468,473 ----
}
! /* get the message type. */
! int dhcp_get_type(dhcp_obj *dhcp)
{
dhcp_opt_t *opt;
***************
*** 481,492 ****
message_type = dhcp_opt_get_host_data(opt);
!
! if(*message_type == type) {
! return 1;
! } else {
! return 0;
! }
}
}
return 0;
--- 481,500 ----
message_type = dhcp_opt_get_host_data(opt);
! return *message_type;
}
}
+ return -1;
+ }
+
+ /* test for type. */
+ int dhcp_is_type(dhcp_obj * dhcp, uint8_t type)
+ {
+ int message_type = dhcp_get_type(dhcp);
+
+ if(message_type == -1)
+ return 0;
+
+ if(message_type == type)
+ return 1;
return 0;
|
|
From: <act...@us...> - 2003-08-05 04:54:38
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25644/src
Modified Files:
dhcp-packet-build.c
Log Message:
dhcp_offer_* routines; constant addresses made global; getting address from arguments
Index: dhcp-packet-build.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-packet-build.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dhcp-packet-build.c 25 Jul 2003 02:37:31 -0000 1.10
--- dhcp-packet-build.c 5 Aug 2003 04:54:36 -0000 1.11
***************
*** 35,41 ****
/* constants we need. */
! static const eth_addr_t eth_null = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
! static const eth_addr_t eth_broadcast = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} };
! static const uint32_t ip_addr_broadcast = 0xffffffff;
/* * * * * * * * * * * * * * *
--- 35,42 ----
/* constants we need. */
! const eth_addr_t eth_null = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
! const eth_addr_t eth_broadcast = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} };
! const ip_addr_t ip_addr_broadcast = 0xffffffff;
! const ip_addr_t ip_addr_null = 0x00000000;
/* * * * * * * * * * * * * * *
***************
*** 343,347 ****
static void build_dhcp(rawnet_t *net, uint32_t xid, time_t secs,
uint32_t ciaddr, uint32_t yiaddr, uint32_t siaddr,
! uint32_t giaddr, ip_addr_t server_ip_addr, eth_addr_t server_hw_addr,
unsigned char broadcast, list_t *options, unsigned char bootp_type)
{
--- 344,348 ----
static void build_dhcp(rawnet_t *net, uint32_t xid, time_t secs,
uint32_t ciaddr, uint32_t yiaddr, uint32_t siaddr,
! uint32_t giaddr, ip_addr_t to_ip_addr, eth_addr_t to_hw_addr,
unsigned char broadcast, list_t *options, unsigned char bootp_type)
{
***************
*** 384,393 ****
build_eth_broadcast(net, eth_addr, ETH_TYPE_IP);
else
! build_eth(net, eth_addr, server_hw_addr, ETH_TYPE_IP);
if(broadcast)
build_ip_broadcast(net, ip_len, IP_PROTO_UDP, 0);
else
! build_ip(net, ip_len, IP_PROTO_UDP, rawnet_get_ip_addr(net), server_ip_addr);
build_udp(net, udp_len);
--- 385,394 ----
build_eth_broadcast(net, eth_addr, ETH_TYPE_IP);
else
! build_eth(net, eth_addr, to_hw_addr, ETH_TYPE_IP);
if(broadcast)
build_ip_broadcast(net, ip_len, IP_PROTO_UDP, 0);
else
! build_ip(net, ip_len, IP_PROTO_UDP, rawnet_get_ip_addr(net), to_ip_addr);
build_udp(net, udp_len);
***************
*** 432,439 ****
--- 433,454 ----
}
+ /* Create dhcp decline message. */
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);
+ }
+
+ /* Create dhcp offer message for unicast. */
+ void build_dhcp_offer_unicast(rawnet_t *net, uint32_t xid, ip_addr_t yiaddr, ip_addr_t siaddr,
+ ip_addr_t to_addr, eth_addr_t to_eth_addr, list_t *options)
+ {
+ build_dhcp(net, xid, 0, 0, yiaddr, siaddr, 0, to_addr, to_eth_addr, 0, options, DHCP_BOOTP_REPLY);
+ }
+
+ /* Create dhcp offer message for broadcast. */
+ void build_dhcp_offer_broadcast(rawnet_t *net, uint32_t xid, ip_addr_t yiaddr, ip_addr_t siaddr, list_t *options)
+ {
+ build_dhcp(net, xid, 0, 0, yiaddr, siaddr, 0, ip_addr_broadcast, eth_broadcast, 0, options, DHCP_BOOTP_REPLY);
}
|
|
From: <act...@us...> - 2003-08-05 04:53:22
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25527/src
Modified Files:
dhcp-rawnet.c
Log Message:
added routine to do raw processing on udp socket
Index: dhcp-rawnet.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-rawnet.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** dhcp-rawnet.c 25 Jul 2003 02:36:21 -0000 1.14
--- dhcp-rawnet.c 5 Aug 2003 04:53:19 -0000 1.15
***************
*** 473,476 ****
--- 473,530 ----
}
+ /* read a packet from a udp socket, and run it through our stack appropriately. */
+ int rawnet_get_packet_udp_socket(int sockd, rawnet_t *rawnet)
+ {
+ int retval;
+ ip_addr_t ip_addr;
+
+ retval = udp_sock_recv(sockd, rawnet->packet_data, rawnet->mtu, &ip_addr);
+
+ if(retval == -1 || retval == 0) {
+ /* error receiving packet. */
+ return RAWNET_ERROR;
+ }
+
+ /* update our raw network objects as best we can. if someone
+ * is calling us then they cannot expect to get the hardware
+ * address, and everything starts from the IP layer. */
+
+ /* just update protocol and address information for the IP layer. */
+ ip_set_proto(rawnet->ip_p, IPPROTO_UDP);
+ ip_set_src_addr(rawnet->ip_p, ip_addr);
+ ip_set_dst_addr(rawnet->ip_p, rawnet_get_ip_addr(rawnet));
+
+ /* update information for the dhcp packet. */
+ dhcp_purge(rawnet->dhcp_p);
+
+ /* read image. */
+ if(dhcp_read_packet_image(rawnet->dhcp_p, rawnet->packet_data, retval)) {
+ return RAWNET_MALFORMED_PACKET;
+ }
+
+ /* that's it. we're done. */
+ return RAWNET_OK;
+ }
+
+ int rawnet_send_packet_udp_socket_unicast(int sockd, rawnet_t *rawnet, ip_addr_t ip_addr)
+ {
+ if(udp_sock_send(sockd, (rawnet->packet_data + IP_HDR_LEN + UDP_HDR_LEN),
+ (udp_get_len(rawnet->udp_p) - UDP_HDR_LEN),
+ ip_addr, udp_get_dst_port(rawnet->udp_p)))
+ return RAWNET_ERROR;
+
+ return RAWNET_OK;
+ }
+
+ int rawnet_send_packet_udp_socket_broadcast(int sockd, rawnet_t *rawnet)
+ {
+ if(udp_sock_send(sockd, (rawnet->packet_data + IP_HDR_LEN + UDP_HDR_LEN),
+ (udp_get_len(rawnet->udp_p) - UDP_HDR_LEN),
+ ip_addr_broadcast, udp_get_dst_port(rawnet->udp_p)))
+ return RAWNET_ERROR;
+
+ return RAWNET_OK;
+ }
+
/*
* rawnet get packet:
|
|
From: <act...@us...> - 2003-08-05 04:51:38
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25348/src
Modified Files:
dhcp-client-guile.c dhcp-client-guile.h dhcp-client.c
Log Message:
client now linking to guile utility code
Index: dhcp-client-guile.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-guile.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** dhcp-client-guile.c 28 Jun 2003 17:40:10 -0000 1.11
--- dhcp-client-guile.c 5 Aug 2003 04:51:35 -0000 1.12
***************
*** 36,39 ****
--- 36,40 ----
#include "dhcp-client-cache.h"
#include "dhcp-client.h"
+ #include "dhcp-guile-util.h"
#include "dhcp-client-guile.h"
#include "dhcp-interface.h"
***************
*** 42,76 ****
static scm_t_bits client_control_tag;
- /* * * * * * * * * * * * * * * * * * * * * * * *
- * utility routines guile doesn't provide but *
- * really should :| *
- * * * * * * * * * * * * * * * * * * * * * * * */
-
- static char *x_scm_symbol2newstr(SCM symbol)
- {
- size_t len;
- char *newstr;
-
- len = SCM_SYMBOL_LENGTH(symbol);
- newstr = xmalloc((len + 1) * sizeof(char));
- memcpy(newstr, SCM_SYMBOL_CHARS(symbol), len);
- newstr[len] = 0;
-
- return newstr;
- }
-
- static char *x_scm_string2newstr(SCM string)
- {
- size_t len;
- char *newstr;
-
- len = SCM_STRING_LENGTH(string);
- newstr = xmalloc((len + 1) * sizeof(char));
- memcpy(newstr, SCM_STRING_CHARS(string), len);
- newstr[len] = 0;
-
- return newstr;
- }
-
/* * * * * * * * * * * * * * * * * * * * * * *
* list conversions. we need to do a few *
--- 43,46 ----
***************
*** 534,538 ****
client_control_smob_t *client_control_smob;
! client_control_smob = xmalloc(sizeof(client_control_smob_t));
client_control_smob->dc = dc;
--- 504,508 ----
client_control_smob_t *client_control_smob;
! client_control_smob = scm_must_malloc(sizeof(client_control_smob_t), "dhcp_scm_make_client_control");
client_control_smob->dc = dc;
Index: dhcp-client-guile.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-guile.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** dhcp-client-guile.h 20 May 2003 01:43:40 -0000 1.2
--- dhcp-client-guile.h 5 Aug 2003 04:51:35 -0000 1.3
***************
*** 26,31 ****
#define DHCP_CLIENT_GUILE_H
- #include <libguile.h>
-
typedef struct client_control_smob {
dhcp_client_control_t *dc;
--- 26,29 ----
Index: dhcp-client.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** dhcp-client.c 8 Jul 2003 07:01:41 -0000 1.36
--- dhcp-client.c 5 Aug 2003 04:51:35 -0000 1.37
***************
*** 34,37 ****
--- 34,38 ----
#include "dhcp-client-cache.h"
#include "dhcp-client.h"
+ #include "dhcp-guile-util.h"
#include "dhcp-client-guile.h"
|
|
From: <act...@us...> - 2003-08-05 04:49:12
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25098/src
Modified Files:
Makefile.am
Added Files:
dhcp-guile-util.c dhcp-guile-util.h
Log Message:
guile utility code now in seperate file
--- NEW FILE: dhcp-guile-util.c ---
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-guile-util.c,v 1.1 2003/08/05 04:49:09 actmodern Exp $
*
* Copyright 2002 Thamer Alharbash
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* guile utility routines which guile should be offering but isn't :|
*
*/
#include "dhcp-local.h"
#include "dhcp-libutil.h"
#include "dhcp-guile-util.h"
char *x_scm_symbol2newstr(SCM symbol)
{
size_t len;
char *newstr;
len = SCM_SYMBOL_LENGTH(symbol);
newstr = xmalloc((len + 1) * sizeof(char));
memcpy(newstr, SCM_SYMBOL_CHARS(symbol), len);
newstr[len] = 0;
return newstr;
}
char *x_scm_string2newstr(SCM string)
{
size_t len;
char *newstr;
len = SCM_STRING_LENGTH(string);
newstr = xmalloc((len + 1) * sizeof(char));
memcpy(newstr, SCM_STRING_CHARS(string), len);
newstr[len] = 0;
return newstr;
}
--- NEW FILE: dhcp-guile-util.h ---
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-guile-util.h,v 1.1 2003/08/05 04:49:09 actmodern Exp $
*
* Copyright 2003 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_GUILE_UTIL_H
#define DHCP_GUILE_UTIL_H
#include <libguile.h>
extern char *x_scm_symbol2newstr(SCM symbol);
extern char *x_scm_string2newstr(SCM string);
#endif /* DHCP_GUILE_UTIL_H */
Index: Makefile.am
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/Makefile.am,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** Makefile.am 28 Jul 2003 00:34:08 -0000 1.33
--- Makefile.am 5 Aug 2003 04:49:09 -0000 1.34
***************
*** 23,27 ****
dhcp-client-guile.h dhcp-sniff-defaults.h dhcp-client-defaults.h dhcp-lease.h \
dhcp-server.h dhcp-server-guile.h dhcp-server-conf.h dhcp-server-defaults.h \
! dhcp-server-guile.h
libdhcputil_la_SOURCES = dhcp-util.c \
--- 23,27 ----
dhcp-client-guile.h dhcp-sniff-defaults.h dhcp-client-defaults.h dhcp-lease.h \
dhcp-server.h dhcp-server-guile.h dhcp-server-conf.h dhcp-server-defaults.h \
! dhcp-server-guile.h dhcp-server-lease-manager.h dhcp-guile-util.h
libdhcputil_la_SOURCES = dhcp-util.c \
***************
*** 69,73 ****
dhcp-client-states.c \
dhcp-sysconf.c \
! dhcp-client-guile.c
dhcp_server_SOURCES = dhcp-server.c \
--- 69,74 ----
dhcp-client-states.c \
dhcp-sysconf.c \
! dhcp-client-guile.c \
! dhcp-guile-util.c
dhcp_server_SOURCES = dhcp-server.c \
***************
*** 76,80 ****
dhcp-server-control.c \
dhcp-server-states.c \
! dhcp-server-guile.c
dhcp_client_LDADD = -ldhcputil ${GUILE_LIB}
--- 77,83 ----
dhcp-server-control.c \
dhcp-server-states.c \
! dhcp-server-guile.c \
! dhcp-guile-util.c \
! dhcp-server-lease-manager.c
dhcp_client_LDADD = -ldhcputil ${GUILE_LIB}
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv27886/src
Modified Files:
dhcp-server-guile.c dhcp-server-guile.h
Added Files:
dhcp-server-lease-manager.c dhcp-server-lease-manager.h
dhcp-server-lease.h
Log Message:
new lease manager, and update to guile bindings
--- NEW FILE: dhcp-server-lease-manager.c ---
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-lease-manager.c,v 1.1 2003/07/29 02:38:14 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.
*
* The lease manager. This is wrapped directly around dhcp-server-guile.
*
*/
#include "dhcp-local.h"
#include "dhcp-libutil.h"
#include "dhcp-librawnet.h"
#include "dhcp-server-conf.h"
#include "dhcp-server.h"
#include "dhcp-lease.h"
#include "dhcp-server-lease-manager.h"
#include "dhcp-server-guile.h"
int lease_manager_initialize(void)
{
return dhcp_guile_initialize_leases();
}
lease_definition_t *lease_manager_lease_available(const char *hostname, eth_addr_t mac_addr,
ip_addr_t giaddr, dhcp_opt_t *client_id)
{
return NULL;
}
lease_definition_t *lease_manager_lookup_lease(ip_addr_t ip_addr, const char *hostname, eth_addr_t mac_addr,
ip_addr_t giaddr, dhcp_opt_t *client_id)
{
return NULL;
}
lease_definition_t *lease_manager_acquire_lease(lease_definition_t *lease)
{
return NULL;
}
int lease_manager_release_lease(lease_definition_t *lease)
{
return 0;
}
void lease_expire(lease_definition_t *lease)
{
return;
}
--- NEW FILE: dhcp-server-lease-manager.h ---
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-lease-manager.h,v 1.1 2003/07/29 02:38:14 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_LEASE_MANAGER_H
#define DHCP_SERVER_LEASE_MANAGER_H
extern int initialize_lease_manager(void);
extern lease_definition_t *lease_manager_lease_available(const char *hostname, eth_addr_t mac_addr,
ip_addr_t giaddr, dhcp_opt_t *client_id);
extern lease_definition_t *lease_manager_lookup_lease(ip_addr_t ip_addr, const char *hostname, eth_addr_t mac_addr,
ip_addr_t giaddr, dhcp_opt_t *client_id);
extern lease_definition_t *lease_manager_acquire_lease(lease_definition_t *lease);
extern int lease_manager_release_lease(lease_definition_t *lease);
extern void lease_expire(lease_definition_t *lease);
#endif /* DHCP_SERVER_LEASE_MANAGER_H */
--- NEW FILE: dhcp-server-lease.h ---
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-lease.h,v 1.1 2003/07/29 02:38:14 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.
*/
Index: dhcp-server-guile.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-guile.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dhcp-server-guile.c 28 Jul 2003 00:33:54 -0000 1.1
--- dhcp-server-guile.c 29 Jul 2003 02:38:14 -0000 1.2
***************
*** 175,181 ****
}
! /* get the next available lease. */
! lease_definition_t *dhcp_guile_get_next_lease(const char *hostname, eth_addr_t mac_addr,
! ip_addr_t giaddr, list_t *client_options)
{
return NULL;
--- 175,188 ----
}
! /* ask if any leases are available. */
! lease_definition_t *dhcp_guile_lease_available(const char *hostname, eth_addr_t mac_addr,
! ip_addr_t giaddr, dhcp_opt_t *client_id)
! {
! return NULL;
! }
!
! /* lookup a lease: lookup a lease. */
! lease_definition_t *dhcp_guile_lookup_lease(ip_addr_t ip_addr, const char *hostname, eth_addr_t mac_addr,
! ip_addr_t giaddr, dhcp_opt_t *client_id)
{
return NULL;
***************
*** 183,191 ****
/* get the next available lease. */
! lease_definition_t *dhcp_guile_lease_lookup(ip_addr_t ip_addr)
{
return NULL;
}
void dhcp_guile_lease_expire(void)
{
--- 190,205 ----
/* get the next available lease. */
! lease_definition_t *dhcp_guile_acquire_lease(lease_definition_t *definition)
{
return NULL;
}
+ /* lookup an existing lease. */
+ lease_definition_t *dhcp_guile_release_lease(lease_definition_t *definition)
+ {
+ return NULL;
+ }
+
+ /* expire a lease. */
void dhcp_guile_lease_expire(void)
{
Index: dhcp-server-guile.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-guile.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** dhcp-server-guile.h 28 Jul 2003 00:33:54 -0000 1.2
--- dhcp-server-guile.h 29 Jul 2003 02:38:14 -0000 1.3
***************
*** 32,39 ****
} server_control_smob_t;
extern int dhcp_guile_initialize_leases(void);
! extern lease_definition_t *dhcp_guile_get_next_lease(const char *hostname, eth_addr_t mac_addr,
! ip_addr_t giaddr, list_t *client_options);
! extern lease_definition_t *dhcp_guile_lease_lookup(ip_addr_t ip_addr);
extern void dhcp_guile_lease_expire(void);
--- 32,45 ----
} server_control_smob_t;
+ /* prototypes. */
+
+ extern void dhcp_guile_init(dhcp_server_control_t *sc);
extern int dhcp_guile_initialize_leases(void);
! extern lease_definition_t *dhcp_guile_lease_available(const char *hostname, eth_addr_t mac_addr,
! ip_addr_t giaddr, dhcp_opt_t *client_id);
! extern lease_definition_t *dhcp_guile_lookup_lease(ip_addr_t ip_addr, const char *hostname, eth_addr_t mac_addr,
! ip_addr_t giaddr, dhcp_opt_t *client_id);
! extern lease_definition_t *dhcp_guile_acquire_lease(lease_definition_t *definition);
! extern lease_definition_t *dhcp_guile_release_lease(lease_definition_t *definition);
extern void dhcp_guile_lease_expire(void);
|
|
From: <act...@us...> - 2003-07-28 00:34:14
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv24729/src
Modified Files:
Makefile.am
Log Message:
now building server guile bindings
Index: Makefile.am
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/Makefile.am,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** Makefile.am 17 Jul 2003 00:22:28 -0000 1.32
--- Makefile.am 28 Jul 2003 00:34:08 -0000 1.33
***************
*** 22,26 ****
dhcp-sysconf.h dhcp-conf.h dhcp-conf-var.h dhcp-option.h dhcp-option-convert.h \
dhcp-client-guile.h dhcp-sniff-defaults.h dhcp-client-defaults.h dhcp-lease.h \
! dhcp-server.h dhcp-server-guile.h dhcp-server-conf.h dhcp-server-defaults.h
libdhcputil_la_SOURCES = dhcp-util.c \
--- 22,27 ----
dhcp-sysconf.h dhcp-conf.h dhcp-conf-var.h dhcp-option.h dhcp-option-convert.h \
dhcp-client-guile.h dhcp-sniff-defaults.h dhcp-client-defaults.h dhcp-lease.h \
! dhcp-server.h dhcp-server-guile.h dhcp-server-conf.h dhcp-server-defaults.h \
! dhcp-server-guile.h
libdhcputil_la_SOURCES = dhcp-util.c \
***************
*** 74,78 ****
dhcp-server-conf.c \
dhcp-server-control.c \
! dhcp-server-states.c
dhcp_client_LDADD = -ldhcputil ${GUILE_LIB}
--- 75,80 ----
dhcp-server-conf.c \
dhcp-server-control.c \
! dhcp-server-states.c \
! dhcp-server-guile.c
dhcp_client_LDADD = -ldhcputil ${GUILE_LIB}
|
|
From: <act...@us...> - 2003-07-28 00:34:06
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv24655/src
Modified Files:
dhcp-server-guile.h
Added Files:
dhcp-server-guile.c
Log Message:
initial server guile bindings
--- NEW FILE: dhcp-server-guile.c ---
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-guile.c,v 1.1 2003/07/28 00:33:54 actmodern Exp $
*
* Copyright 2002 Thamer Alharbash
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Glue between dhcp-server and guile.
*
*
*/
#include "dhcp-local.h"
#include "dhcp-libutil.h"
#include "dhcp-librawnet.h"
#include "dhcp-option.h"
#include "dhcp-lease.h"
#include "dhcp-server-conf.h"
#include "dhcp-server.h"
#include "dhcp-server-guile.h"
static scm_t_bits server_control_tag;
static SCM initialize_leases, get_next_lease, lease_lookup, lease_expire;
/* * * * * * * * * * * * * * * * * * * *
* dhcp server control smob *
* * * * * * * * * * * * * * * * * * * */
/* mark a dhcp server control scm: we don't need to do any marking. */
static SCM dhcp_scm_server_control_mark(SCM scm_server_control)
{
return SCM_BOOL_F;
}
/* free a server control scm. */
static size_t dhcp_scm_server_control_free(SCM scm_server_control)
{
server_control_smob_t *server_control_smob;
server_control_smob = (server_control_smob_t *)SCM_SMOB_DATA(scm_server_control);
xfree(server_control_smob);
return sizeof(server_control_smob_t);
}
/* print out a server control scm. */
static int dhcp_scm_server_control_print(SCM scm_server_control, SCM port, scm_print_state *pstate)
{
scm_puts("#<server_control>", port);
return 1;
}
/* convert a server control handler to SCM. */
static SCM dhcp_scm_make_server_control(dhcp_server_control_t *sc)
{
server_control_smob_t *server_control_smob;
server_control_smob = xmalloc(sizeof(server_control_smob_t));
server_control_smob->sc = sc;
SCM_RETURN_NEWSMOB(server_control_tag, server_control_smob);
}
/* initialization routines for server control SMOB. */
static void init_server_control_smob(void)
{
server_control_tag = scm_make_smob_type("server_control", sizeof(server_control_smob_t));
/* bind mark, free, and print. */
scm_set_smob_mark(server_control_tag, dhcp_scm_server_control_mark);
scm_set_smob_free(server_control_tag, dhcp_scm_server_control_free);
scm_set_smob_print(server_control_tag, dhcp_scm_server_control_print);
return;
}
/* * * * * * * * * * * * * * * * * * * * * *
* bootstrap guile routines. *
* * * * * * * * * * * * * * * * * * * * * */
/* load the guile dhcp backend script. */
static void load_guile_backend(dhcp_server_control_t *sc)
{
stringbuffer_t *sb;
sb = stringbuffer_create();
stringbuffer_aprintf(sb, "%s/default.backend", DHCPSYSCONF_SERVERDIR);
if(file_exists(stringbuffer_getstring(sb))) {
scm_c_primitive_load(stringbuffer_getstring(sb));
stringbuffer_destroy(sb);
return;
}
stringbuffer_clear(sb);
stringbuffer_aprintf(sb, "%s/%s.backend", DHCPSYSCONF_SERVERDIR, sc->interface);
if(file_exists(stringbuffer_getstring(sb))) {
scm_c_primitive_load(stringbuffer_getstring(sb));
stringbuffer_destroy(sb);
return;
}
/* otherwise there is no backend file and this is
* bad. signal a fatal error. */
FATAL_MESSAGE("backend lease manager file missing -- looked for default.backend and <interface>.backend. exiting...");
exit(1); /* get rid of compiler warning. */
}
/* * * * * * * * * * * * * * * *
* public interface routines. *
* * * * * * * * * * * * * * * */
void dhcp_guile_init(dhcp_server_control_t *sc)
{
/* initialize the server control smob. */
init_server_control_smob();
/* bind symbols to top level so that the user defined script can hook into them. */
initialize_leases = scm_str2symbol("initialize-leases");
get_next_lease = scm_str2symbol("get-next-lease");
lease_lookup = scm_str2symbol("lease-lookup");
lease_expire = scm_str2symbol("lease-expire");
/* NOTE: defining at the top level should keep the garbage
* collector from swallowing these symbols up. */
scm_define(initialize_leases, SCM_BOOL_F);
scm_define(get_next_lease, SCM_BOOL_F);
scm_define(lease_lookup, SCM_BOOL_F);
scm_define(lease_expire, SCM_BOOL_F);
/* define all the subroutines. */
/* TODO. */
/* bind our server control object. */
scm_c_define("dhcp-server-control",
dhcp_scm_make_server_control(sc));
/* load the backend code. */
load_guile_backend(sc);
return;
}
/* initialize the lease manager. */
int dhcp_guile_initialize_leases(void)
{
scm_apply_0(initialize_leases, SCM_EOL);
return 0;
}
/* get the next available lease. */
lease_definition_t *dhcp_guile_get_next_lease(const char *hostname, eth_addr_t mac_addr,
ip_addr_t giaddr, list_t *client_options)
{
return NULL;
}
/* get the next available lease. */
lease_definition_t *dhcp_guile_lease_lookup(ip_addr_t ip_addr)
{
return NULL;
}
void dhcp_guile_lease_expire(void)
{
return;
}
Index: dhcp-server-guile.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-guile.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dhcp-server-guile.h 2 Jul 2003 15:23:30 -0000 1.1
--- dhcp-server-guile.h 28 Jul 2003 00:33:54 -0000 1.2
***************
*** 28,30 ****
--- 28,40 ----
#include <libguile.h>
+ typedef struct client_control_smob {
+ dhcp_server_control_t *sc;
+ } server_control_smob_t;
+
+ extern int dhcp_guile_initialize_leases(void);
+ extern lease_definition_t *dhcp_guile_get_next_lease(const char *hostname, eth_addr_t mac_addr,
+ ip_addr_t giaddr, list_t *client_options);
+ extern lease_definition_t *dhcp_guile_lease_lookup(ip_addr_t ip_addr);
+ extern void dhcp_guile_lease_expire(void);
+
#endif /* DHCP_SERVER_GUILE_H */
|
|
From: <act...@us...> - 2003-07-28 00:32:34
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server In directory sc8-pr-cvs1:/tmp/cvs-serv24445/conf/dhcp-server Modified Files: lease.conf.example Log Message: updated lease conf example for new server conf code Index: lease.conf.example =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server/lease.conf.example,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** lease.conf.example 26 Jul 2003 23:47:43 -0000 1.6 --- lease.conf.example 28 Jul 2003 00:32:30 -0000 1.7 *************** *** 12,16 **** --- 12,24 ---- set default-renew-percent = 75; set default-rebind-percent = 90; + + # set the signal/socket polling to 5 second intervals. + # this is reasonable for today's systems. + set poll-timeout = 5; + + # we'll assume the subnet on the interface is local + + enable assume-local-subnet-from-interface = yes; # configure a local subnet. |
|
From: <act...@us...> - 2003-07-27 03:16:47
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv2702/src
Modified Files:
dhcp-server-conf.c
Log Message:
no longer warning if no local subnets are specified
Index: dhcp-server-conf.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** dhcp-server-conf.c 27 Jul 2003 03:13:48 -0000 1.11
--- dhcp-server-conf.c 27 Jul 2003 03:16:41 -0000 1.12
***************
*** 702,713 ****
sc->default_renew_percent = SERVER_DEFAULT_RENEW_PERCENT;
sc->poll_timeout = SERVER_DEFAULT_POLL_TIMEOUT;
if(server_conf_load_options(sc)) {
server_conf_destroy(sc);
return NULL;
- }
-
- if(list_get_len(sc->local_subnets) == 0) {
- WARN_MESSAGE("no local subnets specified. may assume all subnets as local.");
}
--- 702,710 ----
sc->default_renew_percent = SERVER_DEFAULT_RENEW_PERCENT;
sc->poll_timeout = SERVER_DEFAULT_POLL_TIMEOUT;
+ sc->assume_interface_subnet = 1; /* default is yes. */
if(server_conf_load_options(sc)) {
server_conf_destroy(sc);
return NULL;
}
|
|
From: <act...@us...> - 2003-07-27 03:13:53
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv2335/src
Modified Files:
dhcp-server-conf.c dhcp-server-conf.h
Log Message:
added option to assume local subnet from interface
Index: dhcp-server-conf.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dhcp-server-conf.c 26 Jul 2003 23:46:51 -0000 1.10
--- dhcp-server-conf.c 27 Jul 2003 03:13:48 -0000 1.11
***************
*** 50,53 ****
--- 50,61 ----
};
+ static const char *var_boolean_strings[] = {
+ "assume-local-subnet-from-interface",
+ };
+
+ static const arg_symbol_t var_boolean_symbols[] = {
+ SERVER_VAR_ASSUME_LOCAL_SUBNET_FROM_INTERFACE,
+ };
+
static const arg_type_t var_arg_types[] = { CONF_IDENTIFIER, CONF_ASSIGNMENT, CONF_STRING };
static const char **var_arg_strings[] = { var_strings, NULL, NULL };
***************
*** 78,81 ****
--- 86,93 ----
static const arg_symbol_t *subnet_arg_symbols[] = { NULL, NULL };
+ static const arg_type_t enable_arg_types[] = { CONF_IDENTIFIER, CONF_ASSIGNMENT, CONF_BOOLEAN };
+ static const char **enable_arg_strings[] = { var_boolean_strings, NULL, NULL };
+ static const arg_symbol_t *enable_arg_symbols[] = { var_boolean_symbols, NULL, NULL };
+
/* command structures. */
***************
*** 147,150 ****
--- 159,171 ----
};
+ static const command_t command_enable = {
+ DIRECTIVE_ENABLE,
+ "enable",
+ 3,
+ enable_arg_strings,
+ enable_arg_types,
+ enable_arg_symbols,
+ };
+
static const command_t *commands[] = {
&command_set,
***************
*** 155,158 ****
--- 176,180 ----
&command_local_subnet,
&command_subnet,
+ &command_enable,
NULL,
};
***************
*** 167,170 ****
--- 189,193 ----
static int directive_local_subnet_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data);
static int directive_subnet_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data);
+ static int directive_enable_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data);
/* indexed by directive types in dhcp-client-conf.h . */
***************
*** 177,180 ****
--- 200,204 ----
directive_local_subnet_handler,
directive_subnet_handler,
+ directive_enable_handler,
};
***************
*** 311,314 ****
--- 335,365 ----
* directive handlers. *
* * * * * * * * * * * */
+
+ /* enable handler. */
+ static int directive_enable_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data)
+ {
+ list_t *args;
+ arg_symbol_t *var_symbol;
+ uint8_t *var_value;
+
+ args = directive->arguments;
+
+ var_symbol = list_get_by_index(args, 0);
+ var_value = list_get_by_index(args, 2);
+
+ switch(*var_symbol) {
+
+ case SERVER_VAR_ASSUME_LOCAL_SUBNET_FROM_INTERFACE:
+
+ server_conf->assume_interface_subnet = *(var_value);
+ break;
+
+ default:
+ ERROR_MESSAGE("illegal identifier used in enable directive: %s", var_boolean_strings[*var_symbol]);
+ return 1;
+ }
+
+ return 0;
+ }
/* variable set handler. */
Index: dhcp-server-conf.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** dhcp-server-conf.h 26 Jul 2003 23:46:51 -0000 1.8
--- dhcp-server-conf.h 27 Jul 2003 03:13:48 -0000 1.9
***************
*** 38,41 ****
--- 38,42 ----
uint16_t default_renew_percent; /* percent of expiry to assign as renew time. */
uint16_t poll_timeout; /* poll timeout -- used in server event processing. */
+ uint8_t assume_interface_subnet; /* assume the interface has the correct local subnet configured. */
list_t *local_subnets; /* list of subnets. */
***************
*** 46,52 ****
/* constants. */
! enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT, SERVER_VAR_POLL_TIMEOUT };
enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE, DIRECTIVE_HOSTNAME_LEASE,
! DIRECTIVE_MAC_LEASE, DIRECTIVE_OPTION, DIRECTIVE_LOCAL_SUBNET, DIRECTIVE_SUBNET };
enum group_types { GROUP_NULL = 0, GROUP_LEASE_DEF, GROUP_SUBNET_DEF };
--- 47,54 ----
/* constants. */
! enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT, SERVER_VAR_POLL_TIMEOUT,
! SERVER_VAR_ASSUME_LOCAL_SUBNET_FROM_INTERFACE };
enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE, DIRECTIVE_HOSTNAME_LEASE,
! DIRECTIVE_MAC_LEASE, DIRECTIVE_OPTION, DIRECTIVE_LOCAL_SUBNET, DIRECTIVE_SUBNET, DIRECTIVE_ENABLE };
enum group_types { GROUP_NULL = 0, GROUP_LEASE_DEF, GROUP_SUBNET_DEF };
|
|
From: <act...@us...> - 2003-07-27 03:07:45
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv1521
Modified Files:
dhcp-client-conf.c
Log Message:
fixed bug in boolean handler: was referencing wrong array for variable name.
Index: dhcp-client-conf.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** dhcp-client-conf.c 27 Jun 2003 03:16:27 -0000 1.29
--- dhcp-client-conf.c 27 Jul 2003 03:07:39 -0000 1.30
***************
*** 1158,1162 ****
if(client_conf_set_variable_boolean(params, *var_symbol, *var_value)) {
! ERROR_MESSAGE("configuration: error unable to set boolean variable %s", var_strings[*var_symbol], var_value);
return 1;
}
--- 1158,1162 ----
if(client_conf_set_variable_boolean(params, *var_symbol, *var_value)) {
! ERROR_MESSAGE("configuration: error unable to set boolean variable %s", var_boolean_strings[*var_symbol], var_value);
return 1;
}
|
|
From: <act...@us...> - 2003-07-27 00:57:32
|
Update of /cvsroot/dhcp-agent/dhcp-agent
In directory sc8-pr-cvs1:/tmp/cvs-serv15669
Modified Files:
configure.ac INSTALL
Log Message:
added --with-foo-prefix options
Index: configure.ac
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.ac,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** configure.ac 27 Jul 2003 00:30:07 -0000 1.18
--- configure.ac 27 Jul 2003 00:57:28 -0000 1.19
***************
*** 36,39 ****
--- 36,50 ----
esac])
+ AC_ARG_WITH([libdnet-prefix], AC_HELP_STRING([--with-libdnet-prefix],
+ [set explicit prefix to libdnet]),
+ libdnet_prefix=$withval, libdnet_prefix="")
+
+ AC_ARG_WITH([guile-prefix], AC_HELP_STRING([--with-guile-prefix],
+ [set explicit prefix to guile]),
+ guile_prefix=$withval, guile_prefix="")
+
+ AC_ARG_WITH([libpcap-prefix], AC_HELP_STRING([--with-libpcap-prefix],
+ [set explicit prefix to libpcap]),
+ libpcap_prefix=$withval, libpcap_prefix="")
dnl allow user to pick HTML documentation
***************
*** 140,144 ****
dnl pcap sifting
! if test -z "$pcap_prefix"; then
dnl excessive pcap sifting
--- 151,155 ----
dnl pcap sifting
! if test -z "$libpcap_prefix"; then
dnl excessive pcap sifting
***************
*** 171,176 ****
dnl if we've been passed the correct options just force a set.
! PCAP_INC="-I$pcap_prefix/include"
! PCAP_LIB="-L$pcap_prefix/lib -lpcap"
fi
--- 182,187 ----
dnl if we've been passed the correct options just force a set.
! PCAP_INC="-I$libpcap_prefix/include"
! PCAP_LIB="-L$libpcap_prefix/lib -lpcap"
fi
***************
*** 225,229 ****
dnl
! AC_PATH_PROGS(DNET_PATH, [dnet-config], [no])
if test $DNET_PATH = "no"; then
--- 236,248 ----
dnl
! if test -z $libdnet_prefix; then
!
! AC_PATH_PROGS(DNET_PATH, [dnet-config], [no], [$PATH])
!
! else
!
! AC_PATH_PROGS(DNET_PATH, [dnet-config], [no], [$libdnet_prefix/bin])
!
! fi
if test $DNET_PATH = "no"; then
***************
*** 248,254 ****
fi
- AC_PATH_PROGS(GUILE_PATH, [guile-config], [no])
! if test $GUILE_PATH = "no"; then
echo ---------------------------------------------------------
--- 267,284 ----
fi
! if test -z $guile_prefix; then
!
! AC_PATH_PROGS(GUILE_PATH, [guile-config], [no], [$PATH])
!
! else
!
! AC_PATH_PROGS(GUILE_PATH, [guile-config], [no], [$guile_prefix/bin])
!
! fi
!
!
!
! if test $GUILE_PATH = "no"; then
echo ---------------------------------------------------------
Index: INSTALL
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/INSTALL,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** INSTALL 20 Jul 2003 05:48:35 -0000 1.5
--- INSTALL 27 Jul 2003 00:57:28 -0000 1.6
***************
*** 79,82 ****
--- 79,97 ----
option.
+ --with-guile-prefix
+
+ Pass a specific prefix to find "guile-config" in. For
+ example, if guile is installed in /opt/guile, you should use:
+
+ --with-guile-prefix=/opt/guile
+
+ --with-libpcap-prefix
+
+ Pass a specific prefix to find libpcap in.
+
+ --with-libdnet-prefix
+
+ Pass a specific prefix to find "dnet-config" in.
+
--
Thamer Alharbash <tm...@wh...>
|
|
From: <act...@us...> - 2003-07-27 00:30:13
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv11458 Modified Files: configure.ac config.h.in Log Message: added check for in_addr_t Index: configure.ac =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.ac,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** configure.ac 21 Jul 2003 05:15:16 -0000 1.17 --- configure.ac 27 Jul 2003 00:30:07 -0000 1.18 *************** *** 68,71 **** --- 68,72 ---- AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, [have sigatomic_t])], [], [#include <signal.h>]) + AC_CHECK_TYPE(in_addr_t, [AC_DEFINE(HAVE_IN_ADDR_T, 1, [have in_addr_t])], [], [#include <netinet/in.h>]) AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL, 1, [have struct bpf_timeval])], [], Index: config.h.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/config.h.in,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** config.h.in 16 Jul 2003 05:42:24 -0000 1.7 --- config.h.in 27 Jul 2003 00:30:08 -0000 1.8 *************** *** 28,31 **** --- 28,34 ---- #undef HAVE_INTTYPES_H + /* have in_addr_t */ + #undef HAVE_IN_ADDR_T + /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H |
|
From: <act...@us...> - 2003-07-27 00:30:13
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv11458/src Modified Files: dhcp-local.h Log Message: added check for in_addr_t Index: dhcp-local.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-local.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-local.h 11 Jun 2003 03:08:49 -0000 1.7 --- dhcp-local.h 27 Jul 2003 00:30:08 -0000 1.8 *************** *** 108,111 **** --- 108,116 ---- #endif /* INADDR_NONE */ + /* some systems don't have in_addr_t (thanks openpkg maintainers) */ + #ifndef HAVE_IN_ADDR_T + typedef uint32_t in_addr_t; + #endif + /* Some operating systems don't have SCNu8/SCNd8 but will have * the other C99 format macros. I guess they expect us just to |
|
From: <act...@us...> - 2003-07-27 00:14:49
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv9266/src
Modified Files:
dhcp-daemon.c
Log Message:
FATAL_ERROR should be FATAL_MESSAGE
Index: dhcp-daemon.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-daemon.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** dhcp-daemon.c 17 Jul 2003 13:12:54 -0000 1.6
--- dhcp-daemon.c 27 Jul 2003 00:14:46 -0000 1.7
***************
*** 73,77 ****
/* Also we haven't opened logging yet, so do it now and exit. */
init_log(getprogname());
! FATAL_ERROR("initialization: fork: %s", strerror(errno));
case 0:
--- 73,77 ----
/* Also we haven't opened logging yet, so do it now and exit. */
init_log(getprogname());
! FATAL_MESSAGE("initialization: fork: %s", strerror(errno));
case 0:
|
|
From: <act...@us...> - 2003-07-26 23:50:46
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory sc8-pr-cvs1:/tmp/cvs-serv5795 Modified Files: README Log Message: fixed small typo Index: README =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/README,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** README 20 Jul 2003 05:48:36 -0000 1.13 --- README 26 Jul 2003 23:50:43 -0000 1.14 *************** *** 14,18 **** The DHCP suite's components are extendable, where applicable, with the Scheme programming language. This is done by embedding ! guile, GNU's Ubiquitous Intelligent Language for Extension. If you're a fellow Schemer then this feature will make you very happy. If not, don't worry. The suite is still useable without --- 14,18 ---- The DHCP suite's components are extendable, where applicable, with the Scheme programming language. This is done by embedding ! guile, GNU's Ubiquitous Intelligent Language for Extensions. If you're a fellow Schemer then this feature will make you very happy. If not, don't worry. The suite is still useable without |
|
From: <act...@us...> - 2003-07-26 23:49:13
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv5486/src
Modified Files:
dhcp-server-control.c
Log Message:
server control now accepts server conf
Index: dhcp-server-control.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-control.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** dhcp-server-control.c 25 Jul 2003 02:38:02 -0000 1.5
--- dhcp-server-control.c 26 Jul 2003 23:49:11 -0000 1.6
***************
*** 33,37 ****
#include "dhcp-server.h"
! dhcp_server_control_t *dhcp_server_control_create(const char *interface)
{
int dport, sport;
--- 33,37 ----
#include "dhcp-server.h"
! dhcp_server_control_t *dhcp_server_control_create(const char *interface, server_conf_t *server_conf)
{
int dport, sport;
***************
*** 42,50 ****
dhcp_server_control->interface = xstrdup(interface);
! /* read configuration information. */
! if((dhcp_server_control->server_conf = server_conf_create(interface)) == NULL) {
! FATAL_MESSAGE("could not read configuration file");
! }
!
sport = rawnet_port_for_service("bootpc", "udp");
dport = rawnet_port_for_service("bootps", "udp");
--- 42,46 ----
dhcp_server_control->interface = xstrdup(interface);
! dhcp_server_control->server_conf = server_conf;
sport = rawnet_port_for_service("bootpc", "udp");
dport = rawnet_port_for_service("bootps", "udp");
|
|
From: <act...@us...> - 2003-07-26 23:48:04
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv5184/src
Modified Files:
dhcp-server.c dhcp-server.h
Log Message:
server now reads configuration first, before exiting
Index: dhcp-server.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** dhcp-server.c 20 Jul 2003 05:52:31 -0000 1.9
--- dhcp-server.c 26 Jul 2003 23:48:01 -0000 1.10
***************
*** 97,104 ****
--- 97,110 ----
static void do_server(char *interface)
{
+ server_conf_t *server_conf;
dhcp_server_control_t *dhcp_server_control;
INFO_MESSAGE("DHCP server starting");
+ /* read configuration information. */
+ if((server_conf = server_conf_create(interface)) == NULL) {
+ FATAL_MESSAGE("error reading configuration file");
+ }
+
/* we go into the background immediately. */
if(want_background) {
***************
*** 110,114 ****
}
! dhcp_server_control = dhcp_server_control_create(interface);
if(file_create_pid(interface)) {
--- 116,120 ----
}
! dhcp_server_control = dhcp_server_control_create(interface, server_conf);
if(file_create_pid(interface)) {
Index: dhcp-server.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** dhcp-server.h 20 Jul 2003 05:52:31 -0000 1.6
--- dhcp-server.h 26 Jul 2003 23:48:01 -0000 1.7
***************
*** 47,51 ****
/* prototypes. */
! extern dhcp_server_control_t *dhcp_server_control_create(const char *interface);
extern void dhcp_server_control_destroy(dhcp_server_control_t *sc);
--- 47,51 ----
/* prototypes. */
! extern dhcp_server_control_t *dhcp_server_control_create(const char *interface, server_conf_t *server_conf);
extern void dhcp_server_control_destroy(dhcp_server_control_t *sc);
|
|
From: <act...@us...> - 2003-07-26 23:47:46
|
Update of /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server
In directory sc8-pr-cvs1:/tmp/cvs-serv5142/conf/dhcp-server
Modified Files:
lease.conf.example
Log Message:
example configuration file updated
Index: lease.conf.example
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/conf/dhcp-server/lease.conf.example,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** lease.conf.example 15 Jul 2003 10:56:34 -0000 1.5
--- lease.conf.example 26 Jul 2003 23:47:43 -0000 1.6
***************
*** 14,17 ****
--- 14,21 ----
set poll-timeout = 5;
+ # configure a local subnet.
+
+ local-subnet 10.0.0.0 255.255.255.0;
+
# order is try hostname leases before mac-lease
***************
*** 22,51 ****
# 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;
};
--- 26,58 ----
# match a hostname or mac lease.
! subnet 10.0.0.0 255.255.255.0 {
! 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;
! };
};
|
|
From: <act...@us...> - 2003-07-26 23:47:11
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv5061/src
Modified Files:
dhcp-lease.c dhcp-lease.h
Log Message:
leases now accept subnet definition
Index: dhcp-lease.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-lease.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** dhcp-lease.c 14 Jul 2003 05:58:17 -0000 1.6
--- dhcp-lease.c 26 Jul 2003 23:47:08 -0000 1.7
***************
*** 85,88 ****
--- 85,90 ----
lease_definition_t *lease_definition_create(lease_constraint_t *constraint,
+ ip_addr_t subnet_address,
+ ip_addr_t subnet_mask,
int lease_type,
void *data,
***************
*** 103,106 ****
--- 105,112 ----
lease_def->constraint = constraint;
+ /* assign subnet. */
+ lease_def->subnet = subnet_address;
+ lease_def->subnet_mask = subnet_mask;
+
/* setup addresses. */
switch(lease_type) {
***************
*** 227,230 ****
--- 233,246 ----
}
+ ip_addr_t lease_definition_get_subnet_addr(lease_definition_t *lease)
+ {
+ return lease->subnet;
+ }
+
+ ip_addr_t lease_definition_get_subnet_mask(lease_definition_t *lease)
+ {
+ return lease->subnet_mask;
+ }
+
/* * * * * * * * * *
* misc utilities. *
***************
*** 238,241 ****
--- 254,258 ----
dhcp_opt_t *option;
char *bottom_addr, *top_addr;
+ char *subnet_addr, *subnet_mask;
INFO_MESSAGE("Lease type: %s", lease_type_to_string(lease_def));
***************
*** 291,294 ****
--- 308,319 ----
}
+ subnet_addr = ip_addr_to_string(lease_definition_get_subnet_addr(lease_def));
+ subnet_mask = ip_addr_to_string(lease_definition_get_subnet_mask(lease_def));
+
+ INFO_MESSAGE("Subnet: %s %s", subnet_addr, subnet_mask);
+
+ xfree(subnet_addr);
+ xfree(subnet_mask);
+
INFO_MESSAGE(" ");
INFO_MESSAGE("Lease options:");
***************
*** 313,316 ****
--- 338,342 ----
}
+ INFO_MESSAGE("----------------------------------------");
INFO_MESSAGE(" ");
return;
Index: dhcp-lease.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-lease.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** dhcp-lease.h 13 Jul 2003 05:44:30 -0000 1.5
--- dhcp-lease.h 26 Jul 2003 23:47:08 -0000 1.6
***************
*** 56,59 ****
--- 56,62 ----
} address_info;
+ ip_addr_t subnet; /* subnet address. */
+ ip_addr_t subnet_mask; /* subnet address. */
+
list_t *options; /* options to be passed. */
***************
*** 64,76 ****
} lease_definition_t;
! /* assigned lease data. */
typedef struct {
lease_definition_t *definition; /* lease definition. */
time_t ini_assigned; /* initially assigned timestamp. */
time_t last_assigned; /* last assigned timestamp. */
! } assigned_lease_data_t;
/* constants. */
--- 67,80 ----
} lease_definition_t;
! /* lease data. */
typedef struct {
lease_definition_t *definition; /* lease definition. */
+ ip_addr_t address; /* assigned address. */
time_t ini_assigned; /* initially assigned timestamp. */
time_t last_assigned; /* last assigned timestamp. */
! } lease_t;
/* constants. */
***************
*** 84,87 ****
--- 88,93 ----
extern void lease_constraint_destroy(lease_constraint_t *lease_constraint);
extern lease_definition_t *lease_definition_create(lease_constraint_t *constraint,
+ ip_addr_t subnet,
+ ip_addr_t subnet_mask,
int lease_type,
void *data,
***************
*** 107,110 ****
--- 113,118 ----
extern ip_addr_t lease_definition_get_top_addr(lease_definition_t *lease);
extern ip_addr_t lease_definition_get_addr(lease_definition_t *lease);
+ extern ip_addr_t lease_definition_get_subnet_addr(lease_definition_t *lease);
+ extern ip_addr_t lease_definition_get_subnet_mask(lease_definition_t *lease);
extern void pretty_print_lease_def(lease_definition_t *lease_def);
|
|
From: <act...@us...> - 2003-07-26 23:46:55
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv4988/src
Modified Files:
dhcp-server-conf.c dhcp-server-conf.h
Log Message:
added local-subnet variable; added subnet declaration before lease definition
Index: dhcp-server-conf.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** dhcp-server-conf.c 20 Jul 2003 05:51:35 -0000 1.9
--- dhcp-server-conf.c 26 Jul 2003 23:46:51 -0000 1.10
***************
*** 70,73 ****
--- 70,81 ----
static const arg_symbol_t *option_arg_symbols[] = { NULL, NULL, NULL };
+ static const arg_type_t local_subnet_arg_types[] = { CONF_ADDRESS, CONF_ADDRESS };
+ static const char **local_subnet_arg_strings[] = { NULL, NULL };
+ static const arg_symbol_t *local_subnet_arg_symbols[] = { NULL, NULL };
+
+ static const arg_type_t subnet_arg_types[] = { CONF_ADDRESS, CONF_ADDRESS, CONF_GROUP };
+ static const char **subnet_arg_strings[] = { NULL, NULL };
+ static const arg_symbol_t *subnet_arg_symbols[] = { NULL, NULL };
+
/* command structures. */
***************
*** 121,124 ****
--- 129,150 ----
};
+ static const command_t command_local_subnet = {
+ DIRECTIVE_LOCAL_SUBNET,
+ "local-subnet",
+ 2,
+ local_subnet_arg_strings,
+ local_subnet_arg_types,
+ local_subnet_arg_symbols,
+ };
+
+ static const command_t command_subnet = {
+ DIRECTIVE_SUBNET,
+ "subnet",
+ 3,
+ subnet_arg_strings,
+ subnet_arg_types,
+ subnet_arg_symbols,
+ };
+
static const command_t *commands[] = {
&command_set,
***************
*** 127,130 ****
--- 153,158 ----
&command_mac_lease,
&command_option,
+ &command_local_subnet,
+ &command_subnet,
NULL,
};
***************
*** 137,140 ****
--- 165,170 ----
static int directive_hostname_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data);
static int directive_hw_address_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data);
+ static int directive_local_subnet_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data);
+ static int directive_subnet_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data);
/* indexed by directive types in dhcp-client-conf.h . */
***************
*** 145,148 ****
--- 175,180 ----
directive_hw_address_handler,
directive_option_handler,
+ directive_local_subnet_handler,
+ directive_subnet_handler,
};
***************
*** 300,303 ****
--- 332,336 ----
}
+ /* procified lease handler. */
static int directive_lease_handler_proc(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data,
list_t *option_list)
***************
*** 342,345 ****
--- 375,391 ----
uint32_t renew_time = 0;
uint32_t rebind_time = 0;
+ list_t *subnet_data;
+ ip_addr_t subnet_address, subnet_mask;
+
+ if(group_type != GROUP_SUBNET_DEF) {
+ ERROR_MESSAGE("lease definition specified outside of subnet declaration.");
+ return 1;
+ }
+
+ subnet_data = group_data;
+
+ /* get subnet information. */
+ subnet_address = *(ip_addr_t *)list_first(subnet_data);
+ subnet_mask = *(ip_addr_t *)list_second(subnet_data);
/* arguments. */
***************
*** 364,368 ****
directive_lease_handler_proc(server_conf, directive, GROUP_LEASE_DEF, group_data, option_list);
! lease_def = lease_definition_create(NULL, LEASE_RANGE_ADDRESS, address_pair, option_list, lease_expiry, renew_time, rebind_time);
list_add(server_conf->lease_defs, lease_def);
--- 410,415 ----
directive_lease_handler_proc(server_conf, directive, GROUP_LEASE_DEF, group_data, option_list);
! lease_def = lease_definition_create(NULL, subnet_address, subnet_mask, LEASE_RANGE_ADDRESS,
! address_pair, option_list, lease_expiry, renew_time, rebind_time);
list_add(server_conf->lease_defs, lease_def);
***************
*** 384,387 ****
--- 431,447 ----
uint32_t renew_time = 0;
uint32_t rebind_time = 0;
+ list_t *subnet_data;
+ ip_addr_t subnet_address, subnet_mask;
+
+ if(group_type != GROUP_SUBNET_DEF) {
+ ERROR_MESSAGE("lease definition specified outside of subnet declaration.");
+ return 1;
+ }
+
+ subnet_data = group_data;
+
+ /* get subnet information. */
+ subnet_address = *(ip_addr_t *)list_first(subnet_data);
+ subnet_mask = *(ip_addr_t *)list_second(subnet_data);
/* arguments. */
***************
*** 400,405 ****
directive_lease_handler_proc(server_conf, directive, GROUP_LEASE_DEF, group_data, option_list);
! lease_def = lease_definition_create(constraint, LEASE_SINGLE_ADDRESS, ip_address, option_list,
! lease_expiry, renew_time, rebind_time);
list_add(server_conf->lease_defs, lease_def);
--- 460,465 ----
directive_lease_handler_proc(server_conf, directive, GROUP_LEASE_DEF, group_data, option_list);
! lease_def = lease_definition_create(constraint, subnet_address, subnet_mask, LEASE_SINGLE_ADDRESS,
! ip_address, option_list, lease_expiry, renew_time, rebind_time);
list_add(server_conf->lease_defs, lease_def);
***************
*** 419,422 ****
--- 479,495 ----
uint32_t renew_time = 0;
uint32_t rebind_time = 0;
+ list_t *subnet_data;
+ ip_addr_t subnet_address, subnet_mask;
+
+ if(group_type != GROUP_SUBNET_DEF) {
+ ERROR_MESSAGE("lease definition specified outside of subnet declaration.");
+ return 1;
+ }
+
+ subnet_data = group_data;
+
+ /* get subnet information. */
+ subnet_address = *(ip_addr_t *)list_first(subnet_data);
+ subnet_mask = *(ip_addr_t *)list_second(subnet_data);
/* arguments. */
***************
*** 437,442 ****
directive_lease_handler_proc(server_conf, directive, GROUP_LEASE_DEF, group_data, option_list);
! lease_def = lease_definition_create(constraint, LEASE_SINGLE_ADDRESS, ip_address, option_list,
! lease_expiry, renew_time, rebind_time);
list_add(server_conf->lease_defs, lease_def);
--- 510,515 ----
directive_lease_handler_proc(server_conf, directive, GROUP_LEASE_DEF, group_data, option_list);
! lease_def = lease_definition_create(constraint, subnet_address, subnet_mask, LEASE_SINGLE_ADDRESS,
! ip_address, option_list, lease_expiry, renew_time, rebind_time);
list_add(server_conf->lease_defs, lease_def);
***************
*** 487,490 ****
--- 560,634 ----
}
+ /* handle subnet specification. */
+ static int directive_local_subnet_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data)
+ {
+ ip_addr_t *network, *mask;
+ list_t *subnet_data;
+
+
+ network = xcalloc(sizeof(ip_addr_t));
+ mask = xcalloc(sizeof(ip_addr_t));
+
+ memcpy(network, list_first(directive->arguments), IP_ADDR_LEN);
+ memcpy(mask, list_second(directive->arguments), IP_ADDR_LEN);
+
+ subnet_data = list_create();
+
+ list_add(subnet_data, network);
+ list_add(subnet_data, mask);
+
+ list_add(server_conf->local_subnets, subnet_data);
+
+ return 0;
+ }
+
+ static int directive_subnet_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data)
+ {
+ directive_t *subnet_directive;
+ list_t *subnet_directives;
+ list_t *subnet_data;
+ ip_addr_t *network, *mask;
+
+ /* copy out subnet information. */
+ network = xcalloc(sizeof(ip_addr_t));
+ mask = xcalloc(sizeof(ip_addr_t));
+
+ memcpy(network, list_first(directive->arguments), IP_ADDR_LEN);
+ memcpy(mask, list_second(directive->arguments), IP_ADDR_LEN);
+
+ subnet_data = list_create();
+
+ list_add(subnet_data, mask);
+ list_add(subnet_data, network);
+
+ /* parse lower directives. */
+ subnet_directives = list_get_by_index(directive->arguments, 2);
+
+ list_rewind(subnet_directives);
+ while((subnet_directive = list_next(subnet_directives)) != NULL) {
+
+ switch(subnet_directive->command_code) {
+
+ case DIRECTIVE_RANGE_LEASE:
+ case DIRECTIVE_HOSTNAME_LEASE:
+ case DIRECTIVE_MAC_LEASE:
+
+ if(directive_handlers[subnet_directive->command_code](server_conf, subnet_directive, GROUP_SUBNET_DEF, subnet_data))
+ return 1;
+
+ break;
+
+ default:
+ ERROR_MESSAGE("illegal directive specified in a subnet definition");
+ return 1;
+ }
+ }
+
+ /* we don't need the subnet information anymore. */
+ list_destroy(subnet_data, xfree);
+
+ return 0;
+ }
+
/* * * * * * * * * * *
* public interface *
***************
*** 501,504 ****
--- 645,649 ----
/* setup lease definitions. */
sc->lease_defs = list_create();
+ sc->local_subnets = list_create();
/* set defaults. */
***************
*** 510,513 ****
--- 655,662 ----
server_conf_destroy(sc);
return NULL;
+ }
+
+ if(list_get_len(sc->local_subnets) == 0) {
+ WARN_MESSAGE("no local subnets specified. may assume all subnets as local.");
}
Index: dhcp-server-conf.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** dhcp-server-conf.h 15 Jul 2003 10:56:34 -0000 1.7
--- dhcp-server-conf.h 26 Jul 2003 23:46:51 -0000 1.8
***************
*** 39,42 ****
--- 39,43 ----
uint16_t poll_timeout; /* poll timeout -- used in server event processing. */
+ list_t *local_subnets; /* list of subnets. */
} server_conf_t;
***************
*** 46,51 ****
enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT, SERVER_VAR_POLL_TIMEOUT };
! enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE, DIRECTIVE_HOSTNAME_LEASE, DIRECTIVE_MAC_LEASE, DIRECTIVE_OPTION };
! enum group_types { GROUP_NULL = 0, GROUP_LEASE_DEF };
/* prototypes. */
--- 47,53 ----
enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT, SERVER_VAR_POLL_TIMEOUT };
! enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE, DIRECTIVE_HOSTNAME_LEASE,
! DIRECTIVE_MAC_LEASE, DIRECTIVE_OPTION, DIRECTIVE_LOCAL_SUBNET, DIRECTIVE_SUBNET };
! enum group_types { GROUP_NULL = 0, GROUP_LEASE_DEF, GROUP_SUBNET_DEF };
/* prototypes. */
|