diff options
Diffstat (limited to 'net/isc-dhcp30-server/files')
22 files changed, 0 insertions, 3150 deletions
diff --git a/net/isc-dhcp30-server/files/client::scripts::freebsd b/net/isc-dhcp30-server/files/client::scripts::freebsd deleted file mode 100644 index 9c4c3d3a6f24..000000000000 --- a/net/isc-dhcp30-server/files/client::scripts::freebsd +++ /dev/null @@ -1,510 +0,0 @@ -#!/bin/sh - -############################################################################# -# -# Copyright (c) 1999, MindStep Corporation -# 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. -# -# -############################################################################# -# -# This script was written by Patrick Bihan-Faou, patrick@mindstep.com, -# Please contact us for bug reports, etc. -# -############################################################################# -# $MindStep_Id: dhclient-script.sh,v 1.8 1999/12/07 22:11:08 patrick Exp $ -# $MindStep_Tag: CONTRIB_19991207 $ -# from FreeBSD: src/sbin/dhclient/dhclient-script.sh,v 1.2 2002/02/01 18:46:58 alfred Exp -# $FreeBSD$ -############################################################################# - - -############################################################################# -# hook functions prototypes -# -# The "pre_state_XXX_hook" functions are called before the main -# work is done for the state XXX -# -# The "post_state_XXX_hook" functions are called after the main -# work is done for the state XXX -# -# These functions are meant to be overridden by the user's -# dhclient-enter-hooks file -############################################################################# - -pre_state_MEDIUM_hook () { } -pre_state_PREINIT_hook () { } -pre_state_ARPCHECK_hook () { } -pre_state_ARPSEND_hook () { } -pre_state_RENEW_hook () { } -pre_state_REBIND_hook () { } -pre_state_BOUND_hook () { } -pre_state_REBOOT_hook () { } -pre_state_EXPIRE_hook () { } -pre_state_FAIL_hook () { } -pre_state_TIMEOUT_hook () { } -post_state_MEDIUM_hook () { } -post_state_PREINIT_hook () { } -post_state_ARPCHECK_hook () { } -post_state_ARPSEND_hook () { } -post_state_RENEW_hook () { } -post_state_REBIND_hook () { } -post_state_BOUND_hook () { } -post_state_REBOOT_hook () { } -post_state_EXPIRE_hook () { } -post_state_FAIL_hook () { } -post_state_TIMEOUT_hook () { } - -############################################################################# -# make_resolv_conf -# -# This function is called to update the information related to the -# DNS configuration (the resolver part) -############################################################################# -make_resolv_conf () -{ - if [ "x$new_domain_name" != x ] && [ "x$new_domain_name_servers" != x ]; then - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done - fi -} - -############################################################################# -# set_XXX -# unset_XXX -# -# These function each deal with one particular setting. -# They are OS dependent and may be overridden in the -# dhclient-enter-hooks file if needed. -# -# These functions are called with either "new" or "old" to indicate which -# set of variables to use (new_ip_address or old_ip_address...) -# -############################################################################# - -update_hostname () -{ - local current_hostname=`/bin/hostname` - - if [ "$current_hostname" = "" ] || \ - [ "$current_hostname" = "$old_host_name" ] - then - if [ "$new_host_name" != "$old_host_name" ] - then - $LOGGER "New Hostname: $new_host_name" - hostname $new_host_name - fi - fi -} - -set_ip_address () -{ - local ip - local mask - local bcast - - if [ $# -lt 1 ] - then - return 1 - fi - - eval ip="\$${1}_ip_address" - eval mask="\$${1}_subnet_mask" - eval bcast="\$${1}_broadcast_address" - - if [ "$ip" != "" ] - then - ifconfig $interface inet $ip netmask $mask broadcast $bcast $medium -# route add $ip 127.0.0.1 > /dev/null 2>&1 - fi -} - -unset_ip_address () -{ - local ip - - if [ $# -lt 1 ] - then - return 1 - fi - - eval ip="\$${1}_ip_address" - - if [ "$ip" != "" ] - then - ifconfig $interface inet -alias $ip $medium -# route delete $ip 127.0.0.1 > /dev/null 2>&1 - fi -} - -set_ip_alias () -{ - if [ "$alias_ip_address" != "" ] - then - ifconfig $interface inet alias $alias_ip_address netmask $alias_subnet_mask -# route add $alias_ip_address 127.0.0.1 - fi -} - -unset_ip_alias () -{ - if [ "$alias_ip_address" != "" ] - then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 -# route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi -} - -set_routers () -{ - local router_list - - if [ $# -lt 1 ] - then - return 1 - fi - - eval router_list="\$${1}_routers" - - for router in $router_list - do - route add default $router >/dev/null 2>&1 - done -} - -unset_routers () -{ - local router_list - - if [ $# -lt 1 ] - then - return 1 - fi - - eval router_list="\$${1}_routers" - - for router in $router_list - do - route delete default $router >/dev/null 2>&1 - done -} - -set_static_routes () -{ - local static_routes - - if [ $# -lt 1 ] - then - return 1 - fi - - eval static_routes="\$${1}_static_routes" - - set static_routes - - while [ $# -ge 2 ] - do - $LOGGER "New Static Route: $1 -> $2" - route add $1 $2 - shift; shift - done -} - -unset_static_routes () -{ - local static_routes - - if [ $# -lt 1 ] - then - return 1 - fi - - eval static_routes="\$${1}_static_routes" - - set static_routes - - while [ $# -ge 2 ] - do - route delete $1 $2 - shift; shift - done -} - -############################################################################# -# -# utility functions grouping what needs to be done in logical units. -# -############################################################################# - -set_all () -{ - set_ip_address new - set_routers new - set_static_routes new - - if [ "$new_ip_address" != "$alias_ip_address" ] - then - set_ip_alias - fi -} - -set_others () -{ - update_hostname - make_resolv_conf -} - -clear_arp_table () -{ - arp -d -a -} - -unset_all () -{ - if [ "$alias_ip_address" != "$old_ip_address" ] - then - unset_ip_alias - fi - - if [ "$old_ip_address" != "" ] - then - unset_ip_address old - unset_routers old - unset_static_routes old - clear_arp_table - fi -} - -test_new_lease () -{ - local rc - - set $new_routers - - if [ $# -ge 1 ] - then - set_ip_address new - if ping -q -c 1 $1 - then - rc=0 - else - rc=1 - fi - unset_ip_address new - else - rc=1 - fi - return $rc -} - -############################################################################# -# Main State functions. -# -# There is a state function for each state of the DHCP client -# These functions are OS specific and should be be tampered with. -############################################################################# - -in_state_MEDIUM () -{ - ifconfig $interface $medium - ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1 - sleep 1 - exit_status=0 -} - -in_state_PREINIT () -{ - unset_ip_alias - - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \ - broadcast 255.255.255.255 up - exit_status=0 -} - -in_state_ARPCHECK () -{ - exit_status=0 -} - -in_state_ARPSEND () -{ - exit_status=0 -} - -in_state_RENEW () -{ - if [ "$old_ip_address" != "$new_ip_address" ] - then - unset_all - set_all - fi - - set_others -} - -in_state_REBIND () { - in_state_RENEW -} - -in_state_BOUND () { - unset_all - set_all - set_others -} - -in_state_REBOOT () { - in_state_BOUND -} - -in_state_EXPIRE () -{ - unset_all - set_ip_alias - exit_status=0 -} - -in_state_FAIL () { - in_state_EXPIRE -} - -in_state_TIMEOUT () -{ - unset_all - - if test_new_lease - then - set_all - set_others - else - $LOGGER "No good lease information in TIMEOUT state" - set_ip_alias - exit_status=1 - fi -} - -############################################################################# -# Main functions: -# -# dhclient_script_init() parses the optional "enter_hooks" script which can -# override any of the state functions -# -# This function also parses the variables and notifies the detected changes. -############################################################################# -dhclient_script_init () -{ - if [ "$new_network_number" != "" ] - then - $LOGGER "New Network Number: $new_network_number" - fi - - if [ "$new_ip_address" != "" ] - then - $LOGGER "New IP Address: $new_ip_address" - fi - - if [ "$new_broadcast_address" != "" ] - then - $LOGGER "New Broadcast Address: $new_broadcast_address" - fi - - if [ "$new_subnet_mask" != "" ] - then - $LOGGER "New Subnet Mask for $interface: $new_subnet_mask" - fi - - if [ "$alias_subnet_mask" != "" ] - then - fi -} - -############################################################################# -# dhclient_main() does the appropriate work depending on the state of -# the dhcp client -############################################################################# -dhclient_script_main () -{ -# set -x - exit_status=0 - - case $reason in - MEDIUM|\ - PREINIT|\ - ARPCHECK|\ - ARPSEND|\ - RENEW|\ - REBIND|\ - BOUND|\ - REBOOT|\ - EXPIRE|\ - FAIL|\ - TIMEOUT) - pre_state_${reason}_hook - in_state_${reason} - post_state_${reason}_hook - ;; - *) - $LOGGER "dhclient-script called with invalid reason $reason" - exit_status=1 - ;; - esac -} - -############################################################################# -# Let's do the work... -############################################################################# - -if [ -x /usr/bin/logger ]; then - LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" -else - LOGGER=echo -fi - -# Invoke the local dhcp client enter hooks, if they exist. -if [ -x %%PREFIX%%/etc/dhclient-enter-hooks ] -then - exit_status=0 - . %%PREFIX%%/etc/dhclient-enter-hooks - # 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 - -dhclient_script_init -dhclient_script_main - -# Invokes the local dhcp client exit hooks, if any. -if [ -x %%PREFIX%%/etc/dhclient-exit-hooks ]; then - . %%PREFIX%%/etc/dhclient-exit-hooks -fi - -exit $exit_status - -############################################################################# -# That's all folks -############################################################################# diff --git a/net/isc-dhcp30-server/files/isc-dhcpd.sh.sample b/net/isc-dhcp30-server/files/isc-dhcpd.sh.sample deleted file mode 100644 index d070ae0747d9..000000000000 --- a/net/isc-dhcp30-server/files/isc-dhcpd.sh.sample +++ /dev/null @@ -1,620 +0,0 @@ -#! /bin/sh -# -# $FreeBSD$ -# -# PROVIDE: dhcpd -# REQUIRE: DAEMON -# KEYWORD: FreeBSD -# -# Add the following line to /etc/rc.conf to enable dhcpd: -# -# dhcpd_enable="YES" -# - -. %%RC_SUBR%% - -name=dhcpd -paranoia=%%PARANOIA%% # compiled in paranoia? -jail=%%JAIL%% # compiled in jail? - -# override these variables in /etc/rc.conf -dhcpd_enable=${dhcpd_enable:-"NO"} -dhcpd_flags=${dhcpd_flags:-} # -q -early_chroot # command option(s) -dhcpd_conf=${dhcpd_conf:-%%PREFIX%%/etc/${name}.conf} # configuration file -dhcpd_ifaces=${dhcpd_ifaces:-} # ethernet interface(s) -dhcpd_withumask=${dhcpd_withumask:-022} # file creation mask - -dhcpd_chuser_enable=${dhcpd_chuser_enable:-"%%PARANOIA%%"} # runs w/o privileges? -dhcpd_withuser=${dhcpd_withuser:-${name}} # user name to run as -dhcpd_withgroup=${dhcpd_withgroup:-${name}} # group name to run as - -dhcpd_chroot_enable=${dhcpd_chroot_enable:-"NO"} # runs chrooted? -dhcpd_rootdir=${dhcpd_rootdir:-/var/db/${name}} # directory to run in - -# untested -dhcpd_jail_enable=${dhcpd_jail_enable:-"NO"} # runs imprisoned? -dhcpd_hostname=${dhcpd_hostname:-} # jail hostname -dhcpd_ipaddress=${dhcpd_ipaddress:-} # jail ip address - -safe_run () # rc command [args...] -{ - local _rc - - _rc=$1 - shift - - if [ "${_rc}" -eq 0 ]; then - debug safe_run: "$@" - "$@" || _rc=1 - else - warn safe_run: "$@" - fi - return ${_rc} -} - -precious () # entry... -{ - local _entry _rc - - _rc=0 - for _entry; do - # do nothing if /var/run or /var/db - echo ${_entry} | egrep -q '^//*(var//*(run|db)/*)?$' || _rc=1 - done - debug precious: "$@" rc=${_rc} - return ${_rc} -} - -lsmod () # user group file... -{ - local _entry _user _group _rc - - _user=$1 _group=$2 - shift 2 - - _rc=0 - for _entry; do - ls -ld ${_entry} 2> /dev/null | - awk -v u=${_user} -v g=${_group} '{ - exit ((u && $3 != u) || (g && $4 != g)) - }' || _rc=1 - done - debug lsmod: "$@" rc=${_rc} - return ${_rc} -} - -safe_chmog () # entry... -{ - local _entry _user _group _usergroup _rc - - _user=${dhcpd_withuser} - _group=${dhcpd_withgroup} - - _rc=0 - if [ -n "${_user}" -o -n "${_group}" ]; then - _usergroup=${_user}${_group:+:${_group}} - for _entry; do - if [ -d ${_entry} ] && mounted ${_entry}; then - continue - fi - if [ -e ${_entry} ] && - ! precious ${_entry} && - ! lsmod ${_user} ${_group} ${_entry} && - ! safe_run ${_rc} chown ${_usergroup} ${_entry}; then - warn "unable to change permissions of ${_entry}" - _rc=1 - fi - done - fi - return ${_rc} -} - -safe_mkdir () # dir... -{ - local _dir _rc - - _rc=0 - for _dir; do - if [ ! -d ${_dir} ] && - ! precious ${_dir} && - ! safe_run ${_rc} mkdir -p ${_dir}; then - err 1 "unable to create directory ${_dir}" - _rc=1 - fi - done - safe_run ${_rc} safe_chmog "$@" || _rc=1 - return ${_rc} -} - -safe_rmdir () # dir... -{ - local _dir _rc - - _rc=0 - for _dir; do - if [ -d ${_dir} ] && - ! precious ${_dir} && - ! mounted ${_dir}; then - if safe_run ${_rc} rmdir ${_dir}; then - safe_run ${_rc} safe_rmdir ${_dir%/*} || _rc=1 - else - warn "unable to remove directory ${_dir}" - rc=1 - fi - fi - done - return ${_rc} -} - -safe_touch () # file... -{ - local _file _rc - - _rc=0 - for _file; do - if [ ! -e ${_file} ] && - ! safe_run ${_rc} touch ${_file}; then - err 1 "unable to create file ${_file}" - _rc=1 - fi - done - safe_run ${_rc} safe_chmog "$@" || _rc=1 - return ${_rc} -} - -safe_remove () # file... -{ - local _file _rc - - _rc=0 - for _file; do - if [ -f ${_file} ] && - ! safe_run ${_rc} rm -f ${_file}; then - warn "unable to remove file ${_file}" - _rc=1 - fi - done - return ${_rc} -} - -safe_copy () # src dst -{ - local _src _dst _rc - - _src=$1 _dst=$2 - - _rc=0 - if ! safe_run ${_rc} safe_remove ${_dst} || - ! safe_run ${_rc} cp -p ${_src} ${_dst}; then - err 1 "unable to copy file ${_src} to ${_dst}" - _rc=1 - fi - safe_run ${_rc} safe_chmog ${_dst} || _rc=1 - return ${_rc} -} - -mounted () # dir... -{ - local _rc - - _rc=1 - mount -t devfs | awk ' - BEGIN { n = ARGC; ARGC = 2 } - { for (i = 2; i != n; i++) if ($3 == ARGV[i]) exit 1 } - ' - "$@" || _rc=0 - debug mounted: "$@" rc=${_rc} - return ${_rc} -} - -safe_mount () # dir -{ - local _dir _rc - - _dir=$1 - - _rc=0 - if ! mounted ${_dir} && - ! safe_run ${_rc} mount -t devfs devfs ${_dir}; then - err 1 "unable to mount ${_dir}" - _rc=1 - fi - return ${_rc} -} - -safe_umount () # dir -{ - local _dir _rc - - _dir=$1 - - _rc=0 - if mounted ${_dir} && - ! safe_run ${_rc} umount ${_dir}; then - warn "unable to unmount ${_dir}" - _rc=1 - fi - return ${_rc} -} - -safe_useradd () -{ - local _user _group _home _shell _gecos - - _user=$1 _group=$2 _gecos=${3:-"& daemon"} - _home=${4:-/nonexistent} _shell=${5:-/sbin/nologin} - - if [ -n "${_group}" ]; then - if pw group show ${_group} 2>/dev/null; then - echo "You already have a group \"${_group}\"," \ - "so I will use it." - elif pw groupadd ${_group} -h -; then - echo "Added group \"${_group}\"." - else - echo "Adding group \"${_group}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi - if [ -n "${_user}" ]; then - if pw user show ${_user} 2>/dev/null; then - echo "You already have a user \"${_user}\"," \ - "so I will use it." - elif pw useradd ${_user} -g ${_group} -h - \ - -d ${_home} -s ${_shell} -c "${_gecos}"; then - echo "Added user \"${_user}\"." - else - echo "Adding user \"${_user}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi -} - -check_chuser () -{ - if checkyesno paranoia; then - if checkyesno dhcpd_chuser_enable && - [ -z "${dhcpd_withuser}" -a -z "${dhcpd_withgroup}" ]; then - err 1 "one of dhcpd_withuser and dhcpd_withgroup" \ - "must be set if dhcpd_chuser_enable is enabled" - fi - else - if checkyesno dhcpd_chuser_enable; then - warn "dhcpd_chuser_enable disabled -- not compiled in" - dhcpd_chuser_enable=NO - fi - fi -} - -check_jail () -{ - if checkyesno paranoia && checkyesno jail; then - if checkyesno dhcpd_jail_enable && - ! checkyesno dhcpd_chroot_enable; then - warn "dhcpd_chroot_enable implied by dhcpd_jail_enable" - dhcpd_chroot_enable=YES - fi - if checkyesno dhcpd_jail_enable && - [ -n "${dhcpd_hostname}" -a -z "${dhcpd_ipaddress}" ] || - [ -z "${dhcpd_hostname}" -a -n "${dhcpd_ipaddress}" ]; then - err 1 "both dhcpd_hostname and dhcpd_ipaddress" \ - "must be set if dhcpd_jail_enable is enabled" - fi - else - if checkyesno dhcpd_jail_enable; then - warn "dhcpd_jail_enable disabled -- not compiled in" - dhcpd_jail_enable=NO - fi - fi -} - -check_chroot () -{ - if checkyesno paranoia; then - if checkyesno dhcpd_chroot_enable && - [ -z "${dhcpd_rootdir}" ]; then - err 1 "dhcpd_rootdir" \ - "must be set if dhcpd_chroot_enable is enabled" - fi - else - if checkyesno dhcpd_chroot_enable; then - warn "dhcpd_chroot_enable disabled -- not compiled in" - dhcpd_chroot_enable=NO - fi - fi -} - -rcvar_chuser () -{ - if checkyesno paranoia && checkyesno dhcpd_chuser_enable; then - dhcpd_piddir=${__dhcpd_piddir}/${name} - dhcpd_leasesdir=${__dhcpd_leasesdir}/${name} - else - dhcpd_withuser= dhcpd_withgroup= - fi -} - -rcvar_jail () -{ - if ! checkyesno paranoia || ! checkyesno jail || - ! checkyesno dhcpd_jail_enable; then - dhcpd_hostname= dhcpd_ipaddress= - fi -} - -rcvar_chroot () -{ - if ! checkyesno paranoia || ! checkyesno dhcpd_chroot_enable; then - dhcpd_rootdir= - fi -} - -rcvar_pidnleases () -{ - if ! checkyesno dhcpd_chuser_enable; then - dhcpd_piddir=${__dhcpd_piddir} - dhcpd_leasesdir=${__dhcpd_leasesdir} - fi - dhcpd_pidfile=${dhcpd_piddir}/${name}.pid - dhcpd_leasesfile=${dhcpd_leasesdir}/${name}.leases - dhcpd_conffile=${dhcpd_conf} # for convenience only - dhcpd_confdir=$(dirname ${dhcpd_conffile}) -} - -rcvar_rooted () -{ - _dhcpd_rootdir=${dhcpd_rootdir} - _dhcpd_devdir=${dhcpd_rootdir}/dev - _dhcpd_confdir=${dhcpd_rootdir}${dhcpd_confdir} - _dhcpd_piddir=${dhcpd_rootdir}${dhcpd_piddir} - _dhcpd_leasesdir=${dhcpd_rootdir}${dhcpd_leasesdir} - _dhcpd_conffile=${dhcpd_rootdir}${dhcpd_conffile} - _dhcpd_pidfile=${dhcpd_rootdir}${dhcpd_pidfile} - _dhcpd_leasesfile=${dhcpd_rootdir}${dhcpd_leasesfile} -} - -setup_compat () -{ - local dhcpd_rcconf - - # suck in old configuration file and variables - # - dhcpd_rcconf=${dhcpd_confdir}/rc.isc-dhcpd.conf - - if [ -f ${dhcpd_rcconf} ]; then - warn "${dhcpd_rcconf} is obsolete, use /etc/rc.conf and/or" \ - "/etc/rc.conf.d/${name} instead." - . ${dhcpd_rcconf} - - if [ -n "${dhcpd_options}" -a -z "${rc_flags}" ]; then - warn "dhcpd_options is obsolete," \ - "use dhcpd_flags instead." - rc_flags=${dhcpd_options} - fi - fi -} - -setup_umask () -{ - if [ -n "${dhcpd_withumask}" ]; then - umask ${dhcpd_withumask} - fi -} - -setup_chroot () -{ - if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then - safe_mkdir ${_dhcpd_rootdir} ${_dhcpd_devdir} ${_dhcpd_confdir} - safe_mount ${_dhcpd_devdir} - safe_copy ${dhcpd_conffile} ${_dhcpd_conffile} - fi -} - -setup_chuser () -{ - if checkyesno paranoia && { - checkyesno dhcpd_chuser_enable || checkyesno dhcpd_chroot_enable - }; then - safe_mkdir ${_dhcpd_piddir} ${_dhcpd_leasesdir} - fi -} - -setup_leases () -{ - safe_touch ${_dhcpd_leasesfile} -} - -setup_flags () -{ - if [ -n "${dhcpd_conf}" ]; then - rc_flags="${rc_flags} -cf ${dhcpd_conf}" - fi - if [ -n "${dhcpd_leasesfile}" ]; then - rc_flags="${rc_flags} -lf ${dhcpd_leasesfile}" - fi - if [ -n "${dhcpd_pidfile}" ]; then - rc_flags="${rc_flags} -pf ${dhcpd_pidfile}" - fi - if [ -n "${dhcpd_withuser}" ]; then - rc_flags="${rc_flags} -user ${dhcpd_withuser}" - fi - if [ -n "${dhcpd_withgroup}" ]; then - rc_flags="${rc_flags} -group ${dhcpd_withgroup}" - fi - if [ -n "${dhcpd_rootdir}" ]; then - rc_flags="${rc_flags} -chroot ${dhcpd_rootdir}" - fi - if [ -n "${dhcpd_hostname}" -a -n "${dhcpd_ipaddress}" ]; then - rc_flags="${rc_flags} -jail ${dhcpd_hostname} ${dhcpd_ipaddress}" - fi - rc_flags="${rc_flags} ${dhcpd_ifaces}" -} - -cleanup_chroot () -{ - if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then - safe_umount ${_dhcpd_devdir} - fi -} - -dhcpd_stop () -{ - if sh $0 forcestatus; then - sh $0 forcestop - fi -} - -remove_pid () -{ - if [ -e ${_dhcpd_pidfile} ]; then - warn "${_dhcpd_pidfile} still exists! -- removing anyway" - fi - safe_remove ${_dhcpd_pidfile} -} - -remove_leases () -{ - if [ -s ${_dhcpd_leasesfile} ]; then - warn "${_dhcpd_leasesfile} not empty -- not removed --" \ - "futher warning messages expected, don't care." - else - safe_remove ${_dhcpd_leasesfile} ${_dhcpd_leasesfile}~ - fi -} - -remove_chuser () -{ - if checkyesno paranoia && { - checkyesno dhcpd_chuser_enable || checkyesno dhcpd_chroot_enable - }; then - safe_rmdir ${_dhcpd_piddir} ${_dhcpd_leasesdir} - fi -} - -remove_chroot () -{ - if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then - safe_remove ${_dhcpd_conffile} - safe_umount ${_dhcpd_devdir} - safe_rmdir ${_dhcpd_confdir} ${_dhcpd_devdir} ${_dhcpd_rootdir} - fi -} - -dhcpd_check () -{ - check_chuser - check_jail - check_chroot -} - -dhcpd_rcvar () -{ - rcvar_chuser - rcvar_jail - rcvar_chroot - rcvar_pidnleases - rcvar_rooted -} - -dhcpd_precmd () -{ - setup_compat - setup_umask - setup_chroot - setup_chuser - setup_leases - setup_flags -} - -dhcpd_postcmd () -{ - cleanup_chroot -} - -dhcpd_install () -{ - if checkyesno paranoia; then - safe_useradd "${dhcpd_withuser}" "${dhcpd_withgroup}" \ - "DHCP Daemon" - fi -} - -_dhcpd_uninstall () # user group root -{ - local _user _group _root - - _user=$1 _group=$2 _root=$3 - - if [ -n "${_user}" -o -n "${_group}" ]; then - dhcpd_chuser_enable=YES - dhcpd_withuser=${_user} - dhcpd_withgroup=${_group} - else - dhcpd_chuser_enable=NO - fi - if [ -n "${_root}" ]; then - dhcpd_chroot_enable=YES - dhcpd_rootdir=${_root} - else - dhcpd_chroot_enable=NO - fi - dhcpd_check - dhcpd_rcvar - dhcpd_uninstall -} - -dhcpd_uninstall () -{ - if checkyesno __dhcpd_uninstall; then - dhcpd_stop - remove_pid - remove_leases - remove_chuser - remove_chroot - else - local _user _group _root - - __dhcpd_uninstall=YES - - _user=${dhcpd_withuser} - _group=${dhcpd_withgroup} - _root=${dhcpd_rootdir} - - _dhcpd_uninstall "" "" "" - - if checkyesno paranoia; then - if [ -n "${_user}" -o -n "${_group}" ]; then - _dhcpd_uninstall "${_user}" "${_group}" "" - fi - if [ -n "${_root}" ]; then - _dhcpd_uninstall "" "" "${_root}" - fi - if [ -n "${_user}" -o -n "${_group}" ] && - [ -n "${_root}" ]; then - _dhcpd_uninstall "${_user}" "${_group}" "${_root}" - fi - fi - fi -} - -rcvar=$(set_rcvar) -load_rc_config ${name} - -__dhcpd_uninstall="NO" # internal use only -__dhcpd_piddir=/var/run # pid file directory -__dhcpd_leasesdir=/var/db # leases file directory -#__dhcpd_rootdir=/var/db/${name} # root directory - -dhcpd_check -dhcpd_rcvar - -command=%%PREFIX%%/sbin/${name} -pidfile=${_dhcpd_pidfile} -required_files=${dhcpd_conf} -start_precmd=${name}_precmd -stop_postcmd=${name}_postcmd -install_cmd=dhcpd_install -uninstall_cmd=dhcpd_uninstall -extra_commands="install uninstall" - -run_rc_command "$1" diff --git a/net/isc-dhcp30-server/files/isc-dhcrelay.sh.sample b/net/isc-dhcp30-server/files/isc-dhcrelay.sh.sample deleted file mode 100644 index 3c72b5520efe..000000000000 --- a/net/isc-dhcp30-server/files/isc-dhcrelay.sh.sample +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh -# -# $FreeBSD$ -# -# PROVIDE: dhcrelay -# REQUIRE: DAEMON -# KEYWORD: FreeBSD -# -# Add the following line to /etc/rc.conf to enable dhcrelay: -# -# dhcrelay_enable="YES" -# - -# override these variables in /etc/rc.conf -dhcrelay_enable=${dhcrelay_enable:-"NO"} -dhcrelay_flags=${dhcrelay_flags:-} # command option(s) -dhcrelay_servers=${dhcrelay_servers:-} # dhcrelay server(s) -dhcrelay_ifaces=${dhcrelay_ifaces:-} # ethernet interface(s) - -dhcrelay_precmd () -{ - local ifaces - - dhcrelay_rcconf=%%PREFIX%%/etc/rc.isc-dhcrelay.conf - - if [ -f ${dhcrelay_rcconf} ]; then - warn "${dhcrelay_rcconf} is obsolete, use /etc/rc.conf instead." - . ${dhcrelay_rcconf} - - if [ -n "${dhcrelay_options}" -a -z "${rc_flags}" ]; then - warn "dhcrelay_options is obsolete, use dhcrelay_flags instead." - rc_flags=${dhcrelay_options} - fi - fi - - if [ -z "${dhcrelay_servers}" ]; then - err 1 "no dhcrelay server(s) configured." - fi - - ifaces= - for iface in ${dhcrelay_ifaces}; do - ifaces="${ifaces} -i ${iface}" - done - - rc_flags="${rc_flags} ${ifaces} ${dhcrelay_servers}" -} - -. %%RC_SUBR%% - -name=dhcrelay -rcvar=$(set_rcvar) - -command=%%PREFIX%%/sbin/${name} -pidfile=/var/run/${name}.pid -start_precmd=${name}_precmd - -load_rc_config ${name} -run_rc_command "$1" diff --git a/net/isc-dhcp30-server/files/omshell::Makefile.dist b/net/isc-dhcp30-server/files/omshell::Makefile.dist deleted file mode 100644 index 34c90a2e7f53..000000000000 --- a/net/isc-dhcp30-server/files/omshell::Makefile.dist +++ /dev/null @@ -1,80 +0,0 @@ -# Makefile.dist -# -# Copyright (c) 1996-2002 Internet Software Consortium. -# Use is subject to license terms which appear in the file named -# ISC-LICENSE that should have accompanied this file when you -# received it. If a file named ISC-LICENSE did not accompany this -# file, or you are not sure the one you have is correct, you may -# obtain an applicable copy of the license at: -# -# http://www.isc.org/isc-license-1.0.html. -# -# This file is part of the ISC DHCP distribution. The documentation -# associated with this file is listed in the file DOCUMENTATION, -# included in the top-level directory of this release. -# -# Support and other services are available for ISC products - see -# http://www.isc.org for more information. -# - -CATMANPAGES = omshell.cat1 -SEDMANPAGES = omshell.man1 -SRCS = omshell.c -OBJS = omshell.o -PROG = omshell -MAN = omshell.1 - -INCLUDES = -I$(TOP)/dhcpctl $(BINDINC) -I$(TOP)/includes -CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) -DHCPCTLLIBS = ../dhcpctl/libdhcpctl.a ../common/libdhcp.a $(BINDLIB) \ - ../omapip/libomapi.a ../dst/libdst.a - -all: $(PROG) $(CATMANPAGES) - -$(PROG): $(OBJS) $(DHCPCTLLIBS) - $(CC) $(DEBUG) $(LFLAGS) -o $(PROG) $(OBJS) $(DHCPCTLLIBS) $(LIBS) - -install: all $(CATMANPAGES) - for dir in $(USRMANDIR) $(USERBINDIR); do \ - foo=""; \ - for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \ - foo=$${foo}/$$bar; \ - if [ ! -d $$foo ]; then \ - mkdir $$foo; \ - chmod 755 $$foo; \ - fi; \ - done; \ - done - $(INSTALL) omshell $(DESTDIR)$(USERBINDIR) - $(CHMOD) 755 $(DESTDIR)$(USERBINDIR)/omshell - $(MANINSTALL) $(MANFROM) omshell.$(MANCAT)1 $(MANTO) \ - $(DESTDIR)$(USRMANDIR)/omshell$(USRMANEXT) - -depend: - $(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS) - -clean: - -rm -f $(OBJS) - -realclean: clean - -rm -f $(PROG) *~ $(CATMANPAGES) $(SEDMANPAGES) #* - -distclean: realclean - -rm -f Makefile - -links: - @for foo in $(SRCS) $(MAN); do \ - if [ ! -b $$foo ]; then \ - rm -f $$foo; \ - fi; \ - ln -s $(TOP)/omshell/$$foo $$foo; \ - done - -omshell.cat1: omshell.man1 - nroff -man omshell.man1 >omshell.cat1 - -omshell.man1: omshell.1 - sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \ - -e "s#RUNDIR#$(VARRUN)#g" < omshell.1 >omshell.man1 - -# Dependencies (semi-automatically-generated) diff --git a/net/isc-dhcp30-server/files/patch-Makefile b/net/isc-dhcp30-server/files/patch-Makefile deleted file mode 100644 index 7a8df08b137b..000000000000 --- a/net/isc-dhcp30-server/files/patch-Makefile +++ /dev/null @@ -1,76 +0,0 @@ ---- Makefile.orig Fri Nov 8 00:10:07 2002 -+++ Makefile Mon Apr 28 15:04:50 2003 -@@ -38,59 +38,59 @@ - # ``http://www.nominum.com''. - # - --all: -+all all.devel all.server all.relay all.client: - @sysname=`./configure --print-sysname`; \ - if [ ! -d work.$$sysname ]; then \ - echo No build directory for $$sysname - please run ./configure.; \ - else \ -- (cd work.$$sysname; make all); \ -+ (cd work.$$sysname; make $@); \ - fi - --install: -+install install.devel install.server install.relay install.client: - @sysname=`./configure --print-sysname`; \ - if [ ! -d work.$$sysname ]; then \ - echo No build directory for $$sysname - please run ./configure.; \ - else \ -- (cd work.$$sysname; make install); \ -+ (cd work.$$sysname; make $@); \ - fi - --depend: -+depend depend.devel depend.server depend.relay depend.client: - @sysname=`./configure --print-sysname`; \ - if [ ! -d work.$$sysname ]; then \ - echo No build directory for $$sysname - please run ./configure.; \ - else \ -- (cd work.$$sysname; make depend); \ -+ (cd work.$$sysname; make $@); \ - fi - --clean: -+clean clean.devel clean.server clean.relay clean.client: - @sysname=`./configure --print-sysname`; \ - if [ ! -d work.$$sysname ]; then \ - echo No build directory for $$sysname - please run ./configure.; \ - else \ -- (cd work.$$sysname; make clean); \ -+ (cd work.$$sysname; make $@); \ - fi - --realclean: -+realclean realclean.devel realclean.server realclean.relay realclean.client: - @sysname=`./configure --print-sysname`; \ - if [ ! -d work.$$sysname ]; then \ - echo No build directory for $$sysname - please run ./configure.; \ - else \ -- (cd work.$$sysname; make realclean); \ -+ (cd work.$$sysname; make $@); \ - fi - --distclean: -+distclean distclean.devel distclean.server distclean.relay distclean.client: - @sysname=`./configure --print-sysname`; \ - if [ ! -d work.$$sysname ]; then \ - echo No build directory for $$sysname - please run ./configure.; \ - else \ -- (cd work.$$sysname; make distclean); \ -+ (cd work.$$sysname; make $@); \ - fi - --links: -+links links.devel links.server links.relay links.client: - @sysname=`./configure --print-sysname`; \ - if [ ! -d work.$$sysname ]; then \ - echo No build directory for $$sysname - please run ./configure.; \ - else \ -- (cd work.$$sysname; make links); \ -+ (cd work.$$sysname; make $@); \ - fi - diff --git a/net/isc-dhcp30-server/files/patch-Makefile.dist b/net/isc-dhcp30-server/files/patch-Makefile.dist deleted file mode 100644 index 0c09997023cc..000000000000 --- a/net/isc-dhcp30-server/files/patch-Makefile.dist +++ /dev/null @@ -1,226 +0,0 @@ ---- Makefile.dist.orig Fri Nov 8 00:10:08 2002 -+++ Makefile.dist Tue Apr 29 00:07:43 2003 -@@ -17,47 +17,200 @@ - # http://www.isc.org for more information. - # - --SUBDIRS= common $(MINIRES) dst omapip server client relay dhcpctl -+COMMON_SUBDIRS= common -+DEVEL_SUBDIRS= $(MINIRES) dst omapip dhcpctl -+SERVER_SUBDIRS= omshell server -+RELAY_SUBDIRS= relay -+CLIENT_SUBDIRS= client -+ -+DEVEL_BUILD_SUBDIRS= ${COMMON_SUBDIRS} ${DEVEL_SUBDIRS} -+SERVER_BUILD_SUBDIRS= ${SERVER_SUBDIRS} -+RELAY_BUILD_SUBDIRS= ${RELAY_SUBDIRS} -+CLIENT_BUILD_SUBDIRS= ${CLIENT_SUBDIRS} -+ -+DEVEL_INSTALL_SUBDIRS= ${COMMON_SUBDIRS} ${DEVEL_SUBDIRS} -+SERVER_INSTALL_SUBDIRS= ${COMMON_SUBDIRS} ${SERVER_SUBDIRS} -+RELAY_INSTALL_SUBDIRS= ${RELAY_SUBDIRS} -+CLIENT_INSTALL_SUBDIRS= ${COMMON_SUBDIRS} ${CLIENT_SUBDIRS} - --all: -- @for dir in ${SUBDIRS}; do \ -+all: all.server all.relay all.client -+ -+all.devel: -+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \ -+ echo "Making all in $$dir"; \ -+ (cd $$dir; $(MAKE) all) || exit 1; \ -+ done -+ -+all.server: all.devel -+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \ -+ echo "Making all in $$dir"; \ -+ (cd $$dir; $(MAKE) all) || exit 1; \ -+ done -+ -+all.relay: all.devel -+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \ -+ echo "Making all in $$dir"; \ -+ (cd $$dir; $(MAKE) all) || exit 1; \ -+ done -+ -+all.client: all.devel -+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \ - echo "Making all in $$dir"; \ - (cd $$dir; $(MAKE) all) || exit 1; \ -- done -+ done -+ -+install: install.devel install.server install.relay install.client -+ -+install.devel: -+ @for dir in ${DEVEL_INSTALL_SUBDIRS}; do \ -+ echo "Installing in $$dir"; \ -+ (cd $$dir; $(MAKE) install) || exit 1; \ -+ done - --install: -- @for dir in ${SUBDIRS}; do \ -+install.server: -+ @for dir in ${SERVER_INSTALL_SUBDIRS}; do \ - echo "Installing in $$dir"; \ - (cd $$dir; $(MAKE) install) || exit 1; \ -- done -+ done - --depend: -- @for dir in ${SUBDIRS}; do \ -+install.relay: -+ @for dir in ${RELAY_INSTALL_SUBDIRS}; do \ -+ echo "Installing in $$dir"; \ -+ (cd $$dir; $(MAKE) install) || exit 1; \ -+ done -+ -+install.client: -+ @for dir in ${CLIENT_INSTALL_SUBDIRS}; do \ -+ echo "Installing in $$dir"; \ -+ (cd $$dir; $(MAKE) install) || exit 1; \ -+ done -+ -+depend: depend.server depend.relay depend.client -+ -+depend.devel: -+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \ -+ echo "Making dependencies in $$dir"; \ -+ (cd $$dir; $(MAKE) depend) || exit 1; \ -+ done -+ -+depend.server: depend.devel -+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \ -+ echo "Making dependencies in $$dir"; \ -+ (cd $$dir; $(MAKE) depend) || exit 1; \ -+ done -+ -+depend.relay: depend.devel -+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \ - echo "Making dependencies in $$dir"; \ - (cd $$dir; $(MAKE) depend) || exit 1; \ -- done -+ done -+ -+depend.client: depend.devel -+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \ -+ echo "Making dependencies in $$dir"; \ -+ (cd $$dir; $(MAKE) depend) || exit 1; \ -+ done -+ -+clean: clean.server clean.relay clean.client -+ -+clean.devel: -+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \ -+ echo "Cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) clean) || exit 1; \ -+ done -+ -+clean.server: clean.devel -+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \ -+ echo "Cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) clean) || exit 1; \ -+ done -+ -+clean.relay: clean.devel -+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \ -+ echo "Cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) clean) || exit 1; \ -+ done - --clean: -- @for dir in ${SUBDIRS}; do \ -+clean.client: clean.devel -+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \ - echo "Cleaning in $$dir"; \ - (cd $$dir; $(MAKE) clean) || exit 1; \ -- done -+ done -+ -+realclean: realclean.server realclean.relay realclean.client -+ -+realclean.devel: -+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \ -+ echo "Really cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) realclean) || exit 1; \ -+ done - --realclean: -- @for dir in ${SUBDIRS}; do \ -+realclean.server: realclean.devel -+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \ - echo "Really cleaning in $$dir"; \ - (cd $$dir; $(MAKE) realclean) || exit 1; \ -- done -+ done - --distclean: -- @for dir in ${SUBDIRS}; do \ -+realclean.relay: realclean.devel -+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \ -+ echo "Really cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) realclean) || exit 1; \ -+ done -+ -+realclean.client: realclean.devel -+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \ -+ echo "Really cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) realclean) || exit 1; \ -+ done -+ -+distclean: distclean.server distclean.relay distclean.client -+ -+distclean.devel: -+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \ - echo "Really, really cleaning in $$dir"; \ - (cd $$dir; $(MAKE) distclean) || exit 1; \ -- done -- @rm -f Makefile -+ done -+ -+distclean.server: distclean.devel -+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \ -+ echo "Really, really cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) distclean) || exit 1; \ -+ done -+ -+distclean.relay: distclean.devel -+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \ -+ echo "Really, really cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) distclean) || exit 1; \ -+ done -+ -+distclean.client: distclean.devel -+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \ -+ echo "Really, really cleaning in $$dir"; \ -+ (cd $$dir; $(MAKE) distclean) || exit 1; \ -+ done -+ -+links: links.server links.relay links.client -+ -+links.devel: -+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \ -+ echo "Making links in $$dir"; \ -+ (cd $$dir; $(MAKE) links) || exit 1; \ -+ done -+ -+links.server: links.devel -+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \ -+ echo "Making links in $$dir"; \ -+ (cd $$dir; $(MAKE) links) || exit 1; \ -+ done -+ -+links.relay: links.devel -+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \ -+ echo "Making links in $$dir"; \ -+ (cd $$dir; $(MAKE) links) || exit 1; \ -+ done - --links: -- @for dir in ${SUBDIRS}; do \ -+links.client: links.devel -+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \ - echo "Making links in $$dir"; \ - (cd $$dir; $(MAKE) links) || exit 1; \ -- done -+ done diff --git a/net/isc-dhcp30-server/files/patch-client::clparse.c b/net/isc-dhcp30-server/files/patch-client::clparse.c deleted file mode 100644 index 4140cc6e3109..000000000000 --- a/net/isc-dhcp30-server/files/patch-client::clparse.c +++ /dev/null @@ -1,11 +0,0 @@ ---- client/clparse.c.orig Mon Feb 10 01:39:57 2003 -+++ client/clparse.c Wed Mar 3 01:35:39 2004 -@@ -785,7 +785,7 @@ - if (status != ISC_R_SUCCESS) - log_fatal ("Can't record interface %s: %s", - name, isc_result_totext (status)); -- strcpy (ip -> name, name); -+ strlcpy (ip -> name, name, IFNAMSIZ); - if (dummy_interfaces) { - interface_reference (&ip -> next, - dummy_interfaces, MDL); diff --git a/net/isc-dhcp30-server/files/patch-client::dhclient.8 b/net/isc-dhcp30-server/files/patch-client::dhclient.8 deleted file mode 100644 index 4e6096f5aa86..000000000000 --- a/net/isc-dhcp30-server/files/patch-client::dhclient.8 +++ /dev/null @@ -1,83 +0,0 @@ ---- client/dhclient.8.orig Sun Nov 17 03:25:43 2002 -+++ client/dhclient.8 Wed Mar 3 02:06:52 2004 -@@ -18,6 +18,10 @@ - .\" - .\" from Id: dhclient.8,v 1.12.2.8 2004/06/10 17:59:12 dhankins Exp - .\" -+.\" Portions copyright (c) 2000 David E. O'Brien. -+.\" All rights reserved. -+.\" $FreeBSD$ -+.\" - .TH dhclient 8 - .SH NAME - dhclient - Dynamic Host Configuration Protocol Client -@@ -28,12 +32,18 @@ - .I port - ] - [ -+.B -D -+] -+[ - .B -d - ] - [ - .B -q - ] - [ -+.B -v -+] -+[ - .B -1 - ] - [ -@@ -64,6 +74,10 @@ - relay - ] - [ -+.B -i -+interval -+] -+[ - .B -n - ] - [ -@@ -148,6 +162,15 @@ - configuration file or on the command line, and will ignore all other - interfaces. - .PP -+The -+.B -D -+flag causes -+.B dhclient -+to save the script it creates for use in conjunction with -+.B dhclient-script -+in -+.IR /tmp. -+.PP - If the DHCP client should listen and transmit on a port other than the - standard (port 68), the - .B -p -@@ -171,6 +194,12 @@ - flag, followed by the IP address to send. This is only useful for testing, - and should not be expected to work in any consistent or useful way. - .PP -+On FreeBSD, dhclient can be enabled to automatically handle the -+link status of the network card. Normally polling is done every -+five seconds. The polling interval can be set using the -+.B -i -+flag, followed by the numbers of seconds. Minimum is one second. -+.PP - The DHCP client will normally run in the foreground until it has - configured an interface, and then will revert to running in the - background. To run force dhclient to always run as a foreground -@@ -188,6 +217,10 @@ - .B -q - flag prevents any messages other than errors from being printed to the - standard error descriptor. -+.B -v -+flag turns on all messages. -+Opposite of -+.B -q . - .PP - The client normally doesn't release the current lease as it is not - required by the DHCP protocol. Some cable ISPs require their clients diff --git a/net/isc-dhcp30-server/files/patch-client::dhclient.c b/net/isc-dhcp30-server/files/patch-client::dhclient.c deleted file mode 100644 index 27cef99162df..000000000000 --- a/net/isc-dhcp30-server/files/patch-client::dhclient.c +++ /dev/null @@ -1,545 +0,0 @@ ---- client/dhclient.c.orig Sat Apr 26 23:51:39 2003 -+++ client/dhclient.c Wed Mar 3 16:21:02 2004 -@@ -47,6 +47,13 @@ - #include "dhcpd.h" - #include "version.h" - -+#if __FreeBSD_version > 502010 -+#include <sys/ioctl.h> -+#include <net/if_media.h> -+#include <net80211/ieee80211_ioctl.h> -+#include <net80211/ieee80211.h> -+#endif -+ - TIME cur_time; - TIME default_lease_time = 43200; /* 12 hours... */ - TIME max_lease_time = 86400; /* 24 hours... */ -@@ -82,8 +89,11 @@ - struct string_list *client_env=NULL; - int client_env_count=0; - int onetry=0; --int quiet=0; -+int quiet=1; - int nowait=0; -+#ifdef ENABLE_POLLING_MODE -+int polling_interval = 5; -+#endif - - static void usage PROTO ((void)); - -@@ -184,6 +194,9 @@ - } else if (!strcmp (argv [i], "-q")) { - quiet = 1; - quiet_interface_discovery = 1; -+ } else if (!strcmp (argv [i], "-v")) { -+ quiet = 0; -+ quiet_interface_discovery = 0; - } else if (!strcmp (argv [i], "-s")) { - if (++i == argc) - usage (); -@@ -197,6 +210,19 @@ - } else if (!strcmp (argv [i], "-n")) { - /* do not start up any interfaces */ - interfaces_requested = 1; -+#ifdef ENABLE_POLLING_MODE -+ } else if (!strcmp (argv [i], "-i")) { -+ if (++i == argc) -+ usage (); -+ polling_interval = (int)strtol (argv [i], -+ (char **)NULL, 10); -+ if (polling_interval <= 0) { -+ log_info ("Incorrect polling interval %d", -+ polling_interval); -+ log_info ("Using a default of 5 seconds"); -+ polling_interval = 5; -+ } -+#endif - } else if (!strcmp (argv [i], "-w")) { - /* do not exit if there are no broadcast interfaces. */ - persist = 1; -@@ -225,7 +251,16 @@ - if (strlen (argv [i]) > sizeof tmp -> name) - log_fatal ("%s: interface name too long (max %ld)", - argv [i], (long)strlen (argv [i])); -- strcpy (tmp -> name, argv [i]); -+ strlcpy (tmp -> name, argv [i], IFNAMSIZ); -+#if __FreeBSD_version > 502010 -+ set_ieee80211 (tmp); -+#endif -+ /* Init some interface vars, enable polling */ -+#ifdef ENABLE_POLLING_MODE -+ tmp -> forcediscover = 0; -+ tmp -> linkstate = HAVELINK; -+ tmp -> polling = 1; -+#endif /* ifdef ENABLE_POLLING_MODE */ - if (interfaces) { - interface_reference (&tmp -> next, - interfaces, MDL); -@@ -385,6 +420,16 @@ - INTERFACE_AUTOMATIC)) != - INTERFACE_REQUESTED)) - continue; -+#if __FreeBSD_version > 502010 -+ set_ieee80211 (ip); -+#endif -+#ifdef ENABLE_POLLING_MODE -+ ip -> forcediscover = 0; -+ if (ip -> client -> config -> media != NULL) -+ ip -> havemedia = 1; -+ else -+ ip -> havemedia = 0; -+#endif - script_init (ip -> client, - "PREINIT", (struct string_list *)0); - if (ip -> client -> alias) -@@ -427,8 +472,13 @@ - client -> state = S_INIT; - /* Set up a timeout to start the initialization - process. */ -+#ifdef ENABLE_POLLING_MODE -+ add_timeout (cur_time + random () % 5 + 2, -+ state_polling, client, 0, 0); -+#else - add_timeout (cur_time + random () % 5, - state_reboot, client, 0, 0); -+#endif - } - } - } -@@ -486,9 +536,9 @@ - log_info (arr); - log_info (url); - -- log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s", -- "[-s server]"); -- log_error (" [-cf config-file] [-lf lease-file]%s", -+ log_error ("Usage: dhclient [-1Ddqrv] [-i polling-interval] %s", -+ "[-nw] [-p <port>] [-s server]"); -+ log_error (" [-cf config-file] [-lf lease-file] %s", - "[-pf pid-file] [-e VAR=val]"); - log_fatal (" [-sf script-file] [interface]"); - } -@@ -876,6 +926,15 @@ - /* Write out the new lease. */ - write_client_lease (client, client -> new, 0, 0); - -+ /* -+ * It's now possible that state_reboot can be called -+ * after a interface link went down and is up again. -+ * To prevent tons of equal leases saved on disk, we rewrite -+ * them. -+ */ -+ read_client_leases (); -+ rewrite_client_leases (); -+ - /* Replace the old active lease with the new one. */ - if (client -> active) - destroy_client_lease (client -> active); -@@ -890,6 +949,12 @@ - piaddr (client -> active -> address), - (long)(client -> active -> renewal - cur_time)); - client -> state = S_BOUND; -+#ifdef ENABLE_POLLING_MODE -+ /* Init some interface vars, enable polling */ -+ client -> interface -> linkstate = HAVELINK; -+ client -> interface -> forcediscover = 0; -+ client -> interface -> polling = 1; -+#endif /* ifdef ENABLE_POLLING_MODE */ - reinitialize_interfaces (); - go_daemon (); - if (client -> config -> do_forward_update) { -@@ -1352,6 +1417,11 @@ - int interval; - int increase = 1; - -+#ifdef ENABLE_POLLING_MODE -+ /* Disable polling for this interface */ -+ client -> interface -> polling = 0; -+#endif -+ - /* Figure out how long it's been since we started transmitting. */ - interval = cur_time - client -> first_sending; - -@@ -1457,6 +1527,9 @@ - struct client_lease *loop; - struct client_lease *lp; - -+ if (client -> interface -> linkstate == NOLINK) -+ return; -+ - loop = lp = client -> active; - - log_info ("No DHCPOFFERS received."); -@@ -1489,6 +1562,10 @@ - log_info ("bound: renewal in %ld %s.", - (long)(client -> active -> renewal - - cur_time), "seconds"); -+#ifdef ENABLE_POLLING_MODE -+ /* Enable polling for this interface */ -+ client -> interface -> polling = 1; -+#endif - add_timeout (client -> active -> renewal, - state_bound, client, 0, 0); - } else { -@@ -1496,6 +1573,11 @@ - log_info ("bound: immediate renewal."); - state_bound (client); - } -+ /* -+ * Set the link status back to nolink, even -+ * if we have media settings. -+ */ -+ client -> interface -> linkstate = NOLINK; - reinitialize_interfaces (); - go_daemon (); - return; -@@ -1541,6 +1623,12 @@ - } - - log_info ("No working leases in persistent database - sleeping."); -+ -+#ifdef ENABLE_POLLING_MODE -+ /* Enable polling for this interface */ -+ client -> interface -> polling = 1; -+#endif -+ - script_init (client, "FAIL", (struct string_list *)0); - if (client -> alias) - script_write_params (client, "alias_", client -> alias); -@@ -1681,6 +1769,18 @@ - client -> packet.secs = htons (65535); - } - -+ /* -+ * Only try the first ten seconds to renew a lease from a -+ * given dhcp-server adress. After that, fall back to use -+ * state_reboot with INADDR_BROADCAST. -+ */ -+ if (destination.sin_addr.s_addr != INADDR_BROADCAST && -+ (client -> state == S_RENEWING || client -> state == S_REBINDING)) { -+ if (client -> active && client -> active -> expiry > cur_time && -+ interval >= 10) -+ goto cancel; -+ } -+ - log_info ("DHCPREQUEST on %s to %s port %d", - client -> name ? client -> name : client -> interface -> name, - inet_ntoa (destination.sin_addr), -@@ -1702,6 +1802,16 @@ - from, &destination, - (struct hardware *)0); - -+ /* -+ * If sendto() for a direct request fails, fall back to use -+ * state_reboot with INADDR_BROADCAST. -+ */ -+ if (result == -1 && destination.sin_addr.s_addr != INADDR_BROADCAST && -+ (client -> state == S_RENEWING || client -> state == S_REBINDING)) { -+ if (client -> active && client -> active -> expiry > cur_time) -+ goto cancel; -+ } -+ - add_timeout (cur_time + client -> interval, - send_request, client, 0, 0); - } -@@ -2597,6 +2707,13 @@ - wstatus = 0; - } - } else { -+ if ((i = open(_PATH_DEVNULL, O_RDWR)) != -1) { -+ dup2(i, STDIN_FILENO); -+ dup2(i, STDOUT_FILENO); -+ dup2(i, STDERR_FILENO); -+ if (i > STDERR_FILENO) -+ close(i); -+ } - execve (scriptName, argv, envp); - log_error ("execve (%s, ...): %m", scriptName); - exit (0); -@@ -2783,8 +2900,10 @@ - case S_STOPPED: - break; - } -+#ifndef ENABLE_POLLING_MODE - client -> state = S_INIT; - state_reboot (client); -+#endif - } - } - } -@@ -3010,7 +3129,9 @@ - break; - - case server_awaken: -+#ifndef ENABLE_POLLING_MODE - state_reboot (client); -+#endif - break; - } - } -@@ -3147,3 +3268,265 @@ - data_string_forget (&ddns_dhcid, MDL); - return rcode; - } -+ -+/* Check to see if there's a wire plugged in */ -+int -+interface_active(struct interface_info *ip) { -+#if __FreeBSD_version > 502010 -+ struct ifmediareq ifmr; -+ int *media_list, i; -+ char *ifname; -+ int sock; -+ -+ ifname = ip -> name; -+ -+ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) -+ log_fatal ("Can't create interface_active socket"); -+ -+ (void) memset (&ifmr, 0, sizeof (ifmr)); -+ (void) strncpy (ifmr.ifm_name, ifname, sizeof (ifmr.ifm_name)); -+ -+ if (ioctl (sock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { -+ /* -+ * Interface doesn't support SIOCGIFMEDIA, presume okay -+ */ -+ close (sock); -+ return (HAVELINK); -+ } -+ close (sock); -+ -+ if (ifmr.ifm_count == 0) { -+ /* -+ * Assume that this means interface -+ * does not support SIOCGIFMEDIA -+ */ -+ log_fatal ("%s: no media types?", ifname); -+ return (HAVELINK); -+ } -+ -+ if (ifmr.ifm_status & IFM_AVALID) { -+ if (ip -> ieee80211) { -+ /* -+ * Wavelan devices need to be checked if they are -+ * associated. -+ */ -+ if ((IFM_TYPE(ifmr.ifm_active) == IFM_IEEE80211) && -+ (ifmr.ifm_status & IFM_ACTIVE)) { -+ return (HAVELINK); -+ } -+ } else { -+ if (ifmr.ifm_status & IFM_ACTIVE) { -+ return (HAVELINK); -+ } -+ } -+ /* -+ * We really have no link. -+ */ -+ return (NOLINK); -+ } -+ /* -+ * IFM_AVALID is not set. We cannot check -+ * the link state. Assume HAVELINK. -+ */ -+ -+#endif /* Other OSs */ -+ /* -+ * Always return a successful link if the OS -+ * is not supported. -+ */ -+ return (HAVELINK); -+} -+ -+#if __FreeBSD_version > 502010 -+void -+set_ieee80211 (struct interface_info *ip) { -+ -+ struct ieee80211req ireq; -+ u_int8_t data[32]; -+ int associated = 0; -+ int *media_list, i; -+ char *ifname; -+ int sock; -+ -+ ifname = ip -> name; -+ -+ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) -+ log_fatal ("Can't create interface_active socket"); -+ -+ (void) memset (&ireq, 0, sizeof (ireq)); -+ (void) strncpy (ireq.i_name, ifname, sizeof (ireq.i_name)); -+ ireq.i_data = &data; -+ ireq.i_type = IEEE80211_IOC_SSID; -+ ireq.i_val = -1; -+ /* -+ * If we can't get the SSID, -+ * this isn't an 802.11 device. -+ */ -+ if (ioctl (sock, SIOCG80211, &ireq) < 0) -+ ip -> ieee80211 = 0; -+ else { -+#ifdef DEBUG -+ printf ("Device %s has 802.11\n", ifname); -+#endif -+ ip -> ieee80211 = 1; -+ } -+ close (sock); -+ } -+#endif /* __FreeBSD_version */ -+ -+#ifdef ENABLE_POLLING_MODE -+/* Go to background after some time */ -+void state_background (cpp) -+ void *cpp; -+{ -+ go_daemon (); -+} -+ -+/* Check the state of the NICs if we have link */ -+void state_polling (cpp) -+ void *cpp; -+{ -+ static int doinitcheck = 0; -+ struct interface_info *ip; -+ struct client_state *client; -+ int result; -+ -+ for (ip = interfaces; ip; ip = ip -> next) { -+ if (! ip -> polling) -+ continue; -+#ifdef DEBUG -+ printf ("%s: Polling interface state\n", ip -> name); -+ for (client = ip -> client; -+ client; client = client -> next) { -+ printf ("%s: client state of %d\n", ip -> name, ip -> client -> state); -+ printf ("%s: link = %d\n", ip -> name, ip -> linkstate); -+ } -+#endif -+ -+ result = interface_active (ip); -+ /* -+ * If dhclient.conf contains media settings, we cannot -+ * abort if the interface is not set to active mode. -+ */ -+ if (ip -> havemedia && ip -> client -> state != S_BOUND) { -+ if (result == HAVELINK) -+ ip -> forcediscover = 1; -+ result = HAVELINK; -+ } -+ -+ /* -+ * The last status of the interface tells us -+ * the we've got no link ... -+ */ -+ if (ip -> linkstate == NOLINK || ! doinitcheck) { -+ /* -+ * ... but we have now link. Let's send -+ * requests. -+ */ -+ if (result == HAVELINK) { -+#ifdef DEBUG -+ if (ip -> havemedia) -+ printf ("%s: Trying media settings on interface\n", -+ ip -> name); -+ else -+ printf ("%s: Found Link on interface\n", ip -> name); -+#endif -+ /* -+ * Set the interface to state_bound. We assume that we have -+ * a working link. If we cannot reach the server directly, -+ * INADDR_BROADCAST is used. -+ */ -+ for (client = ip -> client; -+ client; client = client -> next) { -+ cancel_timeout (state_init, client); -+ cancel_timeout (state_reboot, client); -+ cancel_timeout (state_selecting, client); -+ if (client -> active) { -+ add_timeout (cur_time + random () % 5, -+ state_bound, client, 0, 0); -+ } else { -+ add_timeout (cur_time + random () % 5, -+ state_reboot, client, 0, 0); -+ } -+ } -+ ip -> linkstate = HAVELINK; -+ } else { -+#ifdef DEBUG -+ printf ("%s: No link on interface\n", ip -> name); -+#endif -+ for (client = ip -> client; -+ client; client = client -> next) { -+ /* -+ * Without this add_timout(), dhclient does -+ * not poll on a interface if there -+ * is no cable plugged in at startup -+ * time. Because we add one additional second -+ * to the time of a normal timeout, we always -+ * skip and block a running one. This prevents -+ * that polling is done twice at the same time. -+ */ -+ if (client -> state == S_INIT) { -+ add_timeout (cur_time + (polling_interval + 1), -+ state_polling, client, 0, 0); -+ } -+ } -+ ip -> linkstate = NOLINK; -+ /* -+ * Automatically go into the background after -+ * some time. Do this only if there are no -+ * media options available for a interface. -+ */ -+ if (! ip -> havemedia && ! doinitcheck) { -+ add_timeout (cur_time + (polling_interval * 2), -+ state_background, client, 0, 0); -+ } -+ } -+ } -+ -+ /* -+ * The last status of the interface tells us -+ * the we previously had link. -+ */ -+ if (ip -> linkstate == HAVELINK && doinitcheck) { -+ if (result == NOLINK) { -+ /* -+ * We lost link on the interface, or it isn't -+ * associated anymore. -+ */ -+#ifdef DEBUG -+ printf ("%s: Lost Link on interface\n", ip -> name); -+#endif -+ /* -+ * After we lost link, cycle again through the -+ * different media settings if available. Else -+ * set NOLINK. -+ */ -+ if (ip -> havemedia) -+ ip -> forcediscover = 1; -+ else -+ ip -> linkstate = NOLINK; -+ } -+ /* -+ * If we happen to have a real link, but no -+ * active lease, force the interface into -+ * state_reboot. Do the same if media settings -+ * are available. -+ */ -+ if (ip -> forcediscover) { -+ for (client = ip -> client; -+ client; client = client -> next) { -+ if (client -> state != S_REBOOTING && -+ client -> state != S_SELECTING) { -+ add_timeout (cur_time + random () % 5, -+ state_reboot, client, 0, 0); -+ } -+ } -+ ip -> forcediscover = 0; -+ ip -> linkstate = HAVELINK; -+ } -+ /* We still have link, do nothing. */ -+ } -+ } -+ doinitcheck = 1; -+} -+#endif /* ifdef ENABLE_POLLING_MODE */ diff --git a/net/isc-dhcp30-server/files/patch-client::dhclient.conf b/net/isc-dhcp30-server/files/patch-client::dhclient.conf deleted file mode 100644 index 2d9560f43bf8..000000000000 --- a/net/isc-dhcp30-server/files/patch-client::dhclient.conf +++ /dev/null @@ -1,11 +0,0 @@ ---- client/dhclient.conf.orig Tue Jun 3 00:50:44 1997 -+++ client/dhclient.conf Wed Mar 3 02:20:41 2004 -@@ -11,7 +11,7 @@ - reboot 10; - select-timeout 5; - initial-interval 2; --script "/etc/dhclient-script"; -+script "%%PREFIX%%/sbin/dhclient-script"; - media "-link0 -link1 -link2", "link0 link1"; - reject 192.33.137.209; - diff --git a/net/isc-dhcp30-server/files/patch-common::dhcp-options.5 b/net/isc-dhcp30-server/files/patch-common::dhcp-options.5 deleted file mode 100644 index 9d936cfffeee..000000000000 --- a/net/isc-dhcp30-server/files/patch-common::dhcp-options.5 +++ /dev/null @@ -1,32 +0,0 @@ ---- common/dhcp-options.5.orig Sun Feb 23 04:27:42 2003 -+++ common/dhcp-options.5 Wed Mar 3 02:12:13 2004 -@@ -431,7 +431,10 @@ - the domain-name option to specify the domain name). See RFC 1035 for - character set restrictions. This option is only honored by - .B dhclient-script(8) --if the hostname for the client machine is not set. -+if the hostname for the client machine is not set (i.e., set to the empty -+string in -+.B rc.conf(5) -+). - .RE - .PP - .B option \fBieee802-3-encapsulation\fR \fIflag\fR\fB;\fR -@@ -654,7 +657,7 @@ - This option specifies whether the client should configure its IP - layer to allow forwarding of datagrams with non-local source routes - (see Section 3.3.5 of [4] for a discussion of this topic). A value --of false means disallow forwarding of such datagrams, and a value of true -+of 0 means disallow forwarding of such datagrams, and a value of true - means allow forwarding. - .RE - .PP -@@ -948,7 +951,7 @@ - .PP - This option specifies whether or not the client should negotiate the - use of trailers (RFC 893 [14]) when using the ARP protocol. A value --of false indicates that the client should not attempt to use trailers. A -+of 0 indicates that the client should not attempt to use trailers. A - value of true means that the client should attempt to use trailers. - .RE - .PP diff --git a/net/isc-dhcp30-server/files/patch-common::discover.c b/net/isc-dhcp30-server/files/patch-common::discover.c deleted file mode 100644 index 1cfcc2094098..000000000000 --- a/net/isc-dhcp30-server/files/patch-common::discover.c +++ /dev/null @@ -1,238 +0,0 @@ ---- common/discover.c.orig Fri Jul 25 21:44:15 2003 -+++ common/discover.c Fri Mar 5 23:33:04 2004 -@@ -47,6 +47,7 @@ - #endif /* not lint */ - - #include "dhcpd.h" -+#include <ifaddrs.h> - #include <sys/ioctl.h> - - struct interface_info *interfaces, *dummy_interfaces, *fallback_interface; -@@ -135,10 +136,7 @@ - { - struct interface_info *tmp, *ip; - struct interface_info *last, *next; -- char buf [2048]; -- struct ifconf ic; -- struct ifreq ifr; -- int i; -+ struct ifaddrs *ifap, *ifa; - int sock; - int address_count = 0; - struct subnet *subnet; -@@ -157,61 +155,6 @@ - if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) - log_fatal ("Can't create addrlist socket"); - -- /* Get the interface configuration information... */ -- --#ifdef SIOCGIFCONF_ZERO_PROBE -- /* linux will only tell us how long a buffer it wants if we give it -- * a null buffer first. So, do a dry run to figure out the length. -- * -- * XXX this code is duplicated from below because trying to fold -- * the logic into the if statement and goto resulted in excesssive -- * obfuscation. The intent is that unless you run Linux you shouldn't -- * have to deal with this. */ -- -- ic.ifc_len = 0; -- ic.ifc_ifcu.ifcu_buf = (caddr_t)NULL; --#else -- /* otherwise, we just feed it a starting size, and it'll tell us if -- * it needs more */ -- -- ic.ifc_len = sizeof buf; -- ic.ifc_ifcu.ifcu_buf = (caddr_t)buf; --#endif -- -- gifconf_again: -- i = ioctl(sock, SIOCGIFCONF, &ic); -- -- if (i < 0) -- log_fatal ("ioctl: SIOCGIFCONF: %m"); -- --#ifdef SIOCGIFCONF_ZERO_PROBE -- /* Workaround for SIOCGIFCONF bug on some Linux versions. */ -- if (ic.ifc_ifcu.ifcu_buf == 0 && ic.ifc_len == 0) { -- ic.ifc_len = sizeof buf; -- ic.ifc_ifcu.ifcu_buf = (caddr_t)buf; -- goto gifconf_again; -- } --#endif -- -- /* If the SIOCGIFCONF resulted in more data than would fit in -- a buffer, allocate a bigger buffer. */ -- if ((ic.ifc_ifcu.ifcu_buf == buf --#ifdef SIOCGIFCONF_ZERO_PROBE -- || ic.ifc_ifcu.ifcu_buf == 0 --#endif -- ) && ic.ifc_len > sizeof buf) { -- ic.ifc_ifcu.ifcu_buf = dmalloc ((size_t)ic.ifc_len, MDL); -- if (!ic.ifc_ifcu.ifcu_buf) -- log_fatal ("Can't allocate SIOCGIFCONF buffer."); -- goto gifconf_again; --#ifdef SIOCGIFCONF_ZERO_PROBE -- } else if (ic.ifc_ifcu.ifcu_buf == 0) { -- ic.ifc_ifcu.ifcu_buf = (caddr_t)buf; -- ic.ifc_len = sizeof buf; -- goto gifconf_again; --#endif -- } -- - - /* If we already have a list of interfaces, and we're running as - a DHCP server, the interfaces were requested. */ -@@ -224,51 +167,38 @@ - else - ir = INTERFACE_REQUESTED; - -+ if (getifaddrs(&ifap) != 0) -+ log_fatal ("getifaddrs failed"); -+ - /* Cycle through the list of interfaces looking for IP addresses. */ -- for (i = 0; i < ic.ifc_len;) { -- struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i); --#ifdef HAVE_SA_LEN -- if (ifp -> ifr_addr.sa_len > sizeof (struct sockaddr)) -- i += (sizeof ifp -> ifr_name) + ifp -> ifr_addr.sa_len; -- else --#endif -- i += sizeof *ifp; -+ for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { - - #ifdef ALIAS_NAMES_PERMUTED -- if ((s = strrchr (ifp -> ifr_name, ':'))) { -+ if ((s = strrchr (ifa -> ifa_name, ':'))) { - *s = 0; - } - #endif - - #ifdef SKIP_DUMMY_INTERFACES -- if (!strncmp (ifp -> ifr_name, "dummy", 5)) -+ if (!strncmp (ifa -> ifa_name, "dummy", 5)) - continue; - #endif - -- -- /* See if this is the sort of interface we want to -- deal with. */ -- strcpy (ifr.ifr_name, ifp -> ifr_name); -- if (ioctl (sock, SIOCGIFFLAGS, &ifr) < 0) -- log_fatal ("Can't get interface flags for %s: %m", -- ifr.ifr_name); -- - /* See if we've seen an interface that matches this one. */ - for (tmp = interfaces; tmp; tmp = tmp -> next) -- if (!strcmp (tmp -> name, ifp -> ifr_name)) -+ if (!strcmp (tmp -> name, ifa -> ifa_name)) - break; - -- /* Skip non broadcast interfaces (plus loopback and -- point-to-point in case an OS incorrectly marks them -- as broadcast). Also skip down interfaces unless we're -+ /* See if this is the sort of interface we want to -+ deal with. Skip loopback, point-to-point and down -+ interfaces, except don't skip down interfaces if we're - trying to get a list of configurable interfaces. */ -- if (((!(ifr.ifr_flags & IFF_BROADCAST) || -- ifr.ifr_flags & IFF_LOOPBACK || -- ifr.ifr_flags & IFF_POINTOPOINT) && !tmp) || -- (!(ifr.ifr_flags & IFF_UP) && -+ if ((ifa->ifa_flags & IFF_LOOPBACK) || -+ (ifa->ifa_flags & IFF_POINTOPOINT) || -+ (!(ifa->ifa_flags & IFF_UP) && - state != DISCOVER_UNCONFIGURED)) - continue; -- -+ - /* If there isn't already an interface by this name, - allocate one. */ - if (!tmp) { -@@ -276,9 +206,9 @@ - status = interface_allocate (&tmp, MDL); - if (status != ISC_R_SUCCESS) - log_fatal ("Error allocating interface %s: %s", -- ifp -> ifr_name, -+ ifa -> ifa_name, - isc_result_totext (status)); -- strcpy (tmp -> name, ifp -> ifr_name); -+ strcpy (tmp -> name, ifa -> ifa_name); - interface_snorf (tmp, ir); - interface_dereference (&tmp, MDL); - tmp = interfaces; /* XXX */ -@@ -290,9 +220,9 @@ - /* If we have the capability, extract link information - and record it in a linked list. */ - #ifdef HAVE_AF_LINK -- if (ifp -> ifr_addr.sa_family == AF_LINK) { -+ if (ifa -> ifa_addr->sa_family == AF_LINK) { - struct sockaddr_dl *foo = ((struct sockaddr_dl *) -- (&ifp -> ifr_addr)); -+ (ifa -> ifa_addr)); - #if defined (HAVE_SIN_LEN) - tmp -> hw_address.hlen = foo -> sdl_alen; - #else -@@ -305,12 +235,11 @@ - } else - #endif /* AF_LINK */ - -- if (ifp -> ifr_addr.sa_family == AF_INET) { -+ if (ifa -> ifa_addr->sa_family == AF_INET) { - struct iaddr addr; - - /* Get a pointer to the address... */ -- memcpy (&foo, &ifp -> ifr_addr, -- sizeof ifp -> ifr_addr); -+ bcopy(ifa->ifa_addr, &foo, sizeof(foo)); - - /* We don't want the loopback interface. */ - if (foo.sin_addr.s_addr == htonl (INADDR_LOOPBACK) && -@@ -323,16 +252,15 @@ - found, keep a pointer to ifreq structure in - which we found it. */ - if (!tmp -> ifp) { --#ifdef HAVE_SA_LEN -- unsigned len = ((sizeof ifp -> ifr_name) + -- ifp -> ifr_addr.sa_len); --#else -- unsigned len = sizeof *ifp; --#endif -+ -+ int len = (IFNAMSIZ + -+ ifa -> ifa_addr->sa_len); - tif = (struct ifreq *)dmalloc (len, MDL); - if (!tif) - log_fatal ("no space for ifp."); -- memcpy (tif, ifp, len); -+ strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ); -+ memcpy(&tif->ifr_addr, ifa->ifa_addr, -+ ifa->ifa_addr->sa_len); - tmp -> ifp = tif; - tmp -> primary_address = foo.sin_addr; - } -@@ -346,9 +274,6 @@ - } - } - -- /* If we allocated a buffer, free it. */ -- if (ic.ifc_ifcu.ifcu_buf != buf) -- dfree (ic.ifc_ifcu.ifcu_buf, MDL); - - #if defined (LINUX_SLASHPROC_DISCOVERY) - /* On Linux, interfaces that don't have IP addresses don't -@@ -529,6 +454,7 @@ - be able to configure, we can quit now. */ - if (state == DISCOVER_UNCONFIGURED) { - close (sock); -+ freeifaddrs(ifap); - return; - } - -@@ -674,6 +600,7 @@ - } - - close (sock); -+ freeifaddrs(ifap); - - if (state == DISCOVER_SERVER && wifcount == 0) { - log_info ("%s", ""); diff --git a/net/isc-dhcp30-server/files/patch-common::dispatch.c b/net/isc-dhcp30-server/files/patch-common::dispatch.c deleted file mode 100644 index 0aa709cf0860..000000000000 --- a/net/isc-dhcp30-server/files/patch-common::dispatch.c +++ /dev/null @@ -1,29 +0,0 @@ ---- common/dispatch.c.orig Sun Nov 17 03:26:57 2002 -+++ common/dispatch.c Wed Mar 3 16:20:15 2004 -@@ -95,11 +95,26 @@ - void dispatch () - { - struct timeval tv, *tvp; -+#ifdef ENABLE_POLLING_MODE -+ struct timeval *tvp_new; -+#endif - isc_result_t status; -+ TIME cur_time; - -+ tvp = NULL; -+#ifdef ENABLE_POLLING_MODE -+ tvp_new = NULL; -+#endif - /* Wait for a packet or a timeout... XXX */ - do { - tvp = process_outstanding_timeouts (&tv); -+#ifdef ENABLE_POLLING_MODE -+ GET_TIME (&cur_time); -+ add_timeout(cur_time + polling_interval, state_polling, 0, 0, 0); -+ tvp_new = process_outstanding_timeouts(&tv); -+ if (tvp != NULL && (tvp -> tv_sec > tvp_new -> tv_sec)) -+ tvp = tvp_new; -+#endif /* ENABLE_POLLING_MODE */ - status = omapi_one_dispatch (0, tvp); - } while (status == ISC_R_TIMEDOUT || status == ISC_R_SUCCESS); - log_fatal ("omapi_one_dispatch failed: %s -- exiting.", diff --git a/net/isc-dhcp30-server/files/patch-common::parse.c b/net/isc-dhcp30-server/files/patch-common::parse.c deleted file mode 100644 index 637d69e7f41b..000000000000 --- a/net/isc-dhcp30-server/files/patch-common::parse.c +++ /dev/null @@ -1,22 +0,0 @@ ---- common/parse.c.orig 2 Sep 2003 11:01:23 -0000 -+++ common/parse.c 22 Feb 2004 10:44:52 -0000 -@@ -414,6 +414,7 @@ - { - const char *val; - enum dhcp_token token; -+ int32_t num; - - token = next_token (&val, (unsigned *)0, cfile); - if (token != NUMBER) { -@@ -421,9 +422,9 @@ - skip_to_semi (cfile); - return; - } -- convert_num (cfile, (unsigned char *)timep, val, 10, 32); -+ convert_num (cfile, (unsigned char *)&num, val, 10, 32); - /* Unswap the number - convert_num returns stuff in NBO. */ -- *timep = ntohl (*timep); /* XXX */ -+ *timep = ntohl (num); - - parse_semi (cfile); - } diff --git a/net/isc-dhcp30-server/files/patch-configure b/net/isc-dhcp30-server/files/patch-configure deleted file mode 100644 index 5aff6909acce..000000000000 --- a/net/isc-dhcp30-server/files/patch-configure +++ /dev/null @@ -1,41 +0,0 @@ ---- configure.orig Sat Apr 20 23:44:13 2002 -+++ configure Mon Apr 28 23:02:10 2003 -@@ -13,6 +13,9 @@ - elif [ x$1 = x--dirs ]; then - dirs=$2 - shift -+ elif [ x$1 = x--subsys ]; then -+ subsys=$2 -+ shift - elif [ x$1 = x--no-links ]; then - nolinks=YES - elif [ x$1 = x--copts ]; then -@@ -233,7 +236,14 @@ - fi - - if [ x"$dirs" = x ]; then -- dirs=". client server relay common omapip dhcpctl minires dst" -+ dirs=". common minires dst omapip dhcpctl" -+ if [ x$subsys = x ]; then -+ dirs="$dirs server omshell client relay" -+ elif [ x$subsys = xserver ]; then -+ dirs="$dirs server omshell" -+ elif [ x$subsys = xclient -o x$subsys = xrelay ]; then -+ dirs="$dirs $subsys" -+ fi - fi - - for foo in $dirs; do -@@ -253,7 +263,11 @@ - - # Make the link tree in which to actually build. - if [ x$nolinks = x ]; then -- make links -+ if [ x$subsys = x ]; then -+ make links -+ else -+ make links.$subsys -+ fi - fi - - exit 0 diff --git a/net/isc-dhcp30-server/files/patch-dhcpctl::Makefile.dist b/net/isc-dhcp30-server/files/patch-dhcpctl::Makefile.dist deleted file mode 100644 index acfee5854413..000000000000 --- a/net/isc-dhcp30-server/files/patch-dhcpctl::Makefile.dist +++ /dev/null @@ -1,79 +0,0 @@ ---- dhcpctl/Makefile.dist.orig Mon Apr 28 16:31:57 2003 -+++ dhcpctl/Makefile.dist Mon Apr 28 16:24:20 2003 -@@ -17,11 +17,11 @@ - # http://www.isc.org for more information. - # - --CATMANPAGES = dhcpctl.cat3 omshell.cat1 --SEDMANPAGES = dhcpctl.man3 omshell.man1 -+CATMANPAGES = dhcpctl.cat3 -+SEDMANPAGES = dhcpctl.man3 - SRC = dhcpctl.c callback.c remote.c - OBJ = dhcpctl.o callback.o remote.o --MAN = dhcpctl.3 omshell.1 -+MAN = dhcpctl.3 - HDRS = dhcpctl.h - - INCLUDES = $(BINDINC) -I$(TOP)/includes -@@ -29,10 +29,7 @@ - DHCPCTLLIBS = libdhcpctl.a ../common/libdhcp.a $(BINDLIB) \ - ../omapip/libomapi.a ../dst/libdst.a - --all: libdhcpctl.a omshell cltest $(CATMANPAGES) -- --omshell: omshell.o $(DHCPCTLLIBS) -- $(CC) $(DEBUG) $(LFLAGS) -o omshell omshell.o $(DHCPCTLLIBS) $(LIBS) -+all: libdhcpctl.a cltest $(CATMANPAGES) - - cltest: cltest.o $(DHCPCTLLIBS) - $(CC) $(DEBUG) $(LFLAGS) -o cltest cltest.o $(DHCPCTLLIBS) $(LIBS) -@@ -43,8 +40,7 @@ - $(RANLIB) libdhcpctl.a - - install: all $(CATMANPAGES) -- for dir in $(LIBDIR) $(LIBMANDIR) $(INCDIR) $(USRMANDIR) \ -- $(USERBINDIR); do \ -+ for dir in $(LIBDIR) $(LIBMANDIR) $(INCDIR); do \ - foo=""; \ - for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \ - foo=$${foo}/$$bar; \ -@@ -64,16 +60,12 @@ - $(MANINSTALL) $(MANFROM) $${prefix}.$(MANCAT)$${suffix} $(MANTO) \ - $(DESTDIR)$(LIBMANDIR)/$${prefix}$(LIBMANEXT); \ - done -- $(INSTALL) omshell $(DESTDIR)$(USERBINDIR) -- $(CHMOD) 755 $(DESTDIR)$(USERBINDIR)/omshell -- $(MANINSTALL) $(MANFROM) omshell.$(MANCAT)1 $(MANTO) \ -- $(DESTDIR)$(USRMANDIR)/omshell$(USRMANEXT) - - depend: - $(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRC) - - clean: -- -rm -f $(OBJ) test.o svtest cltest.o cltest -+ -rm -f $(OBJ) cltest.o cltest - - realclean: clean - -rm -f libdhcpctl.a *~ $(CATMANPAGES) $(SEDMANPAGES) -@@ -82,7 +74,7 @@ - -rm -f Makefile - - links: -- @for foo in $(SRC) $(MAN) omshell.c cltest.c $(HDRS); do \ -+ @for foo in $(SRC) $(MAN) cltest.c $(HDRS); do \ - if [ ! -b $$foo ]; then \ - rm -f $$foo; \ - fi; \ -@@ -95,12 +87,5 @@ - dhcpctl.man3: dhcpctl.3 - sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \ - -e "s#RUNDIR#$(VARRUN)#g" < dhcpctl.3 >dhcpctl.man3 -- --omshell.cat1: omshell.man1 -- nroff -man omshell.man1 >omshell.cat1 -- --omshell.man1: omshell.1 -- sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \ -- -e "s#RUNDIR#$(VARRUN)#g" < omshell.1 >omshell.man1 - - # Dependencies (semi-automatically-generated) diff --git a/net/isc-dhcp30-server/files/patch-dhcpd.conf b/net/isc-dhcp30-server/files/patch-dhcpd.conf deleted file mode 100644 index 030e89874d8d..000000000000 --- a/net/isc-dhcp30-server/files/patch-dhcpd.conf +++ /dev/null @@ -1,12 +0,0 @@ ---- server/dhcpd.conf.orig Thu Jan 25 03:33:11 2001 -+++ server/dhcpd.conf Wed Jan 30 22:06:52 2002 -@@ -14,6 +14,9 @@ - # network, the authoritative directive should be uncommented. - #authoritative; - -+# ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates. -+ddns-update-style ad-hoc; -+ - # Use this to send dhcp log messages to a different log file (you also - # have to hack syslog.conf to complete the redirection). - log-facility local7; diff --git a/net/isc-dhcp30-server/files/patch-dst::Makefile.dist b/net/isc-dhcp30-server/files/patch-dst::Makefile.dist deleted file mode 100644 index ad45436b1629..000000000000 --- a/net/isc-dhcp30-server/files/patch-dst::Makefile.dist +++ /dev/null @@ -1,29 +0,0 @@ ---- dst/Makefile.dist.orig Sun Nov 17 03:27:43 2002 -+++ dst/Makefile.dist Fri Mar 5 23:40:45 2004 -@@ -26,12 +26,24 @@ - - all: libdst.a - --install: -- - libdst.a: $(OBJ) - rm -f dst.a - ar cruv libdst.a $(OBJ) - $(RANLIB) libdst.a -+ -+install: all -+ for dir in $(LIBDIR);\ -+ do \ -+ foo=""; \ -+ for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \ -+ foo=$${foo}/$$bar; \ -+ if [ ! -d $$foo ]; then \ -+ mkdir $$foo; \ -+ chmod 755 $$foo; \ -+ fi; \ -+ done; \ -+ done -+ $(INSTALL) libdst.a $(DESTDIR)$(LIBDIR) - - depend: - $(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRC) diff --git a/net/isc-dhcp30-server/files/patch-includes::cf::freebsd.h b/net/isc-dhcp30-server/files/patch-includes::cf::freebsd.h deleted file mode 100644 index 9a3f4c636b09..000000000000 --- a/net/isc-dhcp30-server/files/patch-includes::cf::freebsd.h +++ /dev/null @@ -1,62 +0,0 @@ ---- includes/cf/freebsd.h.orig Wed Mar 3 02:32:39 2004 -+++ includes/cf/freebsd.h Wed Mar 3 02:31:56 2004 -@@ -42,7 +42,7 @@ - */ - - #include <syslog.h> --#include <sys/types.h> -+#include <sys/param.h> - #include <string.h> - #include <paths.h> - #include <errno.h> -@@ -101,6 +101,10 @@ - #define SOCKLEN_T int - #endif - -+#ifdef RESCUE -+#define _PATH_DHCLIENT_SCRIPT "/rescue/dhclient-script" -+#endif -+ - #if defined (USE_DEFAULT_NETWORK) - # define USE_BPF - #endif -@@ -111,6 +115,9 @@ - #endif /* HAVE_DEV_RANDOM */ - - const char *cmds[] = { -+#ifndef RESCUE -+ /* rescue environment can't rely on these ... */ -+ /* Actually, /sbin/dhclient shouldn't use these, either. */ - "/bin/ps -axlw 2>&1", - "/usr/sbin/arp -an 2>&1", - "/usr/bin/netstat -an 2>&1", -@@ -121,10 +128,12 @@ - "/usr/sbin/iostat 2>&1", - "/usr/bin/vmstat 2>&1", - "/usr/bin/w 2>&1", -+#endif - NULL - }; - - const char *dirs[] = { -+#ifndef RESCUE - "/tmp", - "/usr/tmp", - ".", -@@ -134,13 +143,16 @@ - "/var/mail", - "/home", - "/usr/home", -+#endif - NULL - }; - - const char *files[] = { -+#ifndef RESCUE - "/var/log/messages", - "/var/log/wtmp", - "/var/log/lastlog", -+#endif - NULL - }; - #endif /* NEED_PRAND_CONF */ diff --git a/net/isc-dhcp30-server/files/patch-includes::dhcpd.h b/net/isc-dhcp30-server/files/patch-includes::dhcpd.h deleted file mode 100644 index 1933e0b4037a..000000000000 --- a/net/isc-dhcp30-server/files/patch-includes::dhcpd.h +++ /dev/null @@ -1,56 +0,0 @@ ---- includes/dhcpd.h.orig Mon Feb 10 02:22:46 2003 -+++ includes/dhcpd.h Wed Mar 3 16:20:09 2004 -@@ -99,6 +99,9 @@ - (((x) >> OPTION_HASH_EXP) & \ - (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE; - -+#define NOLINK 0 -+#define HAVELINK 1 -+ - enum dhcp_shutdown_state { - shutdown_listeners, - shutdown_omapi_connections, -@@ -783,6 +786,11 @@ - unsigned remote_id_len; /* Length of Remote ID. */ - - char name [IFNAMSIZ]; /* Its name... */ -+ int ieee80211; /* True if media is ieee802.11 */ -+ int havemedia; /* True if we have a media table */ -+ int linkstate; /* True if we have link */ -+ int polling; /* True if polling is enabled */ -+ int forcediscover; /* True if a discover is needed */ - int index; /* Its index. */ - int rfdesc; /* Its read file descriptor. */ - int wfdesc; /* Its write file descriptor, if -@@ -1845,6 +1853,9 @@ - extern const char *path_dhclient_pid; - extern char *path_dhclient_script; - extern int interfaces_requested; -+#ifdef ENABLE_POLLING_MODE -+extern int polling_interval; -+#endif - - extern struct client_config top_level_config; - -@@ -1858,12 +1869,21 @@ - void send_decline PROTO ((void *)); - - void state_reboot PROTO ((void *)); -+#ifdef ENABLE_POLLING_MODE -+void state_background PROTO ((void *)); -+void state_polling PROTO ((void *)); -+#endif - void state_init PROTO ((void *)); - void state_selecting PROTO ((void *)); - void state_requesting PROTO ((void *)); - void state_bound PROTO ((void *)); - void state_stop PROTO ((void *)); - void state_panic PROTO ((void *)); -+ -+#if __FreeBSD_version > 502010 -+void set_ieee80211 PROTO ((struct interface_info *)); -+#endif -+int interface_active PROTO ((struct interface_info *)); - - void bind_lease PROTO ((struct client_state *)); - diff --git a/net/isc-dhcp30-server/files/patch-server::dhcpd.c b/net/isc-dhcp30-server/files/patch-server::dhcpd.c deleted file mode 100644 index e2e6e24e814e..000000000000 --- a/net/isc-dhcp30-server/files/patch-server::dhcpd.c +++ /dev/null @@ -1,288 +0,0 @@ ---- server/dhcpd.c.orig Thu Jun 10 19:59:52 2004 -+++ server/dhcpd.c Fri Jun 25 15:49:09 2004 -@@ -47,6 +47,22 @@ - #include "version.h" - #include <omapip/omapip_p.h> - -+#if defined (PARANOIA) -+#include <sys/types.h> -+#include <unistd.h> -+#include <pwd.h> -+/* get around the ISC declaration of group */ -+#define group real_group -+#include <grp.h> -+#undef group -+#endif /* PARANOIA */ -+#if defined (JAIL) -+#include <sys/param.h> -+#include <sys/jail.h> -+#include <netinet/in.h> -+#include <arpa/inet.h> -+#endif /* JAIL */ -+ - static void usage PROTO ((void)); - - TIME cur_time; -@@ -195,6 +211,35 @@ - omapi_object_dereference (&listener, MDL); - } - -+#if defined (PARANOIA) -+/* to be used in one of two possible scenarios */ -+static void setup_chroot (char *chroot_dir) -+{ -+ if (geteuid ()) -+ log_fatal ("you must be root to use chroot"); -+ if (chroot (chroot_dir)) -+ log_fatal ("chroot(\"%s\"): %m", chroot_dir); -+ if (chdir ("/")) -+ /* probably permission denied */ -+ log_fatal ("chdir(\"/\"): %m"); -+} -+#endif /* PARANOIA */ -+ -+#if defined (JAIL) -+static void setup_jail (char *chroot_dir, char *hostname, u_int32_t ip_number) -+{ -+ struct jail j; -+ -+ j.version = 0; -+ j.path = chroot_dir; -+ j.hostname = hostname; -+ j.ip_number = ip_number; -+ -+ if (jail (&j) < 0) -+ log_fatal ("jail(%s, %s): %m", chroot_dir, hostname); -+} -+#endif /* JAIL */ -+ - int main (argc, argv, envp) - int argc; - char **argv, **envp; -@@ -227,6 +272,25 @@ - char *traceinfile = (char *)0; - char *traceoutfile = (char *)0; - #endif -+#if defined (PARANOIA) -+ char *set_user = 0; -+ char *set_group = 0; -+ uid_t set_uid = 0; -+ gid_t set_gid = 0; -+ int early_chroot = 0; -+ int no_dhcpd_user = 0; -+ int no_dhcpd_group = 0; -+#endif /* PARANOIA */ -+#if defined (PARANOIA) || defined (JAIL) -+ char *set_chroot = 0; -+ int no_dhcpd_chroot = 0; -+#endif /* PARANOIA || JAIL */ -+#if defined (JAIL) -+ char *set_jail = 0; -+ u_int32_t jail_ip_address = 0; /* Good as long as it's IPv4 ... */ -+ int no_dhcpd_jail = 0; -+ char *s2; -+#endif /* JAIL */ - - /* Make sure we have stdin, stdout and stderr. */ - status = open ("/dev/null", O_RDWR); -@@ -289,6 +353,39 @@ - if (++i == argc) - usage (); - server = argv [i]; -+#if defined (PARANOIA) -+ } else if (!strcmp (argv [i], "-user")) { -+ if (++i == argc) -+ usage (); -+ set_user = argv [i]; -+ no_dhcpd_user = 1; -+ } else if (!strcmp (argv [i], "-group")) { -+ if (++i == argc) -+ usage (); -+ set_group = argv [i]; -+ no_dhcpd_group = 1; -+ } else if (!strcmp (argv [i], "-early_chroot")) { -+ early_chroot = 1; -+#endif /* PARANOIA */ -+#if defined (PARANOIA) || defined (JAIL) -+ } else if (!strcmp (argv [i], "-chroot")) { -+ if (++i == argc) -+ usage (); -+ set_chroot = argv [i]; -+ no_dhcpd_chroot = 1; -+#endif /* PARANOIA || JAIL */ -+#if defined (JAIL) -+ } else if (!strcmp (argv [i], "-jail")) { -+ if (++i == argc) -+ usage (); -+ set_jail = argv [i]; -+ if (++i == argc) -+ usage (); -+ if (ascii2addr (AF_INET, argv[i], &jail_ip_address) < 0) -+ log_fatal ("invalid ip address: %s", argv[i]); -+ jail_ip_address = ntohl (jail_ip_address); -+ no_dhcpd_jail = 1; -+#endif /* JAIL */ - } else if (!strcmp (argv [i], "-cf")) { - if (++i == argc) - usage (); -@@ -366,6 +463,28 @@ - if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) { - path_dhcpd_pid = s; - } -+#if defined (PARANOIA) -+ if (!no_dhcpd_user && (s = getenv ("DHCPD_USER"))) { -+ set_user = s; -+ } -+ if (!no_dhcpd_group && (s = getenv ("DHCPD_GROUP"))) { -+ set_group = s; -+ } -+#endif /* PARANOIA */ -+#if defined (PARANOIA) || defined (JAIL) -+ if (!no_dhcpd_chroot && (s = getenv ("PATH_DHCPD_CHROOT"))) { -+ set_chroot = s; -+ } -+#endif /* PARANOIA || JAIL */ -+#if defined (JAIL) -+ if (!no_dhcpd_jail && (s = getenv ("DHCPD_JAIL_HOSTNAME")) && -+ (s2 = getenv ("DHCPD_JAIL_IPADDRESS"))) { -+ set_jail = s; -+ if (ascii2addr (AF_INET, s2, &jail_ip_address) < 0) -+ log_fatal ("invalid ip address: %s", s2); -+ jail_ip_address = ntohl (jail_ip_address); -+ } -+#endif /* JAIL */ - - if (!quiet) { - log_info ("%s %s", message, DHCP_VERSION); -@@ -388,6 +507,57 @@ - trace_seed_stop, MDL); - #endif - -+#if defined (PARANOIA) -+ /* get user and group info if those options were given */ -+ if (set_user) { -+ struct passwd *tmp_pwd; -+ -+ if (geteuid ()) -+ log_fatal ("you must be root to set user"); -+ -+ if (!(tmp_pwd = getpwnam (set_user))) -+ log_fatal ("no such user: %s", set_user); -+ -+ set_uid = tmp_pwd->pw_uid; -+ -+ /* use the user's group as the default gid */ -+ if (!set_group) -+ set_gid = tmp_pwd->pw_gid; -+ } -+ -+ if (set_group) { -+/* get around the ISC declaration of group */ -+#define group real_group -+ struct group *tmp_grp; -+ -+ if (geteuid ()) -+ log_fatal ("you must be root to set group"); -+ -+ if (!(tmp_grp = getgrnam (set_group))) -+ log_fatal ("no such group: %s", set_group); -+ -+ set_gid = tmp_grp->gr_gid; -+#undef group -+ } -+#endif /* PARANOIA */ -+#if defined (JAIL) -+ if (set_jail) { -+ /* Initialize icmp support... */ -+ if (!cftest && !lftest) -+ icmp_startup (1, lease_pinged); -+ if(!set_chroot) -+ set_chroot = "/"; -+ setup_jail (set_chroot, set_jail, jail_ip_address); -+ } -+#endif /* JAIL */ -+#if defined (PARANOIA) && defined (JAIL) -+ else -+#endif /* PARANOIA && JAIL */ -+#if defined (PARANOIA) -+ if (early_chroot && set_chroot) -+ setup_chroot (set_chroot); -+#endif /* PARANOIA */ -+ - /* Default to the DHCP/BOOTP port. */ - if (!local_port) - { -@@ -462,6 +632,9 @@ - #endif - - /* Initialize icmp support... */ -+#if defined (JAIL) -+ if (!set_jail) -+#endif /* JAIL */ - if (!cftest && !lftest) - icmp_startup (1, lease_pinged); - -@@ -491,6 +664,14 @@ - - postconf_initialization (quiet); - -+#if defined (PARANOIA) -+#if defined (JAIL) -+ if (!set_jail) -+#endif /* JAIL */ -+ if (!early_chroot && set_chroot) -+ setup_chroot (set_chroot); -+#endif /* PARANOIA */ -+ - /* test option should cause an early exit */ - if (cftest && !lftest) - exit(0); -@@ -533,7 +714,22 @@ - else if (pid) - exit (0); - } -+ -+#if defined (PARANOIA) -+ /* change uid to the specified one */ -+ if (set_gid) { -+ if (setgroups (0, (void *)0)) -+ log_fatal ("setgroups: %m"); -+ if (setgid (set_gid)) -+ log_fatal ("setgid(%d): %m", (int) set_gid); -+ } - -+ if (set_uid) { -+ if (setuid (set_uid)) -+ log_fatal ("setuid(%d): %m", (int) set_uid); -+ } -+#endif /* PARANOIA */ -+ - /* Read previous pid file. */ - if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) { - status = read (i, pbuf, (sizeof pbuf) - 1); -@@ -877,8 +1073,24 @@ - log_info (copyright); - log_info (arr); - -- log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s", -+ log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s%s%s%s", - "\n [-cf config-file] [-lf lease-file]", -+ -+#if defined (PARANOIA) -+ /* meld into the following string */ -+ "\n [-user user] [-group group]", -+ "\n [-chroot dir] [-early_chroot]", -+#else /* PARANOIA */ -+ "", "", -+#endif /* PARANOIA */ -+ -+#if defined (JAIL) -+ /* then also these ones */ -+ "\n [-jail name ip]", -+#else /* JAIL */ -+ "", -+#endif /* JAIL */ -+ - #if defined (TRACING) - "\n [-tf trace-output-file]", - "\n [-play trace-input-file]", diff --git a/net/isc-dhcp30-server/files/patch-site.conf b/net/isc-dhcp30-server/files/patch-site.conf deleted file mode 100644 index 1149e0c7925c..000000000000 --- a/net/isc-dhcp30-server/files/patch-site.conf +++ /dev/null @@ -1,42 +0,0 @@ ---- site.conf.orig Wed Jul 7 17:20:10 1999 -+++ site.conf Wed Mar 3 14:00:14 2004 -@@ -1,2 +1,39 @@ - # Put local site configuration stuff here to override the default - # settings in Makefile.conf -+ -+PREFIX ?= /usr/local -+ -+USERBINDIR = $(PREFIX)/bin -+BINDIR = $(PREFIX)/sbin -+CLIENTBINDIR = $(PREFIX)/sbin -+ADMMANDIR = $(PREFIX)/man/man8 -+ADMMANEXT = .8 -+FFMANDIR = $(PREFIX)/man/man5 -+FFMANEXT = .5 -+LIBMANDIR = $(PREFIX)/man/man3 -+LIBMANEXT = .3 -+USRMANDIR = $(PREFIX)/man/man1 -+USRMANEXT = .1 -+MANCAT = man -+# INSTALL = ${INSTALL_DATA} -+# MANINSTALL = ${INSTALL_MAN} -+ETC = $(PREFIX)/etc -+LIBDIR = ${PREFIX}/lib -+INCDIR = ${PREFIX}/include -+CLIENT_PATH = \"PATH=/sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin\" -+ -+DEBUG ?= #none -+ -+CFLAGS += -D_PATH_DHCPD_CONF=\"$(ETC)/dhcpd.conf\" -+CFLAGS += -D_PATH_DHCPD_DB=\"$(VARDB)/dhcpd.leases\" -+CFLAGS += -D_PATH_DHCPD_PID=\"$(VARRUN)/dhcpd.pid\" -+ -+CFLAGS += -D_PATH_DHCRELAY_PID=\"$(VARRUN)/dhcrelay.pid\" -+ -+CFLAGS += -D_PATH_DHCLIENT_CONF=\"$(ETC)/dhclient.conf\" -+CFLAGS += -D_PATH_DHCLIENT_SCRIPT=\"$(CLIENTBINDIR)/dhclient-script\" -+CFLAGS += -D_PATH_DHCLIENT_DB=\"$(VARDB)/dhclient.leases\" -+CFLAGS += -D_PATH_DHCLIENT_PID=\"$(VARRUN)/dhclient.pid\" -+ -+CFLAGS += -Dwarn=dhcp_warn -+CFLAGS += -DNOMINUM |