Skip to content

Commit

Permalink
added some socket options - see changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ZerBea committed Sep 2, 2019
1 parent 90aa960 commit d8a3a4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
02.09.2019
==========
hcxdumptool : added bind() ll.sll_pkttype = PACKET_OTHERHOST | PACKET_OUTGOING
added setsockopt() r.mr_type = PACKET_MR_PROMISC


01.09.2019
==========
hcxdumptool : print additional information about interfering services
Expand Down
7 changes: 7 additions & 0 deletions hcxdumptool.c
Original file line number Diff line number Diff line change
Expand Up @@ -4931,6 +4931,7 @@ static struct ifreq ifr;
static struct iwreq iwr;
static struct sockaddr_ll ll;
static struct ethtool_perm_addr *epmaddr;
static struct packet_mreq mr;

fd_socket = 0;
fd_socket_gpsd = 0;
Expand Down Expand Up @@ -5044,12 +5045,18 @@ ll.sll_family = AF_PACKET;
ll.sll_ifindex = ifr.ifr_ifindex;
ll.sll_protocol = htons(ETH_P_ALL);
ll.sll_halen = ETH_ALEN;
ll.sll_pkttype = PACKET_OTHERHOST | PACKET_OUTGOING;
if(bind(fd_socket, (struct sockaddr*) &ll, sizeof(ll)) < 0)
{
perror("failed to bind socket");
return false;
}

memset(&mr, 0, sizeof(mr));
mr.mr_ifindex = ifr.ifr_ifindex;
mr.mr_type = PACKET_MR_PROMISC;
setsockopt(fd_socket, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr, sizeof(mr));

epmaddr = malloc(sizeof(struct ethtool_perm_addr) +6);
if (!epmaddr)
{
Expand Down

0 comments on commit d8a3a4b

Please sign in to comment.