Skip to content

Commit

Permalink
af-packet: Error on invalid peer device setting
Browse files Browse the repository at this point in the history
If the copy-iface was set to the same as the af-packet interface, the
peer won't be set. This leads to segfault. Catch it and return properly.

Bug 5870
  • Loading branch information
inashivb committed Jul 27, 2023
1 parent ff8bbda commit 64f2743
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/source-af-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,10 @@ static void AFPWritePacket(Packet *p, int version)
}

/* Index of the network device */
if (p->afp_v.peer == NULL) {
SCLogError("Peer network device invalid");
return;
}
socket_address.sll_ifindex = SC_ATOMIC_GET(p->afp_v.peer->if_idx);
/* Address length*/
socket_address.sll_halen = ETH_ALEN;
Expand Down

0 comments on commit 64f2743

Please sign in to comment.