diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-02-16 20:23:13 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-02-16 20:23:13 +0100 |
| commit | c0f18fb9b102ddd67183da5f0e6f16dc1c866ad9 (patch) | |
| tree | addfb6d974c04330be6e1c7cc29f1b9b2ee9ae0a | |
| parent | 30d8a9904de544ba14e5cc92b41244867e4c848e (diff) | |
| download | dnsniff-c0f18fb9b102ddd67183da5f0e6f16dc1c866ad9.tar.gz dnsniff-c0f18fb9b102ddd67183da5f0e6f16dc1c866ad9.zip | |
Small fixes
| -rw-r--r-- | dnsniff.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -18,6 +18,7 @@ #include <stdint.h> #include <stdbool.h> +#define PACKETBUFLEN (1024 * 1024) #define HDRLEN (sizeof(struct ethhdr) + sizeof(struct iphdr) + sizeof(struct udphdr)) struct dnshdr { @@ -74,7 +75,7 @@ static int sock, ifid; void usage(void) { - printf("Usage: dnsniff INTERFACE\n"); + printf("Usage: dnsniff IFACE\n"); exit(0); } @@ -238,7 +239,7 @@ main(int argc, const char **argv) if (argc != 2) usage(); ifname = argv[1]; - buf = malloc(1024 * 1024); + buf = malloc(PACKETBUFLEN); if (!buf) err(1, "malloc"); sniff_init(ifname); @@ -246,7 +247,7 @@ main(int argc, const char **argv) flt.dst_ip = 0; flt.src_ip = 0; flt.dst_port = htons(53); - while (sniff(&pkt, &flt, buf, 1024 * 1024)) { + while (sniff(&pkt, &flt, buf, PACKETBUFLEN)) { inet_ntop(AF_INET, (struct in_addr *) &pkt.ip->saddr, src_ip, INET_ADDRSTRLEN); inet_ntop(AF_INET, (struct in_addr *) &pkt.ip->daddr, |
