![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Capture, filter, and generate statistics for RADIUS traffic. More...
#include <fcntl.h>#include <time.h>#include <math.h>#include <freeradius-devel/autoconf.h>#include <freeradius-devel/radius/list.h>#include <freeradius-devel/util/conf.h>#include <freeradius-devel/util/event.h>#include <freeradius-devel/util/file.h>#include <freeradius-devel/util/syserror.h>#include <freeradius-devel/util/pair_legacy.h>#include <freeradius-devel/util/base16.h>#include <freeradius-devel/util/pcap.h>#include <freeradius-devel/util/timeval.h>#include "radsniff.h"
Include dependency graph for radsniff.c:Go to the source code of this file.
Macros | |
| #define | RS_ASSERT(_x) if (!(_x) && !fr_cond_assert(_x)) exit(1) |
| #define | RS_CLEANUP_NOW(_x, _s) |
Functions | |
| static int | _request_free (rs_request_t *request) |
| static void | _rs_event (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now, void *ctx) |
| static int | _rs_event_status (UNUSED fr_time_t now, fr_time_delta_t wake_t, UNUSED void *uctx) |
| static void | _unmark_link (void *request) |
| Callback for when the request is removed from the link tree. | |
| static void | _unmark_request (void *request) |
| Callback for when the request is removed from the request tree. | |
| int | main (int argc, char *argv[]) |
| static int | rs_build_dict_list (fr_dict_attr_t const **out, size_t len, char *list) |
| static int | rs_build_event_flags (int *flags, fr_table_num_sorted_t const *map, size_t map_len, char *list) |
| static int | rs_build_filter (fr_pair_list_t *out, char const *filter) |
| static int | rs_check_pcap_drop (fr_pcap_t *in) |
| Query libpcap to see if it dropped any packets. | |
| static void | rs_daemonize (char const *pidfile) |
| Fork and kill the parent process, writing out our PID. | |
| static int | rs_get_pairs (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_pair_list_t *vps, fr_dict_attr_t const *da[], int num) |
| Copy a subset of attributes from one list into the other. | |
| static void | rs_got_packet (fr_event_list_t *el, int fd, UNUSED int flags, void *ctx) |
| static int | rs_install_stats_processor (rs_stats_t *stats, fr_event_list_t *el, fr_pcap_t *in, struct timeval *now, bool live) |
| static void | rs_packet_cleanup (rs_request_t *request) |
| static int8_t | rs_packet_cmp (void const *one, void const *two) |
| Wrapper around fr_packet_cmp to strip off the outer request struct. | |
| static void | rs_packet_print (rs_request_t *request, uint64_t count, rs_status_t status, fr_pcap_t *handle, fr_packet_t *packet, fr_pair_list_t *list, struct timeval *elapsed, struct timeval *latency, bool response, bool body) |
| static void | rs_packet_print_csv (uint64_t count, rs_status_t status, fr_pcap_t *handle, fr_packet_t *packet, fr_pair_list_t *list, UNUSED struct timeval *elapsed, struct timeval *latency, UNUSED bool response, bool body) |
| static void | rs_packet_print_csv_header (void) |
| static void | rs_packet_print_fancy (uint64_t count, rs_status_t status, fr_pcap_t *handle, fr_packet_t *packet, fr_pair_list_t *list, struct timeval *elapsed, struct timeval *latency, bool response, bool body) |
| static void | rs_packet_process (uint64_t count, rs_event_t *event, struct pcap_pkthdr const *header, uint8_t const *data) |
| static void | rs_packet_save_in_output_dir (uint64_t count, UNUSED rs_status_t status, UNUSED fr_pcap_t *handle, fr_packet_t *packet, fr_pair_list_t *list, UNUSED struct timeval *elapsed, UNUSED struct timeval *latency, bool response, bool body) |
| static rs_request_t * | rs_request_alloc (TALLOC_CTX *ctx) |
| static int | rs_request_to_pcap (rs_event_t *event, rs_request_t *request, struct pcap_pkthdr const *header, uint8_t const *data) |
| static int | rs_response_to_pcap (rs_event_t *event, rs_request_t *request, struct pcap_pkthdr const *header, uint8_t const *data) |
| static int8_t | rs_rtx_cmp (void const *one, void const *two) |
| Compare requests using packet info and lists of attributes. | |
| static void | rs_signal_action (UNUSED fr_event_list_t *list, int fd, int UNUSED flags, UNUSED void *ctx) |
| Read the last signal from the signal pipe. | |
| static void | rs_signal_self (int sig) |
| Write the last signal to the signal pipe. | |
| static size_t | rs_snprint_csv (char *out, size_t outlen, char const *in, size_t inlen) |
| static ssize_t | rs_stats_print_code_csv (char *out, size_t outlen, 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_csv (rs_update_t *this, rs_stats_t *stats, UNUSED struct timeval *now) |
| static void | rs_stats_print_csv_header (rs_update_t *this) |
| static void | rs_stats_print_fancy (rs_update_t *this, rs_stats_t *stats, struct timeval *now) |
| static void | rs_stats_process (fr_timer_list_t *tl, fr_time_t now_t, void *ctx) |
| Process stats for a single interval. | |
| static void | rs_stats_process_counters (rs_latency_t *stats) |
| static void | rs_stats_process_latency (rs_latency_t *stats) |
| Update smoothed average. | |
| static void | rs_stats_update_latency (rs_latency_t *stats, struct timeval *latency) |
| Update latency statistics for request/response and forwarded packets. | |
| static void | rs_time_print (char *out, size_t len, struct timeval const *t) |
| static void | rs_tv_add_ms (struct timeval const *start, unsigned long interval, struct timeval *result) |
| static void | timeout_event (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now_t, void *ctx) |
| Exit the event loop after a given timeout. | |
| static NEVER_RETURNS void | usage (int status) |
Variables | |
| static fr_dict_attr_t const * | attr_packet_type |
| static bool | cleanup |
| static rs_t * | conf |
| static fr_dict_t const * | dict_freeradius |
| static fr_dict_t const * | dict_radius |
| static fr_event_list_t * | events |
| static fr_rb_tree_t * | link_tree = NULL |
| static int | packets_count = 1 |
| fr_dict_autoload_t | radsniff_dict [] |
| fr_dict_attr_autoload_t | radsniff_dict_attr [] |
| static char const * | radsniff_version = RADIUSD_VERSION_BUILD("radsniff") |
| static fr_rb_tree_t * | request_tree = NULL |
| static fr_table_num_sorted_t const | rs_events [] |
| static size_t | rs_events_len = NUM_ELEMENTS(rs_events) |
| static int | rs_useful_codes [] |
| static int | self_pipe [2] = {-1, -1} |
| Signals from sig handlers. | |
| static struct timeval | start_pcap = {0, 0} |
| static char | timestr [50] |
| static const uint8_t | zeros [RADIUS_AUTH_VECTOR_LENGTH] = {} |
Capture, filter, and generate statistics for RADIUS traffic.
Definition in file radsniff.c.
| #define RS_ASSERT | ( | _x | ) | if (!(_x) && !fr_cond_assert(_x)) exit(1) |
Definition at line 50 of file radsniff.c.
| #define RS_CLEANUP_NOW | ( | _x, | |
| _s | |||
| ) |
Definition at line 1235 of file radsniff.c.
|
static |
Definition at line 1029 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 1129 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 2021 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Callback for when the request is removed from the link tree.
| request | being removed. |
Definition at line 2171 of file radsniff.c.
Here is the caller graph for this function:
|
static |
Callback for when the request is removed from the request tree.
| request | being removed. |
Definition at line 2161 of file radsniff.c.
Here is the caller graph for this function:| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 2323 of file radsniff.c.
|
static |
Definition at line 2063 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 2132 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 2099 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Query libpcap to see if it dropped any packets.
We need to check to see if libpcap dropped any packets and if it did, we need to stop stats output for long enough for inaccurate statistics to be cleared out.
| in | pcap handle to check. |
Definition at line 551 of file radsniff.c.
Here is the caller graph for this function:
|
static |
Fork and kill the parent process, writing out our PID.
| pidfile | the PID file to write our PID to |
Definition at line 116 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Copy a subset of attributes from one list into the other.
Should be O(n) if all the attributes exist. List must be pre-sorted.
Definition at line 995 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 1928 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 939 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 1058 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Wrapper around fr_packet_cmp to strip off the outer request struct.
Definition at line 1139 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
|
static |
Definition at line 308 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 267 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 382 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 1259 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 477 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 1243 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 1197 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
|
static |
Compare requests using packet info and lists of attributes.
Definition at line 2041 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Read the last signal from the signal pipe.
Definition at line 2225 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Write the last signal to the signal pipe.
| sig | raised |
Definition at line 2214 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 773 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
Definition at line 798 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
Definition at line 678 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Process stats for a single interval.
Definition at line 843 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
Update smoothed average.
Definition at line 579 of file radsniff.c.
Here is the caller graph for this function:
|
static |
Update latency statistics for request/response and forwarded packets.
Definition at line 922 of file radsniff.c.
Here is the caller graph for this function:
|
static |
Definition at line 192 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
Exit the event loop after a given timeout.
Definition at line 2180 of file radsniff.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 2268 of file radsniff.c.
|
static |
Definition at line 102 of file radsniff.c.
|
static |
Definition at line 59 of file radsniff.c.
|
static |
Definition at line 52 of file radsniff.c.
|
static |
Definition at line 92 of file radsniff.c.
|
static |
Definition at line 93 of file radsniff.c.
|
static |
Definition at line 58 of file radsniff.c.
|
static |
Definition at line 57 of file radsniff.c.
|
static |
Definition at line 60 of file radsniff.c.
| fr_dict_autoload_t radsniff_dict |
Definition at line 96 of file radsniff.c.
| fr_dict_attr_autoload_t radsniff_dict_attr |
Definition at line 105 of file radsniff.c.
|
static |
Definition at line 64 of file radsniff.c.
|
static |
Definition at line 56 of file radsniff.c.
|
static |
Definition at line 82 of file radsniff.c.
|
static |
Definition at line 90 of file radsniff.c.
|
static |
Definition at line 66 of file radsniff.c.
|
static |
Signals from sig handlers.
Definition at line 62 of file radsniff.c.
|
static |
Definition at line 53 of file radsniff.c.
|
static |
Definition at line 54 of file radsniff.c.
|
static |
Definition at line 1257 of file radsniff.c.
1.9.8