return -1;
}
- fr_packet_log(&default_log, request->packet, &request->request_pairs, false);
+ fr_radius_packet_log(&default_log, request->packet, &request->request_pairs, false);
return 0;
}
*/
if (!rcode) return;
- fr_packet_log(&default_log, reply, &reply_pairs, true);
+ fr_radius_packet_log(&default_log, reply, &reply_pairs, true);
/*
* Increment counters...
return -1;
}
- fr_packet_log(&default_log, request->packet, &request->request_pairs, false);
+ fr_radius_packet_log(&default_log, request->packet, &request->request_pairs, false);
return 0;
}
return 0;
}
- fr_packet_log(&default_log, packet, &my.request_pairs, true);
+ fr_radius_packet_log(&default_log, packet, &my.request_pairs, true);
/*
* Find a Access-Request which has the same User-Name / etc. as this CoA packet.
return 0;
}
- fr_packet_log(&default_log, request->reply, &request->reply_pairs, false);
+ fr_radius_packet_log(&default_log, request->reply, &request->reply_pairs, false);
/*
goto packet_done;
}
PAIR_LIST_VERIFY(&request->reply_pairs);
- fr_packet_log(&default_log, request->reply, &request->reply_pairs, true);
+ fr_radius_packet_log(&default_log, request->reply, &request->reply_pairs, true);
/*
* Increment counters...
/*
* Print the attributes we're about to send
*/
- fr_packet_log(&default_log, packet, &reply_vps, false);
+ fr_radius_packet_log(&default_log, packet, &reply_vps, false);
FD_ZERO(&set); /* clear the set */
FD_SET(fd, &set);
/*
* Print the attributes we received in response
*/
- fr_packet_log(&default_log, reply, &reply_vps, true);
+ fr_radius_packet_log(&default_log, reply, &reply_vps, true);
switch (command) {
case RADSNMP_GET:
return pl->num_outgoing;
}
-
-/*
- * Debug the packet if requested.
- */
-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];
-#ifdef WITH_IFINDEX_NAME_RESOLUTION
- char if_name[IFNAMSIZ];
-#endif
-
- if (!log) return;
- if (!packet) return;
-
- /*
- * Client-specific debugging re-prints the input
- * packet into the client log.
- *
- * This really belongs in a utility library
- */
- if (FR_RADIUS_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
- "%s%s%s"
-#endif
- "length %zu\n",
- received ? "Received" : "Sent",
- fr_radius_packet_name[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),
- packet->socket.inet.src_ipaddr.af == AF_INET6 ? "]" : "",
- packet->socket.inet.src_port,
- packet->socket.inet.dst_ipaddr.af == AF_INET6 ? "[" : "",
- fr_inet_ntop(dst_ipaddr, sizeof(dst_ipaddr), &packet->socket.inet.dst_ipaddr),
- packet->socket.inet.dst_ipaddr.af == AF_INET6 ? "]" : "",
- packet->socket.inet.dst_port,
-#ifdef WITH_IFINDEX_NAME_RESOLUTION
- received ? "via " : "",
- received ? fr_ifname_from_ifindex(if_name, packet->socket.inet.ifindex) : "",
- received ? " " : "",
-#endif
- packet->data_len);
- } else {
- fr_log(log, L_DBG, __FILE__, __LINE__,
- "%s code %u Id %i from %s%s%s:%i to %s%s%s:%i "
-#ifdef WITH_IFINDEX_NAME_RESOLUTION
- "%s%s%s"
-#endif
- "length %zu\n",
- received ? "Received" : "Sent",
- 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),
- packet->socket.inet.src_ipaddr.af == AF_INET6 ? "]" : "",
- packet->socket.inet.src_port,
- packet->socket.inet.dst_ipaddr.af == AF_INET6 ? "[" : "",
- fr_inet_ntop(dst_ipaddr, sizeof(dst_ipaddr), &packet->socket.inet.dst_ipaddr),
- packet->socket.inet.dst_ipaddr.af == AF_INET6 ? "]" : "",
- packet->socket.inet.dst_port,
-#ifdef WITH_IFINDEX_NAME_RESOLUTION
- received ? "via " : "",
- received ? fr_ifname_from_ifindex(if_name, packet->socket.inet.ifindex) : "",
- received ? " " : "",
-#endif
- packet->data_len);
- }
-}
-
-/*
- * Debug the packet header and all attributes
- */
-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);
-#ifndef NDEBUG
- if (fr_debug_lvl >= L_DBG_LVL_4) fr_packet_log_hex(log, packet);
-#endif
-}
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_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);
fr_log(log, L_DBG, file, line, " %s%s\n", buffer, truncated);
}
}
+
+/*
+ * Debug the packet if requested.
+ */
+void fr_radius_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];
+#ifdef WITH_IFINDEX_NAME_RESOLUTION
+ char if_name[IFNAMSIZ];
+#endif
+
+ if (!log) return;
+ if (!packet) return;
+
+ /*
+ * Client-specific debugging re-prints the input
+ * packet into the client log.
+ *
+ * This really belongs in a utility library
+ */
+ if (FR_RADIUS_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
+ "%s%s%s"
+#endif
+ "length %zu\n",
+ received ? "Received" : "Sent",
+ fr_radius_packet_name[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),
+ packet->socket.inet.src_ipaddr.af == AF_INET6 ? "]" : "",
+ packet->socket.inet.src_port,
+ packet->socket.inet.dst_ipaddr.af == AF_INET6 ? "[" : "",
+ fr_inet_ntop(dst_ipaddr, sizeof(dst_ipaddr), &packet->socket.inet.dst_ipaddr),
+ packet->socket.inet.dst_ipaddr.af == AF_INET6 ? "]" : "",
+ packet->socket.inet.dst_port,
+#ifdef WITH_IFINDEX_NAME_RESOLUTION
+ received ? "via " : "",
+ received ? fr_ifname_from_ifindex(if_name, packet->socket.inet.ifindex) : "",
+ received ? " " : "",
+#endif
+ packet->data_len);
+ } else {
+ fr_log(log, L_DBG, __FILE__, __LINE__,
+ "%s code %u Id %i from %s%s%s:%i to %s%s%s:%i "
+#ifdef WITH_IFINDEX_NAME_RESOLUTION
+ "%s%s%s"
+#endif
+ "length %zu\n",
+ received ? "Received" : "Sent",
+ 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),
+ packet->socket.inet.src_ipaddr.af == AF_INET6 ? "]" : "",
+ packet->socket.inet.src_port,
+ packet->socket.inet.dst_ipaddr.af == AF_INET6 ? "[" : "",
+ fr_inet_ntop(dst_ipaddr, sizeof(dst_ipaddr), &packet->socket.inet.dst_ipaddr),
+ packet->socket.inet.dst_ipaddr.af == AF_INET6 ? "]" : "",
+ packet->socket.inet.dst_port,
+#ifdef WITH_IFINDEX_NAME_RESOLUTION
+ received ? "via " : "",
+ received ? fr_ifname_from_ifindex(if_name, packet->socket.inet.ifindex) : "",
+ received ? " " : "",
+#endif
+ packet->data_len);
+ }
+}
+
+/*
+ * Debug the packet header and all attributes
+ */
+void fr_radius_packet_log(fr_log_t const *log, fr_packet_t *packet, fr_pair_list_t *list, bool received)
+{
+ fr_radius_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_packet_log_hex(log, packet);
+#endif
+}
ssize_t fr_radius_decode_foreign(TALLOC_CTX *ctx, fr_pair_list_t *out,
uint8_t const *data, size_t data_len) CC_HINT(nonnull);
+
+void fr_radius_packet_header_log(fr_log_t const *log, fr_packet_t *packet, bool received);
+
+void fr_radius_packet_log(fr_log_t const *log, fr_packet_t *packet, fr_pair_list_t *list, bool received);