Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Aug 12, 2024
1 parent 0562a84 commit 82a02d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ww/devices/capture/capture_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,13 @@ static bool netfilterSetQueueLength(int netfilter_socket, uint16_t qnumber, uint
static int netfilterGetPacket(int netfilter_socket, uint16_t qnumber, shift_buffer_t *buff)
{
// Read a message from netlink
char nl_buff[kEthDataLen + sizeof(struct ethhdr) + sizeof(struct nfqnl_msg_packet_hdr)];
char nl_buff[512+kEthDataLen + sizeof(struct ethhdr) + sizeof(struct nfqnl_msg_packet_hdr)];
struct sockaddr_nl nl_addr;
socklen_t nl_addr_len = sizeof(nl_addr);
ssize_t result =
recvfrom(netfilter_socket, nl_buff, sizeof(nl_buff), 0, (struct sockaddr *) &nl_addr, &nl_addr_len);
if (result <= (int) sizeof(struct nlmsghdr))

if (result <= (int) sizeof(struct nlmsghdr))
{
errno = EINVAL;
return -1;
Expand Down Expand Up @@ -274,7 +275,7 @@ static int netfilterGetPacket(int netfilter_socket, uint16_t qnumber, shift_buff
// eth_header->h_proto = htons(ETH_P_IP);

struct iphdr *ip_header = (struct iphdr *) rawBufMut(buff);
memcpy(ip_header, nl_data, nl_data_size);
memmove(ip_header, nl_data, nl_data_size);

return (int) (nl_data_size);
}
Expand Down

0 comments on commit 82a02d3

Please sign in to comment.