head	1.5;
access;
symbols
	perseant-exfatfs-base-20250801:1.5
	perseant-exfatfs-base-20240630:1.5
	perseant-exfatfs:1.5.0.16
	perseant-exfatfs-base:1.5
	cjep_sun2x:1.5.0.14
	cjep_sun2x-base:1.5
	cjep_staticlib_x-base1:1.5
	cjep_staticlib_x:1.5.0.12
	cjep_staticlib_x-base:1.5
	phil-wifi-20200421:1.5
	phil-wifi-20200411:1.5
	phil-wifi-20200406:1.5
	pgoyette-compat-merge-20190127:1.5
	pgoyette-compat-20190127:1.5
	pgoyette-compat-20190118:1.5
	pgoyette-compat-1226:1.5
	pgoyette-compat-1126:1.5
	pgoyette-compat-1020:1.5
	pgoyette-compat-0930:1.5
	pgoyette-compat-0906:1.5
	pgoyette-compat-0728:1.5
	pgoyette-compat-0625:1.5
	pgoyette-compat-0521:1.5
	pgoyette-compat-0502:1.5
	pgoyette-compat-0422:1.5
	pgoyette-compat-0415:1.5
	pgoyette-compat-0407:1.5
	pgoyette-compat-0330:1.5
	pgoyette-compat-0322:1.5
	pgoyette-compat-0315:1.5
	pgoyette-compat:1.5.0.10
	pgoyette-compat-base:1.5
	prg-localcount2-base3:1.5
	prg-localcount2-base2:1.5
	prg-localcount2-base1:1.5
	prg-localcount2:1.5.0.8
	prg-localcount2-base:1.5
	pgoyette-localcount-20170426:1.5
	bouyer-socketcan-base1:1.5
	pgoyette-localcount-20170320:1.5
	bouyer-socketcan:1.5.0.6
	bouyer-socketcan-base:1.5
	pgoyette-localcount-20170107:1.5
	pgoyette-localcount-20161104:1.5
	localcount-20160914:1.5
	pgoyette-localcount-20160806:1.5
	pgoyette-localcount-20160726:1.5
	pgoyette-localcount:1.5.0.4
	pgoyette-localcount-base:1.5
	netbsd-5-2-3-RELEASE:1.4
	netbsd-5-1-5-RELEASE:1.4
	netbsd-6-0-6-RELEASE:1.4
	netbsd-6-1-5-RELEASE:1.4
	yamt-pagecache-base9:1.5
	yamt-pagecache-tag8:1.4
	netbsd-6-1-4-RELEASE:1.4
	netbsd-6-0-5-RELEASE:1.4
	tls-earlyentropy:1.5.0.2
	tls-earlyentropy-base:1.5
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.5
	riastradh-drm2-base3:1.5
	netbsd-6-1-3-RELEASE:1.4
	netbsd-6-0-4-RELEASE:1.4
	netbsd-5-2-2-RELEASE:1.4
	netbsd-5-1-4-RELEASE:1.4
	netbsd-6-1-2-RELEASE:1.4
	netbsd-6-0-3-RELEASE:1.4
	netbsd-5-2-1-RELEASE:1.4
	netbsd-5-1-3-RELEASE:1.4
	netbsd-6-1-1-RELEASE:1.4
	netbsd-6-1:1.4.0.60
	netbsd-6-0-2-RELEASE:1.4
	netbsd-6-1-RELEASE:1.4
	khorben-n900:1.4.0.58
	netbsd-6-1-RC4:1.4
	netbsd-6-1-RC3:1.4
	agc-symver:1.4.0.56
	agc-symver-base:1.4
	netbsd-6-1-RC2:1.4
	netbsd-6-1-RC1:1.4
	yamt-pagecache-base8:1.4
	netbsd-5-2:1.4.0.52
	netbsd-6-0-1-RELEASE:1.4
	yamt-pagecache-base7:1.4
	netbsd-5-2-RELEASE:1.4
	netbsd-5-2-RC1:1.4
	matt-nb6-plus-nbase:1.4
	yamt-pagecache-base6:1.4
	netbsd-6-0:1.4.0.50
	netbsd-6-0-RELEASE:1.4
	netbsd-6-0-RC2:1.4
	tls-maxphys:1.4.0.48
	tls-maxphys-base:1.5
	matt-nb6-plus:1.4.0.46
	matt-nb6-plus-base:1.4
	netbsd-6-0-RC1:1.4
	yamt-pagecache-base5:1.4
	yamt-pagecache-base4:1.4
	netbsd-6:1.4.0.44
	netbsd-6-base:1.4
	netbsd-5-1-2-RELEASE:1.4
	netbsd-5-1-1-RELEASE:1.4
	yamt-pagecache-base3:1.4
	yamt-pagecache-base2:1.4
	yamt-pagecache:1.4.0.42
	yamt-pagecache-base:1.4
	cherry-xenmp:1.4.0.40
	cherry-xenmp-base:1.4
	bouyer-quota2-nbase:1.4
	bouyer-quota2:1.4.0.38
	bouyer-quota2-base:1.4
	matt-mips64-premerge-20101231:1.4
	matt-nb5-mips64-premerge-20101231:1.4
	matt-nb5-pq3:1.4.0.36
	matt-nb5-pq3-base:1.4
	netbsd-5-1:1.4.0.34
	netbsd-5-1-RELEASE:1.4
	netbsd-5-1-RC4:1.4
	matt-nb5-mips64-k15:1.4
	netbsd-5-1-RC3:1.4
	netbsd-5-1-RC2:1.4
	netbsd-5-1-RC1:1.4
	netbsd-5-0-2-RELEASE:1.4
	matt-nb5-mips64-premerge-20091211:1.4
	matt-premerge-20091211:1.4
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.4
	matt-nb4-mips64-k7-u2a-k9b:1.4
	matt-nb5-mips64-u1-k1-k5:1.4
	matt-nb5-mips64:1.4.0.32
	netbsd-5-0-1-RELEASE:1.4
	jym-xensuspend-nbase:1.4
	netbsd-5-0:1.4.0.30
	netbsd-5-0-RELEASE:1.4
	netbsd-5-0-RC4:1.4
	netbsd-5-0-RC3:1.4
	netbsd-5-0-RC2:1.4
	jym-xensuspend:1.4.0.28
	jym-xensuspend-base:1.4
	netbsd-5-0-RC1:1.4
	netbsd-5:1.4.0.26
	netbsd-5-base:1.4
	matt-mips64-base2:1.4
	matt-mips64:1.4.0.24
	mjf-devfs2:1.4.0.22
	mjf-devfs2-base:1.4
	netbsd-4-0-1-RELEASE:1.4
	wrstuden-revivesa-base-3:1.4
	wrstuden-revivesa-base-2:1.4
	wrstuden-fixsa-newbase:1.4
	wrstuden-revivesa-base-1:1.4
	yamt-pf42-base4:1.4
	yamt-pf42-base3:1.4
	hpcarm-cleanup-nbase:1.4
	yamt-pf42-baseX:1.4
	yamt-pf42-base2:1.4
	wrstuden-revivesa:1.4.0.20
	wrstuden-revivesa-base:1.4
	yamt-pf42:1.4.0.18
	yamt-pf42-base:1.4
	keiichi-mipv6:1.4.0.16
	keiichi-mipv6-base:1.4
	matt-armv6-nbase:1.4
	matt-armv6-prevmlocking:1.4
	wrstuden-fixsa-base-1:1.4
	netbsd-4-0:1.4.0.14
	netbsd-4-0-RELEASE:1.4
	cube-autoconf:1.4.0.12
	cube-autoconf-base:1.4
	netbsd-4-0-RC5:1.4
	netbsd-4-0-RC4:1.4
	netbsd-4-0-RC3:1.4
	netbsd-4-0-RC2:1.4
	netbsd-4-0-RC1:1.4
	matt-armv6:1.4.0.10
	matt-armv6-base:1.4
	matt-mips64-base:1.4
	hpcarm-cleanup:1.4.0.8
	hpcarm-cleanup-base:1.4
	netbsd-3-1-1-RELEASE:1.3
	netbsd-3-0-3-RELEASE:1.3
	wrstuden-fixsa:1.4.0.6
	wrstuden-fixsa-base:1.4
	abandoned-netbsd-4-base:1.4
	abandoned-netbsd-4:1.4.0.2
	netbsd-3-1:1.3.0.12
	netbsd-3-1-RELEASE:1.3
	netbsd-3-0-2-RELEASE:1.3
	netbsd-3-1-RC4:1.3
	netbsd-3-1-RC3:1.3
	netbsd-3-1-RC2:1.3
	netbsd-3-1-RC1:1.3
	netbsd-4:1.4.0.4
	netbsd-4-base:1.4
	netbsd-3-0-1-RELEASE:1.3
	netbsd-3-0:1.3.0.10
	netbsd-3-0-RELEASE:1.3
	netbsd-3-0-RC6:1.3
	netbsd-3-0-RC5:1.3
	netbsd-3-0-RC4:1.3
	netbsd-3-0-RC3:1.3
	netbsd-3-0-RC2:1.3
	netbsd-3-0-RC1:1.3
	netbsd-2-0-3-RELEASE:1.3
	netbsd-2-1:1.3.0.8
	netbsd-2-1-RELEASE:1.3
	netbsd-2-1-RC6:1.3
	netbsd-2-1-RC5:1.3
	netbsd-2-1-RC4:1.3
	netbsd-2-1-RC3:1.3
	netbsd-2-1-RC2:1.3
	netbsd-2-1-RC1:1.3
	ISC_V3-0-3_CORRECT:1.1.1.4
	ISC_V3-0-3:1.1.1.4
	netbsd-2-0-2-RELEASE:1.3
	netbsd-3:1.3.0.6
	netbsd-3-base:1.3
	netbsd-2-0-1-RELEASE:1.3
	netbsd-2:1.3.0.4
	netbsd-2-base:1.3
	netbsd-2-0-RELEASE:1.3
	netbsd-2-0-RC5:1.3
	netbsd-2-0-RC4:1.3
	netbsd-2-0-RC3:1.3
	netbsd-2-0-RC2:1.3
	netbsd-2-0-RC1:1.3
	netbsd-2-0:1.3.0.2
	netbsd-2-0-base:1.3
	netbsd-1-6-PATCH002-RELEASE:1.1.1.1.4.1
	netbsd-1-6-PATCH002:1.1.1.1.4.1
	netbsd-1-6-PATCH002-RC4:1.1.1.1.4.1
	netbsd-1-6-PATCH002-RC3:1.1.1.1.4.1
	netbsd-1-6-PATCH002-RC2:1.1.1.1.4.1
	netbsd-1-6-PATCH002-RC1:1.1.1.1.4.1
	netbsd-1-6-PATCH001:1.1
	netbsd-1-6-PATCH001-RELEASE:1.1
	netbsd-1-6-PATCH001-RC3:1.1
	ISC_V3-0-1RC11:1.1.1.3
	netbsd-1-6-PATCH001-RC2:1.1
	netbsd-1-6-PATCH001-RC1:1.1
	fvdl_fs64_base:1.2
	netbsd-1-6-RELEASE:1.1
	netbsd-1-6-RC3:1.1
	netbsd-1-6-RC2:1.1
	netbsd-1-6-RC1:1.1
	ISC_V3-0-1RC9:1.1.1.2
	netbsd-1-6:1.1.1.1.0.4
	netbsd-1-6-base:1.1
	netbsd-1-5-PATCH003:1.1.1.1.2.2
	netbsd-1-5-PATCH002:1.1.1.1.2.2
	netbsd-1-5:1.1.1.1.0.2
	ISC_V3RC10:1.1.1.1
	ISC:1.1.1;
