mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-01 14:55:30 +00:00
Clean up some compiler warnings
This commit is contained in:
@@ -3782,13 +3782,13 @@ packet6_len_okay(const char *packet, int len) {
|
|||||||
}
|
}
|
||||||
if ((packet[0] == DHCPV6_RELAY_FORW) ||
|
if ((packet[0] == DHCPV6_RELAY_FORW) ||
|
||||||
(packet[0] == DHCPV6_RELAY_REPL)) {
|
(packet[0] == DHCPV6_RELAY_REPL)) {
|
||||||
if (len >= sizeof(struct dhcpv6_relay_packet)) {
|
if (len >= offsetof(struct dhcpv6_relay_packet, options)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (len >= sizeof(struct dhcpv6_packet)) {
|
if (len >= offsetof(struct dhcpv6_packet, options)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -508,6 +508,8 @@ CFLAGS="$CFLAGS $STD_CWARNINGS"
|
|||||||
# Try to add the bind include directory
|
# Try to add the bind include directory
|
||||||
CFLAGS="$CFLAGS -I$libbind/include"
|
CFLAGS="$CFLAGS -I$libbind/include"
|
||||||
|
|
||||||
|
AC_C_FLEXIBLE_ARRAY_MEMBER
|
||||||
|
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
Makefile
|
||||||
client/Makefile
|
client/Makefile
|
||||||
|
@@ -177,7 +177,7 @@ extern const int dhcpv6_type_name_max;
|
|||||||
struct dhcpv6_packet {
|
struct dhcpv6_packet {
|
||||||
unsigned char msg_type;
|
unsigned char msg_type;
|
||||||
unsigned char transaction_id[3];
|
unsigned char transaction_id[3];
|
||||||
unsigned char options[0];
|
unsigned char options[FLEXIBLE_ARRAY_MEMBER];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Offset into DHCPV6 Reply packets where Options spaces commence. */
|
/* Offset into DHCPV6 Reply packets where Options spaces commence. */
|
||||||
@@ -191,7 +191,7 @@ struct dhcpv6_relay_packet {
|
|||||||
unsigned char hop_count;
|
unsigned char hop_count;
|
||||||
unsigned char link_address[16];
|
unsigned char link_address[16];
|
||||||
unsigned char peer_address[16];
|
unsigned char peer_address[16];
|
||||||
unsigned char options[0];
|
unsigned char options[FLEXIBLE_ARRAY_MEMBER];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Leasequery query-types (RFC 5007) */
|
/* Leasequery query-types (RFC 5007) */
|
||||||
|
@@ -297,23 +297,27 @@ do_id_hash(const void *name, unsigned len, unsigned size)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* The switch indexes our starting position into the do/while loop,
|
/*
|
||||||
* taking up the remainder after hashing in all the other bytes in
|
* The switch handles our starting conditions, then we hash the
|
||||||
* threes.
|
* remaining bytes in groups of 3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (len % 3) {
|
switch (len % 3) {
|
||||||
do {
|
|
||||||
case 0:
|
case 0:
|
||||||
accum ^= *s++ << 16;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
accum ^= *s++ << 8;
|
accum ^= *s++ << 8;
|
||||||
case 1:
|
case 1:
|
||||||
accum ^= *s++;
|
accum ^= *s++;
|
||||||
} while (s < end);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (s < end) {
|
||||||
|
accum ^= *s++ << 16;
|
||||||
|
accum ^= *s++ << 8;
|
||||||
|
accum ^= *s++;
|
||||||
|
}
|
||||||
|
|
||||||
return accum % size;
|
return accum % size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1355,7 +1355,7 @@ process_up6(struct packet *packet, struct stream_list *dp) {
|
|||||||
|
|
||||||
/* Build the relay-forward header. */
|
/* Build the relay-forward header. */
|
||||||
relay = (struct dhcpv6_relay_packet *) forw_data;
|
relay = (struct dhcpv6_relay_packet *) forw_data;
|
||||||
cursor = sizeof(*relay);
|
cursor = offsetof(struct dhcpv6_relay_packet, options);
|
||||||
relay->msg_type = DHCPV6_RELAY_FORW;
|
relay->msg_type = DHCPV6_RELAY_FORW;
|
||||||
if (packet->dhcpv6_msg_type == DHCPV6_RELAY_FORW) {
|
if (packet->dhcpv6_msg_type == DHCPV6_RELAY_FORW) {
|
||||||
if (packet->dhcpv6_hop_count >= max_hop_count) {
|
if (packet->dhcpv6_hop_count >= max_hop_count) {
|
||||||
@@ -1483,7 +1483,7 @@ process_down6(struct packet *packet) {
|
|||||||
if (!evaluate_option_cache(&relay_msg, packet, NULL, NULL,
|
if (!evaluate_option_cache(&relay_msg, packet, NULL, NULL,
|
||||||
packet->options, NULL,
|
packet->options, NULL,
|
||||||
&global_scope, oc, MDL) ||
|
&global_scope, oc, MDL) ||
|
||||||
(relay_msg.len < sizeof(struct dhcpv6_packet))) {
|
(relay_msg.len < offsetof (struct dhcpv6_packet, options))) {
|
||||||
log_error("Can't evaluate relay-msg.");
|
log_error("Can't evaluate relay-msg.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -3423,7 +3423,6 @@ int find_lease (struct lease **lp,
|
|||||||
piaddr (hw_lease -> ip_addr));
|
piaddr (hw_lease -> ip_addr));
|
||||||
#endif
|
#endif
|
||||||
goto n_hw;
|
goto n_hw;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (hw_lease -> subnet -> shared_network != share) {
|
if (hw_lease -> subnet -> shared_network != share) {
|
||||||
#if defined (DEBUG_FIND_LEASE)
|
#if defined (DEBUG_FIND_LEASE)
|
||||||
@@ -3431,7 +3430,6 @@ int find_lease (struct lease **lp,
|
|||||||
piaddr (hw_lease -> ip_addr));
|
piaddr (hw_lease -> ip_addr));
|
||||||
#endif
|
#endif
|
||||||
goto n_hw;
|
goto n_hw;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if ((hw_lease -> pool -> prohibit_list &&
|
if ((hw_lease -> pool -> prohibit_list &&
|
||||||
permitted (packet, hw_lease -> pool -> prohibit_list)) ||
|
permitted (packet, hw_lease -> pool -> prohibit_list)) ||
|
||||||
|
@@ -4226,7 +4226,7 @@ dhcpv6_confirm(struct data_string *reply_ret, struct packet *packet) {
|
|||||||
isc_boolean_t inappropriate, has_addrs;
|
isc_boolean_t inappropriate, has_addrs;
|
||||||
char reply_data[65536];
|
char reply_data[65536];
|
||||||
struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
|
struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
|
||||||
int reply_ofs = (int)((char *)reply->options - (char *)reply);
|
int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Basic client message validation.
|
* Basic client message validation.
|
||||||
@@ -4583,7 +4583,7 @@ iterate_over_ia_na(struct data_string *reply_ret,
|
|||||||
int iaaddr_is_found;
|
int iaaddr_is_found;
|
||||||
char reply_data[65536];
|
char reply_data[65536];
|
||||||
struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
|
struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
|
||||||
int reply_ofs = (int)((char *)reply->options - (char *)reply);
|
int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options));
|
||||||
char status_msg[32];
|
char status_msg[32];
|
||||||
struct iasubopt *lease;
|
struct iasubopt *lease;
|
||||||
struct ia_xx *existing_ia_na;
|
struct ia_xx *existing_ia_na;
|
||||||
@@ -5555,7 +5555,7 @@ dhcpv6_relay_forw(struct data_string *reply_ret, struct packet *packet) {
|
|||||||
sizeof(reply->link_address));
|
sizeof(reply->link_address));
|
||||||
memcpy(reply->peer_address, &packet->dhcpv6_peer_address,
|
memcpy(reply->peer_address, &packet->dhcpv6_peer_address,
|
||||||
sizeof(reply->peer_address));
|
sizeof(reply->peer_address));
|
||||||
reply_ofs = (int)((char *)reply->options - (char *)reply);
|
reply_ofs = (int)(offsetof(struct dhcpv6_relay_packet, options));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the reply option state.
|
* Get the reply option state.
|
||||||
|
@@ -30,14 +30,14 @@
|
|||||||
#include <isc/md5.h>
|
#include <isc/md5.h>
|
||||||
|
|
||||||
HASH_FUNCTIONS(ia, unsigned char *, struct ia_xx, ia_hash_t,
|
HASH_FUNCTIONS(ia, unsigned char *, struct ia_xx, ia_hash_t,
|
||||||
ia_reference, ia_dereference, do_string_hash);
|
ia_reference, ia_dereference, do_string_hash)
|
||||||
|
|
||||||
ia_hash_t *ia_na_active;
|
ia_hash_t *ia_na_active;
|
||||||
ia_hash_t *ia_ta_active;
|
ia_hash_t *ia_ta_active;
|
||||||
ia_hash_t *ia_pd_active;
|
ia_hash_t *ia_pd_active;
|
||||||
|
|
||||||
HASH_FUNCTIONS(iasubopt, struct in6_addr *, struct iasubopt, iasubopt_hash_t,
|
HASH_FUNCTIONS(iasubopt, struct in6_addr *, struct iasubopt, iasubopt_hash_t,
|
||||||
iasubopt_reference, iasubopt_dereference, do_string_hash);
|
iasubopt_reference, iasubopt_dereference, do_string_hash)
|
||||||
|
|
||||||
struct ipv6_pool **pools;
|
struct ipv6_pool **pools;
|
||||||
int num_pools;
|
int num_pools;
|
||||||
|
@@ -1891,7 +1891,12 @@ class_set_value (omapi_object_t *h,
|
|||||||
} else
|
} else
|
||||||
return DHCP_R_INVALIDARG;
|
return DHCP_R_INVALIDARG;
|
||||||
|
|
||||||
return ISC_R_SUCCESS;
|
/*
|
||||||
|
* Currently no way to get here, if we update the above
|
||||||
|
* code so that we do get here this return needs to be
|
||||||
|
* uncommented.
|
||||||
|
* return ISC_R_SUCCESS;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user