From: Florian Fainelli Date: Tue, 1 Aug 2006 16:40:03 +0000 (+0000) Subject: Port dhcp-forwarder to -ng X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=35a6b420243b34d5b234d925dec088f1944c999c;p=openwrt%2Fsvn-archive%2Farchive.git Port dhcp-forwarder to -ng SVN-Revision: 4371 --- diff --git a/net/dhcp-forwarder/Makefile b/net/dhcp-forwarder/Makefile new file mode 100644 index 0000000000..2971d7969f --- /dev/null +++ b/net/dhcp-forwarder/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=dhcp-forwarder +PKG_VERSION:=0.7 +PKG_RELEASE:=4 +PKG_MD5SUM:=e7f876e615ebc3f96418f6477b4451e2 + +PKG_SOURCE_URL:=http://savannah.nongnu.org/download/dhcp-fwd +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/dhcp-forwarder + SECTION:=net + CATEGORY:=Network + TITLE:=DHCP relay agent + DESCRIPTION:=DHCP relay agent + URL:=http://www.nongnu.org/dhcp-fwd/ +endef + +define Build/Configure +$(call Build/Configure/Default,,ac_cv_func_malloc_0_nonnull="yes") +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + cfg_filename="/etc/dhcp-fwd.conf" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Package/dhcp-forwarder/install + install -m0755 -d $(1)/etc + install -m0644 $(PKG_BUILD_DIR)/contrib/dhcp-fwd.conf $(1)/etc/ + install -m0755 -d $(1)/etc/init.d + install -m0755 ./files/dhcp-fwd.init $(1)/etc/init.d/dhcp-fwd + install -m0755 -d $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dhcp-fwd $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,dhcp-forwarder)) diff --git a/net/dhcp-forwarder/files/dhcp-fwd.init b/net/dhcp-forwarder/files/dhcp-fwd.init new file mode 100644 index 0000000000..6ad3858e89 --- /dev/null +++ b/net/dhcp-forwarder/files/dhcp-fwd.init @@ -0,0 +1,21 @@ +#!/bin/sh + +LOG_D=/var/log +RUN_D=/var/run +PID_F=$RUN_D/dhcpd-fwd.pid + +case $1 in + start) + [ -d $LOG_D ] || mkdir -p $LOG_D + [ -d $RUN_D ] || mkdir -p $RUN_D + dhcp-fwd + ;; + stop) + [ -f $PID_F ] && kill $(cat $PID_F) + ;; + *) + echo "usage: $0 (start|stop)" + exit 1 +esac + +exit $? diff --git a/net/dhcp-forwarder/patches/00-big_endian.patch b/net/dhcp-forwarder/patches/00-big_endian.patch new file mode 100644 index 0000000000..add157d3f4 --- /dev/null +++ b/net/dhcp-forwarder/patches/00-big_endian.patch @@ -0,0 +1,11 @@ +--- dhcp-forwarder-0.7/src/dhcp.h 2004-06-22 03:46:56.000000000 -0700 ++++ dhcp-forwarder-0.7-x/src/dhcp.h 2005-10-06 17:04:14.000000000 -0700 +@@ -89,7 +89,7 @@ + optDHCP_COOKIE = 0x63538263u, + flgDHCP_BCAST = 0x0080u + #else +- DHCP_COOKIE = 0x63825363u, ++ optDHCP_COOKIE = 0x63825363u, + flgDHCP_BCAST = 0x8000u + #endif + }; diff --git a/net/dhcp-forwarder/patches/01-getpwnmam_getgrnam.patch b/net/dhcp-forwarder/patches/01-getpwnmam_getgrnam.patch new file mode 100644 index 0000000000..ef84913302 --- /dev/null +++ b/net/dhcp-forwarder/patches/01-getpwnmam_getgrnam.patch @@ -0,0 +1,35 @@ +diff -pur dhcp-forwarder-0.7-orig/src/wrappers.h dhcp-forwarder-0.7-patched/src/wrappers.h +--- dhcp-forwarder-0.7-orig/src/wrappers.h 2004-06-22 12:46:56.000000000 +0200 ++++ dhcp-forwarder-0.7-patched/src/wrappers.h 2005-12-27 12:28:10.464289435 +0100 +@@ -65,7 +65,14 @@ Egetgrnam(char const *name) + /*@*/ + { + /*@observer@*/struct group const *res = getgrnam(name); +- FatalErrnoError(res==0, 1, "getgrnam()"); ++ ++ FatalErrnoError((res == NULL) && (errno != 0), 1, "getgrnam()"); ++ ++ if (res == NULL) ++ { ++ fprintf (stderr, "No such group: `%s'\n", name); ++ exit (1); ++ } + + /*@-freshtrans@*/ + /*@-mustfreefresh@*/ +@@ -80,7 +87,14 @@ Egetpwnam(char const *name) + /*@*/ + { + struct passwd const *res = getpwnam(name); +- FatalErrnoError(res==0, 1, "getpwnam()"); ++ ++ FatalErrnoError((res == NULL) && (errno != 0), 1, "getpwnam()"); ++ ++ if (res == NULL) ++ { ++ fprintf (stderr, "No such user: `%s'\n", name); ++ exit (1); ++ } + + return res; + }