head	1.29;
access;
symbols
	RELENG_5_5_0_RELEASE:1.28
	RELENG_5_5:1.28.0.8
	RELENG_5_5_BP:1.28
	RELENG_5_4_0_RELEASE:1.28
	RELENG_5_4:1.28.0.6
	RELENG_5_4_BP:1.28
	RELENG_4_11_0_RELEASE:1.9.2.6
	RELENG_4_11:1.9.2.6.0.8
	RELENG_4_11_BP:1.9.2.6
	RELENG_5_3_0_RELEASE:1.28
	RELENG_5_3:1.28.0.4
	RELENG_5_3_BP:1.28
	RELENG_5:1.28.0.2
	RELENG_5_BP:1.28
	isc_dhcp_3_0_1:1.1.1.9
	isc_dhcp_3_0_1_rc14:1.1.1.9
	RELENG_4_10_0_RELEASE:1.9.2.6
	RELENG_4_10:1.9.2.6.0.6
	RELENG_4_10_BP:1.9.2.6
	RELENG_5_2_1_RELEASE:1.26
	RELENG_5_2_0_RELEASE:1.26
	RELENG_5_2:1.26.0.2
	RELENG_5_2_BP:1.26
	RELENG_4_9_0_RELEASE:1.9.2.6
	RELENG_4_9:1.9.2.6.0.4
	RELENG_4_9_BP:1.9.2.6
	isc_dhcp_3_0_1_rc12:1.1.1.8
	RELENG_5_1_0_RELEASE:1.21
	RELENG_5_1:1.21.0.2
	RELENG_5_1_BP:1.21
	RELENG_4_8_0_RELEASE:1.9.2.6
	RELENG_4_8:1.9.2.6.0.2
	RELENG_4_8_BP:1.9.2.6
	RELENG_5_0_0_RELEASE:1.20.2.1
	isc_dhcp_3_0_1_rc11:1.1.1.7
	isc_dhcp_3_0_1_rc10:1.1.1.7
	RELENG_5_0:1.20.0.2
	RELENG_5_0_BP:1.20
	RELENG_4_7_0_RELEASE:1.9.2.5
	RELENG_4_7:1.9.2.5.0.4
	RELENG_4_7_BP:1.9.2.5
	isc_dhcp_3_0_1_rc9:1.1.1.6
	RELENG_4_6_2_RELEASE:1.9.2.5
	RELENG_4_6_1_RELEASE:1.9.2.5
	RELENG_4_6_0_RELEASE:1.9.2.5
	RELENG_4_6:1.9.2.5.0.2
	RELENG_4_6_BP:1.9.2.5
	isc_dhcp_3_0_1_rc8:1.1.1.6
	isc_dhcp_3_0_1_rc6:1.1.1.5
	RELENG_4_5_0_RELEASE:1.9.2.4
	RELENG_4_5:1.9.2.4.0.6
	RELENG_4_5_BP:1.9.2.4
	RELENG_4_4_0_RELEASE:1.9.2.4
	RELENG_4_4:1.9.2.4.0.4
	RELENG_4_4_BP:1.9.2.4
	RELENG_4_3_0_RELEASE:1.9.2.4
	RELENG_4_3:1.9.2.4.0.2
	RELENG_4_3_BP:1.9.2.4
	RELENG_4_2_0_RELEASE:1.9.2.3
	FBSD_ISC_DHCP_2_0_PL5_+_V3_FIXES:1.17
	isc_dhcp_2_0_pl5_+_v3_fixes:1.1.1.4
	FBSD_ISC_DHCP_2_0_PL5:1.17
	isc_dhcp_2_0_pl5:1.1.1.4
	RELENG_4_1_1_RELEASE:1.9.2.2
	PRE_SMPNG:1.17
	RELENG_4_1_0_RELEASE:1.9.2.1
	isc_dhcp_2_0_pl3:1.1.1.4
	isc_dhcp_2_0_pl2:1.1.1.4
	isc_dhcp_2_0_pl1:1.1.1.4
	RELENG_3_5_0_RELEASE:1.1.1.2.2.8
	RELENG_4_0_0_RELEASE:1.9
	RELENG_4:1.9.0.2
	RELENG_4_BP:1.9
	RELENG_3_4_0_RELEASE:1.1.1.2.2.7
	RELENG_3_3_0_RELEASE:1.1.1.2.2.6
	isc_dhcp_2_0:1.1.1.4
	RELENG_3_2_PAO:1.1.1.2.2.3.0.2
	RELENG_3_2_PAO_BP:1.1.1.2.2.3
	RELENG_3_2_0_RELEASE:1.1.1.2.2.3
	isc_dhcp_2_0_b_1_pl_27:1.1.1.3
	isc_dhcp_2_0_b_1_pl_18:1.1.1.2
	isc_dhcp_2_0_b_1_pl_17:1.1.1.2
	RELENG_3:1.1.1.2.0.2
	isc_dhcp_2_0_b_1_pl_11:1.1.1.2
	isc_dhcp_2_0_b_1_pl_6:1.1.1.1
	ISC:1.1.1;
locks; strict;
comment	@# @;


1.29
date	2005.06.29.01.46.35;	author brooks;	state dead;
branches;
next	1.28;

1.28
date	2004.06.26.10.47.38;	author mbr;	state Exp;
branches;
next	1.27;

1.27
date	2004.06.26.10.37.41;	author mbr;	state Exp;
branches;
next	1.26;

1.26
date	2003.09.15.15.48.12;	author mbr;	state Exp;
branches;
next	1.25;

1.25
date	2003.09.15.04.47.41;	author mbr;	state Exp;
branches;
next	1.24;

1.24
date	2003.09.09.16.19.46;	author mbr;	state Exp;
branches;
next	1.23;

1.23
date	2003.09.02.11.10.29;	author mbr;	state Exp;
branches;
next	1.22;

1.22
date	2003.07.28.22.25.20;	author mbr;	state Exp;
branches;
next	1.21;

1.21
date	2003.01.15.10.47.32;	author murray;	state Exp;
branches;
next	1.20;

1.20
date	2002.02.19.12.10.40;	author murray;	state Exp;
branches
	1.20.2.1;
next	1.19;

1.19
date	2001.03.31.09.26.03;	author obrien;	state Exp;
branches;
next	1.18;

1.18
date	2000.11.04.20.45.35;	author obrien;	state Exp;
branches;
next	1.17;

1.17
date	2000.07.28.09.20.39;	author obrien;	state Exp;
branches;
next	1.16;

1.16
date	2000.07.28.08.53.40;	author obrien;	state Exp;
branches;
next	1.15;

1.15
date	2000.07.28.08.46.08;	author obrien;	state Exp;
branches;
next	1.14;

1.14
date	2000.07.24.20.50.18;	author obrien;	state Exp;
branches;
next	1.13;

1.13
date	2000.07.20.09.55.08;	author obrien;	state Exp;
branches;
next	1.12;

1.12
date	2000.07.20.09.53.10;	author obrien;	state Exp;
branches;
next	1.11;

1.11
date	2000.05.20.18.01.05;	author obrien;	state Exp;
branches;
next	1.10;

1.10
date	2000.05.20.17.47.06;	author obrien;	state Exp;
branches;
next	1.9;

1.9
date	2000.01.15.22.46.40;	author obrien;	state Exp;
branches
	1.9.2.1;
next	1.8;

1.8
date	99.12.12.01.04.36;	author obrien;	state Exp;
branches;
next	1.7;

1.7
date	99.08.10.07.16.00;	author obrien;	state Exp;
branches;
next	1.6;

1.6
date	99.08.04.15.12.27;	author obrien;	state Exp;
branches;
next	1.5;

1.5
date	99.08.04.05.46.11;	author obrien;	state Exp;
branches;
next	1.4;

1.4
date	99.08.04.05.34.33;	author obrien;	state Exp;
branches;
next	1.3;

1.3
date	99.05.02.09.24.16;	author obrien;	state Exp;
branches;
next	1.2;

1.2
date	99.03.30.21.21.23;	author obrien;	state Exp;
branches;
next	1.1;

1.1
date	99.02.10.09.10.13;	author obrien;	state Exp;
branches
	1.1.1.1;
next	;

1.20.2.1
date	2003.01.16.07.59.32;	author obrien;	state Exp;
branches;
next	;

1.9.2.1
date	2000.06.26.23.07.20;	author obrien;	state Exp;
branches;
next	1.9.2.2;

1.9.2.2
date	2000.07.27.20.58.10;	author obrien;	state Exp;
branches;
next	1.9.2.3;

1.9.2.3
date	2000.11.05.09.34.10;	author obrien;	state Exp;
branches;
next	1.9.2.4;

1.9.2.4
date	2001.03.05.10.09.32;	author obrien;	state Exp;
branches;
next	1.9.2.5;

1.9.2.5
date	2002.04.11.10.16.46;	author murray;	state Exp;
branches;
next	1.9.2.6;

1.9.2.6
date	2003.03.02.16.42.38;	author murray;	state Exp;
branches;
next	1.9.2.7;

1.9.2.7
date	2012.11.17.07.22.18;	author svnexp;	state Exp;
branches;
next	;

1.1.1.1
date	99.02.10.09.10.13;	author obrien;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	99.02.11.12.40.20;	author obrien;	state Exp;
branches
	1.1.1.2.2.1;
next	1.1.1.3;

1.1.1.3
date	99.05.02.09.03.25;	author obrien;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	99.06.23.23.39.41;	author obrien;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	2002.02.19.11.04.32;	author murray;	state Exp;
branches;
next	1.1.1.6;

1.1.1.6
date	2002.04.01.07.54.40;	author murray;	state Exp;
branches;
next	1.1.1.7;

1.1.1.7
date	2003.01.15.10.31.06;	author murray;	state Exp;
branches;
next	1.1.1.8;

1.1.1.8
date	2003.09.02.11.01.25;	author mbr;	state Exp;
branches;
next	1.1.1.9;

1.1.1.9
date	2004.06.26.10.34.19;	author mbr;	state Exp;
branches;
next	;

1.1.1.2.2.1
date	99.02.19.10.32.55;	author obrien;	state Exp;
branches;
next	1.1.1.2.2.2;

1.1.1.2.2.2
date	99.03.30.21.22.25;	author obrien;	state Exp;
branches;
next	1.1.1.2.2.3;

1.1.1.2.2.3
date	99.05.08.18.05.10;	author obrien;	state Exp;
branches;
next	1.1.1.2.2.4;

1.1.1.2.2.4
date	99.08.04.05.37.54;	author obrien;	state Exp;
branches;
next	1.1.1.2.2.5;

1.1.1.2.2.5
date	99.08.04.15.19.52;	author obrien;	state Exp;
branches;
next	1.1.1.2.2.6;

1.1.1.2.2.6
date	99.08.10.07.08.07;	author obrien;	state Exp;
branches;
next	1.1.1.2.2.7;

1.1.1.2.2.7
date	99.12.12.01.17.30;	author obrien;	state Exp;
branches;
next	1.1.1.2.2.8;

1.1.1.2.2.8
date	2000.01.24.00.04.04;	author obrien;	state Exp;
branches;
next	1.1.1.2.2.9;

1.1.1.2.2.9
date	2000.06.27.10.30.57;	author obrien;	state Exp;
branches;
next	;


desc
@@


1.29
log
@Remove isc-dhcp files from HEAD now that we're using the OpenBSD
dhclient.

Reminded by:	ru
Approved by:	re (blanket dhclient)
@
text
@#!/bin/sh
#
# $Id: freebsd,v 1.13.2.6 2003/09/12 19:31:03 dhankins Exp $
#
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.28 2004/06/26 10:47:38 mbr Exp $

if [ -x /usr/bin/logger ]; then
	LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
else
	LOGGER=echo
fi

make_resolv_conf() {
  if [ x"$new_domain_name_servers" != x ]; then
    if [ "x$new_domain_name" != x ]; then
      ( echo search $new_domain_name >/etc/resolv.conf )
      exit_status=$?
    else
      ( rm -f /etc/resolv.conf )
      exit_status=$?
    fi
    if [ $exit_status -ne 0 ]; then
      $LOGGER "WARNING: Unable to update resolv.conf: Error $exit_status"
    else
      for nameserver in $new_domain_name_servers; do
       ( echo nameserver $nameserver >>/etc/resolv.conf )
      done
    fi
  fi
}

# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
exit_with_hooks() {
  exit_status=$1
  if [ -f /etc/dhclient-exit-hooks ]; then
    . /etc/dhclient-exit-hooks
  fi
# probably should do something with exit status of the local script
  exit $exit_status
}

# Invoke the local dhcp client enter hooks, if they exist.
if [ -f /etc/dhclient-enter-hooks ]; then
  exit_status=0
  . /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

if [ x$new_broadcast_address != x ]; then
  new_broadcast_arg="broadcast $new_broadcast_address"
fi
if [ x$old_broadcast_address != x ]; then
  old_broadcast_arg="broadcast $old_broadcast_address"
fi
if [ x$new_subnet_mask != x ]; then
  new_netmask_arg="netmask $new_subnet_mask"
fi
if [ x$old_subnet_mask != x ]; then
  old_netmask_arg="netmask $old_subnet_mask"
fi
if [ x$alias_subnet_mask != x ]; then
  alias_subnet_arg="netmask $alias_subnet_mask"