locks; strict;
comment	@# @;


1.5
date	2013.06.20.18.39.14;	author christos;	state dead;
branches;
next	1.4;
commitid	pK1JFBYZBf2ESnUw;

1.4
date	2005.08.11.17.13.21;	author drochner;	state Exp;
branches
	1.4.42.1
	1.4.48.1;
next	1.3;

1.3
date	2003.02.18.17.08.40;	author drochner;	state Exp;
branches;
next	1.2;

1.2
date	2002.06.11.14.00.00;	author drochner;	state Exp;
branches;
next	1.1;

1.1
date	2001.08.03.11.35.31;	author drochner;	state Exp;
branches
	1.1.1.1;
next	;

1.4.42.1
date	2014.05.22.11.26.59;	author yamt;	state dead;
branches;
next	;
commitid	IOnR4fgXMZvMGwBx;

1.4.48.1
date	2013.06.23.06.26.15;	author tls;	state dead;
branches;
next	;
commitid	OnlO1cBgtQRcIHUw;

1.1.1.1
date	2001.08.03.11.35.31;	author drochner;	state Exp;
branches
	1.1.1.1.2.1
	1.1.1.1.4.1;
next	1.1.1.2;

1.1.1.2
date	2002.06.11.12.24.35;	author drochner;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2003.02.18.16.37.55;	author drochner;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2005.08.11.16.54.23;	author drochner;	state Exp;
branches;
next	;

