Collect only ARP packets

This commit is contained in:
Dimitri Lozeve 2016-06-03 16:44:03 +02:00
parent 46d057aab9
commit 599ce82e34
2 changed files with 2 additions and 2 deletions

View file

@ -46,7 +46,7 @@ int main(int argc, char **argv)
(to build it ourselves, we could have used SOCK_RAW)
ETH_P_ALL: We want to listen to every EtherType (here, we could
also have chosen ETH_P_ARP) */
int sockfd = socket(AF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL));
int sockfd = socket(AF_PACKET, SOCK_DGRAM, htons(ETH_P_ARP));
if (sockfd < 0) {
perror("[FAIL] socket()");
exit(EXIT_FAILURE);

View file

@ -37,7 +37,7 @@ int main(int argc, char **argv)
(to build it ourselves, we could have used SOCK_RAW)
ETH_P_ALL: We want to listen to every EtherType (here, we could
also have chosen ETH_P_ARP) */
int sockfd = socket(AF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL));
int sockfd = socket(AF_PACKET, SOCK_DGRAM, htons(ETH_P_ARP));
if (sockfd < 0) {
perror("[FAIL] socket()");
exit(EXIT_FAILURE);