Collect only ARP packets
This commit is contained in:
parent
46d057aab9
commit
599ce82e34
2 changed files with 2 additions and 2 deletions
|
@ -46,7 +46,7 @@ int main(int argc, char **argv)
|
||||||
(to build it ourselves, we could have used SOCK_RAW)
|
(to build it ourselves, we could have used SOCK_RAW)
|
||||||
ETH_P_ALL: We want to listen to every EtherType (here, we could
|
ETH_P_ALL: We want to listen to every EtherType (here, we could
|
||||||
also have chosen ETH_P_ARP) */
|
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) {
|
if (sockfd < 0) {
|
||||||
perror("[FAIL] socket()");
|
perror("[FAIL] socket()");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -37,7 +37,7 @@ int main(int argc, char **argv)
|
||||||
(to build it ourselves, we could have used SOCK_RAW)
|
(to build it ourselves, we could have used SOCK_RAW)
|
||||||
ETH_P_ALL: We want to listen to every EtherType (here, we could
|
ETH_P_ALL: We want to listen to every EtherType (here, we could
|
||||||
also have chosen ETH_P_ARP) */
|
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) {
|
if (sockfd < 0) {
|
||||||
perror("[FAIL] socket()");
|
perror("[FAIL] socket()");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue