aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Tan <samueltan@google.com>2015-08-13 16:51:43 -0700
committerSamuel Tan <samueltan@google.com>2015-08-18 13:47:19 -0700
commit4b053192e86198125efc190c846ef642f3671af3 (patch)
treed1943e46c716b268beb71accb75a957a9e839754
parent47d708b8f4e037f6f224f71ea5864c90184b4ffb (diff)
downloaddhcpcd-6.8.2-4b053192e86198125efc190c846ef642f3671af3.tar.gz
[PATCH] Add ability to disable hook scripts
Cherry-picked from https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/i aster/net-misc/dhcpcd/files/patches/dhcpcd-6.8.2-Add-ability-to-disable- hook-scripts.patch. This allow dhcpcd to be installed without hook scripts and bypassing the hook script processing code. BUG: 22956197 Change-Id: I47177410ac4516a0df27277f251f1ae0d632d770 Reviewed-on: https://chromium-review.googlesource.com/272614
-rw-r--r--Makefile10
-rwxr-xr-xconfigure8
-rw-r--r--script-stub.c49
3 files changed, 64 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index f277750..e52e7cc 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
PROG= dhcpcd
SRCS= common.c control.c dhcpcd.c duid.c eloop.c
-SRCS+= if.c if-options.c script.c rpc-stub.c
+SRCS+= if.c if-options.c rpc-stub.c
SRCS+= dhcp-common.c
CFLAGS?= -O2
@@ -36,7 +36,11 @@ CLEANFILES+= dhcpcd-run-hooks
FILES= dhcpcd.conf
FILESDIR= ${SYSCONFDIR}
-SUBDIRS= dhcpcd-hooks ${MKDIRS}
+SUBDIRS= ${MKDIRS}
+
+ifeq ($(HOOK_SUPPORT),yes)
+SUBDIRS+= dhcpcd-hooks
+endif
SED_RUNDIR= -e 's:@RUNDIR@:${RUNDIR}:g'
SED_DBDIR= -e 's:@DBDIR@:${DBDIR}:g'
@@ -114,7 +118,7 @@ _scriptsinstall: ${SCRIPTS}
${INSTALL} -d ${DESTDIR}${SCRIPTSDIR}
${INSTALL} -m ${BINMODE} ${SCRIPTS} ${DESTDIR}${SCRIPTSDIR}
-proginstall: _proginstall _scriptsinstall ${EMBEDDEDINSTALL}
+proginstall: _proginstall ${SCRIPTSINSTALL} ${EMBEDDEDINSTALL}
for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
_maninstall: ${MAN5} ${MAN8}
diff --git a/configure b/configure
index b13c232..0d80876 100755
--- a/configure
+++ b/configure
@@ -406,6 +406,14 @@ if [ -z "$INET6" -o "$INET6" = yes ]; then
echo "DHCPCD_SRCS+= ipv6.c ipv6nd.c dhcp6.c" >>$CONFIG_MK
fi
+if [ -z "$HOOKSCRIPTS" ]; then
+ echo "DHCPCD_SRCS+= script-stub.c" >>$CONFIG_MK
+else
+ echo "HOOK_SUPPORT= yes" >>$CONFIG_MK
+ echo "SCRIPTSINSTALL= _scriptsinstall" >>$CONFIG_MK
+ echo "DHCPCD_SRCS+= script.c" >>$CONFIG_MK
+fi
+
echo "Using compiler .. $CC"
# Add CPPFLAGS and CFLAGS to CC for testing features
XCC="$CC `$SED -n -e 's/CPPFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
diff --git a/script-stub.c b/script-stub.c
new file mode 100644
index 0000000..ed2a474
--- /dev/null
+++ b/script-stub.c
@@ -0,0 +1,49 @@
+/*
+ * dhcpcd - DHCP client daemon
+ * Copyright (c) 2006-2015 Roy Marples <roy@marples.name>
+ * All rights reserved
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "common.h"
+#include "script.h"
+
+void
+if_printoptions(void)
+{
+ /* Stub implementation. */
+}
+
+int
+send_interface(struct fd_list *fd, const struct interface *ifp)
+{
+ /* Stub implementation. */
+ return 0;
+}
+
+int
+script_runreason(const struct interface *ifp, const char *reason)
+{
+ /* Stub implementation. */
+ return 0;
+}