SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

View file

@ -0,0 +1,101 @@
OpenBSD libpcap uses nonstandard "bpf_timeval" variables which are a
different size to timeval on some arch..
This patch is enough to let it build but is incomplete and unlikely to
allow radsniff to actually work.
Index: src/main/radsniff.c
--- src/main/radsniff.c.orig
+++ src/main/radsniff.c
@@ -1003,7 +1003,8 @@ static inline int rs_request_to_pcap(rs_event_t *event
#define RS_CLEANUP_NOW(_x, _s)\
{\
_x->silent_cleanup = _s;\
- _x->when = header->ts;\
+ _x->when.tv_sec = header->ts.tv_sec;\
+ _x->when.tv_usec = header->ts.tv_usec;\
rs_packet_cleanup(_x);\
_x = NULL;\
} while (0)
@@ -1038,10 +1039,12 @@ static void rs_packet_process(uint64_t count, rs_event
memset(&search, 0, sizeof(search));
if (!start_pcap.tv_sec) {
- start_pcap = header->ts;
+ start_pcap.tv_sec = header->ts.tv_sec;
+ start_pcap.tv_usec = header->ts.tv_usec;
}
if (RIDEBUG_ENABLED()) {
+ /* XXX convert pcap timeval */
rs_time_print(timestr, sizeof(timestr), &header->ts);
}
@@ -1135,11 +1138,13 @@ static void rs_packet_process(uint64_t count, rs_event
current = rad_alloc(conf, false);
if (!current) {
REDEBUG("Failed allocating memory to hold decoded packet");
+ /* XXX convert pcap timeval */
rs_tv_add_ms(&header->ts, conf->stats.timeout, &stats->quiet);
return;
}
- current->timestamp = header->ts;
+ current->timestamp.tv_sec = header->ts.tv_sec;
+ current->timestamp.tv_usec = header->ts.tv_usec;
current->data_len = header->caplen - (p - data);
memcpy(&current->data, &p, sizeof(current->data));
@@ -1259,6 +1264,7 @@ static void rs_packet_process(uint64_t count, rs_event
* The delay is so we can detect retransmissions.
*/
original->linked = talloc_steal(original, current);
+ /* XXX convert pcap timeval */
rs_tv_add_ms(&header->ts, conf->stats.timeout, &original->when);
if (!fr_event_insert(event->list, _rs_event, original, &original->when,
&original->event)) {
@@ -1339,6 +1345,7 @@ static void rs_packet_process(uint64_t count, rs_event
search.expect = rad_alloc_reply(current, current);
if (!search.expect) {
REDEBUG("Failed allocating memory to hold expected reply");
+ /* XXX convert pcap timeval */
rs_tv_add_ms(&header->ts, conf->stats.timeout, &stats->quiet);
rad_free(&current);
return;
@@ -1489,7 +1496,9 @@ static void rs_packet_process(uint64_t count, rs_event
/*
* Insert a callback to remove the request from the tree
*/
- original->packet->timestamp = header->ts;
+ original->packet->timestamp.tv_sec = header->ts.tv_sec;
+ original->packet->timestamp.tv_usec = header->ts.tv_usec;
+ /* XXX convert pcap timeval */
rs_tv_add_ms(&header->ts, conf->stats.timeout, &original->when);
if (!fr_event_insert(event->list, _rs_event, original,
&original->when, &original->event)) {
@@ -1510,6 +1519,7 @@ static void rs_packet_process(uint64_t count, rs_event
return;
}
+ /* XXX convert pcap timeval */
rs_tv_sub(&header->ts, &start_pcap, &elapsed);
/*
@@ -1539,6 +1549,7 @@ static void rs_packet_process(uint64_t count, rs_event
* Were filtering on response, now print out the full data from the request
*/
if (conf->filter_response && RIDEBUG_ENABLED() && (conf->event_flags & RS_NORMAL)) {
+ /* XXX convert pcap timeval */
rs_time_print(timestr, sizeof(timestr), &original->packet->timestamp);
rs_tv_sub(&original->packet->timestamp, &start_pcap, &elapsed);
rs_packet_print(original, original->id, RS_NORMAL, original->in,
@@ -1621,7 +1632,8 @@ static void rs_got_packet(fr_event_list_t *el, int fd,
}
do {
- now = header->ts;
+ now.tv_sec = header->ts.tv_sec;
+ now.tv_usec = header->ts.tv_usec;
} while (fr_event_run(el, &now) == 1);
count++;