fi

# Get the interface to which our default route is bound to.
if [ -x /usr/bin/netstat ]; then
	if_defaultroute=`/usr/bin/netstat -rn \
		| /usr/bin/grep "^default" \
		| /usr/bin/awk '{print $6}'`
else
	if_defaultroute="x"
fi

if [ x$reason = xMEDIUM ]; then
  eval "ifconfig $interface $medium"
  eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
  sleep 1
  exit_with_hooks 0
fi

if [ x$reason = xPREINIT ]; then
  if [ x$alias_ip_address != x ]; 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
  ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
		broadcast 255.255.255.255 up
  exit_with_hooks 0
fi

if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
  exit_with_hooks 0;
fi
  
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
   [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
  current_hostname=`/bin/hostname`
  if [ x$current_hostname = x ] || \
     [ x$current_hostname = x$old_host_name ]; then
    if [ x$current_hostname = x ] || \
       [ x$new_host_name != x$old_host_name ]; then
      $LOGGER "New Hostname: $new_host_name"
      hostname $new_host_name
    fi
  fi
  if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
		[ x$alias_ip_address != x$old_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
  if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
   then
    eval "ifconfig $interface inet -alias $old_ip_address $medium"
    route delete $old_ip_address 127.1 >/dev/null 2>&1
    for router in $old_routers; do
      route delete default $router >/dev/null 2>&1
    done
    if [ -n "$old_static_routes" ]; then
      set -- $old_static_routes
      while [ $# -gt 1 ]; do
	route delete $1 $2
	shift; shift
      done
    fi
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' |sh
  fi
  if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
     [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
    eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium"
    $LOGGER "New IP Address ($interface): $new_ip_address"
    $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
    $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
    if [ -n "$new_routers" ]; then
      $LOGGER "New Routers: $new_routers"
    fi
    route add $new_ip_address 127.1 >/dev/null 2>&1
    for router in $new_routers; do
      route add default $router >/dev/null 2>&1
    done
    if [ -n "$new_static_routes" ]; then
      $LOGGER "New Static Routes: $new_static_routes"
      set -- $new_static_routes
      while [ $# -gt 1 ]; do
	route add $1 $2
	shift; shift
      done
    fi
  fi
  if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
   then
    ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
    route add $alias_ip_address 127.0.0.1
  fi
  make_resolv_conf
  exit_with_hooks 0
fi

if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
   || [ x$reason = xSTOP ]; then
  if [ x$alias_ip_address != x ]; 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
  if [ x$old_ip_address != x ]; then
    eval "ifconfig $interface inet -alias $old_ip_address $medium"
    route delete $old_ip_address 127.1 >/dev/null 2>&1
    for router in $old_routers; do
      if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then
	      route delete default $router >/dev/null 2>&1
      fi
    done
    if [ -n "$old_static_routes" ]; then
      set -- $old_static_routes
      while [ $# -gt 1 ]; do
	route delete $1 $2
	shift; shift
      done
    fi
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' \
						|sh >/dev/null 2>&1
  fi
  if [ x$alias_ip_address != x ]; then
    ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
    route add $alias_ip_address 127.0.0.1
  fi
  exit_with_hooks 0
fi

if [ x$reason = xTIMEOUT ]; then
  if [ x$alias_ip_address != x ]; 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
  eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium"
  $LOGGER "New IP Address ($interface): $new_ip_address"
  $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
  $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
  sleep 1
  if [ -n "$new_routers" ]; then
    $LOGGER "New Routers: $new_routers"
    set -- $new_routers
    if ping -q -c 1 $1; then
      if [ x$new_ip_address != x$alias_ip_address ] && \
			[ x$alias_ip_address != x ]; then
	ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
	route add $alias_ip_address 127.0.0.1
      fi
      route add $new_ip_address 127.1 >/dev/null 2>&1
      for router in $new_routers; do
	route add default $router >/dev/null 2>&1
      done
      set -- $new_static_routes
      while [ $# -gt 1 ]; do
	route add $1 $2
	shift; shift
      done
      make_resolv_conf
      exit_with_hooks 0
    fi
  fi
  eval "ifconfig $interface inet -alias $new_ip_address $medium"
  for router in $old_routers; do
    route delete default $router >/dev/null 2>&1
  done
  if [ -n "$old_static_routes" ]; then
    set -- $old_static_routes
    while [ $# -gt 1 ]; do
      route delete $1 $2
      shift; shift
    done
  fi
  arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' \
							|sh >/dev/null 2>&1
  exit_with_hooks 1
fi

exit_with_hooks 0
@


1.28
log
@Our dhclient-script fails to update /etc/resolv.conf if no new
domain name is given and /etc/resolv.conf doesn't exist. Fix this
by using -f (force).

Assigned to ISC as ISC-Bugs #11570

PR:		bin/67613
Submitted by:	Nikos Ntarmos <ntarmos@@ceid.upatras.gr>
@
text
@d5 1
a5 1
# $FreeBSD$
@


1.27
log
@Resolve conflicts.
@
text
@d19 1
a19 1
      ( rm /etc/resolv.conf )
@


1.26
log
@The previous fix (rev 1.25) is only needed in the second place.
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.13.2.5 2003/04/27 19:44:01 dhankins Exp $
@


1.25
log
@Only kill the default route in the release mode if the interface
where the default route is bound to is the same device. Keep it
working for the single user or sysinstall mode, where we just do
what we did before.

Suggested by:   dougb
@
text
@d167 1
a167 3
    if [ $if_defaultroute = x ] || [ $if_defaultroute = $interface ]; then
	    route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
    fi
@


1.24
log
@Restore behaviour from rev. 1.9. Only log when there is a real change
to the configuration state.

Noticed by:	obrien
@
text
@d69 9
d167 3
a169 1
    route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
d175 3
a177 1
      route delete default $router >/dev/null 2>&1
@


1.23
log
@Resolve conflicts.

* rev. 1.22
@
text
@a52 4
if [ x$new_network_number != x ]; then
   $LOGGER New Network Number: $new_network_number
fi

a53 1
 $LOGGER New Broadcast Address: $new_broadcast_address
@


1.22
log
@Fix dhclient infinite loop on ro /etc/resolv.conf

Submitted by:	C J Michaels <cjm2@@earthling.net>
Reviewed by:	David W. Hankins
PR:		38778
ISC-Bug:	5754
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.13.2.4 2002/06/09 22:37:55 murray Exp $
@


1.21
log
@Resolve conflicts.
@
text
@d16 2
a17 1
      echo search $new_domain_name >/etc/resolv.conf
d19 9
a27 1
      rm /etc/resolv.conf
a28 3
    for nameserver in $new_domain_name_servers; do
      echo nameserver $nameserver >>/etc/resolv.conf
    done
@


1.20
log
@Resolve conflicts.
  * Space the output consistently. (r1.19)
  * Use the cleaner "-n" syntax instead of comparing against "". (r1.17)
  * Fix arp invocation. (r1.13)
@
text
@d2 3
a4 1

d14 6
a19 2
  if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
    echo search $new_domain_name >/etc/resolv.conf
@


1.20.2.1
log
@MFC: isc_dhcp_3_0_1_rc11

Approved by:	scottl(re)
@
text
@d2 2
a3 4
#
# $Id: freebsd,v 1.13.2.4 2002/06/09 22:37:55 murray Exp $
#
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.21 2003/01/15 10:47:32 murray Exp $
d12 2
a13 6
  if [ x"$new_domain_name_servers" != x ]; then
    if [ "x$new_domain_name" != x ]; then
      echo search $new_domain_name >/etc/resolv.conf
    else
      rm /etc/resolv.conf
    fi
@


1.19
log
@Consistently space the output.
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.18 2000/11/04 20:45:35 obrien Exp $
d12 6
a17 4
  echo search $new_domain_name >/etc/resolv.conf
  for nameserver in $new_domain_name_servers; do
    echo nameserver $nameserver >>/etc/resolv.conf
  done
d23 1
a23 1
  if [ -x /etc/dhclient-exit-hooks ]; then
d31 1
a31 1
if [ -x /etc/dhclient-enter-hooks ]; then
d41 4
d46 1
d63 2
a64 2
  ifconfig $interface $medium
  ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
d88 2
a89 1
    if [ x$new_host_name != x$old_host_name ]; then
d101 1
a101 1
    ifconfig $interface inet -alias $old_ip_address $medium
d117 2
a118 2
    ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium
d125 1
d141 1
d147 2
a148 1
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
d154 1
a154 1
    ifconfig $interface inet -alias $old_ip_address $medium
d181 2
a182 2
  ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium
d209 1
a209 1
  ifconfig $interface inet -alias $new_ip_address $medium
@


1.18
log
@* Consistently use the `make_resolv_conf' function.
* Better handling of the 127.0.0.1 route.
* Minor style tweak to reduce diffs from v3 script and ours.

Obtained from:	ISC v3 client script
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.17 2000/07/28 09:20:39 obrien Exp $
d111 1
a111 1
    $LOGGER "New IP Address($interface): $new_ip_address"
d113 1
a113 1
    $LOGGER "New Broadcast Address($interface): $new_broadcast_address"
d172 3
a174 3
  $LOGGER "New IP Address($interface): $new_ip_address"
  $LOGGER "New Subnet Mask($interface): $new_subnet_mask"
  $LOGGER "New Broadcast Address($interface): $new_broadcast_address"
@


1.17
log
@Use the cleaner "-n" syntax w/in [] rather then compare against `""'.

Submitted by:	green
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.16 2000/07/28 08:53:40 obrien Exp $
d91 2
a92 1
  if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
d133 1
a133 4
  echo search $new_domain_name >/etc/resolv.conf
  for nameserver in $new_domain_name_servers; do
    echo nameserver $nameserver >>/etc/resolv.conf
  done
d160 1
d183 1
d185 1
d194 1
a194 8
      echo search $new_domain_name >/etc/resolv.conf.std
      for nameserver in $new_domain_name_servers; do
	echo nameserver $nameserver >>/etc/resolv.conf.std
      done
      if [ -f /etc/resolv.conf ]; then
	rm -f /etc/resolv.conf
      fi
      mv /etc/resolv.conf.std /etc/resolv.conf
@


1.16
log
@Prevent 'set' from it interpreting the shell var as an argument.

Submitted by:	green
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.15 2000/07/28 08:46:08 obrien Exp $
d97 1
a97 1
    if [ "$old_static_routes" != "" ]; then
d113 1
a113 1
    if [ "$new_routers" != "" ]; then
d119 1
a119 1
    if [ "$new_static_routes" != "" ]; then
d150 1
a150 1
    if [ "$old_static_routes" != "" ]; then
d177 1
a177 1
  if [ "$new_routers" != "" ]; then
d208 1
a208 1
  if [ "$old_static_routes" != "" ]; then
@


1.15
log
@The result of 'set' gives parameters starting with $1, not $0.

Submitted by:	green
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.14 2000/07/24 20:50:18 obrien Exp $
d98 1
a98 1
      set $old_static_routes
d121 1
a121 1
      set $new_static_routes
d151 1
a151 1
      set $old_static_routes
d179 1
a179 1
    set $new_routers
d188 1
a188 1
      set $new_static_routes
d209 1
a209 1
    set $old_static_routes
@


1.14
log
@Back out rev 1.12 (safe quoting) until I have a chance to rework the change
and get wider testing.  Too many people are having problems with the
script in its current form.
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.13 2000/07/20 09:55:08 obrien Exp $
d190 1
a190 1
	route add $0 $1
@


1.13
log
@arp(8) invocations fixed -- one does not use "-n" with "-d".

Obtained from:	OpenBSD (rev 1.7)
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.12 2000/07/20 09:53:10 obrien Exp $
d12 3
a14 3
  echo "search $new_domain_name" >/etc/resolv.conf
  for nameserver in "$new_domain_name_servers"; do
    echo "nameserver $nameserver" >>/etc/resolv.conf
d39 1
a39 1
if [ "x$new_broadcast_address" != "x" ]; then
d42 1
a42 1
if [ "x$old_broadcast_address" != "x" ]; then
d45 1
a45 1
if [ "x$new_subnet_mask" != "x" ]; then
d48 1
a48 1
if [ "x$old_subnet_mask" != "x" ]; then
d51 1
a51 1
if [ "x$alias_subnet_mask" != "x" ]; then
d55 3
a57 3
if [ "x$reason" = "xMEDIUM" ]; then
  ifconfig "$interface" "$medium"
  ifconfig "$interface" inet -alias 0.0.0.0 "$medium" >/dev/null 2>&1
d62 4
a65 4
if [ "x$reason" = "xPREINIT" ]; then
  if [ "x$alias_ip_address" != "x" ]; 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
d67 1
a67 1
  ifconfig "$interface" inet 0.0.0.0 netmask 0.0.0.0 \
d72 1
a72 1
if [ "x$reason" = "xARPCHECK" ] || [ "x$reason" = "xARPSEND" ]; then
d76 2
a77 2
if [ "x$reason" = "xBOUND" ] || [ "x$reason" = "xRENEW" ] || \
   [ "x$reason" = "xREBIND" ] || [ "x$reason" = "xREBOOT" ]; then
d79 3
a81 3
  if [ "x$current_hostname" = "x" ] || \
     [ "x$current_hostname" = "x$old_host_name" ]; then
    if [ "x$new_host_name" != "x$old_host_name" ]; then
d83 1
a83 1
      hostname "$new_host_name"
d86 10
a95 10
  if [ "x$old_ip_address" != "x" ] && [ "x$alias_ip_address" != "x" ] && \
		[ "x$alias_ip_address" != "x$old_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
  if [ "x$old_ip_address" != "x" ] && [ "x$old_ip_address" != "x$new_ip_address" ]; then
    ifconfig "$interface" inet -alias "$old_ip_address" "$medium"
    route delete "$old_ip_address" 127.1 >/dev/null 2>&1
    for router in "$old_routers"; do
      route delete default "$router" >/dev/null 2>&1
d100 1
a100 1
	route delete "$1" "$2"
d106 4
a109 4
  if [ "x$old_ip_address" = "x" ] || [ "x$old_ip_address" != "x$new_ip_address" ] || \
     [ "x$reason" = "xBOUND" ] || [ "x$reason" = "xREBOOT" ]; then
    ifconfig "$interface" inet "$new_ip_address" "$new_netmask_arg" \
					"$new_broadcast_arg" "$medium"
d116 2
a117 2
    for router in "$new_routers"; do
      route add default "$router" >/dev/null 2>&1
d123 1
a123 1
	route add "$1" "$2"
d128 1
a128 1
  if [ "x$new_ip_address" != "x$alias_ip_address" ] && [ "x$alias_ip_address" != "x" ];
d130 1
a130 1
    ifconfig "$interface" inet alias "$alias_ip_address" "$alias_subnet_arg"
d132 3
a134 3
  echo search "$new_domain_name" >/etc/resolv.conf
  for nameserver in "$new_domain_name_servers"; do
    echo nameserver "$nameserver" >>/etc/resolv.conf
d139 10
a148 10
if [ "x$reason" = "xEXPIRE" ] || [ "x$reason" = "xFAIL" ]; then
  if [ "x$alias_ip_address" != "x" ]; 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
  if [ "x$old_ip_address" != "x" ]; then
    ifconfig "$interface" inet -alias "$old_ip_address" "$medium"
    route delete "$old_ip_address" 127.1 >/dev/null 2>&1
    for router in "$old_routers"; do
      route delete default "$router" >/dev/null 2>&1
d153 1
a153 1
	route delete "$1" "$2"
d160 2
a161 2
  if [ "x$alias_ip_address" != "x" ]; then
    ifconfig "$interface" inet alias "$alias_ip_address" "$alias_subnet_arg"
d166 4
a169 4
if [ "x$reason" = "xTIMEOUT" ]; then
  if [ "x$alias_ip_address" != "x" ]; 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
d171 2
a172 2
  ifconfig "$interface" inet "$new_ip_address" "$new_netmask_arg" \
					"$new_broadcast_arg" "$medium"
d180 4
a183 4
    if ping -q -c 1 "$1"; then
      if [ "x$new_ip_address" != "x$alias_ip_address" ] && \
			[ "x$alias_ip_address" != "x" ]; then
	ifconfig "$interface" inet alias "$alias_ip_address" "$alias_subnet_arg"
d185 2
a186 2
      for router in "$new_routers"; do
	route add default "$router" >/dev/null 2>&1
d190 1
a190 1
	route add "$0" "$1"
d193 3
a195 3
      echo search "$new_domain_name" >/etc/resolv.conf.std
      for nameserver in "$new_domain_name_servers"; do
	echo nameserver "$nameserver" >>/etc/resolv.conf.std
d204 3
a206 3
  ifconfig "$interface" inet -alias "$new_ip_address" "$medium"
  for router in "$old_routers"; do
    route delete default "$router" >/dev/null 2>&1
d211 1
a211 1
      route delete "$1" "$2"
@


1.12
log
@safe shell quoting

Obtained from:	OpenBSD (rev 1.6)
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.11 2000/05/20 18:01:05 obrien Exp $
d104 1
a104 1
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh
d157 1
a157 1
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
d215 1
a215 1
  arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
@


1.11
log
@Revert rev 1.10 as I took the bug report too much on face value.  The bug
submitter has been refered to the ISC to determine if there his problems
are due to a bug in the script.

As a side note, `man 8 ifconfig' does not show "ifconfig -alias" as being
acceptable, but it is and does server a purpose.
@
text
@d3 1
a3 1
# $FreeBSD$
d12 3
a14 3
  echo search $new_domain_name >/etc/resolv.conf
  for nameserver in $new_domain_name_servers; do
    echo nameserver $nameserver >>/etc/resolv.conf
d39 1
a39 1
if [ x$new_broadcast_address != x ]; then
d42 1
a42 1
if [ x$old_broadcast_address != x ]; then
d45 1
a45 1
if [ x$new_subnet_mask != x ]; then
d48 1
a48 1
if [ x$old_subnet_mask != x ]; then
d51 1
a51 1
if [ x$alias_subnet_mask != x ]; then
d55 3
a57 3
if [ x$reason = xMEDIUM ]; then
  ifconfig $interface $medium
  ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
d62 4
a65 4
if [ x$reason = xPREINIT ]; then
  if [ x$alias_ip_address != x ]; 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
d67 1
a67 1
  ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
d72 1
a72 1
if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
d76 2
a77 2
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
   [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
d79 3
a81 3
  if [ x$current_hostname = x ] || \
     [ x$current_hostname = x$old_host_name ]; then
    if [ x$new_host_name != x$old_host_name ]; then
d83 1
a83 1
      hostname $new_host_name
d86 10
a95 10
  if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
		[ x$alias_ip_address != x$old_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
  if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
    ifconfig $interface inet -alias $old_ip_address $medium
    route delete $old_ip_address 127.1 >/dev/null 2>&1
    for router in $old_routers; do
      route delete default $router >/dev/null 2>&1
d100 1
a100 1
	route delete $1 $2
d106 4
a109 4
  if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
     [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
    ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium
d116 2
a117 2
    for router in $new_routers; do
      route add default $router >/dev/null 2>&1
d123 1
a123 1
	route add $1 $2
d128 1
a128 1
  if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
d130 1
a130 1
    ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
d132 3
a134 3
  echo search $new_domain_name >/etc/resolv.conf
  for nameserver in $new_domain_name_servers; do
    echo nameserver $nameserver >>/etc/resolv.conf
d139 10
a148 10
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
  if [ x$alias_ip_address != x ]; 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
  if [ x$old_ip_address != x ]; then
    ifconfig $interface inet -alias $old_ip_address $medium
    route delete $old_ip_address 127.1 >/dev/null 2>&1
    for router in $old_routers; do
      route delete default $router >/dev/null 2>&1
d153 1
a153 1
	route delete $1 $2
d160 2
a161 2
  if [ x$alias_ip_address != x ]; then
    ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
d166 4
a169 4
if [ x$reason = xTIMEOUT ]; then
  if [ x$alias_ip_address != x ]; 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
d171 2
a172 2
  ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium
d180 4
a183 4
    if ping -q -c 1 $1; then
      if [ x$new_ip_address != x$alias_ip_address ] && \
			[ x$alias_ip_address != x ]; then
	ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
d185 2
a186 2
      for router in $new_routers; do
	route add default $router >/dev/null 2>&1
d190 1
a190 1
	route add $0 $1
d193 3
a195 3
      echo search $new_domain_name >/etc/resolv.conf.std
      for nameserver in $new_domain_name_servers; do
	echo nameserver $nameserver >>/etc/resolv.conf.std
d204 3
a206 3
  ifconfig $interface inet -alias $new_ip_address $medium
  for router in $old_routers; do
    route delete default $router >/dev/null 2>&1
d211 1
a211 1
      route delete $1 $2
@


1.10
log
@Our `ifconfig' syntax uses "alias" not "-alias".

Submitted by:	Per Kristian Hove <Per.Hove@@math.ntnu.no>
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.9 2000/01/15 22:46:40 obrien Exp $
d57 1
a57 1
  ifconfig $interface inet alias 0.0.0.0 $medium >/dev/null 2>&1
d64 1
a64 1
    ifconfig $interface inet alias $alias_ip_address > /dev/null 2>&1
d88 1
a88 1
    ifconfig $interface inet alias $alias_ip_address > /dev/null 2>&1
d92 1
a92 1
    ifconfig $interface inet alias $old_ip_address $medium
d141 1
a141 1
    ifconfig $interface inet alias $alias_ip_address > /dev/null 2>&1
d145 1
a145 1
    ifconfig $interface inet alias $old_ip_address $medium
d168 1
a168 1
    ifconfig $interface inet alias $alias_ip_address > /dev/null 2>&1
d204 1
a204 1
  ifconfig $interface inet alias $new_ip_address $medium
@


1.9
log
@Only log when there is a real change to the configuration state.

Requested and Tested by:	unfurl
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.8 1999/12/12 01:04:36 obrien Exp $
d57 1
a57 1
  ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
d64 1
a64 1
    ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
d88 1
a88 1
    ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
d92 1
a92 1
    ifconfig $interface inet -alias $old_ip_address $medium
d141 1
a141 1
    ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
d145 1
a145 1
    ifconfig $interface inet -alias $old_ip_address $medium
d168 1
a168 1
    ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
d204 1
a204 1
  ifconfig $interface inet -alias $new_ip_address $medium
@


1.9.2.1
log
@Ugrade to version 2.0 PL 1.
@
text
@d3 1
a3 1
# $FreeBSD$
@


1.9.2.2
log
@MFC: rev 1.13 (arp(8) invocation fix)
@
text
@d3 1
a3 1
# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.9.2.1 2000/06/26 23:07:20 obrien Exp $
d104 1
a104 1
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' |sh
d157 1
a157 1
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' \
d215 1
a215 1
  arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' \
@


1.9.2.3
log
@MFC: sync with rev 1.18.

Approved by:	JKH
@
text
@d3 1
a3 1
# $FreeBSD$
d91 1
a91 2
  if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
   then
d97 2
a98 2
    if [ -n "$old_static_routes" ]; then
      set -- $old_static_routes
d113 1
a113 1
    if [ -n "$new_routers" ]; then
d119 1
a119 1
    if [ -n "$new_static_routes" ]; then
d121 1
a121 1
      set -- $new_static_routes
d132 4
a135 1
  make_resolv_conf
d150 2
a151 2
    if [ -n "$old_static_routes" ]; then
      set -- $old_static_routes
a161 1
    route add $alias_ip_address 127.0.0.1
d177 1
a177 1
  if [ -n "$new_routers" ]; then
d179 1
a179 1
    set -- $new_routers
a183 1
	route add $alias_ip_address 127.0.0.1
a184 1
      route add $new_ip_address 127.1 >/dev/null 2>&1
d188 1
a188 1
      set -- $new_static_routes
d190 1
a190 1
	route add $1 $2
d193 8
a200 1
      make_resolv_conf
d208 2
a209 2
  if [ -n "$old_static_routes" ]; then
    set -- $old_static_routes
@


1.9.2.4
log
@MFC:  Patchlevel 5 of the ISC 2.0 dhcp client.
@
text
@@


1.9.2.5
log
@MFC: DHCP 3.0.1 RC8
@
text
@d12 4
a15 6
  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
d21 1
a21 1
  if [ -f /etc/dhclient-exit-hooks ]; then
d29 1
a29 1
if [ -f /etc/dhclient-enter-hooks ]; then
a38 4
if [ x$new_network_number != x ]; then
   $LOGGER New Network Number: $new_network_number
fi

a39 1
 $LOGGER New Broadcast Address: $new_broadcast_address
d56 2
a57 2
  eval "ifconfig $interface $medium"
  eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
d81 1
a81 2
    if [ x$current_hostname = x ] || \
       [ x$new_host_name != x$old_host_name ]; then
d93 1
a93 1
    eval "ifconfig $interface inet -alias $old_ip_address $medium"
d109 3
a111 3
    eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium"
    $LOGGER "New IP Address ($interface): $new_ip_address"
d113 1
a113 1
    $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
a116 1
    route add $new_ip_address 127.1 >/dev/null 2>&1
a131 1
    route add $alias_ip_address 127.0.0.1
d137 1
a137 2
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
   || [ x$reason = xSTOP ]; then
d143 1
a143 1
    eval "ifconfig $interface inet -alias $old_ip_address $medium"
d170 5
a174 5
  eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium"
  $LOGGER "New IP Address ($interface): $new_ip_address"
  $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
  $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
d198 1
a198 1
  eval "ifconfig $interface inet -alias $new_ip_address $medium"
@


1.9.2.6
log
@MFC: ISC DHCP 3.0.1 RC11

Approved by:  re (scottl)
@
text
@d2 1
a2 3
#
# $Id: freebsd,v 1.13.2.4 2002/06/09 22:37:55 murray Exp $
#
d12 2
a13 6
  if [ x"$new_domain_name_servers" != x ]; then
    if [ "x$new_domain_name" != x ]; then
      echo search $new_domain_name >/etc/resolv.conf
    else
      rm /etc/resolv.conf
    fi
@


1.9.2.7
log
@Switch importer
@
text
@d5 1
a5 1
# $FreeBSD: stable/4/contrib/isc-dhcp/client/scripts/freebsd 111743 2003-03-02 16:42:40Z murray $
@


1.8
log
@Do not add routes for localhost to the `dhclient' controlled interface.
Doing so is bogus if the loop-back interface was not configured.

Typically ``network_interfaces="auto"'' will return the list of
interfaces such that "lo0" is not first.  Thus there are times when
`dhclient' configs an interface before "lo0" is configured.

Under BSD4.4, there's no need to add the above route, as it will be
automatically generated by the kernel.

PR:		conf/14098, misc/15183
Submitted by:	luoqi (true identification of the problem)
@
text
@d3 1
a3 1
# $FreeBSD$
a38 4
if [ x$new_network_number != x ]; then
   $LOGGER New Network Number: $new_network_number
fi

a39 1
  $LOGGER New Broadcast Address: $new_broadcast_address
a45 1
  $LOGGER New Subnet Mask for $interface: $new_subnet_mask
d82 1
a82 1
      $LOGGER New Hostname: $new_host_name
d110 6
d120 1
a120 1
      $LOGGER New Static Routes: $new_static_routes
d173 3
d178 1
a178 1
    $LOGGER New Routers: $new_routers
@


1.7
log
@Check to see if /usr/bin/logger exists before using it.  Use "echo" if
/usr/bin/logger is not available.

Noticed from:	error messages in -CURRENT's sysinstall Alt-F2 debug screen
@
text
@d3 2
a115 1
    route add $new_ip_address 127.1 >/dev/null 2>&1
a130 1
    route add $alias_ip_address 127.0.0.1
a161 1
    route add $alias_ip_address 127.0.0.1
a180 1
	route add $alias_ip_address 127.0.0.1
a181 1
      route add $new_ip_address 127.1 >/dev/null 2>&1
@


1.6
log
@Log hostname settings/changes.

Submitted by:	John Baldwin <jobaldwi@@vt.edu>
@
text
@d3 5
a7 1
LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
@


1.5
log
@MFS: use logger(1) instead of plain echo(1).
(some how these local changes made it out of my local tree into the
repository, so lets do it right)
@
text
@d82 1
@


1.4
log
@Support the setting of hostname via DHCP.

Submitted by:	myself & Ted Lemon <mellon@@isc.org>
@
text
@d3 2
d34 1
a34 1
   echo New Network Number: $new_network_number
d38 1
a38 1
 echo New Broadcast Address: $new_broadcast_address
d45 1
d114 1
d171 1
@


1.3
log
@Fix conflicts.
@
text
@d75 7
@


1.2
log
@Our ping doesn't have the ``-w'' option.

Submitted by:	Kevin Street <street@@iname.com>
@
text
@d3 28
d56 1
a56 1
  exit 0
d66 1
a66 1
  exit 0
d70 1
a70 1
  exit 0;
d120 1
a120 1
  exit 0
d148 1
a148 1
  exit 0
d184 1
a184 1
      exit 0
d200 1
a200 1
  exit 1
d203 1
a203 1
exit 0
@


1.1
log
@Initial revision
@
text
@d133 1
a133 1
    if ping -q -c 1 -w 1 $1; then
d158 1
@


1.1.1.1
log
@Virgin import of ISC-DHCP v2.0b1pl6
@
text
@@


1.1.1.2
log
@Virgin import of ISC-DHCP v2.0b1pl11
@
text
@a157 1
  fi
@


1.1.1.3
log
@Virgin import of ISC-DHCP v2.0b1pl27
@
text
@a2 28
make_resolv_conf() {
  echo search $new_domain_name >/etc/resolv.conf
  for nameserver in $new_domain_name_servers; do
    echo nameserver $nameserver >>/etc/resolv.conf
  done
}

# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
exit_with_hooks() {
  exit_status=$1
  if [ -x /etc/dhclient-exit-hooks ]; then
    . /etc/dhclient-exit-hooks
  fi
# probably should do something with exit status of the local script
  exit $exit_status
}

# Invoke the local dhcp client enter hooks, if they exist.
if [ -x /etc/dhclient-enter-hooks ]; then
  exit_status=0
  . /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

d28 1
a28 1
  exit_with_hooks 0
d38 1
a38 1
  exit_with_hooks 0
d42 1
a42 1
  exit_with_hooks 0;
d92 1
a92 1
  exit_with_hooks 0
d120 1
a120 1
  exit_with_hooks 0
d156 1
a156 1
      exit_with_hooks 0
d172 1
a172 1
  exit_with_hooks 1
d175 1
a175 1
exit_with_hooks 0
@


1.1.1.4
log
@Virgin import of ISC-DHCP v2.0
@
text
@d161 1
a161 1
    if ping -q -c 1 $1; then
@


1.1.1.5
log
@Import ISC DHCP 3.0.1 RC6 client.
@
text
@a2 6
if [ -x /usr/bin/logger ]; then
	LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
else
	LOGGER=echo
fi

d4 4
a7 6
  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
d13 1
a13 1
  if [ -f /etc/dhclient-exit-hooks ]; then
d21 1
a21 1
if [ -f /etc/dhclient-enter-hooks ]; then
d32 1
a32 1
   $LOGGER New Network Number: $new_network_number
d36 1
a36 1
 $LOGGER New Broadcast Address: $new_broadcast_address
d53 2
a54 2
  eval "ifconfig $interface $medium"
  eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
a74 9
  current_hostname=`hostname`
  if [ x$current_hostname = x ] || \
     [ x$current_hostname = x$old_host_name ]; then
    if [ x$current_hostname = x ] || \
       [ x$new_host_name != x$old_host_name ]; then
      $LOGGER "New Hostname: $new_host_name"
      hostname $new_host_name
    fi
  fi
d80 2
a81 3
  if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
   then
    eval "ifconfig $interface inet -alias $old_ip_address $medium"
d87 1
a87 1
      set -- $old_static_routes
d93 1
a93 1
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' |sh
d97 2
a98 8
    eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium"
    $LOGGER "New IP Address($interface): $new_ip_address"
    $LOGGER "New Subnet Mask($interface): $new_subnet_mask"
    $LOGGER "New Broadcast Address($interface): $new_broadcast_address"
    if [ "$new_routers" != "" ]; then
      $LOGGER "New Routers: $new_routers"
    fi
d104 1
a104 2
      $LOGGER "New Static Routes: $new_static_routes"
      set -- $new_static_routes
d116 4
a119 1
  make_resolv_conf
d123 1
a123 2
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
   || [ x$reason = xSTOP ]; then
d129 1
a129 1
    eval "ifconfig $interface inet -alias $old_ip_address $medium"
d135 1
a135 1
      set -- $old_static_routes
d156 2
a157 5
  eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
					$new_broadcast_arg $medium"
  $LOGGER "New IP Address($interface): $new_ip_address"
  $LOGGER "New Subnet Mask($interface): $new_subnet_mask"
  $LOGGER "New Broadcast Address($interface): $new_broadcast_address"
d160 1
a160 2
    $LOGGER "New Routers: $new_routers"
    set -- $new_routers
d171 1
a171 1
      set -- $new_static_routes
d173 1
a173 1
	route add $1 $2
d176 8
a183 1
      make_resolv_conf
d187 1
a187 1
  eval "ifconfig $interface inet -alias $new_ip_address $medium"
d192 1
a192 1
    set -- $old_static_routes
d198 1
a198 1
  arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' \
@


1.1.1.6
log
@Import ISC DHCP 3.0.1 RC8 client.
@
text
@a2 2
# $FreeBSD$

d83 1
a83 1
  current_hostname=`/bin/hostname`
d104 1
a104 1
    if [ -n "$old_static_routes" ]; then
d117 4
a120 4
    $LOGGER "New IP Address ($interface): $new_ip_address"
    $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
    $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
    if [ -n "$new_routers" ]; then
d127 1
a127 1
    if [ -n "$new_static_routes" ]; then
d157 1
a157 1
    if [ -n "$old_static_routes" ]; then
d164 1
a164 1
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' \
d181 3
a183 3
  $LOGGER "New IP Address ($interface): $new_ip_address"
  $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
  $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
d185 1
a185 1
  if [ -n "$new_routers" ]; then
d211 1
a211 1
  if [ -n "$old_static_routes" ]; then
@


1.1.1.7
log
@Import ISC DHCP 3.0.1 RC10 client.
@
text
@d2 1
a2 3
#
# $Id: freebsd,v 1.13.2.4 2002/06/09 22:37:55 murray Exp $
#
d12 2
a13 6
  if [ x"$new_domain_name_servers" != x ]; then
    if [ "x$new_domain_name" != x ]; then
      echo search $new_domain_name >/etc/resolv.conf
    else
      rm /etc/resolv.conf
    fi
@


1.1.1.8
log
@Import ISC DHCP 3.0.1 RC12 client.
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.13.2.5 2003/04/27 19:44:01 dhankins Exp $
d16 1
a16 2
      ( echo search $new_domain_name >/etc/resolv.conf )
      exit_status=$?
a18 8
      exit_status=$?
    fi
    if [ $exit_status -ne 0 ]; then
      $LOGGER "WARNING: Unable to update resolv.conf: Error $exit_status"
    else
      for nameserver in $new_domain_name_servers; do
	( echo nameserver $nameserver >>/etc/resolv.conf )
      done
d20 3
@


1.1.1.9
log
@Import ISC DHCP 3.0.1 RC14 client.
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.13.2.6 2003/09/12 19:31:03 dhankins Exp $
d19 1
a19 1
      ( rm /etc/resolv.conf )
@


1.1.1.2.2.1
log
@Mr. 3.1-STABLE, meet Ms. DHCP client
@
text
@@


1.1.1.2.2.2
log
@MFC: rev 1.2 (no "-w" option)
@
text
@d133 1
a133 1
    if ping -q -c 1 $1; then
@


1.1.1.2.2.3
log
@MFC: update to v2.0b1pl27
@
text
@a2 30
LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"

make_resolv_conf() {
  echo search $new_domain_name >/etc/resolv.conf
  for nameserver in $new_domain_name_servers; do
    echo nameserver $nameserver >>/etc/resolv.conf
  done
}

# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
exit_with_hooks() {
  exit_status=$1
  if [ -x /etc/dhclient-exit-hooks ]; then
    . /etc/dhclient-exit-hooks
  fi
# probably should do something with exit status of the local script
  exit $exit_status
}

# Invoke the local dhcp client enter hooks, if they exist.
if [ -x /etc/dhclient-enter-hooks ]; then
  exit_status=0
  . /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

d4 1
a4 1
   $LOGGER New Network Number: $new_network_number
d8 1
a8 1
  $LOGGER New Broadcast Address: $new_broadcast_address
a14 1
  $LOGGER New Subnet Mask for $interface: $new_subnet_mask
d28 1
a28 1
  exit_with_hooks 0
d38 1
a38 1
  exit_with_hooks 0
d42 1
a42 1
  exit_with_hooks 0;
a75 1
      $LOGGER New Static Routes: $new_static_routes
d92 1
a92 1
  exit_with_hooks 0
d120 1
a120 1
  exit_with_hooks 0
a131 1
    $LOGGER New Routers: $new_routers
d156 1
a156 1
      exit_with_hooks 0
d172 1
a172 1
  exit_with_hooks 1
d175 1
a175 1
exit_with_hooks 0
@


1.1.1.2.2.4
log
@MFC rev 1.4 (hostname setting support)
@
text
@a77 7
  current_hostname=`/bin/hostname`
  if [ x$current_hostname = x ] || \
     [ x$current_hostname = x$old_host_name ]; then
    if [ x$new_host_name != x$old_host_name ]; then
      hostname $new_host_name
    fi
  fi
@


1.1.1.2.2.5
log
@MFC: rev 1.6 (log setting hostname)
@
text
@a81 1
      $LOGGER New Hostname: $new_host_name
@


1.1.1.2.2.6
log
@Check to see if /usr/bin/logger exists before using it.  Use "echo" if
/usr/bin/logger is not available.

Noticed from:	error messages in -CURRENT's sysinstall Alt-F2 debug screen
@
text
@d3 1
a3 5
if [ -x /usr/bin/logger ]; then
	LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
else
	LOGGER=echo
fi
@


1.1.1.2.2.7
log
@MFC: rev 1.8 (don't add localhost routes).
@
text
@a2 2
# $FreeBSD$

d114 1
d130 1
d162 1
d182 1
d184 1
@


1.1.1.2.2.8
log
@MFC: rev 1.9 (Only log real changes to configuration state)

Motivated by:	beer
@
text
@d39 4
d44 1
d51 1
d88 1
a88 1
      $LOGGER "New Hostname: $new_host_name"
a115 6
    $LOGGER "New IP Address($interface): $new_ip_address"
    $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
    $LOGGER "New Broadcast Address($interface): $new_broadcast_address"
    if [ "$new_routers" != "" ]; then
      $LOGGER "New Routers: $new_routers"
    fi
d120 1
a120 1
      $LOGGER "New Static Routes: $new_static_routes"
a172 3
  $LOGGER "New IP Address($interface): $new_ip_address"
  $LOGGER "New Subnet Mask($interface): $new_subnet_mask"
  $LOGGER "New Broadcast Address($interface): $new_broadcast_address"
d175 1
a175 1
    $LOGGER "New Routers: $new_routers"
@


1.1.1.2.2.9
log
@Ugrade to version 2.0 PL 1.
@
text
@@


