Permalink
Browse files

fixed DHO_PORT_SET in dhcp.h;fixed mim's code in dhcp.c

  • Loading branch information...
gnocuil committed Oct 8, 2012
1 parent ddcddd2 commit d862df64793ddb8bdfa9c877b4c52c3a10d859cc
@@ -161,7 +161,7 @@ struct dhcp_packet {
#define DHO_VIVCO_SUBOPTIONS 124
#define DHO_VIVSO_SUBOPTIONS 125
-#define DHO_PORT_SET 198 /*pset option, added*/
+#define DHO_PORT_SET 224 /*pset option, added*/
#define DHO_END 255
@@ -148,7 +148,7 @@ dhcp (struct packet *packet) {
{
struct iaddr cip;
struct iaddr_pset ipset;//get pset-option from request packet. sunqi
-
+ printf("*************************dhcp.c,line 151***************\n");
/********if pset option exists, get it; else use original method. sunqi*******/
ipset.ip_addr.len = sizeof packet -> raw -> ciaddr;
@@ -158,7 +158,7 @@ dhcp (struct packet *packet) {
DHO_PORT_SET);
memset (&data, 0, sizeof data);
if (oc &&
- evaluate_option_cache (&data, packet, (struct lease)0,
+ evaluate_option_cache (&data, packet, (struct lease*)0,
(struct client_state *)0,
packet -> options, (struct option_state*)0,
&global_scope, oc, MDL)){
@@ -2694,9 +2694,9 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
if( !lookup_option(&dhcp_universe, state->options,i)){
oc = (struct option_cache *) 0;
if(option_cache_allocate(&oc, MDL)){
- u_int32_t tmp = htons(lease->ip_pset.pset_index) << 16 + htons(lease->ip_pset.pset_mask);
+ u_int32_t tmp = htons((lease->ip_pset.pset_index) << 16) + htons(lease->ip_pset.pset_mask);
if(make_const_data( &oc->expression,
- &tmp, 4,
+ (const unsigned char *)&tmp, 4,
0, 0, MDL)){
option_code_hash_lookup( &oc->option,
dhcp_universe.code_hash,
@@ -1,12 +1,30 @@
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.3-P2
-server-duid "\000\001\000\001\027\371\\t\010\000',\302\257";
-
lease 192.168.1.151 {
starts 6 2012/10/06 16:53:40;
ends 6 2012/10/06 17:03:40;
+ tstp 6 2012/10/06 17:03:40;
cltt 6 2012/10/06 16:53:40;
+ binding state free;
+ hardware ethernet 08:00:27:f3:0f:45;
+}
+server-duid "\000\001\000\001\027\371\\t\010\000',\302\257";
+
+lease 192.168.1.151 {
+ starts 1 2012/10/08 13:48:57;
+ ends 1 2012/10/08 13:58:57;
+ cltt 1 2012/10/08 13:48:57;
+ binding state active;
+ next binding state free;
+ rewind binding state free;
+ hardware ethernet 08:00:27:f3:0f:45;
+ client-hostname "thuos-VirtualBox";
+}
+lease 192.168.1.151 {
+ starts 1 2012/10/08 13:49:46;
+ ends 1 2012/10/08 13:59:46;
+ cltt 1 2012/10/08 13:49:46;
binding state active;
next binding state free;
rewind binding state free;
@@ -1,24 +1,13 @@
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.3-P2
-lease 192.168.1.101 {
- starts 6 2012/10/06 16:48:12;
- ends 6 2012/10/06 16:58:12;
- tstp 6 2012/10/06 16:58:12;
- cltt 6 2012/10/06 16:48:12;
- binding state active;
- next binding state free;
- rewind binding state free;
+lease 192.168.1.151 {
+ starts 6 2012/10/06 16:53:40;
+ ends 6 2012/10/06 17:03:40;
+ tstp 6 2012/10/06 17:03:40;
+ cltt 6 2012/10/06 16:53:40;
+ binding state free;
hardware ethernet 08:00:27:f3:0f:45;
}
server-duid "\000\001\000\001\027\371\\t\010\000',\302\257";
-lease 192.168.1.101 {
- starts 6 2012/10/06 16:52:22;
- ends 6 2012/10/06 17:02:22;
- cltt 6 2012/10/06 16:52:22;
- binding state active;
- next binding state free;
- rewind binding state free;
- hardware ethernet 08:00:27:f3:0f:45;
-}
@@ -773,7 +773,7 @@ void new_address_range (cfile, low, high, subnet, pool, lpchain)
ratio1 = 0;
for (ep = subnet -> group -> statements; ep; ep = ep -> next) {
if (ep -> op == supersede_option_statement) {
- if (ep -> data.option -> option -> code == 224) {
+ if (ep -> data.option -> option -> code == DHO_PORT_SET) {
printf("pset found!!!\n");
printf("%d\n", ep -> data.option -> expression -> op);
pset_mask = ntohs(*(u_int16_t*)(ep -> data.option -> expression -> data.const_data.buffer -> data));

0 comments on commit d862df6

Please sign in to comment.