diff options
Diffstat (limited to 'dnsniff.c')
| -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, |
