1 --- arpd/arpd.c Sun Feb 9 05:20:40 2003
2 +++ arpd/arpd.c.new Mon Aug 1 00:50:40 2005
7 - fprintf(stderr, "Usage: arpd [-d] [-i interface] [net]\n");
8 + fprintf(stderr, "Usage: arpd [-d] [-i interface] [-a 'pcap_expr'] [{host|net|range} ...]\n");
16 -arpd_init(char *dev, int naddresses, char **addresses)
17 +arpd_init(char *dev, char *and_pcap_exp, int naddresses, char **addresses)
19 struct bpf_program fcode;
20 char filter[1024], ebuf[PCAP_ERRBUF_SIZE], *dst;
22 errx(1, "bad interface configuration: not IP or Ethernet");
23 arpd_ifent.intf_addr.addr_bits = IP_ADDR_BITS;
25 - snprintf(filter, sizeof(filter), "arp %s%s%s and not ether src %s",
26 + snprintf(filter, sizeof(filter), "arp %s%s%s and not ether src %s%s%s%s",
27 dst ? "and (" : "", dst ? dst : "", dst ? ")" : "",
28 - addr_ntoa(&arpd_ifent.intf_link_addr));
29 + addr_ntoa(&arpd_ifent.intf_link_addr),
30 + and_pcap_exp ? " and (" : "",
31 + and_pcap_exp ? and_pcap_exp : "",
32 + and_pcap_exp ? ")" : ""
35 if ((arpd_pcap = pcap_open_live(dev, 128, 0, 500, ebuf)) == NULL)
36 errx(1, "pcap_open_live: %s", ebuf);
40 extern int (*event_sigcb)(void);
42 + char *dev, *and_pcap_exp;
49 - while ((c = getopt(argc, argv, "di:h?")) != -1) {
50 + while ((c = getopt(argc, argv, "a:di:h?")) != -1) {
59 + and_pcap_exp = optarg;
68 - arpd_init(dev, 0, NULL);
69 + arpd_init(dev, and_pcap_exp, 0, NULL);
71 - arpd_init(dev, argc, argv);
72 + arpd_init(dev, and_pcap_exp, argc, argv);
74 if ((fp = fopen(PIDFILE, "w")) == NULL)