diff options
author | wbx <wbx@hydrogenium.(none)> | 2009-05-17 14:41:34 +0200 |
---|---|---|
committer | wbx <wbx@hydrogenium.(none)> | 2009-05-17 14:41:34 +0200 |
commit | 219a6dab8995aad9ac4860cc1a84d6f3509a03a4 (patch) | |
tree | b9c0f3c43aebba2fcfef777592d0add39f2072f4 /package/arpd |
Initial import
Diffstat (limited to 'package/arpd')
-rw-r--r-- | package/arpd/Config.in | 11 | ||||
-rw-r--r-- | package/arpd/Makefile | 32 | ||||
-rw-r--r-- | package/arpd/ipkg/arpd.control | 5 | ||||
-rw-r--r-- | package/arpd/patches/patch-Makefile_in | 12 | ||||
-rw-r--r-- | package/arpd/patches/patch-arpd_c | 116 | ||||
-rw-r--r-- | package/arpd/patches/patch-configure | 28 |
6 files changed, 204 insertions, 0 deletions
diff --git a/package/arpd/Config.in b/package/arpd/Config.in new file mode 100644 index 000000000..3f1068ca3 --- /dev/null +++ b/package/arpd/Config.in @@ -0,0 +1,11 @@ +config ADK_PACKAGE_ARPD + prompt "arpd.............................. A daemon to fake ARP replies" + tristate + default n + select ADK_PACKAGE_LIBPCAP + select ADK_PACKAGE_LIBDNET + select ADK_PACKAGE_LIBEVENT + help + Generates ARP responses for (locally unused) IP addresses + + http://www.honeyd.org/tools.php diff --git a/package/arpd/Makefile b/package/arpd/Makefile new file mode 100644 index 000000000..7ac0c03f7 --- /dev/null +++ b/package/arpd/Makefile @@ -0,0 +1,32 @@ +# $Id$ +#- +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include ${TOPDIR}/rules.mk + +PKG_NAME:= arpd +PKG_VERSION:= 0.2 +PKG_RELEASE:= 1 +PKG_MD5SUM:= e2911fa9de1b92ef50deda1489ae944d +MASTER_SITES:= http://niels.xtdnet.nl/honeyd/ +WRKDIST= ${WRKDIR}/${PKG_NAME} + +include ${TOPDIR}/mk/package.mk + +$(eval $(call PKG_template,ARPD,arpd,${PKG_VERSION}-${PKG_RELEASE},${ARCH})) + +CONFIGURE_STYLE= gnu +CONFIGURE_ARGS+= --with-libdnet=${STAGING_DIR}/usr \ + --with-libevent=${STAGING_DIR}/usr \ + --with-libpcap=${STAGING_DIR}/usr +BUILD_STYLE= auto +MAKE_FLAGS+= CCOPT="${TARGET_CFLAGS}" \ + INCLS="-I. -I${STAGING_DIR}/usr/include" \ + LIBS="-L${STAGING_DIR}/usr/lib -lpcap -ldnet -levent" + +post-install: + ${INSTALL_DIR} ${IDIR_ARPD}/usr/sbin + ${INSTALL_BIN} ${WRKBUILD}/arpd ${IDIR_ARPD}/usr/sbin/ + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/arpd/ipkg/arpd.control b/package/arpd/ipkg/arpd.control new file mode 100644 index 000000000..249263e12 --- /dev/null +++ b/package/arpd/ipkg/arpd.control @@ -0,0 +1,5 @@ +Package: arpd +Priority: optional +Section: net +Depends: libpcap, libdnet, libevent +Description: Generates ARP responses for IP address ranges diff --git a/package/arpd/patches/patch-Makefile_in b/package/arpd/patches/patch-Makefile_in new file mode 100644 index 000000000..e8ea3031a --- /dev/null +++ b/package/arpd/patches/patch-Makefile_in @@ -0,0 +1,12 @@ +$Id$ +--- arpd.orig/Makefile.in 2003-02-09 19:31:27.000000000 +0100 ++++ arpd/Makefile.in 2007-01-22 21:28:27.000000000 +0100 +@@ -154,7 +154,7 @@ $(srcdir)/config.h.in: $(srcdir)/stamp-h + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi + $(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h +- cd $(top_srcdir) && $(AUTOHEADER) ++ #cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + + mostlyclean-hdr: diff --git a/package/arpd/patches/patch-arpd_c b/package/arpd/patches/patch-arpd_c new file mode 100644 index 000000000..5ac57ebeb --- /dev/null +++ b/package/arpd/patches/patch-arpd_c @@ -0,0 +1,116 @@ +$Id$ +--- arpd.orig/arpd.c 2003-02-09 05:20:40.000000000 +0100 ++++ arpd/arpd.c 2007-01-21 00:39:05.000000000 +0100 +@@ -70,7 +70,7 @@ static int arpd_sig; + static void + usage(void) + { +- fprintf(stderr, "Usage: arpd [-d] [-i interface] [net]\n"); ++ fprintf(stderr, "Usage: arpd [-d] [-i interface] [-a 'pcap_expr'] [{host|net|range} ...]\n"); + exit(1); + } + +@@ -182,7 +182,7 @@ arpd_expandips(int naddresses, char **ad + } + + static void +-arpd_init(char *dev, int naddresses, char **addresses) ++arpd_init(char *dev, char *and_pcap_exp, int naddresses, char **addresses) + { + struct bpf_program fcode; + char filter[1024], ebuf[PCAP_ERRBUF_SIZE], *dst; +@@ -214,9 +214,13 @@ arpd_init(char *dev, int naddresses, cha + errx(1, "bad interface configuration: not IP or Ethernet"); + arpd_ifent.intf_addr.addr_bits = IP_ADDR_BITS; + +- snprintf(filter, sizeof(filter), "arp %s%s%s and not ether src %s", ++ snprintf(filter, sizeof(filter), "arp %s%s%s and not ether src %s%s%s%s", + dst ? "and (" : "", dst ? dst : "", dst ? ")" : "", +- addr_ntoa(&arpd_ifent.intf_link_addr)); ++ addr_ntoa(&arpd_ifent.intf_link_addr), ++ and_pcap_exp ? " and (" : "", ++ and_pcap_exp ? and_pcap_exp : "", ++ and_pcap_exp ? ")" : "" ++ ); + + if ((arpd_pcap = pcap_open_live(dev, 128, 0, 500, ebuf)) == NULL) + errx(1, "pcap_open_live: %s", ebuf); +@@ -265,7 +269,7 @@ arpd_send(eth_t *eth, int op, + spa->addr_ip, tha->addr_eth, tpa->addr_ip); + + if (op == ARP_OP_REQUEST) { +- syslog(LOG_DEBUG, __FUNCTION__ ": who-has %s tell %s", ++ syslog(LOG_DEBUG, "%s: who-has %s tell %s", __FUNCTION__, + addr_ntoa(tpa), addr_ntoa(spa)); + } else if (op == ARP_OP_REPLY) { + syslog(LOG_INFO, "arp reply %s is-at %s", +@@ -282,7 +286,7 @@ arpd_lookup(struct addr *addr) + int error; + + if (addr_cmp(addr, &arpd_ifent.intf_addr) == 0) { +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, + addr_ntoa(addr), addr_ntoa(&arpd_ifent.intf_link_addr)); + return (0); + } +@@ -291,10 +295,10 @@ arpd_lookup(struct addr *addr) + error = arp_get(arpd_arp, &arpent); + + if (error == -1) { +- syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s", ++ syslog(LOG_DEBUG, "%s: no entry for %s", __FUNCTION__, + addr_ntoa(addr)); + } else { +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, + addr_ntoa(addr), addr_ntoa(&arpent.arp_ha)); + } + return (error); +@@ -423,7 +427,7 @@ arpd_recv_cb(u_char *u, const struct pca + 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); +- syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s", ++ syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__, + addr_ntoa(&req->pa), addr_ntoa(&src.arp_ha)); + + /* This address is claimed */ +@@ -465,14 +469,14 @@ main(int argc, char *argv[]) + { + struct event recv_ev; + extern int (*event_sigcb)(void); +- char *dev; ++ char *dev, *and_pcap_exp; + int c, debug; + FILE *fp; + + dev = NULL; + debug = 0; + +- while ((c = getopt(argc, argv, "di:h?")) != -1) { ++ while ((c = getopt(argc, argv, "a:di:h?")) != -1) { + switch (c) { + case 'd': + debug = 1; +@@ -480,6 +484,9 @@ main(int argc, char *argv[]) + case 'i': + dev = optarg; + break; ++ case 'a': ++ and_pcap_exp = optarg; ++ break; + default: + usage(); + break; +@@ -489,9 +496,9 @@ main(int argc, char *argv[]) + argv += optind; + + if (argc == 0) +- arpd_init(dev, 0, NULL); ++ arpd_init(dev, and_pcap_exp, 0, NULL); + else +- arpd_init(dev, argc, argv); ++ arpd_init(dev, and_pcap_exp, argc, argv); + + if ((fp = fopen(PIDFILE, "w")) == NULL) + err(1, "fopen"); diff --git a/package/arpd/patches/patch-configure b/package/arpd/patches/patch-configure new file mode 100644 index 000000000..8e2dd6e82 --- /dev/null +++ b/package/arpd/patches/patch-configure @@ -0,0 +1,28 @@ +$Id$ +--- arpd.orig/configure 2003-02-09 19:31:28.000000000 +0100 ++++ arpd/configure 2007-01-21 00:51:54.000000000 +0100 +@@ -2205,12 +2205,12 @@ echo "${ECHO_T}no" >&6 + *) + echo "$as_me:2206: result: $withval" >&5 + echo "${ECHO_T}$withval" >&6 +- if test -f $withval/include/event.h -a -f $withval/lib/libevent.a; then ++ if test -f $withval/include/event.h; then + owd=`pwd` + if cd $withval; then withval=`pwd`; cd $owd; fi + EVENTINC="-I$withval/include" + EVENTLIB="-L$withval/lib -levent" +- elif test -f $withval/event.h -a -f $withval/libevent.a; then ++ elif test -f $withval/event.h; then + owd=`pwd` + if cd $withval; then withval=`pwd`; cd $owd; fi + EVENTINC="-I$withval" +@@ -2258,8 +2258,7 @@ echo "${ECHO_T}$withval" >&6 + if cd $withval; then withval=`pwd`; cd $owd; fi + PCAPINC="-I$withval -I$withval/bpf" + PCAPLIB="-L$withval -lpcap" +- elif test -f $withval/include/pcap.h -a \ +- -f $withval/include/net/bpf.h; then ++ elif test -f $withval/include/pcap.h; then + owd=`pwd` + if cd $withval; then withval=`pwd`; cd $owd; fi + PCAPINC="-I$withval/include" |