From: Waldemar Brodkorb Date: Sun, 11 Sep 2005 11:27:16 +0000 (+0000) Subject: arpd and libdnet some time ago from johannes 5, thx X-Git-Tag: reboot~32040 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=5f8dd7176371be0d175ab19a0dc04fa7ec043bf6;p=openwrt%2Fopenwrt.git arpd and libdnet some time ago from johannes 5, thx SVN-Revision: 1900 --- diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in index fe2c82b91a..faad94e898 100644 --- a/openwrt/package/Config.in +++ b/openwrt/package/Config.in @@ -35,6 +35,7 @@ source "package/screen/Config.in" comment "Networking" source "package/aiccu/Config.in" source "package/amwall/Config.in" +source "package/arpd/Config.in" source "package/arptables/Config.in" source "package/arpwatch/Config.in" source "package/asterisk/Config.in" @@ -126,6 +127,7 @@ source "package/libart/Config.in" source "package/curl/Config.in" # libcurl source "package/libdaemon/Config.in" source "package/libdb/Config.in" +source "package/libdnet/Config.in" source "package/libelf/Config.in" source "package/libevent/Config.in" source "package/expat/Config.in" # libexpat diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile index 8515787076..337df83a79 100644 --- a/openwrt/package/Makefile +++ b/openwrt/package/Makefile @@ -5,6 +5,7 @@ package-:=tcp_wrappers package-y:=nvram package-$(BR2_PACKAGE_AICCU) += aiccu package-$(BR2_PACKAGE_AMWALL) += amwall +package-$(BR2_PACKAGE_ARPD) += arpd package-$(BR2_PACKAGE_ARPTABLES) += arptables package-$(BR2_PACKAGE_ARPWATCH) += arpwatch package-$(BR2_PACKAGE_ASTERISK) += asterisk @@ -63,6 +64,7 @@ package-$(BR2_PACKAGE_LIBAMSEL) += libamsel package-$(BR2_PACKAGE_LIBART) += libart package-$(BR2_PACKAGE_LIBDAEMON) += libdaemon package-$(BR2_PACKAGE_LIBDB) += libdb +package-$(BR2_PACKAGE_LIBDNET) += libdnet package-$(BR2_PACKAGE_LIBELF) += libelf package-$(BR2_PACKAGE_LIBEVENT) += libevent package-$(BR2_PACKAGE_LIBFFI_SABLE) += libffi-sable @@ -190,6 +192,7 @@ $(COMPILE_PACKAGES): base-files-compile $(INSTALL_PACKAGES): base-files-install amwall-compile: libamsel-compile +arpd-compile: libpcap-compile libdnet-compile libevent-compile arpwatch-compile: libpcap-compile avahi-compile: libdaemon-compile expat-compile bind-compile: openssl-compile diff --git a/openwrt/package/arpd/Config.in b/openwrt/package/arpd/Config.in new file mode 100644 index 0000000000..504f9fada5 --- /dev/null +++ b/openwrt/package/arpd/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_ARPD + tristate "arpd - fake ARP replies" + default m if CONFIG_DEVEL + select BR2_PACKAGE_LIBPCAP + select BR2_PACKAGE_LIBDNET + select BR2_PACKAGE_LIBEVENT + help + Generates ARP responses for (locally unused) IP addresses + + http://www.honeyd.org/tools.php diff --git a/openwrt/package/arpd/Makefile b/openwrt/package/arpd/Makefile new file mode 100644 index 0000000000..ad75e22d05 --- /dev/null +++ b/openwrt/package/arpd/Makefile @@ -0,0 +1,64 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=arpd +PKG_VERSION:=0.2 +PKG_RELEASE:=1 +PKG_MD5SUM:=e2911fa9de1b92ef50deda1489ae944d + +PKG_SOURCE_URL:=http://niels.xtdnet.nl/honeyd +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_CAT:=zcat +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(TOPDIR)/package/rules.mk + +$(eval $(call PKG_template,ARPD,arpd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) + +$(PKG_BUILD_DIR)/.configured: + (cd $(PKG_BUILD_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --enable-shared \ + --disable-static \ + --with-libdnet=$(STAGING_DIR)/usr \ + --with-libevent=$(STAGING_DIR)/usr \ + --with-libpcap=$(STAGING_DIR)/usr \ + ); + touch $@ + +$(PKG_BUILD_DIR)/.built: + $(MAKE) -C $(PKG_BUILD_DIR) \ + CCOPT="$(TARGET_CFLAGS)" \ + INCLS="-I. -I$(STAGING_DIR)/usr/include" \ + LIBS="-L$(STAGING_DIR)/usr/lib -lpcap -ldnet -levent" + touch $@ + +$(IPKG_ARPD): + mkdir -p $(IDIR_ARPD)/usr/sbin + cp $(PKG_BUILD_DIR)/arpd $(IDIR_ARPD)/usr/sbin/ + $(STRIP) $(IDIR_ARPD)/usr/sbin/* + $(IPKG_BUILD) $(IDIR_ARPD) $(PACKAGE_DIR) diff --git a/openwrt/package/arpd/ipkg/arpd.control b/openwrt/package/arpd/ipkg/arpd.control new file mode 100644 index 0000000000..8211d79942 --- /dev/null +++ b/openwrt/package/arpd/ipkg/arpd.control @@ -0,0 +1,7 @@ +Package: arpd +Priority: optional +Section: net +Maintainer: OpenWrt Developer +Source: buildroot internal +Description: Generates ARP responses for IP address ranges +Depends: libpcap, libdnet, libevent diff --git a/openwrt/package/arpd/patches/configure-no-bpf.patch b/openwrt/package/arpd/patches/configure-no-bpf.patch new file mode 100644 index 0000000000..fb8037807a --- /dev/null +++ b/openwrt/package/arpd/patches/configure-no-bpf.patch @@ -0,0 +1,12 @@ +--- arpd/configure.orig Sun Feb 9 19:31:28 2003 ++++ arpd/configure Thu Jul 21 16:05:16 2005 +@@ -2258,8 +2258,7 @@ + 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" diff --git a/openwrt/package/arpd/patches/function-string.patch b/openwrt/package/arpd/patches/function-string.patch new file mode 100644 index 0000000000..452b810e91 --- /dev/null +++ b/openwrt/package/arpd/patches/function-string.patch @@ -0,0 +1,42 @@ +--- arpd/arpd.c.orig Sun Feb 9 05:20:40 2003 ++++ arpd/arpd.c Thu Jul 21 17:05:40 2005 +@@ -265,7 +265,7 @@ + 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 +282,7 @@ + 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 +291,10 @@ + 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 +423,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); +- 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 */ diff --git a/openwrt/package/arpd/patches/pcap-and-arg.patch b/openwrt/package/arpd/patches/pcap-and-arg.patch new file mode 100644 index 0000000000..7750e2928c --- /dev/null +++ b/openwrt/package/arpd/patches/pcap-and-arg.patch @@ -0,0 +1,75 @@ +--- arpd/arpd.c Sun Feb 9 05:20:40 2003 ++++ arpd/arpd.c.new Mon Aug 1 00:50:40 2005 +@@ -70,7 +70,7 @@ + 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 @@ + } + + 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 @@ + 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); +@@ -465,14 +469,14 @@ + { + 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 @@ + case 'i': + dev = optarg; + break; ++ case 'a': ++ and_pcap_exp = optarg; ++ break; + default: + usage(); + break; +@@ -489,9 +496,9 @@ + 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/openwrt/package/libdnet/Config.in b/openwrt/package/libdnet/Config.in new file mode 100644 index 0000000000..6a719b10dc --- /dev/null +++ b/openwrt/package/libdnet/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_LIBDNET + tristate "libdnet - Low-level network library" + default m if CONFIG_DEVEL + help + simplified, portable interface to several low-level networking routines + + http://sourceforge.net/projects/libdnet/ diff --git a/openwrt/package/libdnet/Makefile b/openwrt/package/libdnet/Makefile new file mode 100644 index 0000000000..e47b34aff4 --- /dev/null +++ b/openwrt/package/libdnet/Makefile @@ -0,0 +1,93 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libdnet +PKG_VERSION:=1.10 +PKG_RELEASE:=1 +PKG_MD5SUM:=416b765e9d9961501ac85e9a366fd219 + +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/libdnet-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(TOPDIR)/package/rules.mk + +$(eval $(call PKG_template,LIBDNET,libdnet,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) + +$(PKG_BUILD_DIR)/.configured: + (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \ + touch configure.in; \ + touch include.m4; \ + touch aclocal.m4; \ + touch Makefile.in; \ + touch configure; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var/run \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --enable-shared \ + --enable-static \ + ); + touch $@ + +$(PKG_BUILD_DIR)/.built: + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install + touch $@ + +$(IPKG_LIBDNET): + install -m0755 -d $(IDIR_LIBDNET)/usr/lib + cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libdnet.so.* $(IDIR_LIBDNET)/usr/lib/ + install -m0755 -d $(IDIR_LIBDNET)/usr/sbin + cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/dnet $(IDIR_LIBDNET)/usr/sbin/ + $(RSTRIP) $(IDIR_LIBDNET) + $(IPKG_BUILD) $(IDIR_LIBDNET) $(PACKAGE_DIR) + +$(STAGING_DIR)/usr/lib/libdnet.so: $(PKG_BUILD_DIR)/.built + mkdir -p $(STAGING_DIR)/usr/bin + cp -fpR $(PKG_INSTALL_DIR)/usr/bin/dnet-config $(STAGING_DIR)/usr/bin/ + mkdir -p $(STAGING_DIR)/usr/include + cp -fpR $(PKG_INSTALL_DIR)/usr/include/dnet* $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libdnet.* $(STAGING_DIR)/usr/lib/ + touch $@ + +install-dev: $(STAGING_DIR)/usr/lib/libdnet.so + +uninstall-dev: + rm -rf \ + $(STAGING_DIR)/usr/bin/dnet-config \ + $(STAGING_DIR)/usr/include/dnet* \ + $(STAGING_DIR)/usr/lib/libdnet.* \ + +compile: install-dev +clean: uninstall-dev diff --git a/openwrt/package/libdnet/ipkg/libdnet.control b/openwrt/package/libdnet/ipkg/libdnet.control new file mode 100644 index 0000000000..083f3377f5 --- /dev/null +++ b/openwrt/package/libdnet/ipkg/libdnet.control @@ -0,0 +1,6 @@ +Package: libdnet +Priority: optional +Section: libs +Maintainer: OpenWrt Developer +Source: buildroot internal +Description: a low-level networking library