]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
s/fr_radius_packet/fr_packet/g
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Mar 2024 20:12:07 +0000 (14:12 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Mar 2024 20:12:19 +0000 (14:12 -0600)
43 files changed:
src/bin/collectd.c
src/bin/dhcpclient.c
src/bin/radclient-ng.c
src/bin/radclient.c
src/bin/radclient.h
src/bin/radsniff.c
src/bin/radsniff.h
src/bin/radsnmp.c
src/bin/unit_test_module.c
src/lib/eap/chbind.c
src/lib/eap/chbind.h
src/lib/eap/compose.c
src/lib/io/worker.c
src/lib/server/pair_server_tests.c
src/lib/server/request.c
src/lib/server/tmpl_dcursor_tests.c
src/lib/util/packet.c
src/lib/util/packet.h
src/listen/radius/proto_radius.c
src/listen/radius/proto_radius_tcp.c
src/listen/radius/proto_radius_udp.c
src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c
src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.h
src/modules/rlm_eap/types/rlm_eap_peap/peap.c
src/modules/rlm_eap/types/rlm_eap_ttls/eap_ttls.h
src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c
src/modules/rlm_radius/rlm_radius.c
src/modules/rlm_radius/rlm_radius_udp.c
src/modules/rlm_stats/rlm_stats.c
src/process/radius/base.c
src/process/ttls/base.c
src/protocols/dhcpv4/dhcpv4.h
src/protocols/dhcpv4/packet.c
src/protocols/dhcpv4/raw.c
src/protocols/radius/base.c
src/protocols/radius/client.c
src/protocols/radius/decode.c
src/protocols/radius/defs.h
src/protocols/radius/list.c
src/protocols/radius/packet.c
src/protocols/radius/radius.h
src/protocols/radius/tcp.c
src/tests/util/radius1_test.c

index efab2bbc70ea91dddd519f632ce17f46d1fc1569..7a1e8fafb7b9389d5df435ffccbb0031e05fae3d 100644 (file)
@@ -238,7 +238,7 @@ error:
  *
  */
 rs_stats_tmpl_t *rs_stats_collectd_init_latency(TALLOC_CTX *ctx, rs_stats_tmpl_t **out, rs_t *conf,
-                                               char const *type, rs_latency_t *stats, fr_radius_packet_code_t code)
+                                               char const *type, rs_latency_t *stats, fr_packet_code_t code)
 {
        rs_stats_tmpl_t **tmpl = out, *last;
        char *p;
@@ -264,7 +264,7 @@ rs_stats_tmpl_t *rs_stats_collectd_init_latency(TALLOC_CTX *ctx, rs_stats_tmpl_t
        };
 
 #define INIT_STATS(_ti, _v) do {\
-               strlcpy(buffer, fr_radius_packet_names[code], sizeof(buffer)); \
+               strlcpy(buffer, fr_packet_names[code], sizeof(buffer)); \
                for (p = buffer; *p; ++p) *p = tolower((uint8_t) *p);\
                last = *tmpl = rs_stats_collectd_init(ctx, conf, type, _ti, buffer, stats, _v);\
                if (!*tmpl) {\
index 67708e855331ff3eadeda9f6615a6d718f71c6e3..a892c213f2664bd091a593f3dec5d7fdf8ba035a 100644 (file)
@@ -154,14 +154,14 @@ static int request_init(fr_packet_t **out, fr_pair_list_t *packet_vps, char cons
                fp = stdin;
        }
 
-       packet = fr_radius_packet_alloc(NULL, false);
+       packet = fr_packet_alloc(NULL, false);
 
        /*
         *      Read the VP's.
         */
        if (fr_pair_list_afrom_file(packet, dict_dhcpv4, packet_vps, fp, &filedone) < 0) {
                fr_perror("dhcpclient");
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                if (fp != stdin) fclose(fp);
                return -1;
        }
index 93b147c97314909e8605b2910a588625e56480a4..0f45bc414c105d56cbc4ad41685a76c83301840a 100644 (file)
@@ -273,7 +273,7 @@ static int getport(char const *name)
 /*
  *     Set a port from the request type if we don't already have one
  */
-static void radclient_get_port(fr_radius_packet_code_t type, uint16_t *port)
+static void radclient_get_port(fr_packet_code_t type, uint16_t *port)
 {
        switch (type) {
        default:
@@ -306,7 +306,7 @@ static void radclient_get_port(fr_radius_packet_code_t type, uint16_t *port)
 /*
  *     Resolve a port to a request type
  */
-static fr_radius_packet_code_t radclient_get_code(uint16_t port)
+static fr_packet_code_t radclient_get_code(uint16_t port)
 {
        /*
         *      getport returns 0 if the service doesn't exist
@@ -401,7 +401,7 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files)
                        goto error;
                }
 
-               request->packet = fr_radius_packet_alloc(request, true);
+               request->packet = fr_packet_alloc(request, true);
                if (!request->packet) {
                        ERROR("Out of memory");
                        goto error;
@@ -720,7 +720,7 @@ static void deallocate_id(rc_request_t *request)
         *      authentication vector.
         */
        if (request->packet->data) TALLOC_FREE(request->packet->data);
-       if (request->reply) fr_radius_packet_free(&request->reply);
+       if (request->reply) fr_packet_free(&request->reply);
 }
 
 /*
@@ -876,7 +876,7 @@ static int send_one_packet(rc_request_t *request)
                /*
                 *      Encode the packet.
                 */
-               if (fr_radius_packet_encode(request->packet, &request->request_pairs, NULL, secret) < 0) {
+               if (fr_packet_encode(request->packet, &request->request_pairs, NULL, secret) < 0) {
                        REDEBUG("Failed encoding packet for ID %d", request->packet->id);
                        deallocate_id(request);
                        request->done = true;
@@ -887,7 +887,7 @@ static int send_one_packet(rc_request_t *request)
                 *      Re-sign it, including updating the
                 *      Message-Authenticator.
                 */
-               if (fr_radius_packet_sign(request->packet, NULL, secret) < 0) {
+               if (fr_packet_sign(request->packet, NULL, secret) < 0) {
                        REDEBUG("Failed signing packet for ID %d", request->packet->id);
                        deallocate_id(request);
                        request->done = true;
@@ -955,7 +955,7 @@ static int recv_one_packet(fr_time_delta_t wait_time)
        if (!packet) {
                ERROR("Received reply to request we did not send. (id=%d socket %d)",
                      reply->id, reply->socket.fd);
-               fr_radius_packet_free(&reply);
+               fr_packet_free(&reply);
                return -1;      /* got reply to packet we didn't send */
        }
        request = packet->uctx;
@@ -964,7 +964,7 @@ static int recv_one_packet(fr_time_delta_t wait_time)
         *      Fails the signature validation: not a real reply.
         *      FIXME: Silently drop it and listen for another packet.
         */
-       if (fr_radius_packet_verify(reply, request->packet, secret) < 0) {
+       if (fr_packet_verify(reply, request->packet, secret) < 0) {
                REDEBUG("Reply verification failed");
                stats.lost++;
                goto packet_done; /* shared secret is incorrect */
@@ -1016,9 +1016,9 @@ static int recv_one_packet(fr_time_delta_t wait_time)
         *      packet matched that.
         */
        if ((request->filter_code != FR_RADIUS_CODE_UNDEFINED) && (request->reply->code != request->filter_code)) {
-               if (FR_RADIUS_PACKET_CODE_VALID(request->reply->code)) {
-                       REDEBUG("%s: Expected %s got %s", request->name, fr_radius_packet_names[request->filter_code],
-                               fr_radius_packet_names[request->reply->code]);
+               if (fr_packet_CODE_VALID(request->reply->code)) {
+                       REDEBUG("%s: Expected %s got %s", request->name, fr_packet_names[request->filter_code],
+                               fr_packet_names[request->reply->code]);
                } else {
                        REDEBUG("%s: Expected %u got %i", request->name, request->filter_code,
                                request->reply->code);
@@ -1048,8 +1048,8 @@ static int recv_one_packet(fr_time_delta_t wait_time)
        }
 
 packet_done:
-       fr_radius_packet_free(&request->reply);
-       fr_radius_packet_free(&reply);  /* may be NULL */
+       fr_packet_free(&request->reply);
+       fr_packet_free(&reply); /* may be NULL */
 
        return 0;
 }
index a44a82a653054eb9cf37d76c852d34a684f6800e..1823748764a5dad8f90e93589a0c296293baecd9 100644 (file)
@@ -290,7 +290,7 @@ static int getport(char const *name)
 /*
  *     Set a port from the request type if we don't already have one
  */
-static void radclient_get_port(fr_radius_packet_code_t type, uint16_t *port)
+static void radclient_get_port(fr_packet_code_t type, uint16_t *port)
 {
        switch (type) {
        default:
@@ -323,7 +323,7 @@ static void radclient_get_port(fr_radius_packet_code_t type, uint16_t *port)
 /*
  *     Resolve a port to a request type
  */
-static fr_radius_packet_code_t radclient_get_code(uint16_t port)
+static fr_packet_code_t radclient_get_code(uint16_t port)
 {
        /*
         *      getport returns 0 if the service doesn't exist
@@ -383,7 +383,7 @@ static int coa_init(rc_request_t *parent, FILE *coa_reply, char const *reply_fil
                return -1;
        }
 
-       request->reply = fr_radius_packet_alloc(request, false);
+       request->reply = fr_packet_alloc(request, false);
        if (!request->reply) {
 
                ERROR("Out of memory");
@@ -533,7 +533,7 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files)
                        goto error;
                }
 
-               request->packet = fr_radius_packet_alloc(request, true);
+               request->packet = fr_packet_alloc(request, true);
                if (!request->packet) {
                        ERROR("Out of memory");
                        goto error;
@@ -928,7 +928,7 @@ static void deallocate_id(rc_request_t *request)
         *      authentication vector.
         */
        if (request->packet->data) TALLOC_FREE(request->packet->data);
-       if (request->reply) fr_radius_packet_free(&request->reply);
+       if (request->reply) fr_packet_free(&request->reply);
 }
 
 /*
@@ -1111,7 +1111,7 @@ static int send_one_packet(rc_request_t *request)
        /*
         *      Send the packet.
         */
-       if (fr_radius_packet_send(request->packet, &request->request_pairs, NULL, secret) < 0) {
+       if (fr_packet_send(request->packet, &request->request_pairs, NULL, secret) < 0) {
                REDEBUG("Failed to send packet for ID %d", request->packet->id);
                deallocate_id(request);
                request->done = true;
@@ -1151,7 +1151,7 @@ static int recv_coa_packet(fr_time_delta_t wait_time)
        /*
         *      Read a packet from a network.
         */
-       packet = fr_radius_packet_recv(NULL, coafd, 0, 200, false);
+       packet = fr_packet_recv(NULL, coafd, 0, 200, false);
        if (!packet) {
                DEBUG("Failed reading CoA packet");
                return 0;
@@ -1160,7 +1160,7 @@ static int recv_coa_packet(fr_time_delta_t wait_time)
        /*
         *      Fails the signature validation: not a real reply.
         */
-       if (fr_radius_packet_verify(packet, NULL, secret) < 0) {
+       if (fr_packet_verify(packet, NULL, secret) < 0) {
                DEBUG("CoA verification failed");
                return 0;
        }
@@ -1197,9 +1197,9 @@ static int recv_coa_packet(fr_time_delta_t wait_time)
         *      packet matched that.
         */
        if (request->reply->code != request->filter_code) {
-               if (FR_RADIUS_PACKET_CODE_VALID(request->reply->code)) {
-                       REDEBUG("%s: Expected %s got %s", request->name, fr_radius_packet_names[request->filter_code],
-                               fr_radius_packet_names[request->reply->code]);
+               if (fr_packet_CODE_VALID(request->reply->code)) {
+                       REDEBUG("%s: Expected %s got %s", request->name, fr_packet_names[request->filter_code],
+                               fr_packet_names[request->reply->code]);
                } else {
                        REDEBUG("%s: Expected %u got %i", request->name, request->filter_code,
                                request->reply->code);
@@ -1249,7 +1249,7 @@ static int recv_coa_packet(fr_time_delta_t wait_time)
        /*
         *      Send reply.
         */
-       if (fr_radius_packet_send(request->reply, &request->reply_pairs, packet, secret) < 0) {
+       if (fr_packet_send(request->reply, &request->reply_pairs, packet, secret) < 0) {
                REDEBUG("Failed sending CoA reply");
                return 0;
        }
@@ -1332,7 +1332,7 @@ static int recv_one_packet(fr_time_delta_t wait_time)
        if (!packet) {
                ERROR("Received reply to request we did not send. (id=%d socket %d)",
                      reply->id, reply->socket.fd);
-               fr_radius_packet_free(&reply);
+               fr_packet_free(&reply);
                return -1;      /* got reply to packet we didn't send */
        }
        request = packet->uctx;
@@ -1341,7 +1341,7 @@ static int recv_one_packet(fr_time_delta_t wait_time)
         *      Fails the signature validation: not a real reply.
         *      FIXME: Silently drop it and listen for another packet.
         */
-       if (fr_radius_packet_verify(reply, request->packet, secret) < 0) {
+       if (fr_packet_verify(reply, request->packet, secret) < 0) {
                REDEBUG("Reply verification failed");
                stats.lost++;
                goto packet_done; /* shared secret is incorrect */
@@ -1393,9 +1393,9 @@ static int recv_one_packet(fr_time_delta_t wait_time)
         *      packet matched that.
         */
        if ((request->filter_code != FR_RADIUS_CODE_UNDEFINED) && (request->reply->code != request->filter_code)) {
-               if (FR_RADIUS_PACKET_CODE_VALID(request->reply->code)) {
-                       REDEBUG("%s: Expected %s got %s", request->name, fr_radius_packet_names[request->filter_code],
-                               fr_radius_packet_names[request->reply->code]);
+               if (fr_packet_CODE_VALID(request->reply->code)) {
+                       REDEBUG("%s: Expected %s got %s", request->name, fr_packet_names[request->filter_code],
+                               fr_packet_names[request->reply->code]);
                } else {
                        REDEBUG("%s: Expected %u got %i", request->name, request->filter_code,
                                request->reply->code);
@@ -1425,8 +1425,8 @@ static int recv_one_packet(fr_time_delta_t wait_time)
        }
 
 packet_done:
-       fr_radius_packet_free(&request->reply);
-       fr_radius_packet_free(&reply);  /* may be NULL */
+       fr_packet_free(&request->reply);
+       fr_packet_free(&reply); /* may be NULL */
 
        return 0;
 }
index e163f780e1ff80a8c78a656abde2207992b45530..e587c957e06817721131f2ca042479aaca19bd78 100644 (file)
@@ -92,7 +92,7 @@ struct rc_request {
        fr_pair_list_t          reply_pairs;
 
        fr_pair_list_t          filter;         //!< If the reply passes the filter, then the request passes.
-       fr_radius_packet_code_t filter_code;    //!< Expected code of the response packet.
+       fr_packet_code_t        filter_code;    //!< Expected code of the response packet.
 
        int                     resend;
        int                     tries;
index a01b63995eafbff0f092b1fb1548c104188b58a3..54a4eb21e9df165fa761bab8b92709d7c76412a7 100644 (file)
@@ -336,9 +336,9 @@ static void rs_packet_print_csv(uint64_t count, rs_status_t status, fr_pcap_t *h
        }
 
        /* Status, Type, Interface, Src, Src port, Dst, Dst port, ID */
-       if (FR_RADIUS_PACKET_CODE_VALID(packet->code)) {
+       if (fr_packet_CODE_VALID(packet->code)) {
                if (fr_sbuff_in_sprintf(&sbuff, "%s,%s,%s,%i,%s,%i,%i,",
-                                       fr_radius_packet_names[packet->code], handle->name,
+                                       fr_packet_names[packet->code], handle->name,
                                        src, packet->socket.inet.src_port, dst, packet->socket.inet.dst_port, packet->id) < 0) return;
        } else {
                if (fr_sbuff_in_sprintf(&sbuff, "%u,%s,%s,%i,%s,%i,%i,", packet->code, handle->name,
@@ -409,9 +409,9 @@ static void rs_packet_print_fancy(uint64_t count, rs_status_t status, fr_pcap_t
                if (s <= 0) return;
        }
 
-       if (FR_RADIUS_PACKET_CODE_VALID(packet->code)) {
+       if (fr_packet_CODE_VALID(packet->code)) {
                len = snprintf(p, s, "%s Id %i %s:%s:%d %s %s:%i ",
-                              fr_radius_packet_names[packet->code],
+                              fr_packet_names[packet->code],
                               packet->id,
                               handle->name,
                               response ? dst : src,
@@ -459,7 +459,7 @@ static void rs_packet_print_fancy(uint64_t count, rs_status_t status, fr_pcap_t
                 *      Print out verbose HEX output
                 */
                if (conf->print_packet && (fr_debug_lvl >= L_DBG_LVL_4)) {
-                       fr_radius_packet_log_hex(&default_log, packet);
+                       fr_packet_log_hex(&default_log, packet);
                }
 
                if (conf->print_packet && (fr_debug_lvl >= L_DBG_LVL_2)) {
@@ -633,7 +633,7 @@ static void rs_stats_process_counters(rs_latency_t *stats)
        }
 }
 
-static void rs_stats_print_code_fancy(rs_latency_t *stats, fr_radius_packet_code_t code)
+static void rs_stats_print_code_fancy(rs_latency_t *stats, fr_packet_code_t code)
 {
        int i;
        bool have_rt = false;
@@ -643,7 +643,7 @@ static void rs_stats_print_code_fancy(rs_latency_t *stats, fr_radius_packet_code
        if (!stats->interval.received && !have_rt && !stats->interval.reused) return;
 
        if (stats->interval.received || stats->interval.linked) {
-               INFO("%s counters:", fr_radius_packet_names[code]);
+               INFO("%s counters:", fr_packet_names[code]);
                if (stats->interval.received > 0) {
                        INFO("\tTotal     : %.3lf/s" , stats->interval.received);
                }
@@ -652,7 +652,7 @@ static void rs_stats_print_code_fancy(rs_latency_t *stats, fr_radius_packet_code
        if (stats->interval.linked > 0) {
                INFO("\tLinked    : %.3lf/s", stats->interval.linked);
                INFO("\tUnlinked  : %.3lf/s", stats->interval.unlinked);
-               INFO("%s latency:", fr_radius_packet_names[code]);
+               INFO("%s latency:", fr_packet_names[code]);
                INFO("\tHigh      : %.3lfms", stats->interval.latency_high);
                INFO("\tLow       : %.3lfms", stats->interval.latency_low);
                INFO("\tAverage   : %.3lfms", stats->interval.latency_average);
@@ -660,7 +660,7 @@ static void rs_stats_print_code_fancy(rs_latency_t *stats, fr_radius_packet_code
        }
 
        if (have_rt || stats->interval.lost || stats->interval.reused) {
-               INFO("%s retransmits & loss:", fr_radius_packet_names[code]);
+               INFO("%s retransmits & loss:", fr_packet_names[code]);
 
                if (stats->interval.lost)       INFO("\tLost      : %.3lf/s", stats->interval.lost);
                if (stats->interval.reused)     INFO("\tID Reused : %.3lf/s", stats->interval.reused);
@@ -738,7 +738,7 @@ static void rs_stats_print_csv_header(rs_update_t *this)
        }
 
        for (i = 0; i < rs_codes_len; i++) {
-               char const *name = fr_radius_packet_names[rs_useful_codes[i]];
+               char const *name = fr_packet_names[rs_useful_codes[i]];
 
                fprintf(stdout,
                        ",\"%s received/s\""
@@ -1052,9 +1052,9 @@ static int _request_free(rs_request_t *request)
                }
        }
 
-       fr_radius_packet_free(&request->packet);
-       fr_radius_packet_free(&request->expect);
-       fr_radius_packet_free(&request->linked);
+       fr_packet_free(&request->packet);
+       fr_packet_free(&request->expect);
+       fr_packet_free(&request->linked);
 
        return 0;
 }
@@ -1391,7 +1391,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
         *      recover once some requests timeout, so make an effort to deal
         *      with allocation failures gracefully.
         */
-       packet = fr_radius_packet_alloc(conf, false);
+       packet = fr_packet_alloc(conf, false);
        if (!packet) {
                REDEBUG("Failed allocating memory to hold decoded packet");
                rs_tv_add_ms(&header->ts, conf->stats.timeout, &stats->quiet);
@@ -1426,13 +1426,13 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
        packet->socket.inet.src_port = ntohs(udp->src);
        packet->socket.inet.dst_port = ntohs(udp->dst);
 
-       if (!fr_radius_packet_ok(packet, RADIUS_MAX_ATTRIBUTES, false, &reason)) {
+       if (!fr_packet_ok(packet, RADIUS_MAX_ATTRIBUTES, false, &reason)) {
                fr_perror("radsniff");
                if (conf->event_flags & RS_ERROR) {
                        rs_packet_print(NULL, count, RS_ERROR, event->in,
                                        packet, &decoded, &elapsed, NULL, false, false);
                }
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
 
                return;
        }
@@ -1458,7 +1458,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                if (conf->filter_response_code && (conf->filter_response_code != packet->code)) {
                drop_response:
                        RDEBUG2("Response dropped by filter");
-                       fr_radius_packet_free(&packet);
+                       fr_packet_free(&packet);
 
                        /* We now need to cleanup the original request too */
                        if (original) {
@@ -1472,24 +1472,24 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                        FILE *log_fp = fr_log_fp;
 
                        fr_log_fp = NULL;
-                       ret = fr_radius_packet_verify(packet, original->expect, conf->radius_secret);
+                       ret = fr_packet_verify(packet, original->expect, conf->radius_secret);
                        fr_log_fp = log_fp;
                        if (ret != 0) {
                                fr_perror("Failed verifying packet ID %d", packet->id);
-                               fr_radius_packet_free(&packet);
+                               fr_packet_free(&packet);
                                return;
                        }
                }
 
                /*
                 *      Only decode attributes if we want to print them or filter on them
-                *      fr_radius_packet_ok( does checks to verify the packet is actually valid.
+                *      fr_packet_ok( does checks to verify the packet is actually valid.
                 */
                if (conf->decode_attrs) {
                        int ret;
 
 #ifndef NDEBUG
-                       if (fr_debug_lvl >= L_DBG_LVL_4) fr_radius_packet_log_hex(&default_log, packet);
+                       if (fr_debug_lvl >= L_DBG_LVL_4) fr_packet_log_hex(&default_log, packet);
 #endif
 
                        ret = fr_radius_decode_simple(packet, &decoded,
@@ -1498,7 +1498,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                                                        original->expect->data + 4 : zeros,
                                                      conf->radius_secret);
                        if (ret < 0) {
-                               fr_radius_packet_free(&packet);         /* Also frees vps */
+                               fr_packet_free(&packet);                /* Also frees vps */
                                REDEBUG("Failed decoding");
                                return;
                        }
@@ -1529,7 +1529,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                                 *      Explicitly free VPs first so list maintains integrity - it is reused below
                                 */
                                fr_pair_list_free(&original->link_vps);
-                               fr_radius_packet_free(&original->linked);
+                               fr_packet_free(&original->linked);
                                fr_event_timer_delete(&original->event);
                        /*
                         *      ...nope it's the first response to a request.
@@ -1566,7 +1566,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                         *      complexity, reduces max capture rate, and is generally a PITA.
                         */
                        if (conf->filter_request) {
-                               fr_radius_packet_free(&packet);
+                               fr_packet_free(&packet);
                                RDEBUG2("Original request dropped by filter");
                                return;
                        }
@@ -1593,7 +1593,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                        drop_request:
 
                        RDEBUG2("Request dropped by filter");
-                       fr_radius_packet_free(&packet);
+                       fr_packet_free(&packet);
 
                        return;
                }
@@ -1608,11 +1608,11 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                                FILE *log_fp = fr_log_fp;
 
                                fr_log_fp = NULL;
-                               ret = fr_radius_packet_verify(packet, NULL, conf->radius_secret);
+                               ret = fr_packet_verify(packet, NULL, conf->radius_secret);
                                fr_log_fp = log_fp;
                                if (ret != 0) {
                                        fr_perror("Failed verifying packet ID %d", packet->id);
-                                       fr_radius_packet_free(&packet);
+                                       fr_packet_free(&packet);
                                        return;
                                }
                        }
@@ -1625,7 +1625,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
 
                /*
                 *      Only decode attributes if we want to print them or filter on them
-                *      fr_radius_packet_ok( does checks to verify the packet is actually valid.
+                *      fr_packet_ok( does checks to verify the packet is actually valid.
                 */
                if (conf->decode_attrs) {
                        int ret;
@@ -1638,7 +1638,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                        fr_log_fp = log_fp;
 
                        if (ret < 0) {
-                               fr_radius_packet_free(&packet); /* Also frees vps */
+                               fr_packet_free(&packet);        /* Also frees vps */
 
                                REDEBUG("Failed decoding");
                                return;
@@ -1650,11 +1650,11 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                /*
                 *      Save the request for later matching
                 */
-               search.expect = fr_radius_packet_alloc_reply(packet, packet);
+               search.expect = fr_packet_alloc_reply(packet, packet);
                if (!search.expect) {
                        REDEBUG("Failed allocating memory to hold expected reply");
                        rs_tv_add_ms(&header->ts, conf->stats.timeout, &stats->quiet);
-                       fr_radius_packet_free(&packet);
+                       fr_packet_free(&packet);
 
                        return;
                }
@@ -1667,7 +1667,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
                                           conf->link_da_num);
                        if (ret < 0) {
                                ERROR("Failed extracting RTX linking pairs from request");
-                               fr_radius_packet_free(&packet);
+                               fr_packet_free(&packet);
                                return;
                        }
                }
@@ -1733,11 +1733,11 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
 
                        /* We may of seen the response, but it may of been lost upstream */
                        fr_pair_list_free(&original->link_vps);
-                       fr_radius_packet_free(&original->linked);
+                       fr_packet_free(&original->linked);
 
                        /* replace packet and vps */
                        fr_pair_list_free(&original->packet_vps);
-                       fr_radius_packet_free(&original->packet);
+                       fr_packet_free(&original->packet);
                        original->packet = talloc_steal(original, packet);
                        fr_pair_list_append(&original->packet_vps, &decoded);
 
@@ -1748,7 +1748,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
 
                        /* replace expected packets and vps */
                        fr_pair_list_free(&original->expect_vps);
-                       fr_radius_packet_free(&original->expect);
+                       fr_packet_free(&original->expect);
                        original->expect = talloc_steal(original, search.expect);
                        fr_pair_list_append(&original->expect_vps, &search.expect_vps);
 
@@ -1828,7 +1828,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
 
        default:
                REDEBUG("Unsupported code %i", packet->code);
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
 
                return;
        }
@@ -1911,7 +1911,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
         *      not be done by the event queue.
         */
        if (response && !original) {
-               fr_radius_packet_free(&packet); /* Also frees decoded */
+               fr_packet_free(&packet);        /* Also frees decoded */
        }
 
        captured++;
@@ -2894,7 +2894,7 @@ int main(int argc, char *argv[])
                        DEBUG2("  RADIUS secret           : [%s]", conf->radius_secret);
 
                if (conf->filter_request_code) {
-                       DEBUG2("  RADIUS request code     : [%s]", fr_radius_packet_names[conf->filter_request_code]);
+                       DEBUG2("  RADIUS request code     : [%s]", fr_packet_names[conf->filter_request_code]);
                }
 
                if (!fr_pair_list_empty(&conf->filter_request_vps)){
@@ -2903,7 +2903,7 @@ int main(int argc, char *argv[])
                }
 
                if (conf->filter_response_code) {
-                       DEBUG2("  RADIUS response code    : [%s]", fr_radius_packet_names[conf->filter_response_code]);
+                       DEBUG2("  RADIUS response code    : [%s]", fr_packet_names[conf->filter_response_code]);
                }
 
                if (conf->to_output_dir) {
index 10c2de3c134cbcb676f0c24bcb98032b29ee09e7..17d2373a919a1da3e56484daa905476c12aa3edb 100644 (file)
@@ -296,8 +296,8 @@ struct rs {
 
        fr_pair_list_t          filter_request_vps;     //!< Sorted filter vps.
        fr_pair_list_t          filter_response_vps;    //!< Sorted filter vps.
-       fr_radius_packet_code_t                 filter_request_code;    //!< Filter request packets by code.
-       fr_radius_packet_code_t                 filter_response_code;   //!< Filter response packets by code.
+       fr_packet_code_t                        filter_request_code;    //!< Filter request packets by code.
+       fr_packet_code_t                        filter_response_code;   //!< Filter response packets by code.
 
        rs_status_t             event_flags;            //!< Events we log and capture on.
        rs_packet_logger_t      logger;                 //!< Packet logger
@@ -352,7 +352,7 @@ struct rs_stats_tmpl
  *     collectd.c - Registration and processing functions
  */
 rs_stats_tmpl_t *rs_stats_collectd_init_latency(TALLOC_CTX *ctx, rs_stats_tmpl_t **out, rs_t *conf,
-                                               char const *type, rs_latency_t *stats, fr_radius_packet_code_t code);
+                                               char const *type, rs_latency_t *stats, fr_packet_code_t code);
 void rs_stats_collectd_do_stats(rs_t *conf, rs_stats_tmpl_t *tmpls, struct timeval *now);
 int rs_stats_collectd_open(rs_t *conf);
 int rs_stats_collectd_close(rs_t *conf);
index a6736f10cf124ed7cba6b00d33ccc9f6084fff07..a9d40a5e2fc67fc5b98b2a7c1eb069fad4613979 100644 (file)
@@ -166,7 +166,7 @@ static fr_packet_t *radsnmp_alloc(radsnmp_conf_t *conf, int fd)
 {
        fr_packet_t *packet;
 
-       packet = fr_radius_packet_alloc(conf, true);
+       packet = fr_packet_alloc(conf, true);
 
        packet->code = conf->code;
 
@@ -797,7 +797,7 @@ do { \
                         *      next call.
                         */
                        for (i = 0; i < conf->retries; i++) {
-                               rcode = fr_radius_packet_send(packet, &request_vps, NULL, conf->secret);
+                               rcode = fr_packet_send(packet, &request_vps, NULL, conf->secret);
                                if (rcode < 0) {
                                        ERROR("Failed sending: %s", fr_syserror(errno));
                                        return EXIT_FAILURE;
@@ -814,7 +814,7 @@ do { \
                                        continue;       /* Timeout */
 
                                case 1:
-                                       reply = fr_radius_packet_recv(packet, packet->socket.fd, UDP_FLAGS_NONE,
+                                       reply = fr_packet_recv(packet, packet->socket.fd, UDP_FLAGS_NONE,
                                                                      RADIUS_MAX_ATTRIBUTES, false);
                                        if (!reply) {
                                                fr_perror("Failed receiving reply");
index 759e0d272ffbfee8ba12443a348200e5c1929dd3..99c4c92aff9b73f92c21f487332f5e9cfb9df236 100644 (file)
@@ -137,8 +137,8 @@ static request_t *request_from_internal(TALLOC_CTX *ctx)
         *      Create and initialize the new request.
         */
        request = request_alloc_internal(ctx, NULL);
-       if (!request->packet) request->packet = fr_radius_packet_alloc(request, false);
-       if (!request->reply) request->reply = fr_radius_packet_alloc(request, false);
+       if (!request->packet) request->packet = fr_packet_alloc(request, false);
+       if (!request->reply) request->reply = fr_packet_alloc(request, false);
 
        request->packet->socket = (fr_socket_t){
                .type = SOCK_DGRAM,
@@ -209,14 +209,14 @@ static request_t *request_from_file(TALLOC_CTX *ctx, FILE *fp, fr_client_t *clie
                return NULL;
        }
 
-       request->packet = fr_radius_packet_alloc(request, false);
+       request->packet = fr_packet_alloc(request, false);
        if (!request->packet) {
                fr_strerror_const("No memory");
                goto error;
        }
        request->packet->timestamp = fr_time();
 
-       request->reply = fr_radius_packet_alloc(request, false);
+       request->reply = fr_packet_alloc(request, false);
        if (!request->reply) {
                fr_strerror_const("No memory");
                goto error;
@@ -612,8 +612,8 @@ static request_t *request_clone(request_t *old, int number, CONF_SECTION *server
        request = request_alloc_internal(NULL, NULL);
        if (!request) return NULL;
 
-       if (!request->packet) request->packet = fr_radius_packet_alloc(request, false);
-       if (!request->reply) request->reply = fr_radius_packet_alloc(request, false);
+       if (!request->packet) request->packet = fr_packet_alloc(request, false);
+       if (!request->reply) request->reply = fr_packet_alloc(request, false);
 
        memcpy(request->packet, old->packet, sizeof(*request->packet));
        (void) fr_pair_list_copy(request->request_ctx, &request->request_pairs, &old->request_pairs);
index e4231463aca4b232480625e0e073d726aac6ac27..f5cd6351a37efd1cbce0d0765c32bf856473b561 100644 (file)
@@ -168,9 +168,9 @@ static size_t chbind_get_data(chbind_packet_t const *packet,
 }
 
 
-fr_radius_packet_code_t chbind_process(request_t *request, CHBIND_REQ *chbind)
+fr_packet_code_t chbind_process(request_t *request, CHBIND_REQ *chbind)
 {
-       fr_radius_packet_code_t         code;
+       fr_packet_code_t                code;
        rlm_rcode_t     rcode;
        request_t       *fake = NULL;
        uint8_t const   *attr_data;
index adc6a9f506a45e036188490dc730001f7b40a226..e3b792c2c9272a04a9b4d7dbb970c6d475a4da0a 100644 (file)
@@ -57,7 +57,7 @@ typedef struct {
 #define CHBIND_CODE_FAILURE             3
 
 /* Channel binding function prototypes */
-fr_radius_packet_code_t chbind_process(request_t *request, CHBIND_REQ *chbind_req);
+fr_packet_code_t chbind_process(request_t *request, CHBIND_REQ *chbind_req);
 
 fr_pair_t *eap_chbind_packet2vp(TALLOC_CTX *ctx, chbind_packet_t *chbind);
 chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, fr_pair_list_t *vps);
index f64e85802886c8e29ab5c6a1438ded26f38ccba9..032eff53ce83ae0d66ac6dd33ec4e57e1224a133 100644 (file)
@@ -312,7 +312,7 @@ rlm_rcode_t eap_start(request_t *request, rlm_eap_method_t const methods[], bool
        /*
         *      http://www.freeradius.org/rfc/rfc2869.html#EAP-Message
         *
-        *      Checks for Message-Authenticator are handled by fr_radius_packet_recv().
+        *      Checks for Message-Authenticator are handled by fr_packet_recv().
         */
 
        /*
index 5c5590ae3b8bcc00132f78283f8c779d6e39fda9..2af781c8444d0eb6e9d60b45d29847af9a6ec449 100644 (file)
@@ -779,8 +779,8 @@ void worker_request_init(fr_worker_t *worker, request_t *request, fr_time_t now)
         *      For internal requests request->packet
         *      and request->reply are already populated.
         */
-       if (!request->packet) MEM(request->packet = fr_radius_packet_alloc(request, false));
-       if (!request->reply) MEM(request->reply = fr_radius_packet_alloc(request, false));
+       if (!request->packet) MEM(request->packet = fr_packet_alloc(request, false));
+       if (!request->reply) MEM(request->reply = fr_packet_alloc(request, false));
 
        request->packet->timestamp = now;
        request->async = talloc_zero(request, fr_async_t);
index 07f28ec9fd853acb690108e7c4bc3949304a2eef..1f5c8729ec459bf970b2f3b076374391715add5d 100644 (file)
@@ -88,10 +88,10 @@ static request_t *request_fake_alloc(void)
         */
        request = request_local_alloc_external(autofree, NULL);
 
-       request->packet = fr_radius_packet_alloc(request, false);
+       request->packet = fr_packet_alloc(request, false);
        TEST_CHECK(request->packet != NULL);
 
-       request->reply = fr_radius_packet_alloc(request, false);
+       request->reply = fr_packet_alloc(request, false);
        TEST_CHECK(request->reply != NULL);
 
        return request;
index 0dd20048c154a164c82d7ee6c369568be4e0d4cf..000d8995437388b82961a2ce7bcb237fe6c1d786 100644 (file)
@@ -209,13 +209,13 @@ static inline CC_HINT(always_inline) int request_child_init(request_t *child, re
         *
         *      FIXME: Permit different servers for inner && outer sessions?
         */
-       child->packet = fr_radius_packet_alloc(child, true);
+       child->packet = fr_packet_alloc(child, true);
        if (!child->packet) {
                talloc_free(child);
                return -1;
        }
 
-       child->reply = fr_radius_packet_alloc(child, false);
+       child->reply = fr_packet_alloc(child, false);
        if (!child->reply) {
                talloc_free(child);
                return -1;
index 7018c56d7dfc7941592090d1f8adc7864a445b50..1dcc5f7ffc5e1219ff5a2fb44ae0240dc2c570c4 100644 (file)
@@ -50,10 +50,10 @@ static request_t *request_fake_alloc(void)
         */
        request = request_local_alloc_external(autofree, NULL);
 
-       request->packet = fr_radius_packet_alloc(request, false);
+       request->packet = fr_packet_alloc(request, false);
        TEST_CHECK(request->packet != NULL);
 
-       request->reply = fr_radius_packet_alloc(request, false);
+       request->reply = fr_packet_alloc(request, false);
        TEST_CHECK(request->reply != NULL);
 
        return request;
index 510b8a049792ec51129a9145aceebbfc73f230af..62da5ac014009284fdc84801e84423fcd33e8319 100644 (file)
@@ -35,7 +35,7 @@ RCSID("$Id$")
  *     - New fr_packet_t.
  *     - NULL on error.
  */
-fr_packet_t *fr_radius_packet_alloc(TALLOC_CTX *ctx, bool new_vector)
+fr_packet_t *fr_packet_alloc(TALLOC_CTX *ctx, bool new_vector)
 {
        fr_packet_t     *rp;
 
@@ -60,13 +60,13 @@ fr_packet_t *fr_radius_packet_alloc(TALLOC_CTX *ctx, bool new_vector)
  *     - New fr_packet_t.
  *     - NULL on error.
  */
-fr_packet_t *fr_radius_packet_alloc_reply(TALLOC_CTX *ctx, fr_packet_t *packet)
+fr_packet_t *fr_packet_alloc_reply(TALLOC_CTX *ctx, fr_packet_t *packet)
 {
        fr_packet_t *reply;
 
        if (!packet) return NULL;
 
-       reply = fr_radius_packet_alloc(ctx, false);
+       reply = fr_packet_alloc(ctx, false);
        if (!reply) return NULL;
 
        /*
@@ -86,7 +86,7 @@ fr_packet_t *fr_radius_packet_alloc_reply(TALLOC_CTX *ctx, fr_packet_t *packet)
 /** Free a fr_packet_t
  *
  */
-void fr_radius_packet_free(fr_packet_t **packet_p)
+void fr_packet_free(fr_packet_t **packet_p)
 {
        fr_packet_t *packet;
 
index f579a21d3f9b5da7317eb46e8e63e3ea8ad22dac..072759f79443eb812d98c2797b66874cb48e5097 100644 (file)
@@ -47,7 +47,7 @@ extern "C" {
 /*
  *     vector:         Request authenticator from access-request packet
  *                     Put in there by rad_decode, and must be put in the
- *                     response fr_packet_t as well before calling fr_radius_packet_send
+ *                     response fr_packet_t as well before calling fr_packet_send
  *
  *     verified:       Filled in by rad_decode for accounting-request packets
  *
@@ -76,9 +76,9 @@ typedef struct {
        void                    *uctx;
 } fr_packet_t;
 
-fr_packet_t    *fr_radius_packet_alloc(TALLOC_CTX *ctx, bool new_vector);
-fr_packet_t    *fr_radius_packet_alloc_reply(TALLOC_CTX *ctx, fr_packet_t *);
-void           fr_radius_packet_free(fr_packet_t **);
+fr_packet_t    *fr_packet_alloc(TALLOC_CTX *ctx, bool new_vector);
+fr_packet_t    *fr_packet_alloc_reply(TALLOC_CTX *ctx, fr_packet_t *);
+void           fr_packet_free(fr_packet_t **);
 
 #ifdef __cplusplus
 }
index b58b84f73ac7947ca06a1b4ef0640b768aa268ba..a3a4de6d7bdce69cc462378e240e67b74b6ee953 100644 (file)
@@ -413,7 +413,7 @@ static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8
 
        if (RDEBUG_ENABLED) {
                RDEBUG("Sending %s ID %i from %pV:%i to %pV:%i length %zu via socket %s",
-                      fr_radius_packet_names[request->reply->code],
+                      fr_packet_names[request->reply->code],
                       request->reply->id,
                       fr_box_ipaddr(request->reply->socket.inet.src_ipaddr),
                       request->reply->socket.inet.src_port,
index 48635a5dfff6b173e2526e97282453beba8aa8c4..4ae95a59e67754f65c6df839d6d3e945bbe4d8a8 100644 (file)
@@ -229,7 +229,7 @@ have_packet:
         *      Print out what we received.
         */
        DEBUG2("proto_radius_tcp - Received %s ID %d length %d %s",
-              fr_radius_packet_names[buffer[0]], buffer[1],
+              fr_packet_names[buffer[0]], buffer[1],
               (int) packet_len, thread->name);
 
        return packet_len;
index 870654d43e61eb564efc73c630ec06e3350107c0..b0b9ac834095a65a83c5ff4a8ee9ec78fb7a944c 100644 (file)
@@ -190,7 +190,7 @@ static ssize_t mod_read(fr_listen_t *li, void **packet_ctx, fr_time_t *recv_time
         *      Print out what we received.
         */
        DEBUG2("proto_radius_udp - Received %s ID %d length %d %s",
-              fr_radius_packet_names[buffer[0]], buffer[1],
+              fr_packet_names[buffer[0]], buffer[1],
               (int) packet_len, thread->name);
 
        return packet_len;
index 049ef12bf1d51c0c05155e5c231e0bd659613a12..e359c0860c735abc55327eaf3635366fa52e0aae 100644 (file)
@@ -124,7 +124,7 @@ static void eap_fast_send_error(fr_tls_session_t *tls_session, int error)
        eap_fast_tlv_append(tls_session, attr_eap_fast_error, true, sizeof(value), &value);
 }
 
-static void eap_fast_append_result(fr_tls_session_t *tls_session, fr_radius_packet_code_t code)
+static void eap_fast_append_result(fr_tls_session_t *tls_session, fr_packet_code_t code)
 {
        eap_fast_tunnel_t       *t = talloc_get_type_abort(tls_session->opaque, eap_fast_tunnel_t);
        uint16_t                state;
@@ -567,10 +567,10 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(UNUSED eap_session_t *eap_sess
        return rcode;
 }
 
-static fr_radius_packet_code_t eap_fast_eap_payload(request_t *request, eap_session_t *eap_session,
+static fr_packet_code_t eap_fast_eap_payload(request_t *request, eap_session_t *eap_session,
                                    fr_tls_session_t *tls_session, fr_pair_t *tlv_eap_payload)
 {
-       fr_radius_packet_code_t                 code = FR_RADIUS_CODE_ACCESS_REJECT;
+       fr_packet_code_t                        code = FR_RADIUS_CODE_ACCESS_REJECT;
        rlm_rcode_t             rcode;
        fr_pair_t               *vp;
        eap_fast_tunnel_t       *t;
@@ -703,7 +703,7 @@ static fr_radius_packet_code_t eap_fast_eap_payload(request_t *request, eap_sess
                        request->proxy->packet->src_port = 0;
                        request->proxy->packet->dst_port = 0;
                        fake->packet = NULL;
-                       fr_radius_packet_free(&fake->reply);
+                       fr_packet_free(&fake->reply);
                        fake->reply = NULL;
 
                        /*
@@ -774,7 +774,7 @@ static fr_radius_packet_code_t eap_fast_eap_payload(request_t *request, eap_sess
        return code;
 }
 
-static fr_radius_packet_code_t eap_fast_crypto_binding(request_t *request, UNUSED eap_session_t *eap_session,
+static fr_packet_code_t eap_fast_crypto_binding(request_t *request, UNUSED eap_session_t *eap_session,
                                       fr_tls_session_t *tls_session, eap_tlv_crypto_binding_tlv_t *binding)
 {
        uint8_t                 cmac[sizeof(binding->compound_mac)];
@@ -797,7 +797,7 @@ static fr_radius_packet_code_t eap_fast_crypto_binding(request_t *request, UNUSE
        return FR_RADIUS_CODE_ACCESS_ACCEPT;
 }
 
-static fr_radius_packet_code_t eap_fast_process_tlvs(request_t *request, eap_session_t *eap_session,
+static fr_packet_code_t eap_fast_process_tlvs(request_t *request, eap_session_t *eap_session,
                                     fr_tls_session_t *tls_session, fr_pair_list_t *fast_vps)
 {
        eap_fast_tunnel_t               *t = talloc_get_type_abort(tls_session->opaque, eap_fast_tunnel_t);
@@ -809,7 +809,7 @@ static fr_radius_packet_code_t eap_fast_process_tlvs(request_t *request, eap_ses
        for (vp = fr_pair_list_head(fast_vps);
             vp;
             vp = fr_pair_list_next(fast_vps, vp)) {
-               fr_radius_packet_code_t code = FR_RADIUS_CODE_ACCESS_REJECT;
+               fr_packet_code_t code = FR_RADIUS_CODE_ACCESS_REJECT;
                if (vp->da->parent == fr_dict_root(dict_eap_fast)) {
                        if (vp->da == attr_eap_fast_eap_payload) {
                                code = eap_fast_eap_payload(request, eap_session, tls_session, vp);
@@ -881,7 +881,7 @@ static fr_radius_packet_code_t eap_fast_process_tlvs(request_t *request, eap_ses
        }
 
        if (binding) {
-               fr_radius_packet_code_t code = eap_fast_crypto_binding(request, eap_session, tls_session, binding);
+               fr_packet_code_t code = eap_fast_crypto_binding(request, eap_session, tls_session, binding);
                if (code == FR_RADIUS_CODE_ACCESS_ACCEPT) {
                        t->stage = EAP_FAST_PROVISIONING;
                }
@@ -895,9 +895,9 @@ static fr_radius_packet_code_t eap_fast_process_tlvs(request_t *request, eap_ses
 /*
  * Process the inner tunnel data
  */
-fr_radius_packet_code_t eap_fast_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
+fr_packet_code_t eap_fast_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
 {
-       fr_radius_packet_code_t                 code;
+       fr_packet_code_t                        code;
        fr_pair_list_t          fast_vps;
        uint8_t const           *data;
        size_t                  data_len;
index d54b0f868ec1ca17a463661d313027a7d1598bb5..871de6730df7f2b7f048cf58e8e937775fe8f13d 100644 (file)
@@ -254,7 +254,7 @@ extern HIDDEN fr_dict_t const *dict_eap_fast;
  */
 void eap_fast_tlv_append(fr_tls_session_t *tls_session, fr_dict_attr_t const *da, bool mandatory,
                         int length, const void *data) CC_HINT(nonnull);
-fr_radius_packet_code_t eap_fast_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session) CC_HINT(nonnull);
+fr_packet_code_t eap_fast_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session) CC_HINT(nonnull);
 
 /*
  *     A bunch of EAP-FAST helper functions.
index 3a83b95c1b65b20afc1f667970a268b2a666b899..713d384dabb8029a2a390b785faf899a596ecfa9 100644 (file)
@@ -289,8 +289,8 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_session_t *eap_session, fr
                 *      Note that we don't do *anything* with the reply
                 *      attributes.
                 */
-               if (FR_RADIUS_PACKET_CODE_VALID(reply->code)) {
-                       RDEBUG2("Got tunneled reply %s", fr_radius_packet_names[reply->code]);
+               if (fr_packet_CODE_VALID(reply->code)) {
+                       RDEBUG2("Got tunneled reply %s", fr_packet_names[reply->code]);
                } else {
                        RDEBUG2("Got tunneled reply code %i", reply->code);
                }
index 34cc7534c79833851d3e9e675beef2a895bf015a..cf0685648534f71c093e64c6de4361e0e285deaf 100644 (file)
@@ -51,4 +51,4 @@ typedef struct {
 /*
  *     Process the TTLS portion of an EAP-TTLS request.
  */
-fr_radius_packet_code_t eap_ttls_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session) CC_HINT(nonnull);
+fr_packet_code_t eap_ttls_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session) CC_HINT(nonnull);
index 7f54bb0d2bd3395a9c088b0c09a15b79ce836da1..789abbbe995d203feff0d31aafb3c96d3d5c63d9 100644 (file)
@@ -614,9 +614,9 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(NDEBUG_UNUSED eap_session_t *e
 /*
  *     Process the "diameter" contents of the tunneled data.
  */
-fr_radius_packet_code_t eap_ttls_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
+fr_packet_code_t eap_ttls_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
 {
-       fr_radius_packet_code_t                 code = FR_RADIUS_CODE_ACCESS_REJECT;
+       fr_packet_code_t                        code = FR_RADIUS_CODE_ACCESS_REJECT;
        rlm_rcode_t             rcode;
        fr_pair_t               *vp = NULL;
        fr_dcursor_t            cursor;
@@ -723,7 +723,7 @@ fr_radius_packet_code_t eap_ttls_process(request_t *request, eap_session_t *eap_
         */
        chbind = eap_chbind_vp2packet(request, &request->request_pairs);
        if (chbind) {
-               fr_radius_packet_code_t chbind_code;
+               fr_packet_code_t chbind_code;
                CHBIND_REQ *req = talloc_zero(request, CHBIND_REQ);
 
                RDEBUG2("received chbind request");
index ba1ae364fc80b813bb865c4d9bccd74498bf6b78..71097b51efa19547c020fb54e844447de65c768f 100644 (file)
@@ -418,7 +418,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul
 
        if (!inst->allowed[request->packet->code]) {
                REDEBUG("Packet code %s is disallowed by the configuration",
-                      fr_radius_packet_names[request->packet->code]);
+                      fr_packet_names[request->packet->code]);
                RETURN_MODULE_FAIL;
        }
 
@@ -503,7 +503,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
         */
        if (inst->replicate && inst->status_check) {
                cf_log_warn(conf, "Ignoring 'status_check = %s' due to 'replicate = true'",
-                           fr_radius_packet_names[inst->status_check]);
+                           fr_packet_names[inst->status_check]);
                inst->status_check = 0;
        }
 
@@ -520,7 +520,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
 
                } else if (!inst->allowed[inst->status_check]) {
                        cf_log_err(conf, "Using 'status_check = %s' requires also 'type = %s'",
-                                  fr_radius_packet_names[inst->status_check], fr_radius_packet_names[inst->status_check]);
+                                  fr_packet_names[inst->status_check], fr_packet_names[inst->status_check]);
                        return -1;
                }
 
index 9f4cb8c9953da319c8ff34e4ca257fdb82856e36..0e29eceb8f1119cb136b2cc407cadc179a30553b 100644 (file)
@@ -351,8 +351,8 @@ static void CC_HINT(nonnull) status_check_alloc(udp_handle_t *h)
        talloc_const_free(request->name);
        request->name = talloc_strdup(request, h->module_name);
 
-       request->packet = fr_radius_packet_alloc(request, false);
-       request->reply = fr_radius_packet_alloc(request, false);
+       request->packet = fr_packet_alloc(request, false);
+       request->reply = fr_packet_alloc(request, false);
 
        /*
         *      Create the VPs, and ignore any errors
@@ -411,7 +411,7 @@ static void CC_HINT(nonnull) status_check_alloc(udp_handle_t *h)
        u->code = inst->parent->status_check;
        request->packet->code = u->code;
 
-       DEBUG3("%s - Status check packet type will be %s", h->module_name, fr_radius_packet_names[u->code]);
+       DEBUG3("%s - Status check packet type will be %s", h->module_name, fr_packet_names[u->code]);
        log_request_pair_list(L_DBG_LVL_3, request, NULL, &request->request_pairs, NULL);
 
        MEM(h->status_r = talloc_zero(request, udp_result_t));
@@ -638,7 +638,7 @@ static void conn_writable_status_check(fr_event_list_t *el, UNUSED int fd, UNUSE
        }
 
        DEBUG("%s - Sending %s ID %d length %ld over connection %s",
-             h->module_name, fr_radius_packet_names[u->code], u->id, u->packet_len, h->name);
+             h->module_name, fr_packet_names[u->code], u->id, u->packet_len, h->name);
 
        if (encode(h->inst, h->status_request, u, u->id) < 0) {
        fail:
@@ -651,7 +651,7 @@ static void conn_writable_status_check(fr_event_list_t *el, UNUSED int fd, UNUSE
        slen = write(h->fd, u->packet, u->packet_len);
        if (slen < 0) {
                ERROR("%s - Failed sending %s ID %d length %ld over connection %s: %s",
-                     h->module_name, fr_radius_packet_names[u->code], u->id, u->packet_len, h->name, fr_syserror(errno));
+                     h->module_name, fr_packet_names[u->code], u->id, u->packet_len, h->name, fr_syserror(errno));
                goto fail;
        }
        fr_assert((size_t)slen == u->packet_len);
@@ -1175,7 +1175,7 @@ static decode_fail_t decode(TALLOC_CTX *ctx, fr_pair_list_t *reply, uint8_t *res
        code = data[0];
 
        RDEBUG("Received %s ID %d length %ld reply packet on connection %s",
-              fr_radius_packet_names[code], data[1], data_len, h->name);
+              fr_packet_names[code], data[1], data_len, h->name);
        log_request_pair_list(L_DBG_LVL_2, request, NULL, reply, NULL);
 
        *response_code = code;
@@ -1772,7 +1772,7 @@ static void request_mux(fr_event_list_t *el,
                        u->id = u->rr->id;
 
                        RDEBUG("Sending %s ID %d length %ld over connection %s",
-                              fr_radius_packet_names[u->code], u->id, u->packet_len, h->name);
+                              fr_packet_names[u->code], u->id, u->packet_len, h->name);
 
                        if (encode(h->inst, request, u, u->id) < 0) {
                                /*
@@ -1793,7 +1793,7 @@ static void request_mux(fr_event_list_t *el,
                        (void) radius_track_entry_update(u->rr, u->packet + RADIUS_AUTH_VECTOR_OFFSET);
                } else {
                        RDEBUG("Retransmitting %s ID %d length %ld over connection %s",
-                              fr_radius_packet_names[u->code], u->id, u->packet_len, h->name);
+                              fr_packet_names[u->code], u->id, u->packet_len, h->name);
                }
 
                log_request_pair_list(L_DBG_LVL_2, request, NULL, &request->request_pairs, NULL);
@@ -2001,7 +2001,7 @@ static void request_mux_replicate(UNUSED fr_event_list_t *el,
                }
 
                RDEBUG("Sending %s ID %d length %ld over connection %s",
-                      fr_radius_packet_names[u->code], u->id, u->packet_len, h->name);
+                      fr_packet_names[u->code], u->id, u->packet_len, h->name);
                RHEXDUMP3(u->packet, u->packet_len, "Encoded packet");
 
                h->coalesced[queued].treq = treq;
index e5ec8c57968f06713fc9c2c12b9eeca14d658243..3a692fd8ed821564a072495cb34d1f23f07a25d1 100644 (file)
@@ -333,7 +333,7 @@ static unlang_action_t CC_HINT(nonnull) mod_stats(rlm_rcode_t *p_result, module_
 
                if (!local_stats[i]) continue;
 
-               strlcpy(buffer + 18, fr_radius_packet_names[i], sizeof(buffer) - 18);
+               strlcpy(buffer + 18, fr_packet_names[i], sizeof(buffer) - 18);
                da = fr_dict_attr_by_name(NULL, fr_dict_root(dict_radius), buffer);
                if (!da) continue;
 
index 52a39d49749e40d57c2b022a7ba3f5568d45987a..73f865915b85dfa1b1357b39e23adb4dfc712562 100644 (file)
@@ -171,9 +171,9 @@ typedef struct {
                                                        ///< the same order as they were added.
 } process_radius_request_pairs_t;
 
-#define FR_RADIUS_PROCESS_CODE_VALID(_x) (FR_RADIUS_PACKET_CODE_VALID(_x) || (_x == FR_RADIUS_CODE_DO_NOT_RESPOND))
+#define FR_RADIUS_PROCESS_CODE_VALID(_x) (fr_packet_CODE_VALID(_x) || (_x == FR_RADIUS_CODE_DO_NOT_RESPOND))
 
-#define PROCESS_PACKET_TYPE            fr_radius_packet_code_t
+#define PROCESS_PACKET_TYPE            fr_packet_code_t
 #define PROCESS_CODE_MAX               FR_RADIUS_CODE_MAX
 #define PROCESS_CODE_DO_NOT_RESPOND    FR_RADIUS_CODE_DO_NOT_RESPOND
 #define PROCESS_PACKET_CODE_VALID      FR_RADIUS_PROCESS_CODE_VALID
@@ -234,7 +234,7 @@ static void radius_packet_debug(request_t *request, fr_packet_t *packet, fr_pair
 #endif
                       "",
                       received ? "Received" : "Sending",
-                      fr_radius_packet_names[packet->code],
+                      fr_packet_names[packet->code],
                       packet->id,
                       packet->socket.inet.src_ipaddr.af == AF_INET6 ? "[" : "",
                       fr_box_ipaddr(packet->socket.inet.src_ipaddr),
@@ -880,7 +880,7 @@ RESUME(protocol_error)
 
        PROCESS_TRACE;
 
-       fr_assert(FR_RADIUS_PACKET_CODE_VALID(request->reply->code));
+       fr_assert(fr_packet_CODE_VALID(request->reply->code));
 
        /*
         *      https://tools.ietf.org/html/rfc7930#section-4
@@ -924,7 +924,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc
        request->module = NULL;
        fr_assert(request->dict == dict_radius);
 
-       fr_assert(FR_RADIUS_PACKET_CODE_VALID(request->packet->code));
+       fr_assert(fr_packet_CODE_VALID(request->packet->code));
 
        UPDATE_STATE(packet);
 
index a353b9389f5bdd1e503f492a199c46c0cb41ecb9..2e444f9197d93e5ada08c19f3e3c277460dee045 100644 (file)
@@ -158,10 +158,10 @@ typedef struct {
        process_ttls_auth_t             auth;           //!< Authentication configuration.
 } process_ttls_t;
 
-#define PROCESS_PACKET_TYPE            fr_radius_packet_code_t
+#define PROCESS_PACKET_TYPE            fr_packet_code_t
 #define PROCESS_CODE_MAX               FR_RADIUS_CODE_MAX
 #define PROCESS_CODE_DO_NOT_RESPOND    FR_RADIUS_CODE_DO_NOT_RESPOND
-#define PROCESS_PACKET_CODE_VALID      FR_RADIUS_PACKET_CODE_VALID
+#define PROCESS_PACKET_CODE_VALID      fr_packet_CODE_VALID
 #define PROCESS_INST                   process_ttls_t
 #include <freeradius-devel/server/process.h>
 
@@ -217,7 +217,7 @@ static void radius_packet_debug(request_t *request, fr_packet_t *packet, fr_pair
 #endif
                       "",
                       received ? "Received" : "Sending",
-                      fr_radius_packet_names[packet->code],
+                      fr_packet_names[packet->code],
                       packet->id,
                       packet->socket.inet.src_ipaddr.af == AF_INET6 ? "[" : "",
                       fr_box_ipaddr(packet->socket.inet.src_ipaddr),
@@ -452,7 +452,7 @@ RESUME(auth_type)
        PROCESS_TRACE;
 
        fr_assert(rcode < RLM_MODULE_NUMCODES);
-       fr_assert(FR_RADIUS_PACKET_CODE_VALID(request->reply->code));
+       fr_assert(fr_packet_CODE_VALID(request->reply->code));
 
        if (auth_type_rcode[rcode] == FR_RADIUS_CODE_DO_NOT_RESPOND) {
                request->reply->code = auth_type_rcode[rcode];
@@ -614,7 +614,7 @@ RESUME(protocol_error)
 
        PROCESS_TRACE;
 
-       fr_assert(FR_RADIUS_PACKET_CODE_VALID(request->reply->code));
+       fr_assert(fr_packet_CODE_VALID(request->reply->code));
 
        /*
         *      https://tools.ietf.org/html/rfc7930#section-4
@@ -654,7 +654,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc
 
        PROCESS_TRACE;
 
-       fr_assert(FR_RADIUS_PACKET_CODE_VALID(request->packet->code));
+       fr_assert(fr_packet_CODE_VALID(request->packet->code));
 
        request->component = "radius";
        request->module = NULL;
index cd584b95c8f45e3b631c55a083876bb03f9f08c5..24d4195921871fb197d1b759eb818b23c30c6f5a 100644 (file)
@@ -141,7 +141,7 @@ extern HIDDEN fr_dict_attr_t const  *dhcp_option_82;
                fprintf(stdout, ## __VA_ARGS__); \
                fprintf(stdout, "\n"); \
        } \
-       fr_radius_packet_free(&packet); \
+       fr_packet_free(&packet); \
        return NULL; \
 }
 #endif
index 28c98867de1e5f62b1d975e1db30e0b6b4061d5c..bb142c503ae4ff298514bdba616bd522b4892585 100644 (file)
@@ -410,7 +410,7 @@ fr_packet_t *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len)
        if (data_len < MIN_PACKET_SIZE) return NULL;
 
        /* Now that checks are done, allocate packet */
-       packet = fr_radius_packet_alloc(NULL, false);
+       packet = fr_packet_alloc(NULL, false);
        if (!packet) {
                fr_strerror_const("Failed allocating packet");
                return NULL;
index f565e5dc52a02d626505ba9e42c90a89f6f0aa49..695592a901431bbd5904f1e66d18b31e3613147a 100644 (file)
@@ -187,7 +187,7 @@ fr_packet_t *fr_dhcpv4_raw_packet_recv(int sockfd, struct sockaddr_ll *link_laye
        socklen_t               sock_len;
        uint8_t                 data_offset;
 
-       packet = fr_radius_packet_alloc(NULL, false);
+       packet = fr_packet_alloc(NULL, false);
        if (!packet) {
                fr_strerror_const("Failed allocating packet");
                return NULL;
@@ -196,7 +196,7 @@ fr_packet_t *fr_dhcpv4_raw_packet_recv(int sockfd, struct sockaddr_ll *link_laye
        raw_packet = talloc_zero_array(packet, uint8_t, MAX_PACKET_SIZE);
        if (!raw_packet) {
                fr_strerror_const("Out of memory");
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                return NULL;
        }
 
@@ -305,13 +305,13 @@ fr_packet_t *fr_dhcpv4_raw_packet_recv(int sockfd, struct sockaddr_ll *link_laye
                                           packet->data_len, attr_dhcp_message_type);
        if (!code) {
                fr_strerror_const("No message-type option was found in the packet");
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                return NULL;
        }
 
        if ((code[1] < 1) || (code[2] == 0) || (code[2] > 8)) {
                fr_strerror_const("Unknown value for message-type option");
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                return NULL;
        }
 
index c926ef37315aa1c0a6d32a3f7a4f48fc84945e6a..498733d1e7af223db9cf9ba26a4bbdffed5684cc 100644 (file)
@@ -91,7 +91,7 @@ fr_table_num_sorted_t const fr_radius_request_name_table[] = {
 };
 size_t fr_radius_request_name_table_len = NUM_ELEMENTS(fr_radius_request_name_table);
 
-char const *fr_radius_packet_names[FR_RADIUS_CODE_MAX] = {
+char const *fr_packet_names[FR_RADIUS_CODE_MAX] = {
        "",                                     //!< 0
        "Access-Request",
        "Access-Accept",
@@ -151,7 +151,7 @@ char const *fr_radius_packet_names[FR_RADIUS_CODE_MAX] = {
 /** If we get a reply, the request must come from one of a small
  * number of packet types.
  */
-static const fr_radius_packet_code_t allowed_replies[FR_RADIUS_CODE_MAX] = {
+static const fr_packet_code_t allowed_replies[FR_RADIUS_CODE_MAX] = {
        [FR_RADIUS_CODE_ACCESS_ACCEPT]          = FR_RADIUS_CODE_ACCESS_REQUEST,
        [FR_RADIUS_CODE_ACCESS_CHALLENGE]       = FR_RADIUS_CODE_ACCESS_REQUEST,
        [FR_RADIUS_CODE_ACCESS_REJECT]          = FR_RADIUS_CODE_ACCESS_REQUEST,
@@ -1028,7 +1028,7 @@ ssize_t   fr_radius_decode(TALLOC_CTX *ctx, fr_pair_list_t *out,
 
                if (!allowed_replies[code]) {
                        fr_strerror_printf("%s packet received unknown reply code %s",
-                                          fr_radius_packet_names[decode_ctx->request_code], fr_radius_packet_names[code]);
+                                          fr_packet_names[decode_ctx->request_code], fr_packet_names[code]);
                        return DECODE_FAIL_UNKNOWN_PACKET_CODE;
                }
 
@@ -1042,7 +1042,7 @@ ssize_t   fr_radius_decode(TALLOC_CTX *ctx, fr_pair_list_t *out,
                if ((code != FR_RADIUS_CODE_PROTOCOL_ERROR) && (decode_ctx->request_code != FR_RADIUS_CODE_STATUS_SERVER) &&
                    (allowed_replies[code] != decode_ctx->request_code)) {
                        fr_strerror_printf("%s packet received invalid reply code %s",
-                                          fr_radius_packet_names[decode_ctx->request_code], fr_radius_packet_names[code]);
+                                          fr_packet_names[decode_ctx->request_code], fr_packet_names[code]);
                        return DECODE_FAIL_UNKNOWN_PACKET_CODE;
                }
        }
index 2dc174d2743281c6ed5361e9527610bb45893e6f..bb8b383870a992553e75878ea9cfe06956b43e5e 100644 (file)
@@ -101,13 +101,13 @@ int fr_radius_client_fd_bio_write(fr_radius_client_fd_bio_t *my, UNUSED void *pa
        /*
         *      Encode the packet.
         */
-       if (fr_radius_packet_encode(packet, list, NULL, (char const *) my->cfg.verify.secret) < 0) {
+       if (fr_packet_encode(packet, list, NULL, (char const *) my->cfg.verify.secret) < 0) {
        fail:
                fr_radius_code_id_push(my->codes, packet);
                return -1;
        }
 
-       if (fr_radius_packet_sign(packet, NULL, (char const *) my->cfg.verify.secret) < 0) goto fail;
+       if (fr_packet_sign(packet, NULL, (char const *) my->cfg.verify.secret) < 0) goto fail;
 
        slen = fr_bio_write(my->common.bio, &packet->socket, packet->data, packet->data_len);
        if (slen <= 0) goto fail;
@@ -115,7 +115,7 @@ int fr_radius_client_fd_bio_write(fr_radius_client_fd_bio_t *my, UNUSED void *pa
        return 0;
 }
 
-static const fr_radius_packet_code_t allowed_replies[FR_RADIUS_CODE_MAX] = {
+static const fr_packet_code_t allowed_replies[FR_RADIUS_CODE_MAX] = {
        [FR_RADIUS_CODE_ACCESS_ACCEPT]          = FR_RADIUS_CODE_ACCESS_REQUEST,
        [FR_RADIUS_CODE_ACCESS_CHALLENGE]       = FR_RADIUS_CODE_ACCESS_REQUEST,
        [FR_RADIUS_CODE_ACCESS_REJECT]          = FR_RADIUS_CODE_ACCESS_REQUEST,
@@ -193,7 +193,7 @@ int fr_radius_client_fd_bio_read(fr_bio_packet_t *bio, UNUSED void *packet_ctx,
        /*
         *      Allocate the new request data structure
         */
-       reply = fr_radius_packet_alloc(packet, false);
+       reply = fr_packet_alloc(packet, false);
        if (!reply) return -1;
 
        reply->socket = fd_ctx.socket;
index 2566775f5b536057c04deb714d406640009de785..23a983bcc02d6930dac77b3ead9c8f047054ba8d 100644 (file)
@@ -1461,7 +1461,7 @@ static ssize_t decode_tlv_trampoline(TALLOC_CTX *ctx, fr_pair_list_t *out,
  *
  *  "length" is AT LEAST the length of this attribute, as we
  *  expect the caller to have verified the data with
- *  fr_radius_packet_ok().  "length" may be up to the length of the
+ *  fr_packet_ok().  "length" may be up to the length of the
  *  packet.
  *
  *  This function will ONLY return -1 on programmer error or OOM.  If
@@ -1660,7 +1660,7 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, fr_pair_list_t *out,
                 */
                case FLAG_TAGGED_TUNNEL_PASSWORD:
                case FLAG_ENCRYPT_TUNNEL_PASSWORD:
-                       if (!packet_ctx->request_authenticator) goto raw;       
+                       if (!packet_ctx->request_authenticator) goto raw;
 
                        if (fr_radius_decode_tunnel_password(buffer, &data_len, packet_ctx) < 0) {
                                goto raw;
@@ -1671,7 +1671,7 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, fr_pair_list_t *out,
                 *      Ascend-Send-Secret
                 *      Ascend-Receive-Secret
                 */
-               case FLAG_ENCRYPT_ASCEND_SECRET:        
+               case FLAG_ENCRYPT_ASCEND_SECRET:
                        if (!packet_ctx->request_authenticator) goto raw;
 
                        fr_radius_ascend_secret(&FR_DBUFF_TMP(buffer, sizeof(buffer)), p, data_len,
index 21d3ab5f27f90e3b3e2289703513f509146f83a9..7bf1107fa6977d662fda1c54bd399b73be380f50 100644 (file)
@@ -52,7 +52,7 @@ typedef enum {
        FR_RADIUS_CODE_PROTOCOL_ERROR           = 52,   //!< RFC7930 - Protocol-Error (generic NAK)
        FR_RADIUS_CODE_MAX                      = 53,   //!< Maximum possible protocol code
        FR_RADIUS_CODE_DO_NOT_RESPOND           = 256   //!< Special rcode to indicate we will not respond.
-} fr_radius_packet_code_t;
+} fr_packet_code_t;
 
 #define FR_AUTH_UDP_PORT               1812
 #define FR_AUTH_UDP_PORT_ALT           1645
index 3d7a602f296f57c39e0c813376d35d874195627b..cb1e15146505b175b44dfeba50956ada6d64984b 100644 (file)
@@ -688,7 +688,7 @@ fr_packet_t *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max
                if (pl->sockets[start].socket.type == SOCK_STREAM) {
                        packet = fr_tcp_recv(pl->sockets[start].socket.fd, false);
                } else
-                       packet = fr_radius_packet_recv(NULL, pl->sockets[start].socket.fd, UDP_FLAGS_NONE,
+                       packet = fr_packet_recv(NULL, pl->sockets[start].socket.fd, UDP_FLAGS_NONE,
                                                       max_attributes, require_ma);
                if (!packet) continue;
 
@@ -744,7 +744,7 @@ void fr_packet_header_log(fr_log_t const *log, fr_packet_t *packet, bool receive
         *
         *      This really belongs in a utility library
         */
-       if (FR_RADIUS_PACKET_CODE_VALID(packet->code)) {
+       if (fr_packet_CODE_VALID(packet->code)) {
                fr_log(log, L_DBG, __FILE__, __LINE__,
                       "%s %s Id %i from %s%s%s:%i to %s%s%s:%i "
 #ifdef WITH_IFINDEX_NAME_RESOLUTION
@@ -752,7 +752,7 @@ void fr_packet_header_log(fr_log_t const *log, fr_packet_t *packet, bool receive
 #endif
                       "length %zu\n",
                        received ? "Received" : "Sent",
-                       fr_radius_packet_names[packet->code],
+                       fr_packet_names[packet->code],
                        packet->id,
                        packet->socket.inet.src_ipaddr.af == AF_INET6 ? "[" : "",
                        fr_inet_ntop(src_ipaddr, sizeof(src_ipaddr), &packet->socket.inet.src_ipaddr),
@@ -803,6 +803,6 @@ void fr_packet_log(fr_log_t const *log, fr_packet_t *packet, fr_pair_list_t *lis
        fr_packet_header_log(log, packet, received);
        if (fr_debug_lvl >= L_DBG_LVL_1) fr_pair_list_log(log, 4, list);
 #ifndef NDEBUG
-       if (fr_debug_lvl >= L_DBG_LVL_4) fr_radius_packet_log_hex(log, packet);
+       if (fr_debug_lvl >= L_DBG_LVL_4) fr_packet_log_hex(log, packet);
 #endif
 }
index a9a76c209253bcc5e1852502b338e9d24e9ca41a..cae9c7e8d24f5ab8abfd0aa80da02bc750f56929 100644 (file)
@@ -49,7 +49,7 @@ typedef struct {
 /** Encode a packet
  *
  */
-ssize_t fr_radius_packet_encode(fr_packet_t *packet, fr_pair_list_t *list,
+ssize_t fr_packet_encode(fr_packet_t *packet, fr_pair_list_t *list,
                                fr_packet_t const *original, char const *secret)
 {
        uint8_t const *original_data;
@@ -61,7 +61,7 @@ ssize_t fr_radius_packet_encode(fr_packet_t *packet, fr_pair_list_t *list,
        uint8_t data[MAX_PACKET_LEN];
 
 #ifndef NDEBUG
-       if (fr_debug_lvl >= L_DBG_LVL_4) fr_radius_packet_log_hex(&default_log, packet);
+       if (fr_debug_lvl >= L_DBG_LVL_4) fr_packet_log_hex(&default_log, packet);
 #endif
 
        if (original) {
@@ -112,7 +112,7 @@ ssize_t fr_radius_packet_encode(fr_packet_t *packet, fr_pair_list_t *list,
  *     - True on success.
  *     - False on failure.
  */
-bool fr_radius_packet_ok(fr_packet_t *packet, uint32_t max_attributes, bool require_ma, decode_fail_t *reason)
+bool fr_packet_ok(fr_packet_t *packet, uint32_t max_attributes, bool require_ma, decode_fail_t *reason)
 {
        char host_ipaddr[INET6_ADDRSTRLEN];
 
@@ -136,7 +136,7 @@ bool fr_radius_packet_ok(fr_packet_t *packet, uint32_t max_attributes, bool requ
 /** Verify the Request/Response Authenticator (and Message-Authenticator if present) of a packet
  *
  */
-int fr_radius_packet_verify(fr_packet_t *packet, fr_packet_t *original, char const *secret)
+int fr_packet_verify(fr_packet_t *packet, fr_packet_t *original, char const *secret)
 {
        char            buffer[INET6_ADDRSTRLEN];
 
@@ -157,7 +157,7 @@ int fr_radius_packet_verify(fr_packet_t *packet, fr_packet_t *original, char con
 /** Sign a previously encoded packet
  *
  */
-int fr_radius_packet_sign(fr_packet_t *packet, fr_packet_t const *original,
+int fr_packet_sign(fr_packet_t *packet, fr_packet_t const *original,
                          char const *secret)
 {
        int ret;
@@ -208,7 +208,7 @@ static ssize_t rad_recvfrom(int sockfd, fr_packet_t *packet, int flags)
 /** Receive UDP client requests, and fill in the basics of a fr_packet_t structure
  *
  */
-fr_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma)
+fr_packet_t *fr_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma)
 {
        ssize_t                 data_len;
        fr_packet_t     *packet;
@@ -216,7 +216,7 @@ fr_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t
        /*
         *      Allocate the new request data structure
         */
-       packet = fr_radius_packet_alloc(ctx, false);
+       packet = fr_packet_alloc(ctx, false);
        if (!packet) {
                fr_strerror_const("out of memory");
                return NULL;
@@ -225,7 +225,7 @@ fr_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t
        data_len = rad_recvfrom(fd, packet, flags);
        if (data_len < 0) {
                FR_DEBUG_STRERROR_PRINTF("Error receiving packet: %s", fr_syserror(errno));
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                return NULL;
        }
 
@@ -238,7 +238,7 @@ fr_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t
            (packet->socket.inet.dst_ipaddr.af == AF_UNSPEC) ||
            (packet->socket.inet.dst_port == 0)) {
                FR_DEBUG_STRERROR_PRINTF("Error receiving packet: %s", fr_syserror(errno));
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                return NULL;
        }
 #endif
@@ -252,7 +252,7 @@ fr_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t
         */
        if (packet->data_len > MAX_PACKET_LEN) {
                FR_DEBUG_STRERROR_PRINTF("Discarding packet: Larger than RFC limitation of 4096 bytes");
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                return NULL;
        }
 
@@ -264,15 +264,15 @@ fr_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t
         */
        if ((packet->data_len == 0) || !packet->data) {
                FR_DEBUG_STRERROR_PRINTF("Empty packet: Socket is not ready");
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                return NULL;
        }
 
        /*
         *      See if it's a well-formed RADIUS packet.
         */
-       if (!fr_radius_packet_ok(packet, max_attributes, require_ma, NULL)) {
-               fr_radius_packet_free(&packet);
+       if (!fr_packet_ok(packet, max_attributes, require_ma, NULL)) {
+               fr_packet_free(&packet);
                return NULL;
        }
 
@@ -294,7 +294,7 @@ fr_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t
  *
  * Also attach reply attribute value pairs and any user message provided.
  */
-int fr_radius_packet_send(fr_packet_t *packet, fr_pair_list_t *list,
+int fr_packet_send(fr_packet_t *packet, fr_pair_list_t *list,
                          fr_packet_t const *original, char const *secret)
 {
        /*
@@ -311,7 +311,7 @@ int fr_radius_packet_send(fr_packet_t *packet, fr_pair_list_t *list,
                /*
                 *      Encode the packet.
                 */
-               if (fr_radius_packet_encode(packet, list, original, secret) < 0) {
+               if (fr_packet_encode(packet, list, original, secret) < 0) {
                        return -1;
                }
 
@@ -319,7 +319,7 @@ int fr_radius_packet_send(fr_packet_t *packet, fr_pair_list_t *list,
                 *      Re-sign it, including updating the
                 *      Message-Authenticator.
                 */
-               if (fr_radius_packet_sign(packet, original, secret) < 0) {
+               if (fr_packet_sign(packet, original, secret) < 0) {
                        return -1;
                }
 
@@ -352,7 +352,7 @@ int fr_radius_packet_send(fr_packet_t *packet, fr_pair_list_t *list,
        return udp_send(&packet->socket, 0, packet->data, packet->data_len);
 }
 
-void _fr_radius_packet_log_hex(fr_log_t const *log, fr_packet_t const *packet, char const *file, int line)
+void _fr_packet_log_hex(fr_log_t const *log, fr_packet_t const *packet, char const *file, int line)
 {
        uint8_t const *attr, *end;
        char buffer[1024];
@@ -370,7 +370,7 @@ void _fr_radius_packet_log_hex(fr_log_t const *log, fr_packet_t const *packet, c
        }
 
        if ((packet->data[0] > 0) && (packet->data[0] < FR_RADIUS_CODE_MAX)) {
-               fr_log(log, L_DBG, file, line, "  Code     : %s", fr_radius_packet_names[packet->data[0]]);
+               fr_log(log, L_DBG, file, line, "  Code     : %s", fr_packet_names[packet->data[0]]);
        } else {
                fr_log(log, L_DBG, file, line, "  Code     : %u", packet->data[0]);
        }
index 6ab24ea3a146b79166672e6ed1d72ae48b6d0704..f5b8f3b33d52f32787c4a9f0baaa69a5061dcc44 100644 (file)
@@ -47,8 +47,8 @@
  *     protocols/radius/base.c
  */
 
-extern char const *fr_radius_packet_names[FR_RADIUS_CODE_MAX];
-#define FR_RADIUS_PACKET_CODE_VALID(_x) ((_x > 0) && (_x < FR_RADIUS_CODE_MAX))
+extern char const *fr_packet_names[FR_RADIUS_CODE_MAX];
+#define fr_packet_CODE_VALID(_x) ((_x > 0) && (_x < FR_RADIUS_CODE_MAX))
 
 #define AUTH_PASS_LEN (RADIUS_AUTH_VECTOR_LENGTH)
 
@@ -188,24 +188,24 @@ void              fr_radius_global_free(void);
 /*
  *     protocols/radius/packet.c
  */
-ssize_t                fr_radius_packet_encode(fr_packet_t *packet, fr_pair_list_t *list,
+ssize_t                fr_packet_encode(fr_packet_t *packet, fr_pair_list_t *list,
                                        fr_packet_t const *original,
                                        char const *secret) CC_HINT(nonnull (1,2,4));
 
-bool           fr_radius_packet_ok(fr_packet_t *packet, uint32_t max_attributes, bool require_ma,
+bool           fr_packet_ok(fr_packet_t *packet, uint32_t max_attributes, bool require_ma,
                                    decode_fail_t *reason) CC_HINT(nonnull (1));
 
-int            fr_radius_packet_verify(fr_packet_t *packet, fr_packet_t *original,
+int            fr_packet_verify(fr_packet_t *packet, fr_packet_t *original,
                                        char const *secret) CC_HINT(nonnull (1,3));
-int            fr_radius_packet_sign(fr_packet_t *packet, fr_packet_t const *original,
+int            fr_packet_sign(fr_packet_t *packet, fr_packet_t const *original,
                                      char const *secret) CC_HINT(nonnull (1,3));
 
-fr_packet_t    *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma);
-int            fr_radius_packet_send(fr_packet_t *packet, fr_pair_list_t *list,
+fr_packet_t    *fr_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma);
+int            fr_packet_send(fr_packet_t *packet, fr_pair_list_t *list,
                                      fr_packet_t const *original, char const *secret) CC_HINT(nonnull (1,2,4));
 
-#define fr_radius_packet_log_hex(_log, _packet) _fr_radius_packet_log_hex(_log, _packet, __FILE__, __LINE__)
-void           _fr_radius_packet_log_hex(fr_log_t const *log, fr_packet_t const *packet, char const *file, int line) CC_HINT(nonnull);
+#define fr_packet_log_hex(_log, _packet) _fr_packet_log_hex(_log, _packet, __FILE__, __LINE__)
+void           _fr_packet_log_hex(fr_log_t const *log, fr_packet_t const *packet, char const *file, int line) CC_HINT(nonnull);
 
 /*
  *     protocols/radius/abinary.c
index bbcff289a19d755e5e17fe680dc1be04d413b5b1..5a4f0eddf250741283547456c223d3bf87be030b 100644 (file)
@@ -30,14 +30,14 @@ RCSID("$Id$")
 
 fr_packet_t *fr_tcp_recv(int sockfd, int flags)
 {
-       fr_packet_t *packet = fr_radius_packet_alloc(NULL, false);
+       fr_packet_t *packet = fr_packet_alloc(NULL, false);
 
        if (!packet) return NULL;
 
        packet->socket.fd = sockfd;
 
        if (fr_tcp_read_packet(packet, RADIUS_MAX_ATTRIBUTES, flags) != 1) {
-               fr_radius_packet_free(&packet);
+               fr_packet_free(&packet);
                return NULL;
        }
 
@@ -141,7 +141,7 @@ int fr_tcp_read_packet(fr_packet_t *packet, uint32_t max_attributes, bool requir
        /*
         *      See if it's a well-formed RADIUS packet.
         */
-       if (!fr_radius_packet_ok(packet, max_attributes, require_ma, NULL)) {
+       if (!fr_packet_ok(packet, max_attributes, require_ma, NULL)) {
                return -1;
        }
 
index b5deb63ed6ec1d28980b78b38a90493426d7e25c..8fd3b9be6e033327bce66dc34c4054afcfd8cc12 100644 (file)
@@ -63,7 +63,7 @@ typedef struct {
 
        struct sockaddr_storage src;
        socklen_t       salen;
-} fr_radius_packet_ctx_t;
+} fr_packet_ctx_t;
 
 static int             debug_lvl = 0;
 static int             max_control_plane = 0;
@@ -98,8 +98,8 @@ static rlm_rcode_t test_process(UNUSED void const *instance, request_t *request,
 
 static int test_decode(UNUSED void const *instance, request_t *request, uint8_t *const data, size_t data_len)
 {
-       fr_radius_packet_ctx_t const *pc = talloc_get_type_abort_const(request->async->listen->app_instance,
-                                                                      fr_radius_packet_ctx_t);
+       fr_packet_ctx_t const *pc = talloc_get_type_abort_const(request->async->listen->app_instance,
+                                                                      fr_packet_ctx_t);
 
        request->number = pc->id;
        request->async->process = test_process;
@@ -114,8 +114,8 @@ static int test_decode(UNUSED void const *instance, request_t *request, uint8_t
 static ssize_t test_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
 {
        fr_md5_ctx_t    *md5_ctx;
-       fr_radius_packet_ctx_t const *pc = talloc_get_type_abort_const(request->async->listen->app_instance,
-                                                                      fr_radius_packet_ctx_t);
+       fr_packet_ctx_t const *pc = talloc_get_type_abort_const(request->async->listen->app_instance,
+                                                                      fr_packet_ctx_t);
 
        MPRINT1("\t\tENCODE >>> request %"PRIu64" - data %p %p room %zd\n",
                request->number, pc, buffer, buffer_len);
@@ -189,7 +189,7 @@ static void *worker_thread(void *arg)
 
 static void send_reply(int sockfd, fr_channel_data_t *reply)
 {
-       fr_radius_packet_ctx_t *pc = talloc_get_type_abort(reply->packet_ctx, fr_radius_packet_ctx_t);
+       fr_packet_ctx_t *pc = talloc_get_type_abort(reply->packet_ctx, fr_packet_ctx_t);
 
        MPRINT1("Master got reply %d size %zd\n", pc->id, reply->m.data_size);
 
@@ -332,7 +332,7 @@ static void master_process(TALLOC_CTX *ctx)
                        uint8_t                 *packet, *attr, *end;
                        size_t                  total_len;
                        ssize_t                 data_size;
-                       fr_radius_packet_ctx_t  *packet_ctx;
+                       fr_packet_ctx_t *packet_ctx;
 
                        if (events[i].filter == EVFILT_USER) {
                                (void) fr_channel_service_kevent(workers[0].ch, control_master, &events[i]);
@@ -345,7 +345,7 @@ static void master_process(TALLOC_CTX *ctx)
                        cd = (fr_channel_data_t *) fr_message_reserve(ms, 4096);
                        fr_assert(cd != NULL);
 
-                       packet_ctx = talloc(ctx, fr_radius_packet_ctx_t);
+                       packet_ctx = talloc(ctx, fr_packet_ctx_t);
                        fr_assert(packet_ctx != NULL);
                        packet_ctx->salen = sizeof(packet_ctx->src);