diff -r 119553d296d2 -r c10fb90893b9 arpd/arpd.patch --- a/arpd/arpd.patch Thu Oct 04 20:26:02 2012 +0200 +++ b/arpd/arpd.patch Thu Oct 04 20:30:05 2012 +0200 @@ -1,5 +1,15 @@ +Index: arpd.c --- arpd.c.dist 2003-07-02 16:49:31.000000000 +0200 +++ arpd.c 2003-07-02 16:53:25.000000000 +0200 +@@ -33,7 +33,7 @@ + #define ARPD_MAX_ACTIVE 600 + #define ARPD_MAX_INACTIVE 300 + +-#define PIDFILE "/var/run/arpd.pid" ++#define PIDFILE "/opsw/var/arpd/arpd.pid" + + struct arp_req { + struct addr pa; @@ -111,9 +111,11 @@ struct in_addr in; ip_addr_t istart, iend; @@ -14,7 +24,43 @@ if (second == NULL) errx(1, "%s: Invalid network range: %s", __func__, p); -@@ -267,7 +267,7 @@ +@@ -185,7 +187,7 @@ + arpd_init(char *dev, int naddresses, char **addresses) + { + struct bpf_program fcode; +- char filter[1024], ebuf[PCAP_ERRBUF_SIZE], *dst; ++ char filter[1024], ebuf[PCAP_ERRBUF_SIZE], *dst, *iface; + intf_t *intf; + + dst = arpd_expandips(naddresses, addresses); +@@ -203,7 +205,16 @@ + errx(1, "pcap_lookupdev: %s", ebuf); + } + arpd_ifent.intf_len = sizeof(arpd_ifent); +- strncpy(arpd_ifent.intf_name, dev, sizeof(arpd_ifent.intf_name) - 1); ++ ++ /* mitigate slash paths in OS that provide */ ++ /* network devices in subdirectories of /dev */ ++ iface = strrchr(dev, '/'); ++ if (iface) ++ iface += sizeof(char); ++ else ++ iface = dev; ++ ++ strncpy(arpd_ifent.intf_name, iface, sizeof(arpd_ifent.intf_name) - 1); + arpd_ifent.intf_name[sizeof(arpd_ifent.intf_name) - 1] = '\0'; + + if (intf_get(intf, &arpd_ifent) < 0) +@@ -218,7 +229,7 @@ + dst ? "and (" : "", dst ? dst : "", dst ? ")" : "", + addr_ntoa(&arpd_ifent.intf_link_addr)); + +- if ((arpd_pcap = pcap_open_live(dev, 128, 0, 500, ebuf)) == NULL) ++ if ((arpd_pcap = pcap_open_live(iface, 128, 0, 500, ebuf)) == NULL) + errx(1, "pcap_open_live: %s", ebuf); + + if (pcap_compile(arpd_pcap, &fcode, filter, 1, 0) < 0 || +@@ -265,7 +276,7 @@ spa->addr_ip, tha->addr_eth, tpa->addr_ip); if (op == ARP_OP_REQUEST) { @@ -23,7 +69,7 @@ addr_ntoa(tpa), addr_ntoa(spa)); } else if (op == ARP_OP_REPLY) { syslog(LOG_INFO, "arp reply %s is-at %s", -@@ -284,7 +284,7 @@ +@@ -282,7 +293,7 @@ int error; if (addr_cmp(addr, &arpd_ifent.intf_addr) == 0) { @@ -32,7 +78,7 @@ addr_ntoa(addr), addr_ntoa(&arpd_ifent.intf_link_addr)); return (0); } -@@ -293,10 +293,10 @@ +@@ -291,10 +302,10 @@ error = arp_get(arpd_arp, &arpent); if (error == -1) { @@ -45,7 +91,7 @@ addr_ntoa(addr), addr_ntoa(&arpent.arp_ha)); } return (error); -@@ -425,7 +425,7 @@ +@@ -423,7 +434,7 @@ if ((req = SPLAY_FIND(tree, &arpd_reqs, &tmp)) != NULL) { addr_pack(&src.arp_ha, ADDR_TYPE_ETH, ETH_ADDR_BITS, ethip->ar_sha, ETH_ADDR_LEN); @@ -54,3 +100,29 @@ addr_ntoa(&req->pa), addr_ntoa(&src.arp_ha)); /* This address is claimed */ +@@ -445,9 +456,6 @@ + void + terminate_handler(int sig) + { +- extern int event_gotsig; +- +- event_gotsig = 1; + arpd_sig = sig; + } + +@@ -464,7 +472,6 @@ + main(int argc, char *argv[]) + { + struct event recv_ev; +- extern int (*event_sigcb)(void); + char *dev; + int c, debug; + FILE *fp; +@@ -524,7 +531,6 @@ + perror("signal"); + return (-1); + } +- event_sigcb = arpd_signal; + + event_dispatch(); +