grp.h \
inttypes.h \
limits.h \
+ linux/if_packet.h \
malloc.h \
netdb.h \
netinet/in.h \
grp.h \
inttypes.h \
limits.h \
+ linux/if_packet.h \
malloc.h \
netdb.h \
netinet/in.h \
/* Define to 1 if you have the <sys/capability.h> header file. */
#undef HAVE_CAPABILITY_H
+/* Define to 1 if you have the <linux/if_packet.h> header file. */
+#undef HAVE_LINUX_IF_PACKET_H
+
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/*
* print an ethernet address in a buffer
*/
-char * ether_addr_print(const uint8_t *addr, char *buf)
+static char * ether_addr_print(const uint8_t *addr, char *buf)
{
sprintf (buf, "%02x:%02x:%02x:%02x:%02x:%02x",
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
uint16_t udp_src_port;
uint16_t udp_dst_port;
size_t dhcp_data_len;
- int retval;
socklen_t sock_len;
- fd_set read_fd;
packet = rad_alloc(NULL, false);
if (!packet) {
/* d. Check DHCP layer data */
dhcp_data_len = data_len - data_offset;
- if (dhcp_data_len < MIN_PACKET_SIZE) DISCARD_RP("DHCP packet is too small (%d < %d)", dhcp_data_len, MIN_PACKET_SIZE);
- if (dhcp_data_len > MAX_PACKET_SIZE) DISCARD_RP("DHCP packet is too large (%d > %d)", dhcp_data_len, MAX_PACKET_SIZE);
+ if (dhcp_data_len < MIN_PACKET_SIZE) DISCARD_RP("DHCP packet is too small (%zu < %d)", dhcp_data_len, MIN_PACKET_SIZE);
+ if (dhcp_data_len > MAX_PACKET_SIZE) DISCARD_RP("DHCP packet is too large (%zu > %d)", dhcp_data_len, MAX_PACKET_SIZE);
dhcp_hdr = (dhcp_packet_t *)(raw_packet + ETH_HDR_SIZE + IP_HDR_SIZE + UDP_HDR_SIZE);
* A real client would pick one of the proposed replies.
* We'll just return the first eligible reply, and display the others.
*/
-static RADIUS_PACKET *fr_dhcp_recv_raw_loop(int sockfd, struct sockaddr_ll *p_ll, RADIUS_PACKET *request_p)
+static RADIUS_PACKET *fr_dhcp_recv_raw_loop(int sockfd_r, struct sockaddr_ll *p_ll, RADIUS_PACKET *request_p)
{
struct timeval tval;
RADIUS_PACKET *reply_p = NULL;
cur_reply_p = NULL;
FD_ZERO(&read_fd);
- FD_SET(sockfd, &read_fd);
- retval = select(sockfd + 1, &read_fd, NULL, NULL, &tval);
+ FD_SET(sockfd_r, &read_fd);
+ retval = select(sockfd_r + 1, &read_fd, NULL, NULL, &tval);
if (retval < 0) {
fr_strerror_printf("Select on DHCP socket failed: %s", fr_syserror(errno));
return NULL;
}
- if ( retval > 0 && FD_ISSET(sockfd, &read_fd)) {
+ if ( retval > 0 && FD_ISSET(sockfd_r, &read_fd)) {
/* There is something to read on our socket */
- cur_reply_p = fr_dhcp_recv_raw_packet(sockfd, p_ll, request_p);
+ cur_reply_p = fr_dhcp_recv_raw_packet(sockfd_r, p_ll, request_p);
}
if (cur_reply_p) {