Remove "hash" from RADIUS_PACKET
authorAlan T. DeKok <aland@freeradius.org>
Wed, 25 Jan 2012 10:53:29 +0000 (11:53 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 25 Jan 2012 10:53:29 +0000 (11:53 +0100)
It's no longer needed.  Various support functions are
also removed.

src/include/libradius.h
src/include/packet.h
src/lib/packet.c

index ea14111..4b5618b 100644 (file)
@@ -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;
index 74e2a33..e7b5bae 100644 (file)
@@ -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,
index ad68ce2..813360b 100644 (file)
@@ -32,102 +32,6 @@ RCSID("$Id$")
 #include <fcntl.h>
 
 /*
- *     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.
  *
  *     Note that we do NOT compare the authentication vectors.