1.1.1.1.2.1
date	2001.08.03.11.35.31;	author tv;	state dead;
branches;
next	1.1.1.1.2.2;

1.1.1.1.2.2
date	2001.08.16.18.46.54;	author tv;	state Exp;
branches;
next	;

1.1.1.1.4.1
date	2003.10.27.04.41.52;	author jmc;	state Exp;
branches;
next	;


desc
@@


1.5
log
@buy ancient code
@
text
@#!/bin/sh
#
# $Id: freebsd,v 1.4 2005/08/11 17:13:21 drochner Exp $
#
# $FreeBSD$

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
      if [ -e /etc/resolv.conf ] ; then
	( rm /etc/resolv.conf )
	exit_status=$?
      else
	( touch /etc/resolv.conf )
	exit_status=$?
      fi
    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_network_number != x ]; then
   $LOGGER New Network Number: $new_network_number
fi

if [ x$new_broadcast_address != x ]; then
 $LOGGER New Broadcast Address: $new_broadcast_address
  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

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
      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
  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.4
log
@merge dhcp-3.0.3
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.13.2.7 2004/09/30 23:22:48 dhankins Exp $
@


1.4.42.1
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.4 2005/08/11 17:13:21 drochner Exp $
@


1.4.48.1
log
@resync from head
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.4 2005/08/11 17:13:21 drochner Exp $
@


