From: Alan T. DeKok Date: Wed, 25 Jan 2012 10:53:29 +0000 (+0100) Subject: Remove "hash" from RADIUS_PACKET X-Git-Tag: release_3_0_0_beta0~377 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9c3d099e95e84ae59b7c99fdf3e3440f2fd8208;p=thirdparty%2Ffreeradius-server.git Remove "hash" from RADIUS_PACKET It's no longer needed. Various support functions are also removed. --- diff --git a/src/include/libradius.h b/src/include/libradius.h index ea1411134cb..4b5618b6c9c 100644 --- a/src/include/libradius.h +++ b/src/include/libradius.h @@ -231,7 +231,6 @@ typedef struct radius_packet { uint16_t dst_port; int id; unsigned int code; - uint32_t hash; uint8_t vector[AUTH_VECTOR_LEN]; struct timeval timestamp; uint8_t *data; diff --git a/src/include/packet.h b/src/include/packet.h index 74e2a33e963..e7b5bae3714 100644 --- a/src/include/packet.h +++ b/src/include/packet.h @@ -31,8 +31,6 @@ RCSIDH(packet_h, "$Id$") extern "C" { #endif -uint32_t fr_request_packet_hash(const RADIUS_PACKET *packet); -uint32_t fr_reply_packet_hash(const RADIUS_PACKET *packet); int fr_packet_cmp(const RADIUS_PACKET *a, const RADIUS_PACKET *b); int fr_inaddr_any(fr_ipaddr_t *ipaddr); void fr_request_from_reply(RADIUS_PACKET *request, diff --git a/src/lib/packet.c b/src/lib/packet.c index ad68ce2eabc..813360b252b 100644 --- a/src/lib/packet.c +++ b/src/lib/packet.c @@ -31,102 +31,6 @@ RCSID("$Id$") #include -/* - * Take the key fields of a request packet, and convert it to a - * hash. - */ -uint32_t fr_request_packet_hash(const RADIUS_PACKET *packet) -{ - uint32_t hash; - - if (packet->hash) return packet->hash; - - hash = fr_hash(&packet->sockfd, sizeof(packet->sockfd)); - hash = fr_hash_update(&packet->src_port, sizeof(packet->src_port), - hash); - hash = fr_hash_update(&packet->dst_port, - sizeof(packet->dst_port), hash); - hash = fr_hash_update(&packet->src_ipaddr.af, - sizeof(packet->src_ipaddr.af), hash); - - /* - * The caller ensures that src & dst AF are the same. - */ - switch (packet->src_ipaddr.af) { - case AF_INET: - hash = fr_hash_update(&packet->src_ipaddr.ipaddr.ip4addr, - sizeof(packet->src_ipaddr.ipaddr.ip4addr), - hash); - hash = fr_hash_update(&packet->dst_ipaddr.ipaddr.ip4addr, - sizeof(packet->dst_ipaddr.ipaddr.ip4addr), - hash); - break; - case AF_INET6: - hash = fr_hash_update(&packet->src_ipaddr.ipaddr.ip6addr, - sizeof(packet->src_ipaddr.ipaddr.ip6addr), - hash); - hash = fr_hash_update(&packet->dst_ipaddr.ipaddr.ip6addr, - sizeof(packet->dst_ipaddr.ipaddr.ip6addr), - hash); - break; - default: - break; - } - - return fr_hash_update(&packet->id, sizeof(packet->id), hash); -} - - -/* - * Take the key fields of a reply packet, and convert it to a - * hash. - * - * i.e. take a reply packet, and find the hash of the request packet - * that asked for the reply. To do this, we hash the reverse fields - * of the request. e.g. where the request does (src, dst), we do - * (dst, src) - */ -uint32_t fr_reply_packet_hash(const RADIUS_PACKET *packet) -{ - uint32_t hash; - - hash = fr_hash(&packet->sockfd, sizeof(packet->sockfd)); - hash = fr_hash_update(&packet->id, sizeof(packet->id), hash); - hash = fr_hash_update(&packet->src_port, sizeof(packet->src_port), - hash); - hash = fr_hash_update(&packet->dst_port, - sizeof(packet->dst_port), hash); - hash = fr_hash_update(&packet->src_ipaddr.af, - sizeof(packet->src_ipaddr.af), hash); - - /* - * The caller ensures that src & dst AF are the same. - */ - switch (packet->src_ipaddr.af) { - case AF_INET: - hash = fr_hash_update(&packet->dst_ipaddr.ipaddr.ip4addr, - sizeof(packet->dst_ipaddr.ipaddr.ip4addr), - hash); - hash = fr_hash_update(&packet->src_ipaddr.ipaddr.ip4addr, - sizeof(packet->src_ipaddr.ipaddr.ip4addr), - hash); - break; - case AF_INET6: - hash = fr_hash_update(&packet->dst_ipaddr.ipaddr.ip6addr, - sizeof(packet->dst_ipaddr.ipaddr.ip6addr), - hash); - hash = fr_hash_update(&packet->src_ipaddr.ipaddr.ip6addr, - sizeof(packet->src_ipaddr.ipaddr.ip6addr), - hash); - break; - default: - break; - } - - return fr_hash_update(&packet->id, sizeof(packet->id), hash); -} - - /* * See if two packets are identical. *