Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/mpl/dhcp Add build glue.



details:   https://anonhg.NetBSD.org/src/rev/28820db9741b
branches:  trunk
changeset: 321849:28820db9741b
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Apr 07 22:31:36 2018 +0000

description:
Add build glue.

diffstat:

 external/mpl/dhcp/Makefile                         |    5 +
 external/mpl/dhcp/Makefile.inc                     |   53 +++
 external/mpl/dhcp/bin/Makefile                     |    5 +
 external/mpl/dhcp/bin/Makefile.inc                 |    2 +
 external/mpl/dhcp/bin/client/Makefile              |   17 +
 external/mpl/dhcp/bin/clientscript/Makefile        |    8 +
 external/mpl/dhcp/bin/clientscript/dhclient-script |  282 ++++++++++++++++++
 external/mpl/dhcp/bin/omshell/Makefile             |   16 +
 external/mpl/dhcp/bin/relay/Makefile               |    9 +
 external/mpl/dhcp/bin/server/Makefile              |   20 +
 external/mpl/dhcp/bin/server/dhcpd.conf            |  104 ++++++
 external/mpl/dhcp/dhcp2netbsd                      |  102 ++++++
 external/mpl/dhcp/include/config.h                 |  326 +++++++++++++++++++++
 external/mpl/dhcp/lib/Makefile                     |    5 +
 external/mpl/dhcp/lib/Makefile.inc                 |    1 +
 external/mpl/dhcp/lib/common/Makefile              |   14 +
 external/mpl/dhcp/lib/dhcpctl/Makefile             |   10 +
 external/mpl/dhcp/lib/omapip/Makefile              |   13 +
 external/mpl/dhcp/share/Makefile                   |    5 +
 external/mpl/dhcp/share/dhcpd/Makefile             |   10 +
 external/mpl/dhcp/share/dhcpd/pxe.defs             |  113 +++++++
 21 files changed, 1120 insertions(+), 0 deletions(-)

diffs (truncated from 1204 to 300 lines):

diff -r bdb8487cb377 -r 28820db9741b external/mpl/dhcp/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mpl/dhcp/Makefile        Sat Apr 07 22:31:36 2018 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile,v 1.1 2018/04/07 22:31:36 christos Exp $
+
+SUBDIR=        lib share .WAIT bin
+
+.include <bsd.subdir.mk>
diff -r bdb8487cb377 -r 28820db9741b external/mpl/dhcp/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mpl/dhcp/Makefile.inc    Sat Apr 07 22:31:36 2018 +0000
@@ -0,0 +1,53 @@
+# $NetBSD: Makefile.inc,v 1.1 2018/04/07 22:31:36 christos Exp $
+
+WARNS?=        1       # XXX -Wshadow -Wcast-qual -Wsign-compare
+
+.include <bsd.own.mk>
+
+USE_FORT?= yes # network client/server
+CWARNFLAGS.clang+=     -Wno-tautological-compare \
+                       -Wno-conversion -Wno-constant-logical-operand \
+                       -Wno-format-security -Wno-error=unused-const-variable
+
+DIST:= ${.PARSEDIR}/dist
+BIND:= ${.PARSEDIR}/../../bsd/bind/dist
+.PATH: ${DIST}/${DHCPSRCDIR}
+
+COBJDIR!=cd ${.PARSEDIR}/lib/common && ${PRINTOBJDIR}
+OMOBJDIR!=cd ${.PARSEDIR}/lib/omapip && ${PRINTOBJDIR}
+
+.if (${USE_INET6} != "no")
+CPPFLAGS+=     -DDHCPv6
+.endif
+CPPFLAGS+= -DISC_PLATFORM_USETHREADS -DHAVE_CONFIG_H
+CPPFLAGS+= -I${DIST} -I${DIST}/includes -I${DIST}/../include
+CPPFLAGS+= -I${BIND} -I${BIND}/includes -I${BIND}/../include
+.for dir in isc dns irs
+CPPFLAGS+= -I${BIND}/lib/${dir}/include
+CPPFLAGS+= -I${BIND}/lib/${dir}/unix/include
+CPPFLAGS+= -I${BIND}/lib/${dir}/pthreads/include
+.endfor
+CPPFLAGS+= -DLOCALSTATEDIR='"/var"'
+LDADD+= ${COBJDIR}/libdhcp.a
+LDADD+= ${OMOBJDIR}/libomapi.a
+.if defined(PROG) && ${PROG} == "dhclient"
+LDADD+=-Wl,-Bstatic
+.endif
+LDADD+= -lirs -lisccfg -ldns -lisc
+LDADD+=-lpthread
+.if (${MKKERBEROS} != "no")
+LDADD+= -lgssapi -lheimntlm ${LIBKRB5_LDADD} ${LIBKRB5_STATIC_LDADD}
+DPADD+= ${LIBKRB5_DPADD} ${LIBHEIMNTLM} ${LIBGSSAPI} ${LIBKRB5_STATIC_DPADD}
+.endif
+.if defined(PROG) && ${PROG} == "dhclient"
+LDADD+=-Wl,-Bdynamic
+.endif
+LDADD+= -lcrypto -lipsec -lcrypt
+DPADD+= ${LIBCRYPTO} ${LIBIPSEC} ${LIBCRYPT}
+.if defined(PROG) && ${PROG} == "dhclient"
+LDADD+=-Wl,-Bdynamic
+.endif
+DPADD+= ${COBJDIR}/libdhcp.a
+DPADD+= ${OMOBJDIR}/libomapi.a
+DPADD+=        ${LIBDNS} ${LIBISC}
+DPADD+= ${LIBPTHREAD}
diff -r bdb8487cb377 -r 28820db9741b external/mpl/dhcp/bin/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mpl/dhcp/bin/Makefile    Sat Apr 07 22:31:36 2018 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile,v 1.1 2018/04/07 22:31:37 christos Exp $
+
+SUBDIR=        clientscript server client relay omshell
+
+.include <bsd.subdir.mk>
diff -r bdb8487cb377 -r 28820db9741b external/mpl/dhcp/bin/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mpl/dhcp/bin/Makefile.inc        Sat Apr 07 22:31:36 2018 +0000
@@ -0,0 +1,2 @@
+.include "${.PARSEDIR}/../Makefile.inc"
+BINDIR?=/usr/sbin
diff -r bdb8487cb377 -r 28820db9741b external/mpl/dhcp/bin/client/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mpl/dhcp/bin/client/Makefile     Sat Apr 07 22:31:36 2018 +0000
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.1 2018/04/07 22:31:37 christos Exp $
+
+BINDIR=        /sbin
+.include <bsd.own.mk>          # for MKDYNAMICROOT definition
+
+SRCS   = dhclient.c clparse.c dhc6.c client_tables.c
+PROG   = dhclient
+MAN    = dhclient.8 dhclient.conf.5 dhclient.leases.5 dhclient-script.8
+CPPFLAGS += -DCLIENT_PATH='"PATH=/usr/bin:/usr/sbin:/bin:/sbin"'
+
+DHCPSRCDIR=    client
+
+.if (${MKDYNAMICROOT} == "no")
+LDSTATIC?=     -static
+.endif
+
+.include <bsd.prog.mk>
diff -r bdb8487cb377 -r 28820db9741b external/mpl/dhcp/bin/clientscript/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mpl/dhcp/bin/clientscript/Makefile       Sat Apr 07 22:31:36 2018 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2018/04/07 22:31:37 christos Exp $
+
+NOOBJ= # defined
+
+SCRIPTS=dhclient-script
+SCRIPTSDIR=/sbin
+
+.include <bsd.prog.mk>
diff -r bdb8487cb377 -r 28820db9741b external/mpl/dhcp/bin/clientscript/dhclient-script
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mpl/dhcp/bin/clientscript/dhclient-script        Sat Apr 07 22:31:36 2018 +0000
@@ -0,0 +1,282 @@
+#!/bin/sh
+#
+# $NetBSD: dhclient-script,v 1.1 2018/04/07 22:31:37 christos Exp $
+
+ENTERHOOKS=/etc/dhclient-enter-hooks
+EXITHOOKS=/etc/dhclient-exit-hooks
+RESOLV=/etc/resolv.conf
+SIGNATURE="# Created by dhclient from"
+INTSIG="$SIGNATURE $interface"
+
+echo_resolv_conf() {
+       echo "$INTSIG"
+       echo search $new_domain_name
+       for nameserver in $new_domain_name_servers; do
+               echo nameserver $nameserver
+       done
+}
+
+make_resolv_conf() {
+       if [ ! -z "$new_domain_name_servers" ]; then
+               if [ -x /sbin/resolvconf ]; then
+                       echo_resolv_conf | /sbin/resolvconf -a $interface
+               else
+                       if [ -f $RESOLV ]; then
+                               while read line; do
+                                       case $line in
+                                       "$SIGNATURE"*)
+                                               ;;
+                                       *)
+                                               mv $RESOLV $RESOLV.save;;
+                                       esac
+                                       break
+                               done < $RESOLV
+                       fi
+                       echo_resolv_conf > $RESOLV
+               fi
+       fi
+}
+
+restore_resolv_conf() {
+       if [ -x /sbin/resolvconf ]; then
+               /sbin/resolvconf -d $interface
+       elif [ -f $RESOLV.save -a -f $RESOLV ]; then
+               while read line; do
+                       case $line in
+                       "$INTSIG"*)
+                               mv $RESOLV.save $RESOLV;;
+                       esac
+                       break
+               done < $RESOLV
+       fi
+}
+
+# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
+exit_with_hooks() {
+       exit_status=$1
+       if [ -f "$EXITHOOKS" ]; then
+               . "$EXITHOOKS"
+       fi
+       # probably should do something with exit status of the local script
+       exit $exit_status
+}
+
+
+add_new_routes() {
+       for router in $new_routers; do
+               route add default $router
+       done >/dev/null 2>&1
+
+       set -- $new_static_routes
+       while [ $# -gt 1 ]; do
+               route add $1 $2
+               shift; shift
+       done
+}
+
+delete_old_routes() {
+       for router in $old_routers; do
+               route delete default $router
+       done >/dev/null 2>&1
+
+       set -- $old_static_routes
+       while [ $# -gt 1 ]; do
+               route delete $1 $2
+               shift; shift
+       done
+
+       route -n flush -inet -host
+}
+
+# Invoke the local dhcp client enter hooks, if they exist.
+if [ -f $ENTERHOOKS ]; then
+       exit_status=0
+       . $ENTERHOOKS
+       # allow the local script to abort processing of this state
+       # local script must set exit_status variable to nonzero.
+       if [ $exit_status -ne 0 ]; then
+               exit $exit_status
+       fi
+fi
+
+#if [ ! -z "$new_host_name" ]; then
+#      echo New Host Name: $new_host_name
+#fi
+#
+#if [ ! -z "$new_nis_domain" ]; then
+#      echo New NIS Domain: $new_nis_domain
+#fi
+#
+#if [ ! -z "$new_network_number" ]; then
+#      echo New Network Number: $new_network_number
+#fi
+
+if [ ! -z "$new_broadcast_address" ]; then
+#      echo New Broadcast Address: $new_broadcast_address
+       new_broadcast_arg="broadcast $new_broadcast_address"
+fi
+
+if [ ! -z "$old_broadcast_address" ]; then
+       old_broadcast_arg="broadcast $old_broadcast_address"
+fi
+
+if [ ! -z "$new_subnet_mask" ]; then
+       new_netmask_arg="netmask $new_subnet_mask"
+fi
+
+if [ ! -z "$old_subnet_mask" ]; then
+       old_netmask_arg="netmask $old_subnet_mask"
+fi
+
+if [ ! -z "$alias_subnet_mask" ]; then
+       alias_subnet_arg="netmask $alias_subnet_mask"
+fi
+
+case "$reason" in
+MEDIUM)
+       test -z "$medium" && exit_with_hooks 0
+       eval "ifconfig $interface $medium"
+       eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
+
+       sleep 1
+
+       exit_with_hooks 0
+       ;;
+
+PREINIT)
+       if [ ! -z "$alias_ip_address" ]; then
+               ifconfig $interface inet \
+                   -alias $alias_ip_address >/dev/null 2>&1
+       fi
+
+       ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
+           broadcast 255.255.255.255 up
+
+       exit_with_hooks 0
+       ;;
+
+ARPCHECK|ARPSEND)
+       exit_with_hooks 0
+       ;;
+
+BOUND|RENEW|REBIND|REBOOT)
+       if [ ! -z "$new_nis_domain" ]; then
+               if type domainname > /dev/null 2>&1; then
+                       domainname $new_nis_domain
+               fi
+       fi
+
+       if type hostname > /dev/null 2>&1; then
+               if [ \( -z "$current_hostname" \) -o \
+                   \( "x$new_host_name" = "x$old_hostname" \) ]; then
+                       current_hostname=`hostname`
+               fi
+               if [ \( -z "$current_hostname" \) -o \
+                   \( "x$new_host_name" != "x$old_hostname" \) ]; then
+                       hostname $new_host_name
+               fi
+       fi
+    
+       if [ \( ! -z "$old_ip_address" \) -a \( ! -z "$alias_ip_address" \) -a \
+           \( "x$alias_ip_address" != "x$old_ip_address" \) ]; then
+               ifconfig $interface inet \



Home | Main Index | Thread Index | Old Index