1.3
log
@merge dhcp-3.0.1rc11
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.13.2.4 2002/06/09 22:37:55 murray Exp $
d16 2
a17 1
      echo search $new_domain_name >/etc/resolv.conf
d19 14
a32 1
      rm /etc/resolv.conf
a33 3
    for nameserver in $new_domain_name_servers; do
      echo nameserver $nameserver >>/etc/resolv.conf
    done
@


1.2
log
@merge dhcp-3.0.1rc9
@
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.1
log
@Initial revision
@
text
@d3 2
d85 1
a85 1
  current_hostname=`hostname`
d106 1
a106 1
    if [ "$old_static_routes" != "" ]; then
d119 4
a122 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 [ "$new_routers" != "" ]; then
d129 1
a129 1
    if [ "$new_static_routes" != "" ]; then
d159 1
a159 1
    if [ "$old_static_routes" != "" ]; then
d166 1
a166 1
    arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
d183 3
a185 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"
d187 1
a187 1
  if [ "$new_routers" != "" ]; then
d213 1
a213 1
  if [ "$old_static_routes" != "" ]; then
@


1.1.1.1
log
@import of ISC dhcp-3.0rc10
@
text
@@


1.1.1.1.2.1
log
@file freebsd was added on branch netbsd-1-5 on 2001-08-16 18:46:54 +0000
@
text
@d1 223
@


1.1.1.1.2.2
log
@Pullup [drochner]:

dist/dhcp/*					sync at 2001-August-16

  Update dhcp to Version 3, Release Candidate 10.
@
text
@a0 223
#!/bin/sh

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" != 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
}

# 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_network_number != x ]; then
   $LOGGER New Network Number: $new_network_number
fi

if [ x$new_broadcast_address != x ]; then
 $LOGGER New Broadcast Address: $new_broadcast_address
  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

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=`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 [ "$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 [ "$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 [ "$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
      route delete default $router >/dev/null 2>&1
    done
    if [ "$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 -n -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 [ "$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 [ "$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.1.1.1.4.1
log
@Update dhcp to dhcp-3.0.1rc11 (requested by mellon in ticket #1537)
@
text
@a1 4
#
# $Id: freebsd,v 1.1.4.1 2003/10/27 04:41:52 jmc Exp $
#
# $FreeBSD$
d10 2
a11 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
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.2
log
@import of ISC dhcp-3.0.1rc9
@
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.3
log
@import of ISC dhcp-3.0.1rc11
@
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.4
log
@import ISC dhcp-3.0.3 onto the vendor branch
@
text
@d3 1
a3 1
# $Id: freebsd,v 1.13.2.7 2004/09/30 23:22:48 dhankins Exp $
d16 1
a16 2
      ( echo search $new_domain_name >/etc/resolv.conf )
      exit_status=$?
d18 1
a18 14
      if [ -e /etc/resolv.conf ] ; then
	( rm /etc/resolv.conf )
	exit_status=$?
      else
	( touch /etc/resolv.conf )
	exit_status=$?
      fi
    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
@
