From: Arran Cudbard-Bell Date: Wed, 6 Mar 2024 20:10:48 +0000 (-0600) Subject: s/fr_radius_packet_t/fr_packet_t/g X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69a127baee9e2b939c92b6cffc7bf56105347f1f;p=thirdparty%2Ffreeradius-server.git s/fr_radius_packet_t/fr_packet_t/g --- diff --git a/src/bin/dhcpclient.c b/src/bin/dhcpclient.c index 109afe8d165..67708e85533 100644 --- a/src/bin/dhcpclient.c +++ b/src/bin/dhcpclient.c @@ -133,12 +133,12 @@ static NEVER_RETURNS void usage(void) /* * Initialize the request. */ -static int request_init(fr_radius_packet_t **out, fr_pair_list_t *packet_vps, char const *filename) +static int request_init(fr_packet_t **out, fr_pair_list_t *packet_vps, char const *filename) { FILE *fp; fr_pair_t *vp; bool filedone = false; - fr_radius_packet_t *packet; + fr_packet_t *packet; /* * Determine where to read the VP's from. @@ -214,11 +214,11 @@ static int request_init(fr_radius_packet_t **out, fr_pair_list_t *packet_vps, ch * We'll just return the first eligible reply, and display the others. */ #if defined(HAVE_LINUX_IF_PACKET_H) || defined (HAVE_LIBPCAP) -static fr_radius_packet_t *fr_dhcpv4_recv_raw_loop(int lsockfd, +static fr_packet_t *fr_dhcpv4_recv_raw_loop(int lsockfd, #ifdef HAVE_LINUX_IF_PACKET_H struct sockaddr_ll *p_ll, #endif - fr_radius_packet_t *request, + fr_packet_t *request, #ifndef HAVE_LINUX_IF_PACKET_H UNUSED #endif @@ -226,8 +226,8 @@ static fr_radius_packet_t *fr_dhcpv4_recv_raw_loop(int lsockfd, ) { fr_time_delta_t our_timeout; - fr_radius_packet_t *found = NULL; - fr_radius_packet_t *reply = NULL; + fr_packet_t *found = NULL; + fr_packet_t *reply = NULL; fr_pair_list_t reply_vps; int nb_reply = 0; int nb_offer = 0; @@ -326,7 +326,7 @@ static fr_radius_packet_t *fr_dhcpv4_recv_raw_loop(int lsockfd, } #endif /* or */ -static int send_with_socket(fr_radius_packet_t **reply, fr_radius_packet_t *request, +static int send_with_socket(fr_packet_t **reply, fr_packet_t *request, #ifndef HAVE_LINUX_IF_PACKET_H UNUSED #endif @@ -411,7 +411,7 @@ static int send_with_socket(fr_radius_packet_t **reply, fr_radius_packet_t *requ } #ifdef HAVE_LIBPCAP -static int send_with_pcap(fr_radius_packet_t **reply, fr_radius_packet_t *request, fr_pair_list_t *request_list) +static int send_with_pcap(fr_packet_t **reply, fr_packet_t *request, fr_pair_list_t *request_list) { char ip[16]; char pcap_filter[255]; @@ -462,7 +462,7 @@ static int send_with_pcap(fr_radius_packet_t **reply, fr_radius_packet_t *reques } #endif /* HAVE_LIBPCAP */ -static void dhcp_packet_debug(fr_radius_packet_t *packet, fr_pair_list_t *list, bool received) +static void dhcp_packet_debug(fr_packet_t *packet, fr_pair_list_t *list, bool received) { char buffer[2048]; @@ -531,9 +531,9 @@ int main(int argc, char **argv) char const *dict_dir = DICTDIR; char const *filename = NULL; - fr_radius_packet_t *packet = NULL; + fr_packet_t *packet = NULL; fr_pair_list_t packet_vps; - fr_radius_packet_t *reply = NULL; + fr_packet_t *reply = NULL; fr_pair_list_t reply_vps; int ret; diff --git a/src/bin/radclient-ng.c b/src/bin/radclient-ng.c index d697c728d11..93b147c9731 100644 --- a/src/bin/radclient-ng.c +++ b/src/bin/radclient-ng.c @@ -224,7 +224,7 @@ static void openssl3_free(void) #define openssl3_free() #endif -static int mschapv1_encode(fr_radius_packet_t *packet, fr_pair_list_t *list, +static int mschapv1_encode(fr_packet_t *packet, fr_pair_list_t *list, char const *password) { unsigned int i; @@ -916,7 +916,7 @@ static int recv_one_packet(fr_time_delta_t wait_time) fd_set set; fr_time_delta_t our_wait_time; rc_request_t *request; - fr_radius_packet_t *reply, *packet; + fr_packet_t *reply, *packet; volatile int max_fd; #ifdef STATIC_ANALYZER diff --git a/src/bin/radclient.c b/src/bin/radclient.c index 62757003223..a44a82a6530 100644 --- a/src/bin/radclient.c +++ b/src/bin/radclient.c @@ -241,7 +241,7 @@ static void openssl3_free(void) #define openssl3_free() #endif -static int mschapv1_encode(fr_radius_packet_t *packet, fr_pair_list_t *list, +static int mschapv1_encode(fr_packet_t *packet, fr_pair_list_t *list, char const *password) { unsigned int i; @@ -1131,7 +1131,7 @@ static int recv_coa_packet(fr_time_delta_t wait_time) fd_set set; fr_time_delta_t our_wait_time; rc_request_t *request, *parent; - fr_radius_packet_t *packet; + fr_packet_t *packet; #ifdef STATIC_ANALYZER if (!secret) fr_exit_now(1); @@ -1270,7 +1270,7 @@ static int recv_one_packet(fr_time_delta_t wait_time) fd_set set; fr_time_delta_t our_wait_time; rc_request_t *request; - fr_radius_packet_t *reply, *packet; + fr_packet_t *reply, *packet; volatile int max_fd; #ifdef STATIC_ANALYZER diff --git a/src/bin/radclient.h b/src/bin/radclient.h index 4f30a418e79..e163f780e1f 100644 --- a/src/bin/radclient.h +++ b/src/bin/radclient.h @@ -85,8 +85,8 @@ struct rc_request { fr_pair_t *password; //!< Password.Cleartext fr_time_t timestamp; - fr_radius_packet_t *packet; //!< The outgoing request. - fr_radius_packet_t *reply; //!< The incoming response. + fr_packet_t *packet; //!< The outgoing request. + fr_packet_t *reply; //!< The incoming response. fr_pair_list_t request_pairs; fr_pair_list_t reply_pairs; diff --git a/src/bin/radsniff.c b/src/bin/radsniff.c index 20d279db754..a01b63995ea 100644 --- a/src/bin/radsniff.c +++ b/src/bin/radsniff.c @@ -308,7 +308,7 @@ static void rs_packet_print_csv_header(void) } static void rs_packet_print_csv(uint64_t count, rs_status_t status, fr_pcap_t *handle, - fr_radius_packet_t *packet, fr_pair_list_t *list, + fr_packet_t *packet, fr_pair_list_t *list, UNUSED struct timeval *elapsed, struct timeval *latency, UNUSED bool response, bool body) { @@ -382,7 +382,7 @@ static void rs_packet_print_csv(uint64_t count, rs_status_t status, fr_pcap_t *h } static void rs_packet_print_fancy(uint64_t count, rs_status_t status, fr_pcap_t *handle, - fr_radius_packet_t *packet, fr_pair_list_t *list, + fr_packet_t *packet, fr_pair_list_t *list, struct timeval *elapsed, struct timeval *latency, bool response, bool body) { char buffer[2048]; @@ -477,7 +477,7 @@ static void rs_packet_print_fancy(uint64_t count, rs_status_t status, fr_pcap_t } static void rs_packet_save_in_output_dir(uint64_t count, UNUSED rs_status_t status, UNUSED fr_pcap_t *handle, - fr_radius_packet_t *packet, fr_pair_list_t *list, + fr_packet_t *packet, fr_pair_list_t *list, UNUSED struct timeval *elapsed, UNUSED struct timeval *latency, bool response, bool body) { fr_log_t output_file; @@ -528,7 +528,7 @@ static void rs_packet_save_in_output_dir(uint64_t count, UNUSED rs_status_t stat } static inline void rs_packet_print(rs_request_t *request, uint64_t count, rs_status_t status, fr_pcap_t *handle, - fr_radius_packet_t *packet, fr_pair_list_t *list, + fr_packet_t *packet, fr_pair_list_t *list, struct timeval *elapsed, struct timeval *latency, bool response, bool body) { @@ -1283,7 +1283,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt static uint64_t captured = 0; rs_status_t status = RS_NORMAL; /* Any special conditions (RTX, Unlinked, ID-Reused) */ - fr_radius_packet_t *packet; /* Current packet were processing */ + fr_packet_t *packet; /* Current packet were processing */ rs_request_t *original = NULL; fr_pair_list_t decoded; @@ -1886,7 +1886,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt */ } else if (!conf->filter_response && (conf->event_flags & status)) { uint64_t print_id; - fr_radius_packet_t *print_packet; + fr_packet_t *print_packet; fr_pair_list_t *print_pair_list; if (original) { diff --git a/src/bin/radsniff.h b/src/bin/radsniff.h index c810b77176c..10c2de3c134 100644 --- a/src/bin/radsniff.h +++ b/src/bin/radsniff.h @@ -76,7 +76,7 @@ typedef enum { } rs_status_t; typedef void (*rs_packet_logger_t)(uint64_t count, rs_status_t status, fr_pcap_t *handle, - fr_radius_packet_t *packet, fr_pair_list_t *list, + fr_packet_t *packet, fr_pair_list_t *list, struct timeval *elapsed, struct timeval *latency, bool response, bool body); typedef enum { #ifdef HAVE_COLLECTDC_H @@ -176,7 +176,7 @@ typedef struct { uint8_t *data; //!< PCAP packet data. } rs_capture_t; -/** Wrapper for fr_radius_packet_t +/** Wrapper for fr_packet_t * * Allows an event to be associated with a request packet. This is required because we need to disarm * the event timer when a response is received, so we don't erroneously log the response as lost. @@ -190,11 +190,11 @@ typedef struct { struct timeval when; //!< Time when the packet was received, or next time an event //!< is scheduled. fr_pcap_t *in; //!< PCAP handle the original request was received on. - fr_radius_packet_t *packet; //!< The original packet. + fr_packet_t *packet; //!< The original packet. fr_pair_list_t packet_vps; - fr_radius_packet_t *expect; //!< Request/response. + fr_packet_t *expect; //!< Request/response. fr_pair_list_t expect_vps; - fr_radius_packet_t *linked; //!< The subsequent response or forwarded request the packet + fr_packet_t *linked; //!< The subsequent response or forwarded request the packet //!< was linked against. fr_pair_list_t link_vps; //!< fr_pair_ts used to link retransmissions. diff --git a/src/bin/radsnmp.c b/src/bin/radsnmp.c index cc127f03e5b..a6736f10cf1 100644 --- a/src/bin/radsnmp.c +++ b/src/bin/radsnmp.c @@ -162,9 +162,9 @@ static void rs_signal_stop(UNUSED int sig) * @param fd the request will be sent on. * @return new request. */ -static fr_radius_packet_t *radsnmp_alloc(radsnmp_conf_t *conf, int fd) +static fr_packet_t *radsnmp_alloc(radsnmp_conf_t *conf, int fd) { - fr_radius_packet_t *packet; + fr_packet_t *packet; packet = fr_radius_packet_alloc(conf, true); @@ -654,7 +654,7 @@ do { \ fr_dcursor_t cursor; fr_pair_t *vp; - fr_radius_packet_t *packet; + fr_packet_t *packet; fr_pair_list_t request_vps; /* @@ -773,7 +773,7 @@ do { \ * Send the packet */ { - fr_radius_packet_t *reply = NULL; + fr_packet_t *reply = NULL; fr_pair_list_t reply_vps; ssize_t rcode; diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index d0afcd6f39f..759e0d272ff 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -364,7 +364,7 @@ static request_t *request_from_file(TALLOC_CTX *ctx, FILE *fp, fr_client_t *clie } -static void print_packet(FILE *fp, fr_radius_packet_t *packet, fr_pair_list_t *list) +static void print_packet(FILE *fp, fr_packet_t *packet, fr_pair_list_t *list) { fr_dict_enum_value_t *dv; fr_log_t log; diff --git a/src/lib/bio/packet.h b/src/lib/bio/packet.h index b3ee6b0f2ba..361d89d7ac3 100644 --- a/src/lib/bio/packet.h +++ b/src/lib/bio/packet.h @@ -18,7 +18,7 @@ /** * $Id$ * @file lib/bio/packet.h - * @brief Binary IO abstractions for #fr_radius_packet_t + * @brief Binary IO abstractions for #fr_packet_t * * @copyright 2024 Network RADIUS SAS (legal@networkradius.com) */ @@ -42,7 +42,7 @@ typedef struct fr_bio_packet_s fr_bio_packet_t; * - <0 on error * - 0 for success (*packet_p may still be NULL tho) */ -typedef int (*fr_bio_packet_read_t)(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t **packet_p, TALLOC_CTX *ctx, fr_pair_list_t *out); +typedef int (*fr_bio_packet_read_t)(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t **packet_p, TALLOC_CTX *ctx, fr_pair_list_t *out); /** Write a packet and pairs from the network * @@ -54,7 +54,7 @@ typedef int (*fr_bio_packet_read_t)(fr_bio_packet_t *bio, void *packet_ctx, fr_r * - <0 on error (EOF, fail, etc,) * - 0 for success */ -typedef int (*fr_bio_packet_write_t)(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t *packet, fr_pair_list_t *list); +typedef int (*fr_bio_packet_write_t)(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t *packet, fr_pair_list_t *list); /** Release an outgoing packet. * @@ -65,7 +65,7 @@ typedef int (*fr_bio_packet_write_t)(fr_bio_packet_t *bio, void *packet_ctx, fr_ * - <0 on error * - 0 for success */ -typedef int (*fr_bio_packet_release_t)(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t *packet); +typedef int (*fr_bio_packet_release_t)(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t *packet); struct fr_bio_packet_s { void *uctx; //!< user ctx, caller can manually set it. @@ -79,17 +79,17 @@ struct fr_bio_packet_s { }; -static inline CC_HINT(nonnull) int fr_bio_packet_read(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t **packet_p, TALLOC_CTX *ctx, fr_pair_list_t *out) +static inline CC_HINT(nonnull) int fr_bio_packet_read(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t **packet_p, TALLOC_CTX *ctx, fr_pair_list_t *out) { return bio->read(bio, packet_ctx, packet_p, ctx, out); } -static inline CC_HINT(nonnull) int fr_bio_packet_write(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t *packet, fr_pair_list_t *list) +static inline CC_HINT(nonnull) int fr_bio_packet_write(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t *packet, fr_pair_list_t *list) { return bio->write(bio, packet_ctx, packet, list); } -static inline CC_HINT(nonnull) int fr_bio_packet_release(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t *packet) +static inline CC_HINT(nonnull) int fr_bio_packet_release(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t *packet) { if (!bio->release) return 0; diff --git a/src/lib/server/auth.c b/src/lib/server/auth.c index 4a5c48eb18f..25ed29b8f5d 100644 --- a/src/lib/server/auth.c +++ b/src/lib/server/auth.c @@ -196,7 +196,7 @@ unlang_action_t rad_virtual_server(rlm_rcode_t *p_result, request_t *request) /* * Debug the packet if requested. */ -void common_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *pairs, bool received) +void common_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *pairs, bool received) { #ifdef WITH_IFINDEX_NAME_RESOLUTION char if_name[IFNAMSIZ]; diff --git a/src/lib/server/listen.h b/src/lib/server/listen.h index 95e1b9a33ed..c3f60b1c0f9 100644 --- a/src/lib/server/listen.h +++ b/src/lib/server/listen.h @@ -69,7 +69,7 @@ typedef int (*rad_listen_recv_t)(rad_listen_t *); typedef int (*rad_listen_send_t)(rad_listen_t *, request_t *); typedef int (*rad_listen_error_t)(rad_listen_t *, int); typedef int (*rad_listen_print_t)(rad_listen_t const *, char *, size_t); -typedef void (*rad_listen_debug_t)(request_t *, fr_radius_packet_t *, fr_pair_list_t *, bool received); +typedef void (*rad_listen_debug_t)(request_t *, fr_packet_t *, fr_pair_list_t *, bool received); typedef int (*rad_listen_encode_t)(rad_listen_t *, request_t *); typedef int (*rad_listen_decode_t)(rad_listen_t *, request_t *); diff --git a/src/lib/server/main_config.c b/src/lib/server/main_config.c index 5805a3cfc4a..a887227053e 100644 --- a/src/lib/server/main_config.c +++ b/src/lib/server/main_config.c @@ -1068,7 +1068,7 @@ int main_config_init(main_config_t *config) INFO("Starting - reading configuration files ..."); /* - * About sizeof(request_t) + sizeof(fr_radius_packet_t) * 2 + sizeof(fr_pair_t) * 400 + * About sizeof(request_t) + sizeof(fr_packet_t) * 2 + sizeof(fr_pair_t) * 400 * * Which should be enough for many configurations. */ diff --git a/src/lib/server/packet.c b/src/lib/server/packet.c index 5d7f50345ae..2882adc2113 100644 --- a/src/lib/server/packet.c +++ b/src/lib/server/packet.c @@ -14,7 +14,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -/** fr_radius_packet_t alloc/free functions +/** fr_packet_t alloc/free functions * * @file src/lib/server/packet.c * @@ -76,14 +76,14 @@ static int inet2pairs(TALLOC_CTX *ctx, fr_pair_list_t *list, /** Allocate a "Net." struct with src/dst host and port. * * @param ctx The context in which the packet is allocated. - * @param[in] list #fr_pair_list_t value to resolve to #fr_radius_packet_t. + * @param[in] list #fr_pair_list_t value to resolve to #fr_packet_t. * @param[out] packet The request packet. * * @return * - 0 on success * - <0 on error. */ -int fr_packet_pairs_from_packet(TALLOC_CTX *ctx, fr_pair_list_t *list, fr_radius_packet_t const *packet) +int fr_packet_pairs_from_packet(TALLOC_CTX *ctx, fr_pair_list_t *list, fr_packet_t const *packet) { fr_pair_t *vp, *net, *tlv; @@ -103,7 +103,7 @@ int fr_packet_pairs_from_packet(TALLOC_CTX *ctx, fr_pair_list_t *list, fr_radius * Net.Dst */ if (fr_pair_find_or_append_by_da(net, &tlv, &net->vp_group, attr_net_dst) < 0) return -1; - + if (inet2pairs(tlv, &tlv->vp_group, attr_net_dst_ip, attr_net_dst_port, &packet->socket.inet.dst_ipaddr, packet->socket.inet.dst_port) < 0) return -1; /* @@ -123,7 +123,7 @@ static void pairs2inet(fr_ipaddr_t *ipaddr, uint16_t *port, fr_pair_list_t const vp = fr_pair_find_by_da(list, NULL, attr_ip); if (vp) *ipaddr = vp->vp_ip; - + vp = fr_pair_find_by_da(list, NULL, attr_port); if (vp) *port = vp->vp_uint16; } @@ -133,7 +133,7 @@ static void pairs2inet(fr_ipaddr_t *ipaddr, uint16_t *port, fr_pair_list_t const * @param packet the packet to send * @param list the list to check for Net.* */ -void fr_packet_pairs_to_packet(fr_radius_packet_t *packet, fr_pair_list_t const *list) +void fr_packet_pairs_to_packet(fr_packet_t *packet, fr_pair_list_t const *list) { fr_pair_t *net, *tlv; diff --git a/src/lib/server/packet.h b/src/lib/server/packet.h index 586314913d5..50bd51c5228 100644 --- a/src/lib/server/packet.h +++ b/src/lib/server/packet.h @@ -30,8 +30,8 @@ extern "C" { #include #include -int fr_packet_pairs_from_packet(TALLOC_CTX *ctx, fr_pair_list_t *list, fr_radius_packet_t const *packet) CC_HINT(nonnull); -void fr_packet_pairs_to_packet(fr_radius_packet_t *packet, fr_pair_list_t const *list) CC_HINT(nonnull); +int fr_packet_pairs_from_packet(TALLOC_CTX *ctx, fr_pair_list_t *list, fr_packet_t const *packet) CC_HINT(nonnull); +void fr_packet_pairs_to_packet(fr_packet_t *packet, fr_pair_list_t const *list) CC_HINT(nonnull); int packet_global_init(void); void packet_global_free(void); diff --git a/src/lib/server/protocol.c b/src/lib/server/protocol.c index e61df3b5ac3..3fd4b0bb6f2 100644 --- a/src/lib/server/protocol.c +++ b/src/lib/server/protocol.c @@ -37,7 +37,7 @@ extern "C" { /* * Debug the packet if requested. */ -void common_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *pairs, bool received) +void common_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *pairs, bool received) { #ifdef WITH_IFINDEX_NAME_RESOLUTION char if_name[IFNAMSIZ]; diff --git a/src/lib/server/protocol.h b/src/lib/server/protocol.h index be56ed47fae..6550c11a88b 100644 --- a/src/lib/server/protocol.h +++ b/src/lib/server/protocol.h @@ -47,7 +47,7 @@ typedef void (*rad_listen_free_t)(rad_listen_t *); int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this); int common_socket_open(CONF_SECTION *cs, rad_listen_t *this); int common_socket_print(rad_listen_t const *this, char *buffer, size_t bufsize); -void common_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *pairs, bool received); +void common_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *pairs, bool received); /** Struct exported by a proto_* module * diff --git a/src/lib/server/request.c b/src/lib/server/request.c index 795c8b6f0b2..0dd20048c15 100644 --- a/src/lib/server/request.c +++ b/src/lib/server/request.c @@ -472,7 +472,7 @@ static inline CC_HINT(always_inline) request_t *request_alloc_pool(TALLOC_CTX *c 10, /* extra */ (UNLANG_FRAME_PRE_ALLOC * UNLANG_STACK_MAX) + /* Stack memory */ (sizeof(fr_pair_t) * 5) + /* pair lists and root*/ - (sizeof(fr_radius_packet_t) * 2) + /* packets */ + (sizeof(fr_packet_t) * 2) + /* packets */ 128 /* extra */ )); fr_assert(ctx != request); @@ -717,11 +717,11 @@ void request_global_free(void) * Verify a packet. */ static void packet_verify(char const *file, int line, - request_t const *request, fr_radius_packet_t const *packet, fr_pair_list_t *list, char const *type) + request_t const *request, fr_packet_t const *packet, fr_pair_list_t *list, char const *type) { TALLOC_CTX *parent; - fr_fatal_assert_msg(packet, "CONSISTENCY CHECK FAILED %s[%i]: fr_radius_packet_t %s pointer was NULL", + fr_fatal_assert_msg(packet, "CONSISTENCY CHECK FAILED %s[%i]: fr_packet_t %s pointer was NULL", file, line, type); parent = talloc_parent(packet); @@ -730,7 +730,7 @@ static void packet_verify(char const *file, int line, if (parent) fr_log_talloc_report(parent); - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%i]: Expected fr_radius_packet_t %s to be parented " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%i]: Expected fr_packet_t %s to be parented " "by %p (%s), but parented by %p (%s)", file, line, type, request, talloc_get_name(request), parent, parent ? talloc_get_name(parent) : "NULL"); diff --git a/src/lib/server/request.h b/src/lib/server/request.h index fb06a1e3d9e..d2bd500880a 100644 --- a/src/lib/server/request.h +++ b/src/lib/server/request.h @@ -223,8 +223,8 @@ struct request_s { char const *component; //!< Section the request is in. char const *module; //!< Module the request is currently being processed by. - fr_radius_packet_t *packet; //!< Incoming request. - fr_radius_packet_t *reply; //!< Outgoing response. + fr_packet_t *packet; //!< Incoming request. + fr_packet_t *reply; //!< Outgoing response. fr_client_t *client; //!< The client that originally sent us the request. diff --git a/src/lib/server/tmpl.h b/src/lib/server/tmpl.h index 83f15f5dc9c..01ef164f4b4 100644 --- a/src/lib/server/tmpl.h +++ b/src/lib/server/tmpl.h @@ -1067,7 +1067,7 @@ void tmpl_debug(tmpl_t const *vpt) CC_HINT(nonnull); fr_pair_list_t *tmpl_list_head(request_t *request, fr_dict_attr_t const *list); -fr_radius_packet_t *tmpl_packet_ptr(request_t *request, fr_dict_attr_t const *list) CC_HINT(nonnull); +fr_packet_t *tmpl_packet_ptr(request_t *request, fr_dict_attr_t const *list) CC_HINT(nonnull); TALLOC_CTX *tmpl_list_ctx(request_t *request, fr_dict_attr_t const *list); diff --git a/src/lib/server/tmpl_eval.c b/src/lib/server/tmpl_eval.c index 884b603c32f..34df081ac61 100644 --- a/src/lib/server/tmpl_eval.c +++ b/src/lib/server/tmpl_eval.c @@ -99,8 +99,8 @@ fr_pair_list_t *tmpl_list_head(request_t *request, fr_dict_attr_t const *list) /** Return the correct TALLOC_CTX to alloc #fr_pair_t in, for a list * * Allocating new #fr_pair_t in the context of a #request_t is usually wrong. - * #fr_pair_t should be allocated in the context of a #fr_radius_packet_t, so that if the - * #fr_radius_packet_t is freed before the #request_t, the associated #fr_pair_t lists are + * #fr_pair_t should be allocated in the context of a #fr_packet_t, so that if the + * #fr_packet_t is freed before the #request_t, the associated #fr_pair_t lists are * freed too. * * @param[in] request containing the target lists. @@ -128,20 +128,20 @@ TALLOC_CTX *tmpl_list_ctx(request_t *request, fr_dict_attr_t const *list) return NULL; } -/** Resolve a list to the #fr_radius_packet_t holding the HEAD pointer for a #fr_pair_t list +/** Resolve a list to the #fr_packet_t holding the HEAD pointer for a #fr_pair_t list * - * Returns a pointer to the #fr_radius_packet_t that holds the HEAD pointer of a given list, + * Returns a pointer to the #fr_packet_t that holds the HEAD pointer of a given list, * for the current #request_t. * * @param[in] request To resolve list in. - * @param[in] list #fr_pair_list_t value to resolve to #fr_radius_packet_t. + * @param[in] list #fr_pair_list_t value to resolve to #fr_packet_t. * @return - * - #fr_radius_packet_t on success. + * - #fr_packet_t on success. * - NULL on failure. * * @see tmpl_pair_list */ -fr_radius_packet_t *tmpl_packet_ptr(request_t *request, fr_dict_attr_t const *list) +fr_packet_t *tmpl_packet_ptr(request_t *request, fr_dict_attr_t const *list) { if (list == request_attr_request) return request->packet; diff --git a/src/lib/util/packet.c b/src/lib/util/packet.c index d5216f58cd2..510b8a04979 100644 --- a/src/lib/util/packet.c +++ b/src/lib/util/packet.c @@ -14,7 +14,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -/** fr_radius_packet_t alloc/free functions +/** fr_packet_t alloc/free functions * * @file src/lib/util/packet.c * @@ -26,20 +26,20 @@ RCSID("$Id$") #include #include -/** Allocate a new fr_radius_packet_t +/** Allocate a new fr_packet_t * * @param ctx the context in which the packet is allocated. May be NULL if * the packet is not associated with a request_t. * @param new_vector if true a new request authenticator will be generated. * @return - * - New fr_radius_packet_t. + * - New fr_packet_t. * - NULL on error. */ -fr_radius_packet_t *fr_radius_packet_alloc(TALLOC_CTX *ctx, bool new_vector) +fr_packet_t *fr_radius_packet_alloc(TALLOC_CTX *ctx, bool new_vector) { - fr_radius_packet_t *rp; + fr_packet_t *rp; - rp = talloc_zero(ctx, fr_radius_packet_t); + rp = talloc_zero(ctx, fr_packet_t); if (!rp) { fr_strerror_const("out of memory"); return NULL; @@ -51,18 +51,18 @@ fr_radius_packet_t *fr_radius_packet_alloc(TALLOC_CTX *ctx, bool new_vector) return rp; } -/** Allocate a new fr_radius_packet_t response +/** Allocate a new fr_packet_t response * * @param ctx the context in which the packet is allocated. May be NULL if * the packet is not associated with a request_t. * @param packet The request packet. * @return - * - New fr_radius_packet_t. + * - New fr_packet_t. * - NULL on error. */ -fr_radius_packet_t *fr_radius_packet_alloc_reply(TALLOC_CTX *ctx, fr_radius_packet_t *packet) +fr_packet_t *fr_radius_packet_alloc_reply(TALLOC_CTX *ctx, fr_packet_t *packet) { - fr_radius_packet_t *reply; + fr_packet_t *reply; if (!packet) return NULL; @@ -83,12 +83,12 @@ fr_radius_packet_t *fr_radius_packet_alloc_reply(TALLOC_CTX *ctx, fr_radius_pack } -/** Free a fr_radius_packet_t +/** Free a fr_packet_t * */ -void fr_radius_packet_free(fr_radius_packet_t **packet_p) +void fr_radius_packet_free(fr_packet_t **packet_p) { - fr_radius_packet_t *packet; + fr_packet_t *packet; if (!packet_p || !*packet_p) return; packet = *packet_p; diff --git a/src/lib/util/packet.h b/src/lib/util/packet.h index 71de57dbe43..f579a21d3f9 100644 --- a/src/lib/util/packet.h +++ b/src/lib/util/packet.h @@ -37,7 +37,7 @@ extern "C" { #include #ifdef WITH_VERIFY_PTR -# define PACKET_VERIFY(_x) (void) talloc_get_type_abort_const(_x, fr_radius_packet_t) +# define PACKET_VERIFY(_x) (void) talloc_get_type_abort_const(_x, fr_packet_t) #else # define PACKET_VERIFY(_x) fr_cond_assert(_x) #endif @@ -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_radius_packet_t as well before calling fr_radius_packet_send + * response fr_packet_t as well before calling fr_radius_packet_send * * verified: Filled in by rad_decode for accounting-request packets * @@ -74,11 +74,11 @@ typedef struct { size_t partial; void *uctx; -} fr_radius_packet_t; +} fr_packet_t; -fr_radius_packet_t *fr_radius_packet_alloc(TALLOC_CTX *ctx, bool new_vector); -fr_radius_packet_t *fr_radius_packet_alloc_reply(TALLOC_CTX *ctx, fr_radius_packet_t *); -void fr_radius_packet_free(fr_radius_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 **); #ifdef __cplusplus } diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index 38892de6cc1..680b2b30a66 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -266,7 +266,7 @@ fr_pair_t *fr_pair_root_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da) * * @note Will duplicate any unknown attributes passed as the da. * - * @param[in] ctx for allocated memory, usually a pointer to a #fr_radius_packet_t + * @param[in] ctx for allocated memory, usually a pointer to a #fr_packet_t * @param[in] da Specifies the dictionary attribute to build the #fr_pair_t from. * If unknown, will be duplicated, with the memory being bound to * the pair. @@ -356,7 +356,7 @@ int fr_pair_reinit_from_da(fr_pair_list_t *list, fr_pair_t *vp, fr_dict_attr_t c * Which type of #fr_dict_attr_t the #fr_pair_t was created with can be determined by * checking @verbatim vp->da->flags.is_unknown @endverbatim. * - * @param[in] ctx for allocated memory, usually a pointer to a #fr_radius_packet_t. + * @param[in] ctx for allocated memory, usually a pointer to a #fr_packet_t. * @param[in] parent of the attribute being allocated (usually a dictionary or vendor). * @param[in] attr number. * @return @@ -392,7 +392,7 @@ fr_pair_t *fr_pair_afrom_child_num(TALLOC_CTX *ctx, fr_dict_attr_t const *parent * * Unlike fr_pair_afrom_da_nested(), this function starts off at an intermediate ctx and list. * - * @param[in] ctx for allocated memory, usually a pointer to a #fr_radius_packet_t. + * @param[in] ctx for allocated memory, usually a pointer to a #fr_packet_t. * @param[out] list where the created pair is supposed to go. * @param[in] da the da for the pair to create * @param[in] start the starting depth. If start != 0, we must have ctx==vp at that depth, and list==&vp->vp_group @@ -452,7 +452,7 @@ fr_pair_t *fr_pair_afrom_da_depth_nested(TALLOC_CTX *ctx, fr_pair_list_t *list, * This function is similar to fr_pair_update_by_da_parent(), except that function requires * a parent pair, and this one takes a separate talloc ctx and pair list. * - * @param[in] ctx for allocated memory, usually a pointer to a #fr_radius_packet_t. + * @param[in] ctx for allocated memory, usually a pointer to a #fr_packet_t. * @param[out] list where the created pair is supposed to go. * @param[in] da the da for the pair to create * @return diff --git a/src/listen/dhcpv4/proto_dhcpv4.c b/src/listen/dhcpv4/proto_dhcpv4.c index d8961a5a96e..2190d978b19 100644 --- a/src/listen/dhcpv4/proto_dhcpv4.c +++ b/src/listen/dhcpv4/proto_dhcpv4.c @@ -193,7 +193,7 @@ static int mod_decode(UNUSED void const *instance, request_t *request, uint8_t * fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; fr_client_t const *client; - fr_radius_packet_t *packet = request->packet; + fr_packet_t *packet = request->packet; /* * Set the request dictionary so that we can do diff --git a/src/listen/dhcpv6/proto_dhcpv6.c b/src/listen/dhcpv6/proto_dhcpv6.c index 6906ee081f8..f3a36783f1e 100644 --- a/src/listen/dhcpv6/proto_dhcpv6.c +++ b/src/listen/dhcpv6/proto_dhcpv6.c @@ -193,7 +193,7 @@ static int mod_decode(UNUSED void const *instance, request_t *request, uint8_t * fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; fr_client_t const *client; - fr_radius_packet_t *packet = request->packet; + fr_packet_t *packet = request->packet; /* * Set the request dictionary so that we can do diff --git a/src/listen/vmps/proto_vmps.c b/src/listen/vmps/proto_vmps.c index 0bb1cd929e4..4aefa021d37 100644 --- a/src/listen/vmps/proto_vmps.c +++ b/src/listen/vmps/proto_vmps.c @@ -181,7 +181,7 @@ static int mod_decode(UNUSED void const *instance, request_t *request, uint8_t * fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t); fr_io_address_t const *address = track->address; fr_client_t const *client; - fr_radius_packet_t *packet = request->packet; + fr_packet_t *packet = request->packet; fr_assert(data[0] < FR_VMPS_CODE_MAX); diff --git a/src/modules/rlm_attr_filter/rlm_attr_filter.c b/src/modules/rlm_attr_filter/rlm_attr_filter.c index c8ff1fbae3a..bad95a7a399 100644 --- a/src/modules/rlm_attr_filter/rlm_attr_filter.c +++ b/src/modules/rlm_attr_filter/rlm_attr_filter.c @@ -188,7 +188,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) */ static unlang_action_t CC_HINT(nonnull(1,2)) attr_filter_common(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, - fr_radius_packet_t *packet, fr_pair_list_t *list) + fr_packet_t *packet, fr_pair_list_t *list) { rlm_attr_filter_t const *inst = talloc_get_type_abort_const(mctx->inst->data, rlm_attr_filter_t); fr_pair_list_t output; diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index c3879afd474..a260de673fd 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -221,7 +221,7 @@ static void detail_fr_pair_fprint(TALLOC_CTX *ctx, FILE *out, fr_pair_t const *s * @param[in] compat Write out entry in compatibility mode. */ static int detail_write(FILE *out, rlm_detail_t const *inst, request_t *request, fr_value_box_t *header, - fr_radius_packet_t *packet, fr_pair_list_t *list, bool compat, fr_hash_table_t *ht) + fr_packet_t *packet, fr_pair_list_t *list, bool compat, fr_hash_table_t *ht) { if (fr_pair_list_empty(list)) { RWDEBUG("Skipping empty packet"); @@ -322,7 +322,7 @@ static int detail_write(FILE *out, rlm_detail_t const *inst, request_t *request, * Do detail, compatible with old accounting */ static unlang_action_t CC_HINT(nonnull) detail_do(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, - fr_radius_packet_t *packet, fr_pair_list_t *list, + fr_packet_t *packet, fr_pair_list_t *list, bool compat) { rlm_detail_env_t *env = talloc_get_type_abort(mctx->env_data, rlm_detail_env_t); diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c index 5931794bda1..049ef12bf1d 100644 --- a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c +++ b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c @@ -477,7 +477,7 @@ ssize_t eap_fast_decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_ static rlm_rcode_t CC_HINT(nonnull) process_reply(UNUSED eap_session_t *eap_session, fr_tls_session_t *tls_session, request_t *request, - fr_radius_packet_t *reply, fr_pair_list_t *reply_list) + fr_packet_t *reply, fr_pair_list_t *reply_list) { rlm_rcode_t rcode = RLM_MODULE_REJECT; fr_pair_t *vp; diff --git a/src/modules/rlm_eap/types/rlm_eap_peap/peap.c b/src/modules/rlm_eap/types/rlm_eap_peap/peap.c index 5936d12e86c..3a83b95c1b6 100644 --- a/src/modules/rlm_eap/types/rlm_eap_peap/peap.c +++ b/src/modules/rlm_eap/types/rlm_eap_peap/peap.c @@ -277,7 +277,7 @@ static int eap_peap_check_tlv(request_t *request, uint8_t const *data, size_t da */ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_session_t *eap_session, fr_tls_session_t *tls_session, request_t *request, - fr_radius_packet_t *reply, fr_pair_list_t *reply_list) + fr_packet_t *reply, fr_pair_list_t *reply_list) { rlm_rcode_t rcode = RLM_MODULE_REJECT; fr_pair_list_t vps; diff --git a/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c b/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c index 7e7caade8ef..7f54bb0d2bd 100644 --- a/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c +++ b/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c @@ -497,7 +497,7 @@ static int vp2diameter(request_t *request, fr_tls_session_t *tls_session, fr_pai */ static rlm_rcode_t CC_HINT(nonnull) process_reply(NDEBUG_UNUSED eap_session_t *eap_session, fr_tls_session_t *tls_session, request_t *request, - fr_radius_packet_t *reply, fr_pair_list_t *reply_list) + fr_packet_t *reply, fr_pair_list_t *reply_list) { rlm_rcode_t rcode = RLM_MODULE_REJECT; fr_pair_t *vp; diff --git a/src/modules/rlm_sometimes/rlm_sometimes.c b/src/modules/rlm_sometimes/rlm_sometimes.c index a340de09bc4..2bf85cc0f69 100644 --- a/src/modules/rlm_sometimes/rlm_sometimes.c +++ b/src/modules/rlm_sometimes/rlm_sometimes.c @@ -72,7 +72,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) * A lie! It always returns! */ static unlang_action_t sometimes_return(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, - fr_radius_packet_t *packet, fr_radius_packet_t *reply) + fr_packet_t *packet, fr_packet_t *reply) { rlm_sometimes_t const *inst = talloc_get_type_abort_const(mctx->inst->data, rlm_sometimes_t); uint32_t hash; diff --git a/src/process/arp/base.c b/src/process/arp/base.c index 0cb807dc116..059e4a5e26b 100644 --- a/src/process/arp/base.c +++ b/src/process/arp/base.c @@ -160,7 +160,7 @@ static fr_process_state_t const process_state[] = { /* * Debug the packet if requested. */ -static void arp_packet_debug(request_t *request, fr_radius_packet_t const *packet, fr_pair_list_t const *list, bool received) +static void arp_packet_debug(request_t *request, fr_packet_t const *packet, fr_pair_list_t const *list, bool received) { if (!packet) return; if (!RDEBUG_ENABLED) return; diff --git a/src/process/bfd/base.c b/src/process/bfd/base.c index 85f06f3b800..7bcde3c7a52 100644 --- a/src/process/bfd/base.c +++ b/src/process/bfd/base.c @@ -79,7 +79,7 @@ typedef struct { /* * Debug the packet if requested. */ -static void bfd_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *list, bool received) +static void bfd_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *list, bool received) { #ifdef WITH_IFINDEX_NAME_RESOLUTION char if_name[IFNAMSIZ]; diff --git a/src/process/dhcpv4/base.c b/src/process/dhcpv4/base.c index 7296b8b8863..e980dd23d62 100644 --- a/src/process/dhcpv4/base.c +++ b/src/process/dhcpv4/base.c @@ -53,7 +53,7 @@ fr_dict_attr_autoload_t process_dhcpv4_dict_attr[] = { /* * Debug the packet if requested. */ -static void dhcpv4_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *list, bool received) +static void dhcpv4_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *list, bool received) { #ifdef WITH_IFINDEX_NAME_RESOLUTION char if_name[IFNAMSIZ]; diff --git a/src/process/dhcpv6/base.c b/src/process/dhcpv6/base.c index 1041dc3cd6c..0f42a0ddb9c 100644 --- a/src/process/dhcpv6/base.c +++ b/src/process/dhcpv6/base.c @@ -287,7 +287,7 @@ static const virtual_server_compile_t compile_list[] = { /* * Debug the packet if requested. */ -static void dhcpv6_packet_debug(request_t *request, fr_radius_packet_t const *packet, fr_pair_list_t const *list, bool received) +static void dhcpv6_packet_debug(request_t *request, fr_packet_t const *packet, fr_pair_list_t const *list, bool received) { #ifdef WITH_IFINDEX_NAME_RESOLUTION char if_name[IFNAMSIZ]; diff --git a/src/process/dns/base.c b/src/process/dns/base.c index 924d86deabb..cec2af3ef12 100644 --- a/src/process/dns/base.c +++ b/src/process/dns/base.c @@ -127,7 +127,7 @@ static fr_process_state_t const process_state[] = { /* * Debug the packet if requested. */ -static void dns_packet_debug(request_t *request, fr_radius_packet_t const *packet, fr_pair_list_t const *list, bool received) +static void dns_packet_debug(request_t *request, fr_packet_t const *packet, fr_pair_list_t const *list, bool received) { if (!packet) return; if (!RDEBUG_ENABLED) return; diff --git a/src/process/ldap_sync/base.c b/src/process/ldap_sync/base.c index d185c16bae6..a36e06ae7b5 100644 --- a/src/process/ldap_sync/base.c +++ b/src/process/ldap_sync/base.c @@ -57,7 +57,7 @@ static char const *ldap_sync_message_types[FR_LDAP_SYNC_CODE_MAX] = { "Cookie-Store-Response", }; -static void ldap_sync_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *list, bool received) +static void ldap_sync_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *list, bool received) { if (!packet) return; diff --git a/src/process/radius/base.c b/src/process/radius/base.c index 4e4c9e7ee84..52a39d49749 100644 --- a/src/process/radius/base.c +++ b/src/process/radius/base.c @@ -219,7 +219,7 @@ static const conf_parser_t config[] = { /* * Debug the packet if requested. */ -static void radius_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *list, bool received) +static void radius_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *list, bool received) { #ifdef WITH_IFINDEX_NAME_RESOLUTION char if_name[IFNAMSIZ]; diff --git a/src/process/ttls/base.c b/src/process/ttls/base.c index 531d3f1180e..a353b9389f5 100644 --- a/src/process/ttls/base.c +++ b/src/process/ttls/base.c @@ -202,7 +202,7 @@ static const conf_parser_t config[] = { /* * Debug the packet if requested. */ -static void radius_packet_debug(request_t *request, fr_radius_packet_t *packet, fr_pair_list_t *list, bool received) +static void radius_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *list, bool received) { #ifdef WITH_IFINDEX_NAME_RESOLUTION char if_name[IFNAMSIZ]; diff --git a/src/process/vmps/base.c b/src/process/vmps/base.c index fb206d60ebc..3c8dcbe9207 100644 --- a/src/process/vmps/base.c +++ b/src/process/vmps/base.c @@ -162,7 +162,7 @@ static fr_process_state_t const process_state[] = { /* * Debug the packet if requested. */ -static void vmps_packet_debug(request_t *request, fr_radius_packet_t const *packet, fr_pair_list_t const *list, bool received) +static void vmps_packet_debug(request_t *request, fr_packet_t const *packet, fr_pair_list_t const *list, bool received) { #ifdef WITH_IFINDEX_NAME_RESOLUTION char if_name[IFNAMSIZ]; diff --git a/src/protocols/dhcpv4/base.c b/src/protocols/dhcpv4/base.c index 3600066b4b6..76c832f04ee 100644 --- a/src/protocols/dhcpv4/base.c +++ b/src/protocols/dhcpv4/base.c @@ -201,7 +201,7 @@ int8_t fr_dhcpv4_attr_cmp(void const *a, void const *b) return fr_pair_cmp_by_parent_num(my_a, my_b); } -/** Check received DHCP request is valid and build fr_radius_packet_t structure if it is +/** Check received DHCP request is valid and build fr_packet_t structure if it is * * @param data pointer to received packet. * @param data_len length of received data, and then length of the actual DHCP data. diff --git a/src/protocols/dhcpv4/dhcpv4.h b/src/protocols/dhcpv4/dhcpv4.h index 8bc8ef111ad..cd584b95c8f 100644 --- a/src/protocols/dhcpv4/dhcpv4.h +++ b/src/protocols/dhcpv4/dhcpv4.h @@ -160,7 +160,7 @@ typedef struct { int8_t fr_dhcpv4_attr_cmp(void const *a, void const *b); bool fr_dhcpv4_ok(uint8_t const *data, ssize_t data_len, uint8_t *message_type, uint32_t *xid); -fr_radius_packet_t *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len); +fr_packet_t *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len); bool fr_dhcpv4_is_encodable(void const *item, void const *uctx); void *fr_dhcpv4_next_encodable(fr_dlist_head_t *list, void *to_eval, void *uctx); ssize_t fr_dhcpv4_encode(uint8_t *buffer, size_t buflen, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_list_t *vps); @@ -192,7 +192,7 @@ uint8_t const *fr_dhcpv4_packet_get_option(dhcp_packet_t const *packet, size_t p int fr_dhcpv4_decode(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len, unsigned int *code); -int fr_dhcpv4_packet_encode(fr_radius_packet_t *packet, fr_pair_list_t *list); +int fr_dhcpv4_packet_encode(fr_packet_t *packet, fr_pair_list_t *list); #ifdef HAVE_LINUX_IF_PACKET_H /* @@ -202,10 +202,10 @@ int fr_dhcpv4_packet_encode(fr_radius_packet_t *packet, fr_pair_list_t *list); int fr_dhcpv4_raw_socket_open(struct sockaddr_ll *p_ll, int iface_index); int fr_dhcpv4_raw_packet_send(int sockfd, struct sockaddr_ll *p_ll, - fr_radius_packet_t *packet, fr_pair_list_t *list); + fr_packet_t *packet, fr_pair_list_t *list); -fr_radius_packet_t *fr_dhcpv4_raw_packet_recv(int sockfd, struct sockaddr_ll *p_ll, - fr_radius_packet_t *request, fr_pair_list_t *list); +fr_packet_t *fr_dhcpv4_raw_packet_recv(int sockfd, struct sockaddr_ll *p_ll, + fr_packet_t *request, fr_pair_list_t *list); #endif /* @@ -215,16 +215,16 @@ fr_radius_packet_t *fr_dhcpv4_raw_packet_recv(int sockfd, struct sockaddr_ll *p_ /* * Use fr_pcap_init and fr_pcap_open to create/open handles. */ -fr_radius_packet_t *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap); +fr_packet_t *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap); -int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, fr_radius_packet_t *packet); +int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, fr_packet_t *packet); #endif /* * udp.c */ -fr_radius_packet_t *fr_dhcpv4_udp_packet_recv(int sockfd); -int fr_dhcpv4_udp_packet_send(fr_radius_packet_t *packet); +fr_packet_t *fr_dhcpv4_udp_packet_recv(int sockfd); +int fr_dhcpv4_udp_packet_send(fr_packet_t *packet); #ifdef __cplusplus } diff --git a/src/protocols/dhcpv4/packet.c b/src/protocols/dhcpv4/packet.c index 79a3c8e25d1..28c98867de1 100644 --- a/src/protocols/dhcpv4/packet.c +++ b/src/protocols/dhcpv4/packet.c @@ -370,7 +370,7 @@ int fr_dhcpv4_decode(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, return 0; } -int fr_dhcpv4_packet_encode(fr_radius_packet_t *packet, fr_pair_list_t *list) +int fr_dhcpv4_packet_encode(fr_packet_t *packet, fr_pair_list_t *list) { ssize_t len; fr_pair_t *vp; @@ -398,9 +398,9 @@ int fr_dhcpv4_packet_encode(fr_radius_packet_t *packet, fr_pair_list_t *list) return 0; } -fr_radius_packet_t *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len) +fr_packet_t *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len) { - fr_radius_packet_t *packet; + fr_packet_t *packet; uint32_t magic; uint8_t const *code; diff --git a/src/protocols/dhcpv4/pcap.c b/src/protocols/dhcpv4/pcap.c index 3e3c374c246..47dee0495a1 100644 --- a/src/protocols/dhcpv4/pcap.c +++ b/src/protocols/dhcpv4/pcap.c @@ -37,7 +37,7 @@ * - -1 on failure. * - 0 on success. */ -int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, fr_radius_packet_t *packet) +int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, fr_packet_t *packet) { int ret; uint8_t dhcp_packet[1518] = { 0 }; @@ -107,10 +107,10 @@ int fr_dhcpv4_pcap_send(fr_pcap_t *pcap, uint8_t *dst_ether_addr, fr_radius_pack * * @param pcap handle * @return - * - pointer to fr_radius_packet_t if successful. + * - pointer to fr_packet_t if successful. * - NULL if failed. */ -fr_radius_packet_t *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap) +fr_packet_t *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap) { int ret; @@ -120,7 +120,7 @@ fr_radius_packet_t *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap) uint16_t src_port, dst_port; struct pcap_pkthdr *header; ssize_t link_len, len; - fr_radius_packet_t *packet; + fr_packet_t *packet; /* * Pointers into the packet data we just received diff --git a/src/protocols/dhcpv4/raw.c b/src/protocols/dhcpv4/raw.c index e93ce081ac3..f565e5dc52a 100644 --- a/src/protocols/dhcpv4/raw.c +++ b/src/protocols/dhcpv4/raw.c @@ -99,7 +99,7 @@ int fr_dhcpv4_raw_socket_open(struct sockaddr_ll *link_layer, int ifindex) * - -1 on failure. */ int fr_dhcpv4_raw_packet_send(int sockfd, struct sockaddr_ll *link_layer, - fr_radius_packet_t *packet, fr_pair_list_t *list) + fr_packet_t *packet, fr_pair_list_t *list) { uint8_t dhcp_packet[1518] = { 0 }; ethernet_header_t *eth_hdr = (ethernet_header_t *)dhcp_packet; @@ -166,11 +166,11 @@ int fr_dhcpv4_raw_packet_send(int sockfd, struct sockaddr_ll *link_layer, * * FIXME: split this into two, recv_raw_packet, and verify(packet, original) */ -fr_radius_packet_t *fr_dhcpv4_raw_packet_recv(int sockfd, struct sockaddr_ll *link_layer, - fr_radius_packet_t *request, fr_pair_list_t *list) +fr_packet_t *fr_dhcpv4_raw_packet_recv(int sockfd, struct sockaddr_ll *link_layer, + fr_packet_t *request, fr_pair_list_t *list) { fr_pair_t *vp; - fr_radius_packet_t *packet; + fr_packet_t *packet; dhcp_packet_t *dhcp_data; uint8_t const *code; uint32_t magic, xid; diff --git a/src/protocols/dhcpv4/udp.c b/src/protocols/dhcpv4/udp.c index 726de435732..ab4ad5ed220 100644 --- a/src/protocols/dhcpv4/udp.c +++ b/src/protocols/dhcpv4/udp.c @@ -38,7 +38,7 @@ * - >= 0 if successful. * - < 0 if failed. */ -int fr_dhcpv4_udp_packet_send(fr_radius_packet_t *packet) +int fr_dhcpv4_udp_packet_send(fr_packet_t *packet) { int ret; struct sockaddr_storage dst; @@ -68,16 +68,16 @@ int fr_dhcpv4_udp_packet_send(fr_radius_packet_t *packet) * * @param sockfd handle. * @return - * - pointer to fr_radius_packet_t if successful. + * - pointer to fr_packet_t if successful. * - NULL if failed. */ -fr_radius_packet_t *fr_dhcpv4_udp_packet_recv(int sockfd) +fr_packet_t *fr_dhcpv4_udp_packet_recv(int sockfd) { struct sockaddr_storage src; struct sockaddr_storage dst; socklen_t sizeof_src; socklen_t sizeof_dst; - fr_radius_packet_t *packet; + fr_packet_t *packet; uint8_t *data; ssize_t data_len; fr_ipaddr_t src_ipaddr, dst_ipaddr; @@ -136,4 +136,3 @@ fr_radius_packet_t *fr_dhcpv4_udp_packet_recv(int sockfd) packet->timestamp = when; return packet; } - diff --git a/src/protocols/radius/client.c b/src/protocols/radius/client.c index af86c1e9645..2dc174d2743 100644 --- a/src/protocols/radius/client.c +++ b/src/protocols/radius/client.c @@ -82,7 +82,7 @@ fr_radius_client_fd_bio_t *fr_radius_client_fd_bio_alloc(TALLOC_CTX *ctx, size_t return my; } -int fr_radius_client_fd_bio_write(fr_radius_client_fd_bio_t *my, UNUSED void *packet_ctx, fr_radius_packet_t *packet, fr_pair_list_t *list) +int fr_radius_client_fd_bio_write(fr_radius_client_fd_bio_t *my, UNUSED void *packet_ctx, fr_packet_t *packet, fr_pair_list_t *list) { ssize_t slen; @@ -131,13 +131,13 @@ static const fr_radius_packet_code_t allowed_replies[FR_RADIUS_CODE_MAX] = { [FR_RADIUS_CODE_PROTOCOL_ERROR] = FR_RADIUS_CODE_PROTOCOL_ERROR, /* Any */ }; -int fr_radius_client_fd_bio_read(fr_bio_packet_t *bio, UNUSED void *packet_ctx, fr_radius_packet_t **packet_p, +int fr_radius_client_fd_bio_read(fr_bio_packet_t *bio, UNUSED void *packet_ctx, fr_packet_t **packet_p, TALLOC_CTX *ctx, fr_pair_list_t *out) { int code; ssize_t slen; fr_radius_client_fd_bio_t *my = talloc_get_type_abort(bio, fr_radius_client_fd_bio_t); - fr_radius_packet_t *packet, *reply; + fr_packet_t *packet, *reply; fr_bio_fd_packet_ctx_t fd_ctx; slen = fr_bio_read(my->common.bio, &fd_ctx, &my->buffer, sizeof(my->buffer)); @@ -227,7 +227,7 @@ int fr_radius_client_fd_bio_read(fr_bio_packet_t *bio, UNUSED void *packet_ctx, /** Release (or cancel) an outgoing packet. * */ -int fr_radius_client_fd_bio_release(fr_bio_packet_t *bio, UNUSED void *packet_ctx, fr_radius_packet_t *packet) +int fr_radius_client_fd_bio_release(fr_bio_packet_t *bio, UNUSED void *packet_ctx, fr_packet_t *packet) { fr_radius_client_fd_bio_t *my = talloc_get_type_abort(bio, fr_radius_client_fd_bio_t); diff --git a/src/protocols/radius/client_priv.h b/src/protocols/radius/client_priv.h index 7c6a7eaf7c0..457fde31edf 100644 --- a/src/protocols/radius/client_priv.h +++ b/src/protocols/radius/client_priv.h @@ -50,8 +50,8 @@ typedef struct { fr_radius_client_fd_bio_t *fr_radius_client_fd_bio_alloc(TALLOC_CTX *ctx, size_t read_size, fr_radius_client_config_t *cfg, fr_bio_fd_config_t const *fd_cfg) CC_HINT(nonnull); -int fr_radius_client_fd_bio_write(fr_radius_client_fd_bio_t *my, void *packet_ctx, fr_radius_packet_t *packet, fr_pair_list_t *list); +int fr_radius_client_fd_bio_write(fr_radius_client_fd_bio_t *my, void *packet_ctx, fr_packet_t *packet, fr_pair_list_t *list); -int fr_radius_client_fd_bio_read(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t **packet_p, TALLOC_CTX *ctx, fr_pair_list_t *list); +int fr_radius_client_fd_bio_read(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t **packet_p, TALLOC_CTX *ctx, fr_pair_list_t *list); -int fr_radius_client_fd_bio_release(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t *packet); +int fr_radius_client_fd_bio_release(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t *packet); diff --git a/src/protocols/radius/client_tcp.c b/src/protocols/radius/client_tcp.c index 6a9d2dbcc25..f30dad0f72c 100644 --- a/src/protocols/radius/client_tcp.c +++ b/src/protocols/radius/client_tcp.c @@ -31,7 +31,7 @@ RCSID("$Id$") /** Allocate an ID, and write one packet. * */ -static int fr_radius_client_tcp_bio_write(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t *packet, fr_pair_list_t *list) +static int fr_radius_client_tcp_bio_write(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t *packet, fr_pair_list_t *list) { fr_radius_client_fd_bio_t *my = talloc_get_type_abort(bio, fr_radius_client_fd_bio_t); diff --git a/src/protocols/radius/client_udp.c b/src/protocols/radius/client_udp.c index e6589e1e10c..a329889148f 100644 --- a/src/protocols/radius/client_udp.c +++ b/src/protocols/radius/client_udp.c @@ -31,7 +31,7 @@ RCSID("$Id$") /** Allocate an ID, and write one packet. * */ -static int fr_radius_client_udp_bio_write(fr_bio_packet_t *bio, void *packet_ctx, fr_radius_packet_t *packet, fr_pair_list_t *list) +static int fr_radius_client_udp_bio_write(fr_bio_packet_t *bio, void *packet_ctx, fr_packet_t *packet, fr_pair_list_t *list) { ssize_t slen; fr_radius_client_fd_bio_t *my = talloc_get_type_abort(bio, fr_radius_client_fd_bio_t); @@ -65,6 +65,3 @@ fr_bio_packet_t *fr_radius_client_udp_bio_alloc(TALLOC_CTX *ctx, fr_radius_clien return (fr_bio_packet_t *) my; } - - - diff --git a/src/protocols/radius/id.c b/src/protocols/radius/id.c index 409f9fe5aaf..3b8b634aa59 100644 --- a/src/protocols/radius/id.c +++ b/src/protocols/radius/id.c @@ -32,15 +32,15 @@ struct fr_radius_id_s { int free_start; int free_end; - fr_radius_packet_t *packet[256]; //!< pointer to packet data - + fr_packet_t *packet[256]; //!< pointer to packet data + int free_ids[256]; }; /** Allocate a tracking structure for one packet code. - * + * */ fr_radius_id_t *fr_radius_id_alloc(TALLOC_CTX *ctx) { @@ -62,9 +62,9 @@ fr_radius_id_t *fr_radius_id_alloc(TALLOC_CTX *ctx) } /** Allocate an ID for a packet, using LRU - * + * */ -int fr_radius_id_pop(fr_radius_id_t *track, fr_radius_packet_t *packet) +int fr_radius_id_pop(fr_radius_id_t *track, fr_packet_t *packet) { int id; @@ -89,9 +89,9 @@ int fr_radius_id_pop(fr_radius_id_t *track, fr_radius_packet_t *packet) } /** De-allocate an ID for a packet, using LRU - * + * */ -int fr_radius_id_push(fr_radius_id_t *track, fr_radius_packet_t const *packet) +int fr_radius_id_push(fr_radius_id_t *track, fr_packet_t const *packet) { fr_assert(packet->id >= 0); fr_assert(packet->id < 256); @@ -114,7 +114,7 @@ int fr_radius_id_push(fr_radius_id_t *track, fr_radius_packet_t const *packet) return 0; } -fr_radius_packet_t *fr_radius_id_find(fr_radius_id_t *track, int id) +fr_packet_t *fr_radius_id_find(fr_radius_id_t *track, int id) { fr_assert(id >= 0); fr_assert(id < 256); diff --git a/src/protocols/radius/id.h b/src/protocols/radius/id.h index 603e80d1b03..330636b6633 100644 --- a/src/protocols/radius/id.h +++ b/src/protocols/radius/id.h @@ -33,11 +33,11 @@ typedef fr_radius_id_t *fr_radius_code_id_t[FR_RADIUS_CODE_MAX]; fr_radius_id_t *fr_radius_id_alloc(TALLOC_CTX *ctx); -int fr_radius_id_pop(fr_radius_id_t *track, fr_radius_packet_t *packet) CC_HINT(nonnull); +int fr_radius_id_pop(fr_radius_id_t *track, fr_packet_t *packet) CC_HINT(nonnull); -int fr_radius_id_push(fr_radius_id_t *track, fr_radius_packet_t const *packet) CC_HINT(nonnull); +int fr_radius_id_push(fr_radius_id_t *track, fr_packet_t const *packet) CC_HINT(nonnull); -fr_radius_packet_t *fr_radius_id_find(fr_radius_id_t *track, int id) CC_HINT(nonnull); +fr_packet_t *fr_radius_id_find(fr_radius_id_t *track, int id) CC_HINT(nonnull); static inline CC_HINT(nonnull) int fr_radius_code_id_alloc(TALLOC_CTX *ctx, fr_radius_code_id_t codes, int code) { @@ -52,7 +52,7 @@ static inline CC_HINT(nonnull) int fr_radius_code_id_alloc(TALLOC_CTX *ctx, fr_r return 0; } -static inline CC_HINT(nonnull) int fr_radius_code_id_pop(fr_radius_code_id_t codes, fr_radius_packet_t *packet) +static inline CC_HINT(nonnull) int fr_radius_code_id_pop(fr_radius_code_id_t codes, fr_packet_t *packet) { fr_assert(packet->code > 0); fr_assert(packet->code < FR_RADIUS_CODE_MAX); @@ -62,7 +62,7 @@ static inline CC_HINT(nonnull) int fr_radius_code_id_pop(fr_radius_code_id_t cod return fr_radius_id_pop(codes[packet->code], packet); } -static inline CC_HINT(nonnull) int fr_radius_code_id_push(fr_radius_code_id_t codes, fr_radius_packet_t const *packet) +static inline CC_HINT(nonnull) int fr_radius_code_id_push(fr_radius_code_id_t codes, fr_packet_t const *packet) { fr_assert(packet->code > 0); fr_assert(packet->code < FR_RADIUS_CODE_MAX); @@ -72,7 +72,7 @@ static inline CC_HINT(nonnull) int fr_radius_code_id_push(fr_radius_code_id_t co return fr_radius_id_push(codes[packet->code], packet); } -static inline CC_HINT(nonnull) fr_radius_packet_t *fr_radius_code_id_find(fr_radius_code_id_t codes, int code, int id) +static inline CC_HINT(nonnull) fr_packet_t *fr_radius_code_id_find(fr_radius_code_id_t codes, int code, int id) { fr_assert(code > 0); fr_assert(code < FR_RADIUS_CODE_MAX); @@ -81,4 +81,3 @@ static inline CC_HINT(nonnull) fr_radius_packet_t *fr_radius_code_id_find(fr_rad return fr_radius_id_find(codes[code], id); } - diff --git a/src/protocols/radius/list.c b/src/protocols/radius/list.c index 749b2bfec80..3d7a602f296 100644 --- a/src/protocols/radius/list.c +++ b/src/protocols/radius/list.c @@ -42,7 +42,7 @@ RCSID("$Id$") */ int8_t fr_packet_cmp(void const *a_v, void const *b_v) { - fr_radius_packet_t const *a = a_v, *b = b_v; + fr_packet_t const *a = a_v, *b = b_v; int8_t ret; /* @@ -69,8 +69,8 @@ int8_t fr_packet_cmp(void const *a_v, void const *b_v) /* * Create a fake "request" from a reply, for later lookup. */ -void fr_request_from_reply(fr_radius_packet_t *request, - fr_radius_packet_t const *reply) +void fr_request_from_reply(fr_packet_t *request, + fr_packet_t const *reply) { fr_socket_addr_swap(&request->socket, &reply->socket); request->id = reply->id; @@ -280,7 +280,7 @@ fr_packet_list_t *fr_packet_list_create(int alloc_id) pl = talloc_zero(NULL, fr_packet_list_t); if (!pl) return NULL; - pl->tree = fr_rb_inline_alloc(pl, fr_radius_packet_t, node, fr_packet_cmp, NULL); /* elements not talloc safe */ + pl->tree = fr_rb_inline_alloc(pl, fr_packet_t, node, fr_packet_cmp, NULL); /* elements not talloc safe */ if (!pl->tree) { fr_packet_list_free(pl); return NULL; @@ -301,14 +301,14 @@ fr_packet_list_t *fr_packet_list_create(int alloc_id) * be called before inserting the packet into the list! */ bool fr_packet_list_insert(fr_packet_list_t *pl, - fr_radius_packet_t *request) + fr_packet_t *request) { if (!pl || !request) return 0; return fr_rb_insert(pl->tree, request); } -fr_radius_packet_t *fr_packet_list_find(fr_packet_list_t *pl, fr_radius_packet_t *request) +fr_packet_t *fr_packet_list_find(fr_packet_list_t *pl, fr_packet_t *request) { if (!pl || !request) return 0; @@ -320,9 +320,9 @@ fr_radius_packet_t *fr_packet_list_find(fr_packet_list_t *pl, fr_radius_packet_t * This presumes that the reply has dst_ipaddr && dst_port set up * correctly (i.e. real IP, or "*"). */ -fr_radius_packet_t *fr_packet_list_find_byreply(fr_packet_list_t *pl, fr_radius_packet_t *reply) +fr_packet_t *fr_packet_list_find_byreply(fr_packet_list_t *pl, fr_packet_t *reply) { - fr_radius_packet_t my_request, *request; + fr_packet_t my_request, *request; fr_packet_socket_t *ps; if (!pl || !reply) return NULL; @@ -358,7 +358,7 @@ fr_radius_packet_t *fr_packet_list_find_byreply(fr_packet_list_t *pl, fr_radius_ } -bool fr_packet_list_yank(fr_packet_list_t *pl, fr_radius_packet_t *request) +bool fr_packet_list_yank(fr_packet_list_t *pl, fr_packet_t *request) { if (!pl || !request) return false; @@ -393,7 +393,7 @@ uint32_t fr_packet_list_num_elements(fr_packet_list_t *pl) * should be used. */ bool fr_packet_list_id_alloc(fr_packet_list_t *pl, int proto, - fr_radius_packet_t *request, void **pctx) + fr_packet_t *request, void **pctx) { int i, j, k, fd, id, start_i, start_j, start_k; int src_any = 0; @@ -619,7 +619,7 @@ bool fr_packet_list_id_alloc(fr_packet_list_t *pl, int proto, * any newly inserted entries don't collide with this one. */ bool fr_packet_list_id_free(fr_packet_list_t *pl, - fr_radius_packet_t *request, bool yank) + fr_packet_t *request, bool yank) { fr_packet_socket_t *ps; @@ -669,10 +669,10 @@ int fr_packet_list_fd_set(fr_packet_list_t *pl, fd_set *set) * FIXME: Add socket.fd, if -1, do round-robin, else do socket.fd * IF in fdset. */ -fr_radius_packet_t *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max_attributes, bool require_ma) +fr_packet_t *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max_attributes, bool require_ma) { int start; - fr_radius_packet_t *packet; + fr_packet_t *packet; if (!pl || !set) return NULL; @@ -727,7 +727,7 @@ uint32_t fr_packet_list_num_outgoing(fr_packet_list_t *pl) /* * Debug the packet if requested. */ -void fr_packet_header_log(fr_log_t const *log, fr_radius_packet_t *packet, bool received) +void fr_packet_header_log(fr_log_t const *log, fr_packet_t *packet, bool received) { char src_ipaddr[FR_IPADDR_STRLEN]; char dst_ipaddr[FR_IPADDR_STRLEN]; @@ -798,7 +798,7 @@ void fr_packet_header_log(fr_log_t const *log, fr_radius_packet_t *packet, bool /* * Debug the packet header and all attributes */ -void fr_packet_log(fr_log_t const *log, fr_radius_packet_t *packet, fr_pair_list_t *list, bool received) +void fr_packet_log(fr_log_t const *log, fr_packet_t *packet, fr_pair_list_t *list, bool received) { fr_packet_header_log(log, packet, received); if (fr_debug_lvl >= L_DBG_LVL_1) fr_pair_list_log(log, 4, list); diff --git a/src/protocols/radius/list.h b/src/protocols/radius/list.h index a3216b0fd6d..10a3582415d 100644 --- a/src/protocols/radius/list.h +++ b/src/protocols/radius/list.h @@ -30,24 +30,24 @@ RCSIDH(list_h, "$Id$") #include int8_t fr_packet_cmp(void const *a, void const *b); -void fr_request_from_reply(fr_radius_packet_t *request, - fr_radius_packet_t const *reply); +void fr_request_from_reply(fr_packet_t *request, + fr_packet_t const *reply); typedef struct fr_packet_list_s fr_packet_list_t; fr_packet_list_t *fr_packet_list_create(int alloc_id); void fr_packet_list_free(fr_packet_list_t *pl); -bool fr_packet_list_insert(fr_packet_list_t *pl, fr_radius_packet_t *request_p); +bool fr_packet_list_insert(fr_packet_list_t *pl, fr_packet_t *request_p); -fr_radius_packet_t *fr_packet_list_find(fr_packet_list_t *pl, fr_radius_packet_t *request); -fr_radius_packet_t *fr_packet_list_find_byreply(fr_packet_list_t *pl, fr_radius_packet_t *reply); +fr_packet_t *fr_packet_list_find(fr_packet_list_t *pl, fr_packet_t *request); +fr_packet_t *fr_packet_list_find_byreply(fr_packet_list_t *pl, fr_packet_t *reply); bool fr_packet_list_yank(fr_packet_list_t *pl, - fr_radius_packet_t *request); + fr_packet_t *request); uint32_t fr_packet_list_num_elements(fr_packet_list_t *pl); bool fr_packet_list_id_alloc(fr_packet_list_t *pl, int proto, - fr_radius_packet_t *request_p, void **pctx); + fr_packet_t *request_p, void **pctx); bool fr_packet_list_id_free(fr_packet_list_t *pl, - fr_radius_packet_t *request, bool yank); + fr_packet_t *request, bool yank); bool fr_packet_list_socket_add(fr_packet_list_t *pl, int sockfd, int proto, fr_ipaddr_t *dst_ipaddr, uint16_t dst_port, void *ctx); @@ -55,10 +55,10 @@ bool fr_packet_list_socket_del(fr_packet_list_t *pl, int sockfd); bool fr_packet_list_socket_freeze(fr_packet_list_t *pl, int sockfd); bool fr_packet_list_socket_thaw(fr_packet_list_t *pl, int sockfd); int fr_packet_list_fd_set(fr_packet_list_t *pl, fd_set *set); -fr_radius_packet_t *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max_attributes, bool require_ma); +fr_packet_t *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set, uint32_t max_attributes, bool require_ma); uint32_t fr_packet_list_num_incoming(fr_packet_list_t *pl); uint32_t fr_packet_list_num_outgoing(fr_packet_list_t *pl); -void fr_packet_header_log(fr_log_t const *log, fr_radius_packet_t *packet, bool received); -void fr_packet_log(fr_log_t const *log, fr_radius_packet_t *packet, fr_pair_list_t *list, bool received); +void fr_packet_header_log(fr_log_t const *log, fr_packet_t *packet, bool received); +void fr_packet_log(fr_log_t const *log, fr_packet_t *packet, fr_pair_list_t *list, bool received); diff --git a/src/protocols/radius/packet.c b/src/protocols/radius/packet.c index 9390e3ab0d3..a9a76c20925 100644 --- a/src/protocols/radius/packet.c +++ b/src/protocols/radius/packet.c @@ -18,7 +18,7 @@ * $Id$ * * @file protocols/radius/packet.c - * @brief Functions to deal with fr_radius_packet_t data structures. + * @brief Functions to deal with fr_packet_t data structures. * * @copyright 2000-2017 The FreeRADIUS server project */ @@ -49,8 +49,8 @@ typedef struct { /** Encode a packet * */ -ssize_t fr_radius_packet_encode(fr_radius_packet_t *packet, fr_pair_list_t *list, - fr_radius_packet_t const *original, char const *secret) +ssize_t fr_radius_packet_encode(fr_packet_t *packet, fr_pair_list_t *list, + fr_packet_t const *original, char const *secret) { uint8_t const *original_data; ssize_t slen; @@ -112,7 +112,7 @@ ssize_t fr_radius_packet_encode(fr_radius_packet_t *packet, fr_pair_list_t *list * - True on success. * - False on failure. */ -bool fr_radius_packet_ok(fr_radius_packet_t *packet, uint32_t max_attributes, bool require_ma, decode_fail_t *reason) +bool fr_radius_packet_ok(fr_packet_t *packet, uint32_t max_attributes, bool require_ma, decode_fail_t *reason) { char host_ipaddr[INET6_ADDRSTRLEN]; @@ -136,8 +136,8 @@ bool fr_radius_packet_ok(fr_radius_packet_t *packet, uint32_t max_attributes, bo /** Verify the Request/Response Authenticator (and Message-Authenticator if present) of a packet * */ -int fr_radius_packet_verify(fr_radius_packet_t *packet, fr_radius_packet_t *original, char const *secret) -{ +int fr_radius_packet_verify(fr_packet_t *packet, fr_packet_t *original, char const *secret) +{ char buffer[INET6_ADDRSTRLEN]; if (!packet->data) return -1; @@ -157,7 +157,7 @@ int fr_radius_packet_verify(fr_radius_packet_t *packet, fr_radius_packet_t *orig /** Sign a previously encoded packet * */ -int fr_radius_packet_sign(fr_radius_packet_t *packet, fr_radius_packet_t const *original, +int fr_radius_packet_sign(fr_packet_t *packet, fr_packet_t const *original, char const *secret) { int ret; @@ -184,7 +184,7 @@ int fr_radius_packet_sign(fr_radius_packet_t *packet, fr_radius_packet_t const * /** Wrapper for recvfrom, which handles recvfromto, IPv6, and all possible combinations * */ -static ssize_t rad_recvfrom(int sockfd, fr_radius_packet_t *packet, int flags) +static ssize_t rad_recvfrom(int sockfd, fr_packet_t *packet, int flags) { ssize_t data_len; @@ -205,13 +205,13 @@ static ssize_t rad_recvfrom(int sockfd, fr_radius_packet_t *packet, int flags) } -/** Receive UDP client requests, and fill in the basics of a fr_radius_packet_t structure +/** Receive UDP client requests, and fill in the basics of a fr_packet_t structure * */ -fr_radius_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma) +fr_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, uint32_t max_attributes, bool require_ma) { ssize_t data_len; - fr_radius_packet_t *packet; + fr_packet_t *packet; /* * Allocate the new request data structure @@ -294,8 +294,8 @@ fr_radius_packet_t *fr_radius_packet_recv(TALLOC_CTX *ctx, int fd, int flags, ui * * Also attach reply attribute value pairs and any user message provided. */ -int fr_radius_packet_send(fr_radius_packet_t *packet, fr_pair_list_t *list, - fr_radius_packet_t const *original, char const *secret) +int fr_radius_packet_send(fr_packet_t *packet, fr_pair_list_t *list, + fr_packet_t const *original, char const *secret) { /* * Maybe it's a fake packet. Don't send it. @@ -352,7 +352,7 @@ int fr_radius_packet_send(fr_radius_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_radius_packet_t const *packet, char const *file, int line) +void _fr_radius_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]; diff --git a/src/protocols/radius/radius.h b/src/protocols/radius/radius.h index 0e7f3168618..6ab24ea3a14 100644 --- a/src/protocols/radius/radius.h +++ b/src/protocols/radius/radius.h @@ -188,24 +188,24 @@ void fr_radius_global_free(void); /* * protocols/radius/packet.c */ -ssize_t fr_radius_packet_encode(fr_radius_packet_t *packet, fr_pair_list_t *list, - fr_radius_packet_t const *original, +ssize_t fr_radius_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_radius_packet_t *packet, uint32_t max_attributes, bool require_ma, +bool fr_radius_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_radius_packet_t *packet, fr_radius_packet_t *original, +int fr_radius_packet_verify(fr_packet_t *packet, fr_packet_t *original, char const *secret) CC_HINT(nonnull (1,3)); -int fr_radius_packet_sign(fr_radius_packet_t *packet, fr_radius_packet_t const *original, +int fr_radius_packet_sign(fr_packet_t *packet, fr_packet_t const *original, char const *secret) CC_HINT(nonnull (1,3)); -fr_radius_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_radius_packet_t *packet, fr_pair_list_t *list, - fr_radius_packet_t const *original, char const *secret) CC_HINT(nonnull (1,2,4)); +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 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_radius_packet_t const *packet, char const *file, int line) CC_HINT(nonnull); +void _fr_radius_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 diff --git a/src/protocols/radius/tcp.c b/src/protocols/radius/tcp.c index 74eea4a40ff..bbcff289a19 100644 --- a/src/protocols/radius/tcp.c +++ b/src/protocols/radius/tcp.c @@ -28,9 +28,9 @@ RCSID("$Id$") #include #include "tcp.h" -fr_radius_packet_t *fr_tcp_recv(int sockfd, int flags) +fr_packet_t *fr_tcp_recv(int sockfd, int flags) { - fr_radius_packet_t *packet = fr_radius_packet_alloc(NULL, false); + fr_packet_t *packet = fr_radius_packet_alloc(NULL, false); if (!packet) return NULL; @@ -45,7 +45,7 @@ fr_radius_packet_t *fr_tcp_recv(int sockfd, int flags) } /* - * Receives a packet, assuming that the fr_radius_packet_t structure + * Receives a packet, assuming that the fr_packet_t structure * has been filled out already. * * This ASSUMES that the packet is allocated && fields @@ -57,7 +57,7 @@ fr_radius_packet_t *fr_tcp_recv(int sockfd, int flags) * Calling this function MAY change sockfd, * if src_ipaddr.af == AF_UNSPEC. */ -int fr_tcp_read_packet(fr_radius_packet_t *packet, uint32_t max_attributes, bool require_ma) +int fr_tcp_read_packet(fr_packet_t *packet, uint32_t max_attributes, bool require_ma) { ssize_t len; diff --git a/src/protocols/radius/tcp.h b/src/protocols/radius/tcp.h index 08673e3078a..7e7ab6d7540 100644 --- a/src/protocols/radius/tcp.h +++ b/src/protocols/radius/tcp.h @@ -25,5 +25,5 @@ */ RCSIDH(tcp_h, "$Id$") -int fr_tcp_read_packet(fr_radius_packet_t *packet, uint32_t max_attributes, bool require_ma); -fr_radius_packet_t *fr_tcp_recv(int sockfd, int flags); +int fr_tcp_read_packet(fr_packet_t *packet, uint32_t max_attributes, bool require_ma); +fr_packet_t *fr_tcp_recv(int sockfd, int flags);