head	1.7;
access;
symbols
	netbsd-11-0-RC4:1.7
	netbsd-11-0-RC3:1.7
	dhcpcd-10_3_1:1.1.1.7
	netbsd-11-0-RC2:1.7
	netbsd-11-0-RC1:1.7
	perseant-exfatfs-base-20250801:1.7
	netbsd-11:1.7.0.4
	netbsd-11-base:1.7
	dhcpcd-10_2_3:1.1.1.7
	dhcpcd-10_2_2:1.1.1.7
	dhcpcd-10_2_0a:1.1.1.7
	dhcpcd-10_2_0:1.1.1.7
	netbsd-10-1-RELEASE:1.5
	perseant-exfatfs-base-20240630:1.7
	perseant-exfatfs:1.7.0.2
	perseant-exfatfs-base:1.7
	dhcpcd-10_0_8:1.1.1.7
	dhcpcd-10_0_7:1.1.1.7
	netbsd-8-3-RELEASE:1.1.1.1.8.2
	netbsd-9-4-RELEASE:1.3
	netbsd-10-0-RELEASE:1.5
	netbsd-10-0-RC6:1.5
	netbsd-10-0-RC5:1.5
	netbsd-10-0-RC4:1.5
	netbsd-10-0-RC3:1.5
	netbsd-10-0-RC2:1.5
	dhcpcd-10_0_6a:1.1.1.6
	dhcpcd-10_0_6:1.1.1.6
	netbsd-10-0-RC1:1.5
	dhcpcd-10_0_4:1.1.1.6
	dhcpcd-10_0_3:1.1.1.6
	dhcpcd-10_0_2:1.1.1.6
	dhcpcd-10_0_1:1.1.1.6
	netbsd-10:1.5.0.2
	netbsd-10-base:1.5
	netbsd-9-3-RELEASE:1.3
	dhcpcd-9_4_1:1.1.1.5
	cjep_sun2x:1.4.0.4
	cjep_sun2x-base:1.4
	cjep_staticlib_x-base1:1.4
	netbsd-9-2-RELEASE:1.3
	cjep_staticlib_x:1.4.0.2
	cjep_staticlib_x-base:1.4
	netbsd-9-1-RELEASE:1.3
	phil-wifi-20200421:1.4
	phil-wifi-20200411:1.4
	is-mlppp:1.3.0.4
	is-mlppp-base:1.3
	phil-wifi-20200406:1.4
	netbsd-8-2-RELEASE:1.1.1.1.8.2
	netbsd-9-0-RELEASE:1.3
	netbsd-9-0-RC2:1.3
	dhcpcd-8_1_6:1.1.1.4
	dhcpcd-8_1_5:1.1.1.4
	dhcpcd-8_1_4:1.1.1.4
	dhcpcd-8_1_3:1.1.1.4
	netbsd-9-0-RC1:1.3
	phil-wifi-20191119:1.3
	dhcpcd-8_1_2:1.1.1.4
	dhcpcd-8_1_1:1.1.1.4
	dhcpcd-8_1_0:1.1.1.4
	ROY:1.1.1
	dhcpcd-8-0-6:1.1.1.4
	dhcpcd-8-0-5:1.1.1.4
	dhcpcd-8-0-4:1.1.1.4
	dhcpcd-8-0-3:1.1.1.4
	netbsd-9:1.3.0.2
	netbsd-9-base:1.3
	dhcpcd-8-0-2:1.1.1.4
	dhcpcd-8-0-1:1.1.1.4
	dhcpcd-8-0-0:1.1.1.4
	dhcpcd-7-2-3a:1.1.1.4
	phil-wifi-20190609:1.2
	netbsd-8-1-RELEASE:1.1.1.1.8.2
	netbsd-8-1-RC1:1.1.1.1.8.2
	dhcpcd-7-2-2:1.1.1.3
	dhcpcd-7-2-1:1.1.1.3
	dhcpcd-7-2-0:1.1.1.3
	dhcpcd-7-1-1:1.1.1.3
	pgoyette-compat-merge-20190127:1.1.1.2.2.1
	pgoyette-compat-20190127:1.2
	dhcpcd-7-1-0:1.1.1.3
	pgoyette-compat-20190118:1.2
	pgoyette-compat-1226:1.2
	pgoyette-compat-1126:1.2
	pgoyette-compat-1020:1.2
	pgoyette-compat-0930:1.2
	pgoyette-compat-0906:1.1.1.2
	netbsd-7-2-RELEASE:1.1.1.2.6.2
	dhcpcd-7-0-8:1.1.1.2
	pgoyette-compat-0728:1.1.1.2
	netbsd-7:1.1.1.2.0.6
	dhcpcd-7-0-7:1.1.1.2
	netbsd-8-0-RELEASE:1.1.1.1.8.1
	phil-wifi:1.1.1.2.0.4
	phil-wifi-base:1.1.1.2
	pgoyette-compat-0625:1.1.1.2
	netbsd-8-0-RC2:1.1.1.1.8.1
	dhcpcd-7-0-6:1.1.1.2
	dhcpcd-7-0-5b:1.1.1.2
	dhcpcd-7-0-5a:1.1.1.2
	dhcpcd-7-0-5:1.1.1.2
	pgoyette-compat-0521:1.1.1.2
	dhcpcd-7-0-4:1.1.1.2
	pgoyette-compat-0502:1.1.1.2
	pgoyette-compat-0422:1.1.1.2
	netbsd-8-0-RC1:1.1.1.1.8.1
	pgoyette-compat-0415:1.1.1.2
	pgoyette-compat-0407:1.1.1.2
	dhcpcd-7-0-3:1.1.1.2
	pgoyette-compat-0330:1.1.1.2
	dhcpcd-7-0-2:1.1.1.2
	pgoyette-compat-0322:1.1.1.2
	pgoyette-compat-0315:1.1.1.2
	pgoyette-compat:1.1.1.2.0.2
	pgoyette-compat-base:1.1.1.2
	dhcpcd-7-0-1:1.1.1.2
	dhcpcd-7-0-0:1.1.1.1
	dhcpcd-7-0-0-rc4:1.1.1.1
	matt-nb8-mediatek:1.1.1.1.0.12
	matt-nb8-mediatek-base:1.1.1.1
	dhcpcd-7-0-0-rc3:1.1.1.1
	dhcpcd-7-0-0-rc2:1.1.1.1
	perseant-stdc-iso10646:1.1.1.1.0.10
	perseant-stdc-iso10646-base:1.1.1.1
	netbsd-8:1.1.1.1.0.8
	netbsd-8-base:1.1.1.1
	prg-localcount2-base3:1.1.1.1
	prg-localcount2-base2:1.1.1.1
	dhcpcd-7-0-0-rc1:1.1.1.1
	prg-localcount2-base1:1.1.1.1
	prg-localcount2:1.1.1.1.0.6
	prg-localcount2-base:1.1.1.1
	pgoyette-localcount:1.1.1.1.0.4
	pgoyette-localcount-20170426:1.1.1.1
	bouyer-socketcan:1.1.1.1.0.2
	bouyer-socketcan-base1:1.1.1.1
	dhcpcd-7-0-0-beta3:1.1.1.1
	dhcpcd-7-0-0-beta2:1.1.1.1
	dhcpcd-7-0-0-beta1:1.1.1.1
	roy:1.1.1;
locks; strict;
comment	@# @;


1.7
date	2024.05.24.11.30.29;	author roy;	state Exp;
branches;
next	1.6;
commitid	pUkKwn8PLzlRdfbF;

1.6
date	2023.04.21.16.54.26;	author roy;	state Exp;
branches;
next	1.5;
commitid	RSjPPlaT2zc9QZlE;

1.5
date	2021.10.22.13.23.20;	author roy;	state Exp;
branches;
next	1.4;
commitid	D8cnLmHb76ZVdOdD;

1.4
date	2020.04.02.12.41.47;	author roy;	state dead;
branches;
next	1.3;
commitid	f8Wc4BN4taQtfO2C;

1.3
date	2019.06.26.17.47.47;	author roy;	state Exp;
branches;
next	1.2;
commitid	LD0AA0nHNWtDYIsB;

1.2
date	2018.09.22.13.17.46;	author kre;	state Exp;
branches;
next	1.1;
commitid	DO5SBbZluRbhn6TA;

1.1
date	2017.03.31.20.51.16;	author roy;	state Exp;
branches
	1.1.1.1;
next	;
commitid	2iSri9mccyHffKLz;

1.1.1.1
date	2017.03.31.20.51.16;	author roy;	state Exp;
branches
	1.1.1.1.2.1
	1.1.1.1.4.1
	1.1.1.1.8.1;
next	1.1.1.2;
commitid	2iSri9mccyHffKLz;

1.1.1.2
date	2018.01.29.11.11.23;	author roy;	state Exp;
branches
	1.1.1.2.2.1
	1.1.1.2.4.1
	1.1.1.2.6.1;
next	1.1.1.3;
commitid	ANwLArYxQ3OXfLoA;

1.1.1.3
date	2019.01.22.15.16.25;	author roy;	state Exp;
branches;
next	1.1.1.4;
commitid	ObRHdPr38Oth7N8B;

1.1.1.4
date	2019.06.26.17.46.09;	author roy;	state Exp;
branches;
next	1.1.1.5;
commitid	dFJvHdulqVrVXIsB;

1.1.1.5
date	2021.10.22.13.21.59;	author roy;	state Exp;
branches;
next	1.1.1.6;
commitid	eOPIn2Vu4Z0idOdD;

1.1.1.6
date	2023.04.21.16.52.46;	author roy;	state Exp;
branches;
next	1.1.1.7;
commitid	SzhZ9f5ppzfOOZlE;

1.1.1.7
date	2024.05.24.11.28.29;	author roy;	state Exp;
branches;
next	;
commitid	9ULNNMdpI0oScfbF;

1.1.1.1.2.1
date	2017.03.31.20.51.16;	author roy;	state dead;
branches;
next	1.1.1.1.2.2;

1.1.1.1.2.2
date	2017.03.31.20.51.17;	author roy;	state Exp;
branches;
next	;

1.1.1.1.4.1
date	2017.03.31.20.51.16;	author pgoyette;	state dead;
branches;
next	1.1.1.1.4.2;
commitid	ojV02aOSdzvBqZOz;

1.1.1.1.4.2
date	2017.04.26.02.52.23;	author pgoyette;	state Exp;
branches;
next	;
commitid	ojV02aOSdzvBqZOz;

1.1.1.1.8.1
date	2018.04.09.16.46.34;	author martin;	state Exp;
branches;
next	1.1.1.1.8.2;
commitid	EzvHIuotKE2mSMxA;

1.1.1.1.8.2
date	2019.04.26.19.18.22;	author martin;	state Exp;
branches;
next	;
commitid	ApYO1Wt23frIqTkB;

1.1.1.2.2.1
date	2018.09.30.01.45.11;	author pgoyette;	state Exp;
branches;
next	;
commitid	SQ44grEPCeKPh4UA;

1.1.1.2.4.1
date	2019.06.10.21.44.43;	author christos;	state Exp;
branches;
next	1.1.1.2.4.2;
commitid	jtc8rnCzWiEEHGqB;

1.1.1.2.4.2
date	2020.04.08.14.04.03;	author martin;	state dead;
branches;
next	;
commitid	Qli2aW9E74UFuA3C;

1.1.1.2.6.1
date	2018.01.29.11.11.23;	author martin;	state dead;
branches;
next	1.1.1.2.6.2;
commitid	HmTKhyRj9OTCmLLA;

1.1.1.2.6.2
date	2018.07.27.10.43.20;	author martin;	state Exp;
branches;
next	;
commitid	HmTKhyRj9OTCmLLA;


desc
@@


1.7
log
@Sync with dhcpcd-10.0.7
@
text
@# Set the hostname from DHCP data if required

# A hostname can either be a short hostname or a FQDN.
# hostname_fqdn=true
# hostname_fqdn=false
# hostname_fqdn=server

# A value of server means just what the server says, don't manipulate it.
# This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
# where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
# DHCPv6 has no hostname option.
# RFC4702 section 3.1 says FQDN should be prefered over hostname.
#
# As such, the default is hostname_fqdn=true so that a consistent hostname
# is always assigned.
: ${hostname_fqdn:=true}

# If we used to set the hostname, but relinquish control of it, we should
# reset to the default value.
: ${hostname_default=}

# Some systems don't have hostname(1)
_hostname()
{
	if [ -z "${1+x}" ]; then
		if [ -r /proc/sys/kernel/hostname ]; then
			read name </proc/sys/kernel/hostname && echo "$name"
		elif command -v hostname >/dev/null 2>/dev/null; then
			hostname
		elif sysctl kern.hostname >/dev/null 2>&1; then
			sysctl -n kern.hostname
		elif sysctl kernel.hostname >/dev/null 2>&1; then
			sysctl -n kernel.hostname
		else
			return 1
		fi
		return $?
	fi

	if [ -w /proc/sys/kernel/hostname ]; then
		echo "$1" >/proc/sys/kernel/hostname
	elif [ -n "$1" ] && command -v hostname >/dev/null 2>&1; then
		hostname "$1"
	elif sysctl kern.hostname >/dev/null 2>&1; then
		sysctl -w "kern.hostname=$1" >/dev/null
	elif sysctl kernel.hostname >/dev/null 2>&1; then
		sysctl -w "kernel.hostname=$1" >/dev/null
	else
		# May fail to set a blank hostname
		hostname "$1"
	fi
}

is_default_hostname()
{
	case "$1" in
	""|"$hostname_default"|localhost|localhost.localdomain)
		return 0;;
	esac
	return 1
}

need_hostname()
{
	# Always load the hostname variable for future use
	hostname="$(_hostname)"
	is_default_hostname "$hostname" && return 0

	case "$force_hostname" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) return 0;;
	esac

	if [ -n "$old_fqdn" ]; then
		if ${hfqdn} || ! ${hshort}; then
			[ "$hostname" = "$old_fqdn" ]
		else
			[ "$hostname" = "${old_fqdn%%.*}" ]
		fi
	elif [ -n "$old_host_name" ]; then
		if ${hfqdn}; then
			if [ -n "$old_domain_name" ] &&
			   [ "$old_host_name" = "${old_host_name#*.}" ]
			then
				[ "$hostname" = \
				    "$old_host_name.$old_domain_name" ]
			else
				[ "$hostname" = "$old_host_name" ]
			fi
		elif ${hshort}; then
			[ "$hostname" = "${old_host_name%%.*}" ]
		else
			[ "$hostname" = "$old_host_name" ]
		fi
	else
		# No old hostname
		false
	fi
}

try_hostname()
{
	[ "$hostname" = "$1" ] && return 0
	if valid_domainname "$1"; then
		syslog info "Setting hostname: $1"
		_hostname "$1"
	else
		syslog err "Invalid hostname: $1"
	fi
}

set_hostname()
{
	hfqdn=false
	hshort=false
	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac

	need_hostname || return 0

	if [ -n "$new_fqdn" ]; then
		if ${hfqdn} || ! ${hshort}; then
			try_hostname "$new_fqdn"
		else
			try_hostname "${new_fqdn%%.*}"
		fi
	elif [ -n "$new_host_name" ]; then
		if ${hfqdn}; then
			if [ -n "$new_domain_name" ] &&
			   [ "$new_host_name" = "${new_host_name#*.}" ]
			then
				try_hostname "$new_host_name.$new_domain_name"
			else
				try_hostname "$new_host_name"
			fi
		elif ${hshort}; then
			try_hostname "${new_host_name%%.*}"
		else
			try_hostname "$new_host_name"
		fi
	elif ! is_default_hostname "$hostname"; then
		try_hostname "$hostname_default"
	fi
}

# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_fqdn="$new_dhcp6_fqdn"
	old_fqdn="$old_dhcp6_fqdn"
	;;
esac

if $if_configured && $if_up && [ "$reason" != ROUTERADVERT ]; then
	set_hostname
fi
@


1.6
log
@Merge changes
@
text
@d121 1
a121 1
	need_hostname || return
@


1.5
log
@Sync update
@
text
@d28 1
a28 1
		elif type hostname >/dev/null 2>/dev/null; then
d42 1
a42 1
	elif [ -n "$1" ] && type hostname >/dev/null 2>&1; then
@


1.4
log
@Sync
@
text
@d20 1
a20 1
: ${hostname_default=localhost}
d26 3
a28 1
		if type hostname >/dev/null 2>&1; then
a29 2
		elif [ -r /proc/sys/kernel/hostname ]; then
			read name </proc/sys/kernel/hostname && echo "$name"
d40 3
a42 2
	# Always prefer hostname(1) if we have it
	if type hostname >/dev/null 2>&1; then
a43 2
	elif [ -w /proc/sys/kernel/hostname ]; then
		echo "$1" >/proc/sys/kernel/hostname
d45 1
a45 1
		sysctl -w "kern.hostname=$1"
d47 1
a47 1
		sysctl -w "kernel.hostname=$1"
d49 1
a49 2
		# We know this will fail, but it will now fail
		# with an error to stdout
d54 1
a54 1
set_hostname_vars()
d56 3
a58 6
	hfqdn=false
	hshort=false
	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
d60 1
d67 1
a67 4
	case "$hostname" in
	""|"(none)"|localhost|localhost.localdomain|"$hostname_default")
		return 0;;
	esac
a72 2
	set_hostname_vars

d113 8
a122 2
	set_hostname_vars

d143 1
a143 1
	elif [ -n "${hostname_default+x}" ]; then
d156 1
a156 1
if $if_up; then
@


1.3
log
@Sync
@
text
@@


1.2
log
@
PR install/53622  (probably)

When used as part of a network based install kernel, the SMALL "test" (aka [)
does not support -a or -o, so rewrite these scripts to avoid using that.
@
text
@d83 1
a83 1
		if ${hfqdn} || ! ${hsort}; then
@


1.1
log
@Initial revision
@
text
@a24 2
	local name=

d56 11
a68 2
	local hfqdn=false hshort=false

d80 1
a80 5
	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac
d90 2
a91 2
			if [ -n "$old_domain_name" -a \
			    "$old_host_name" = "${old_host_name#*.}" ]
a110 1

a121 2
	local hfqdn=false hshort=false

d124 1
a124 5
	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac
d134 2
a135 2
			if [ -n "$new_domain_name" -a \
			    "$new_host_name" = "${new_host_name#*.}" ]
@


1.1.1.1
log
@Import dhcpcd-7.0.0-beta. Changes from prior version include:

  *  source file locations reworked:
       dhcpcd source is in src
       dhcpcd hooks are in hooks
       compat is in compat
  *  README split into README.md and BUILDING.md
  *  internal routing is now protocol agnostic
  *  avoid using __packed and use compile time asserts instead
  *  addresses some alignment issues
  *  disable some ARP code on kernels which support RFC5227
  *  BSD IPv6 kernel settings are now updated to reflect dhcpcd config
  *  custom logger has been removed, syslog handles everything
     as such, the --logfile option has been removed as well.
     If you need better/earlier logging, get a better syslogger!
  *  distinfo and signed distinfo files are now available alongside
     release taraballs from this point onwards
  *  default DBDIR has changed from /var/db to /var/db/dhcpcd
  *  /etc/dhcpcd.duid moves to DBDIR/duid
  *  /etc/dhcpcd.secret moves to DBDIR/secret
  *  lease file names have dhcpcd removed from them as they are now
     inside a directory of the same name
  *  fixed issues with reject routes not working on some platforms
  *  improved nl80211 support on Linux for working out the SSID
  *  no longer request NTP by default in dhcpcd.conf
  *  BPF filtering vastly improved so dhcpcd only wake up on
     ARP or DHCP packets destined for it
  *  support for MUD URL (draft-ietf-opsawg-mud-05)
  *  if the kernel isn't doing DAD, don't insist on waiting for it
     to actually do it
  *  fix a potential crash where the DHCP or ARP states could be
     freed before the packet processing loop naturally breaks
  *  removed gateway and nogateway options
     (these can be controlled by the nooption directive which
     works for more than just gateways)
  *  removed ipv6ra_own and ipv6ra_own_default options
     (these can be controled by the ipv6rs/noipv6rs directive)
  *  fix a crash receiving SIGUSR1
@
text
@@


1.1.1.1.8.1
log
@Catch up to current in external/bsd/dhcpcd/, requested by roy in ticket #707:

external/bsd/dhcpcd/dist/configure              up to 1.1.1.7
external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant up to 1.1.1.2
external/bsd/dhcpcd/dist/hooks/15-timezone      up to 1.1.1.2
external/bsd/dhcpcd/dist/hooks/20-resolv.conf   up to 1.1.1.2
external/bsd/dhcpcd/dist/hooks/29-lookup-hostname up to 1.1.1.2
external/bsd/dhcpcd/dist/hooks/30-hostname      up to 1.1.1.2
external/bsd/dhcpcd/dist/hooks/50-ntp.conf      up to 1.1.1.2
external/bsd/dhcpcd/dist/hooks/50-yp.conf       up to 1.1.1.2
external/bsd/dhcpcd/dist/hooks/50-ypbind.in     up to 1.1.1.2
external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in up to 1.1.1.4
external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in up to 1.1.1.4
external/bsd/dhcpcd/dist/src/arp.c              up to 1.1.1.6
external/bsd/dhcpcd/dist/src/common.h           up to 1.1.1.4
external/bsd/dhcpcd/dist/src/defs.h             up to 1.1.1.11
external/bsd/dhcpcd/dist/src/dhcp.c             up to 1.9
external/bsd/dhcpcd/dist/src/dhcp.h             up to 1.1.1.5
external/bsd/dhcpcd/dist/src/dhcp6.c            up to 1.1.1.10
external/bsd/dhcpcd/dist/src/dhcp6.h            up to 1.1.1.4
external/bsd/dhcpcd/dist/src/dhcpcd.8.in        up to 1.1.1.8
external/bsd/dhcpcd/dist/src/dhcpcd.c           up to 1.10
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.7
external/bsd/dhcpcd/dist/src/dhcpcd.h           up to 1.1.1.5
external/bsd/dhcpcd/dist/src/if-bsd.c           up to 1.1.1.7
external/bsd/dhcpcd/dist/src/if-linux.c         up to 1.1.1.8
external/bsd/dhcpcd/dist/src/if-options.c       up to 1.8
external/bsd/dhcpcd/dist/src/if-options.h       up to 1.1.1.7
external/bsd/dhcpcd/dist/src/if-sun.c           up to 1.1.1.4
external/bsd/dhcpcd/dist/src/if.c               up to 1.1.1.8
external/bsd/dhcpcd/dist/src/if.h               up to 1.1.1.5
external/bsd/dhcpcd/dist/src/ipv4.c             up to 1.1.1.9
external/bsd/dhcpcd/dist/src/ipv4.h             up to 1.1.1.4
external/bsd/dhcpcd/dist/src/ipv6.c             up to 1.1.1.8
external/bsd/dhcpcd/dist/src/ipv6.h             up to 1.1.1.6
external/bsd/dhcpcd/dist/src/ipv6nd.c           up to 1.1.1.7
external/bsd/dhcpcd/dist/src/ipv6nd.h           up to 1.1.1.5
external/bsd/dhcpcd/dist/src/logerr.h           up to 1.1.1.3
external/bsd/dhcpcd/dist/src/route.c            up to 1.1.1.6
external/bsd/dhcpcd/dist/src/route.h            up to 1.1.1.4
external/bsd/dhcpcd/dist/src/dev/udev.c         up to 1.1.1.2
external/bsd/dhcpcd/dist/tests/eloop-bench/eloop-bench.c up to 1.1.1.3
external/bsd/dhcpcd/include/config.h            up to 1.3
external/bsd/dhcpcd/sbin/dhcpcd/Makefile        up to 1.43

Import dhcpcd-7.0.1 with the following changes:

  *  hooks: remove use of local builtin for better portability
  *  dhcpcd: don't log errors working out carrier for departed interfaces
  *  ipv4: allow configuration of static broadcast address
  *  if: don't set MTU during interface discovery
  *  if: don't activate non matching interfaces to commandline ones
  *  eloop-bench: fix hangs when using a large number of cycles
  *  dhcp: don't bind when we've just probed an address to inform

Import dhcpcd-7.0.2 with the following changes:

  *  Added support for setproctitle(3)
  *  Kernel RA is no longer disabled when IPv6 is disabled in dhcpcd
  *  DHCPv6 PD is no longer stopped if no Routers are found
  *  If the DHCP leased address is deleted, enter the reboot state
  *  DHCPv6 unicast is no longer performed when not in master mode
  *  dhcpcd will now detect netlink/route socket overflows ad re-sync

Import dhcpcd-7.0.3 with the following changes:

  *  dhcp6: fix a null termination overflow on status messages
  *  options: static routes can be setup in global context again
  *  routes: dhcpcd added host routes are now reported correctly
@
text
@d25 2
d58 1
a58 1
set_hostname_vars()
d60 1
a60 8
	hfqdn=false
	hshort=false
	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac
}
a61 2
need_hostname()
{
d73 5
a77 1
	set_hostname_vars
d108 1
d120 2
d124 5
a128 1
	set_hostname_vars
@


1.1.1.1.8.2
log
@Sync to head, requested by roy in ticket #1250:

	external/bsd/dhcpcd/dist/compat/consttime_memequal.h up to 1.1.1.1
	external/bsd/dhcpcd/dist/.arcconfig             delete
	external/bsd/dhcpcd/dist/BUILDING.md            up to 1.1.1.3
	external/bsd/dhcpcd/dist/LICENSE                up to 1.1.1.3
	external/bsd/dhcpcd/dist/Makefile               up to 1.1.1.6
	external/bsd/dhcpcd/dist/configure              up to 1.1.1.11
	external/bsd/dhcpcd/dist/iconfig.mk             up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/20-resolv.conf   up to 1.2
	external/bsd/dhcpcd/dist/hooks/29-lookup-hostname up to 1.2
	external/bsd/dhcpcd/dist/hooks/30-hostname      up to 1.2
	external/bsd/dhcpcd/dist/hooks/50-ntp.conf      up to 1.2
	external/bsd/dhcpcd/dist/hooks/50-yp.conf       up to 1.2
	external/bsd/dhcpcd/dist/hooks/50-ypbind.in     up to 1.2
	external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in up to 1.3
	external/bsd/dhcpcd/dist/src/Makefile           up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/arp.c              up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/arp.h              up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/auth.c             up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/auth.h             up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/bpf.c              up to 1.8
	external/bsd/dhcpcd/dist/src/bpf.h              up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/common.c           up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/common.h           up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/control.c          up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/control.h          up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/defs.h             up to 1.1.1.20
	external/bsd/dhcpcd/dist/src/dev.c              up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/dev.h              up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/dhcp-common.c      up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/dhcp-common.h      up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/dhcp.c             up to 1.18
	external/bsd/dhcpcd/dist/src/dhcp.h             up to 1.1.1.9
	external/bsd/dhcpcd/dist/src/dhcp6.c            up to 1.6
	external/bsd/dhcpcd/dist/src/dhcp6.h            up to 1.1.1.9
	external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/dhcpcd.8.in        up to 1.1.1.12
	external/bsd/dhcpcd/dist/src/dhcpcd.c           up to 1.18
	external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.12
	external/bsd/dhcpcd/dist/src/dhcpcd.h           up to 1.1.1.9
	external/bsd/dhcpcd/dist/src/duid.c             up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/eloop.c            up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/eloop.h            up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/if-bsd.c           up to 1.6
	external/bsd/dhcpcd/dist/src/if-linux-wext.c    up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/if-linux.c         up to 1.1.1.12
	external/bsd/dhcpcd/dist/src/if-options.c       up to 1.13
	external/bsd/dhcpcd/dist/src/if-options.h       up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/if-sun.c           up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/if.c               up to 1.1.1.12
	external/bsd/dhcpcd/dist/src/if.h               up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/ipv4.c             up to 1.1.1.13
	external/bsd/dhcpcd/dist/src/ipv4.h             up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/ipv4ll.c           up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/ipv4ll.h           up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/ipv6.c             up to 1.1.1.16
	external/bsd/dhcpcd/dist/src/ipv6.h             up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/ipv6nd.c           up to 1.6
	external/bsd/dhcpcd/dist/src/ipv6nd.h           up to 1.1.1.9
	external/bsd/dhcpcd/dist/src/logerr.c           up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/logerr.h           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/route.c            up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/route.h            up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/sa.c               up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/sa.h               up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/script.c           up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/script.h           up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/dev/udev.c         up to 1.1.1.3
	external/bsd/dhcpcd/dist/tests/Makefile         up to 1.1.1.2
	external/bsd/dhcpcd/sbin/dhcpcd/Makefile        up to 1.45

Import dhcpcd-7.2.1 with the following changes:
*  auth: Use consttime_memequal to avoid latency attack
*  DHCP: Fix a potential 1 byte read overflow with DHO_OPTSOVERLOADED
*  DHCPv6: Fix a potential buffer overflow reading NA/TA addresses
@
text
@d90 2
a91 2
			if [ -n "$old_domain_name" ] &&
			   [ "$old_host_name" = "${old_host_name#*.}" ]
d134 2
a135 2
			if [ -n "$new_domain_name" ] &&
			   [ "$new_host_name" = "${new_host_name#*.}" ]
@


1.1.1.2
log
@Import dhcpcd-7.0.1 with the following changes:
*  hooks: remove use of local builtin for better portability
*  dhcpcd: don't log errors working out carrier for departed interfaces
*  ipv4: allow configuration of static broadcast address
*  if: don't set MTU during interface discovery
*  if: don't activate non matching interfaces to commandline ones
*  eloop-bench: fix hangs when using a large number of cycles
*  dhcp: don't bind when we've just probed an address to inform
@
text
@d25 2
d58 1
a58 1
set_hostname_vars()
d60 1
a60 8
	hfqdn=false
	hshort=false
	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac
}
a61 2
need_hostname()
{
d73 5
a77 1
	set_hostname_vars
d108 1
d120 2
d124 5
a128 1
	set_hostname_vars
@


1.1.1.2.4.1
log
@Sync with HEAD
@
text
@d90 2
a91 2
			if [ -n "$old_domain_name" ] &&
			   [ "$old_host_name" = "${old_host_name#*.}" ]
d134 2
a135 2
			if [ -n "$new_domain_name" ] &&
			   [ "$new_host_name" = "${new_host_name#*.}" ]
@


1.1.1.2.4.2
log
@Merge changes from current as of 20200406
@
text
@@


1.1.1.3
log
@Import dhcpcd-7.1.0 with the following changes:

* NetBSD: sets SO_RERROR on to detect receive socket overflow
* BSD: route improvements to avoid listening for own changes
* IP6: implement IP6 address sharing
* BSD: catch UP/DOWN events when interfaces does support media changes
* IPv4LL: remember old address when carrier is lost
@
text
@d90 2
a91 2
			if [ -n "$old_domain_name" ] &&
			   [ "$old_host_name" = "${old_host_name#*.}" ]
d134 2
a135 2
			if [ -n "$new_domain_name" ] &&
			   [ "$new_host_name" = "${new_host_name#*.}" ]
@


1.1.1.4
log
@Import dhcpcd-7.2.3 with the following changes:
  *  BSD: Check RTM lengths incase of kernel issues
  *  DHCP6: Don't stop even when last router goes away
  *  DHCP6: Fix inform from RA
  *  hostname: Fix short hostname check
@
text
@d83 1
a83 1
		if ${hfqdn} || ! ${hshort}; then
@


1.1.1.5
log
@Update to dhcpcd-9.4.1 with the following changes:

 * BSD: Find the correct interface for tunnelled routes
 * OpenBSD: Fix uniqueness of routes for matching priorities
 * Linux: Support more platforms for seccomp (thanks to Fabrice Fontaine)
 * eloop: Process all waiting fd's as they come in
 * control: Unlink sockets when not in privsep
 * privsep: Renamed Master to Manager
 * privsep: Renamed Privilged Actioneer to Privileged Proxy
 * privsep: Fix getting interface VLANID on BSD
 * privsep: Enforce proper alignment of serialized struct cmsghdr
 * IPv4LL: Don't remove statically assigned addresses
 * routes: Fix route comparision for network prefixes with different masks
 * DHCP6: Only send FQDN for SOLICIT, REQUEST, RENEW, or REBIND messages
 * DHCP6: Don't spam the log when a RA repeatedly triggers an INFORM
 * DHCP: Fix infinite INFORM messages
@
text
@d20 1
a20 1
: ${hostname_default=}
d26 3
a28 1
		if [ -r /proc/sys/kernel/hostname ]; then
a29 2
		elif type hostname >/dev/null 2>/dev/null; then
			hostname
d40 4
a43 1
	if [ -w /proc/sys/kernel/hostname ]; then
a44 2
	elif [ -n "$1" ] && type hostname >/dev/null 2>&1; then
		hostname "$1"
d46 1
a46 1
		sysctl -w "kern.hostname=$1" >/dev/null
d48 1
a48 1
		sysctl -w "kernel.hostname=$1" >/dev/null
d50 2
a51 1
		# May fail to set a blank hostname
d56 1
a56 1
is_default_hostname()
d58 6
a63 3
	case "$1" in
	""|"$hostname_default"|localhost|localhost.localdomain)
		return 0;;
a64 1
	return 1
d71 4
a74 1
	is_default_hostname "$hostname" && return 0
d80 2
d122 1
a122 7
	hfqdn=false
	hshort=false
	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac
d124 1
a124 1
	need_hostname || return
d146 1
a146 1
	elif ! is_default_hostname "$hostname"; then
d159 1
a159 1
if $if_configured && $if_up && [ "$reason" != ROUTERADVERT ]; then
@


1.1.1.6
log
@Update to dhcpcd-10.0.1 with the following changes:

 * privsep: keep resources open rather than open/close
 * dhcp6: OPTION_NTP_SERVER is now preferred over OPTION_SNTP_SERVER
 * Misc bug fixes mainly around privsep for many platforms.
 * Fix for reading the some BSD routing table entries.
 * Fix reading authtokens from config.

Big new release, mainly around better privsep process management
which allows us to detect when they exit unexpectedly.
@
text
@d28 1
a28 1
		elif command -v hostname >/dev/null 2>/dev/null; then
d42 1
a42 1
	elif [ -n "$1" ] && command -v hostname >/dev/null 2>&1; then
@


1.1.1.7
log
@Update to dhcpcd-10.0.7 with the following changes:

* DHCP: use request_time, fallback_time and ipv4ll_time rather than reboot timeout
* DHCP6: Wait for IRT to elapse before requesting advertisments
* DHCPv6: Don't re-INFORM if the RA changes
* privsep: Reduce fd use
* dhcpcd: Add support for arp persist defence
* Move dhcp(v4) packet size check earlier
* Define the Azure Endpoint and other site-specific options
* add RFC4191 support by @@goertzenator in #297
* dhcpcd: Respect IPV6_PREFERRED_ONLY flag regardless of state
* Fix time_offset to be int to match RFC-2132
* hooks/30-hostname: Exit with 0 if setting hostname is not needed
@
text
@d121 1
a121 1
	need_hostname || return 0
@


1.1.1.2.2.1
log
@Ssync with HEAD
@
text
@d90 2
a91 2
			if [ -n "$old_domain_name" ] &&
			   [ "$old_host_name" = "${old_host_name#*.}" ]
d134 2
a135 2
			if [ -n "$new_domain_name" ] &&
			   [ "$new_host_name" = "${new_host_name#*.}" ]
@


1.1.1.2.6.1
log
@file 30-hostname was added on branch netbsd-7 on 2018-07-27 10:43:20 +0000
@
text
@d1 161
@


1.1.1.2.6.2
log
@Pull up following revision(s) (requested by roy in ticket #1621):

	external/bsd/dhcpcd/dist/compat/crypt/sha256.c  up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/crypt/md5.c     up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/crypt/md5.h     up to 1.1.1.2
	external/bsd/dhcpcd/dist/compat/crypt/sha256.h  up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/crypt/hmac.c    up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/crypt/hmac.h    up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/_strtoi.h       up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/arc4random.c    up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/arc4random.h    up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/arc4random_uniform.c up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/arc4random_uniform.h up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/bitops.h        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/dprintf.c       up to 1.1.1.2
	external/bsd/dhcpcd/dist/compat/dprintf.h       up to 1.1.1.2
	external/bsd/dhcpcd/dist/compat/endian.h        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/pidfile.c       up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/pidfile.h       up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/queue.h         up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/reallocarray.c  up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/reallocarray.h  up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strtoi.c        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strtoi.h        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strtou.c        up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strlcpy.c       up to 1.1.1.1
	external/bsd/dhcpcd/dist/compat/strlcpy.h       up to 1.1.1.1
	external/bsd/dhcpcd/dist/config-null.mk         up to 1.1.1.1
	external/bsd/dhcpcd/dist/configure              up to 1.1.1.8
	external/bsd/dhcpcd/dist/iconfig.mk             up to 1.1.1.1
	external/bsd/dhcpcd/dist/hooks/01-test          up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/02-dump          up to 1.1.1.1
	external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/15-timezone      up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/20-resolv.conf   up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/29-lookup-hostname up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/30-hostname      up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/50-dhcpcd-compat up to 1.1.1.1
	external/bsd/dhcpcd/dist/hooks/50-ntp.conf      up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/50-yp.conf       up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/50-ypbind.in     up to 1.1.1.2
	external/bsd/dhcpcd/dist/hooks/Makefile         up to 1.1.1.1
	external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in up to 1.1.1.4
	external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/GNUmakefile        up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/Makefile           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/arp.c              up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/arp.h              up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/auth.c             up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/auth.h             up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/bpf.c              up to 1.7
	external/bsd/dhcpcd/dist/src/bpf.h              up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/common.c           up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/common.h           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/control.c          up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/control.h          up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/defs.h             up to 1.1.1.15
	external/bsd/dhcpcd/dist/src/dev.c              up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/dev.h              up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcp-common.c      up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/dhcp-common.h      up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcp.c             up to 1.11
	external/bsd/dhcpcd/dist/src/dhcp.h             up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/dhcp6.c            up to 1.1.1.12
	external/bsd/dhcpcd/dist/src/dhcp6.h            up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/dhcpcd-definitions-small.conf up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd-definitions.conf up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd.8.in        up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/dhcpcd.c           up to 1.13
	external/bsd/dhcpcd/dist/src/dhcpcd.conf        up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in   up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/dhcpcd.h           up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/duid.c             up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/duid.h             up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/eloop.c            up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/eloop.h            up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/genembedc          up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/genembedh          up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/if-bsd.c           up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/if-linux-wext.c    up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/if-linux.c         up to 1.1.1.10
	external/bsd/dhcpcd/dist/src/if-options.c       up to 1.10
	external/bsd/dhcpcd/dist/src/if-options.h       up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/if-sun.c           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/if.c               up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/if.h               up to 1.1.1.5
	external/bsd/dhcpcd/dist/src/ipv4.c             up to 1.1.1.9
	external/bsd/dhcpcd/dist/src/ipv4.h             up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/ipv4ll.c           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/ipv4ll.h           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/ipv6.c             up to 1.1.1.11
	external/bsd/dhcpcd/dist/src/ipv6.h             up to 1.1.1.7
	external/bsd/dhcpcd/dist/src/ipv6nd.c           up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/ipv6nd.h           up to 1.1.1.6
	external/bsd/dhcpcd/dist/src/logerr.c           up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/logerr.h           up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/route.c            up to 1.1.1.8
	external/bsd/dhcpcd/dist/src/route.h            up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/sa.c               up to 1.1.1.3
	external/bsd/dhcpcd/dist/src/sa.h               up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/script.c           up to 1.1.1.4
	external/bsd/dhcpcd/dist/src/script.h           up to 1.1.1.2
	external/bsd/dhcpcd/dist/src/dev/Makefile       up to 1.1.1.1
	external/bsd/dhcpcd/dist/src/dev/udev.c         up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/crypt/.gitignore up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/crypt/GNUmakefile up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/crypt/Makefile   up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/crypt/README.md  up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/crypt/run-test.c up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/crypt/test.h     up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/crypt/test_hmac_md5.c up to 1.1.1.3
	external/bsd/dhcpcd/dist/tests/Makefile         up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/eloop-bench/.gitignore up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/eloop-bench/Makefile up to 1.1.1.2
	external/bsd/dhcpcd/dist/tests/eloop-bench/README.md up to 1.1.1.1
	external/bsd/dhcpcd/dist/tests/eloop-bench/eloop-bench.c up to 1.1.1.3
	external/bsd/dhcpcd/dist/.arcconfig             up to 1.1.1.1
	external/bsd/dhcpcd/dist/.gitignore             up to 1.4
	external/bsd/dhcpcd/dist/BUILDING.md            up to 1.1.1.2
	external/bsd/dhcpcd/dist/LICENSE                up to 1.1.1.2
	external/bsd/dhcpcd/dist/Makefile               up to 1.1.1.5
	external/bsd/dhcpcd/dist/Makefile.inc           up to 1.1.1.2
	external/bsd/dhcpcd/dist/README.md              up to 1.1.1.3
	external/bsd/dhcpcd/dist/bpf-filter.h           delete
	external/bsd/dhcpcd/dist/common.c               delete
	external/bsd/dhcpcd/dist/arp.c                  delete
	external/bsd/dhcpcd/dist/arp.h                  delete
	external/bsd/dhcpcd/dist/auth.c                 delete
	external/bsd/dhcpcd/dist/auth.h                 delete
	external/bsd/dhcpcd/dist/dhcpcd.c               delete
	external/bsd/dhcpcd/dist/control.c              delete
	external/bsd/dhcpcd/dist/common.h               delete
	external/bsd/dhcpcd/dist/config.h               delete
	external/bsd/dhcpcd/dist/dhcp-common.c          delete
	external/bsd/dhcpcd/dist/control.h              delete
	external/bsd/dhcpcd/dist/defs.h                 delete
	external/bsd/dhcpcd/dist/dev.h                  delete
	external/bsd/dhcpcd/dist/dhcpcd-definitions.conf delete
	external/bsd/dhcpcd/dist/dhcp-common.h          delete
	external/bsd/dhcpcd/dist/dhcp.c                 delete
	external/bsd/dhcpcd/dist/dhcp.h                 delete
	external/bsd/dhcpcd/dist/dhcp6.c                delete
	external/bsd/dhcpcd/dist/dhcp6.h                delete
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in  delete
	external/bsd/dhcpcd/dist/dhcpcd-embedded.c      delete
	external/bsd/dhcpcd/dist/dhcpcd.8.in            delete
	external/bsd/dhcpcd/dist/dhcpcd-embedded.c.in   delete
	external/bsd/dhcpcd/dist/dhcpcd-embedded.h      delete
	external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in   delete
	external/bsd/dhcpcd/dist/ipv4.c                 delete
	external/bsd/dhcpcd/dist/if.c                   delete
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in    delete
	external/bsd/dhcpcd/dist/dhcpcd.h               delete
	external/bsd/dhcpcd/dist/dhcpcd.conf            delete
	external/bsd/dhcpcd/dist/dhcpcd.conf.5.in       delete
	external/bsd/dhcpcd/dist/duid.c                 delete
	external/bsd/dhcpcd/dist/duid.h                 delete
	external/bsd/dhcpcd/dist/eloop.c                delete
	external/bsd/dhcpcd/dist/eloop.h                delete
	external/bsd/dhcpcd/dist/if-bsd.c               delete
	external/bsd/dhcpcd/dist/if-options.c           delete
	external/bsd/dhcpcd/dist/if-options.h           delete
	external/bsd/dhcpcd/dist/if.h                   delete
	external/bsd/dhcpcd/dist/crypt/hmac_md5.c       delete
	external/bsd/dhcpcd/dist/crypt/crypt.h          delete
	external/bsd/dhcpcd/dist/ipv4.h                 delete
	external/bsd/dhcpcd/dist/ipv4ll.c               delete
	external/bsd/dhcpcd/dist/ipv6.c                 delete
	external/bsd/dhcpcd/dist/ipv4ll.h               delete
	external/bsd/dhcpcd/dist/ipv6.h                 delete
	external/bsd/dhcpcd/dist/ipv6nd.c               delete
	external/bsd/dhcpcd/dist/ipv6nd.h               delete
	external/bsd/dhcpcd/dist/script.c               delete
	external/bsd/dhcpcd/dist/script.h               delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/15-timezone delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test   delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/02-dump   delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu    delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/10-wpa_supplicant delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf delete
	external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind delete
	usr.sbin/postinstall/postinstall: revision 1.211-1.213
	etc/rc.d/dhcpcd					upto 1.5
	doc/3RDPARTY					manual edit

Import dhcpcd-7.0.7.
Adjust postinstal and rc file.
@
text
@a0 161
# Set the hostname from DHCP data if required

# A hostname can either be a short hostname or a FQDN.
# hostname_fqdn=true
# hostname_fqdn=false
# hostname_fqdn=server

# A value of server means just what the server says, don't manipulate it.
# This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
# where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
# DHCPv6 has no hostname option.
# RFC4702 section 3.1 says FQDN should be prefered over hostname.
#
# As such, the default is hostname_fqdn=true so that a consistent hostname
# is always assigned.
: ${hostname_fqdn:=true}

# If we used to set the hostname, but relinquish control of it, we should
# reset to the default value.
: ${hostname_default=localhost}

# Some systems don't have hostname(1)
_hostname()
{
	if [ -z "${1+x}" ]; then
		if type hostname >/dev/null 2>&1; then
			hostname
		elif [ -r /proc/sys/kernel/hostname ]; then
			read name </proc/sys/kernel/hostname && echo "$name"
		elif sysctl kern.hostname >/dev/null 2>&1; then
			sysctl -n kern.hostname
		elif sysctl kernel.hostname >/dev/null 2>&1; then
			sysctl -n kernel.hostname
		else
			return 1
		fi
		return $?
	fi

	# Always prefer hostname(1) if we have it
	if type hostname >/dev/null 2>&1; then
		hostname "$1"
	elif [ -w /proc/sys/kernel/hostname ]; then
		echo "$1" >/proc/sys/kernel/hostname
	elif sysctl kern.hostname >/dev/null 2>&1; then
		sysctl -w "kern.hostname=$1"
	elif sysctl kernel.hostname >/dev/null 2>&1; then
		sysctl -w "kernel.hostname=$1"
	else
		# We know this will fail, but it will now fail
		# with an error to stdout
		hostname "$1"
	fi
}

set_hostname_vars()
{
	hfqdn=false
	hshort=false
	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac
}

need_hostname()
{
	# Always load the hostname variable for future use
	hostname="$(_hostname)"
	case "$hostname" in
	""|"(none)"|localhost|localhost.localdomain|"$hostname_default")
		return 0;;
	esac

	case "$force_hostname" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) return 0;;
	esac

	set_hostname_vars

	if [ -n "$old_fqdn" ]; then
		if ${hfqdn} || ! ${hsort}; then
			[ "$hostname" = "$old_fqdn" ]
		else
			[ "$hostname" = "${old_fqdn%%.*}" ]
		fi
	elif [ -n "$old_host_name" ]; then
		if ${hfqdn}; then
			if [ -n "$old_domain_name" -a \
			    "$old_host_name" = "${old_host_name#*.}" ]
			then
				[ "$hostname" = \
				    "$old_host_name.$old_domain_name" ]
			else
				[ "$hostname" = "$old_host_name" ]
			fi
		elif ${hshort}; then
			[ "$hostname" = "${old_host_name%%.*}" ]
		else
			[ "$hostname" = "$old_host_name" ]
		fi
	else
		# No old hostname
		false
	fi
}

try_hostname()
{
	[ "$hostname" = "$1" ] && return 0
	if valid_domainname "$1"; then
		syslog info "Setting hostname: $1"
		_hostname "$1"
	else
		syslog err "Invalid hostname: $1"
	fi
}

set_hostname()
{
	need_hostname || return

	set_hostname_vars

	if [ -n "$new_fqdn" ]; then
		if ${hfqdn} || ! ${hshort}; then
			try_hostname "$new_fqdn"
		else
			try_hostname "${new_fqdn%%.*}"
		fi
	elif [ -n "$new_host_name" ]; then
		if ${hfqdn}; then
			if [ -n "$new_domain_name" -a \
			    "$new_host_name" = "${new_host_name#*.}" ]
			then
				try_hostname "$new_host_name.$new_domain_name"
			else
				try_hostname "$new_host_name"
			fi
		elif ${hshort}; then
			try_hostname "${new_host_name%%.*}"
		else
			try_hostname "$new_host_name"
		fi
	elif [ -n "${hostname_default+x}" ]; then
		try_hostname "$hostname_default"
	fi
}

# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_fqdn="$new_dhcp6_fqdn"
	old_fqdn="$old_dhcp6_fqdn"
	;;
esac

if $if_up; then
	set_hostname
fi
@


1.1.1.1.2.1
log
@file 30-hostname was added on branch bouyer-socketcan on 2017-03-31 20:51:17 +0000
@
text
@d1 165
@


1.1.1.1.2.2
log
@2552809
@
text
@a0 165
# Set the hostname from DHCP data if required

# A hostname can either be a short hostname or a FQDN.
# hostname_fqdn=true
# hostname_fqdn=false
# hostname_fqdn=server

# A value of server means just what the server says, don't manipulate it.
# This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
# where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
# DHCPv6 has no hostname option.
# RFC4702 section 3.1 says FQDN should be prefered over hostname.
#
# As such, the default is hostname_fqdn=true so that a consistent hostname
# is always assigned.
: ${hostname_fqdn:=true}

# If we used to set the hostname, but relinquish control of it, we should
# reset to the default value.
: ${hostname_default=localhost}

# Some systems don't have hostname(1)
_hostname()
{
	local name=

	if [ -z "${1+x}" ]; then
		if type hostname >/dev/null 2>&1; then
			hostname
		elif [ -r /proc/sys/kernel/hostname ]; then
			read name </proc/sys/kernel/hostname && echo "$name"
		elif sysctl kern.hostname >/dev/null 2>&1; then
			sysctl -n kern.hostname
		elif sysctl kernel.hostname >/dev/null 2>&1; then
			sysctl -n kernel.hostname
		else
			return 1
		fi
		return $?
	fi

	# Always prefer hostname(1) if we have it
	if type hostname >/dev/null 2>&1; then
		hostname "$1"
	elif [ -w /proc/sys/kernel/hostname ]; then
		echo "$1" >/proc/sys/kernel/hostname
	elif sysctl kern.hostname >/dev/null 2>&1; then
		sysctl -w "kern.hostname=$1"
	elif sysctl kernel.hostname >/dev/null 2>&1; then
		sysctl -w "kernel.hostname=$1"
	else
		# We know this will fail, but it will now fail
		# with an error to stdout
		hostname "$1"
	fi
}

need_hostname()
{
	local hfqdn=false hshort=false

	# Always load the hostname variable for future use
	hostname="$(_hostname)"
	case "$hostname" in
	""|"(none)"|localhost|localhost.localdomain|"$hostname_default")
		return 0;;
	esac

	case "$force_hostname" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) return 0;;
	esac

	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac

	if [ -n "$old_fqdn" ]; then
		if ${hfqdn} || ! ${hsort}; then
			[ "$hostname" = "$old_fqdn" ]
		else
			[ "$hostname" = "${old_fqdn%%.*}" ]
		fi
	elif [ -n "$old_host_name" ]; then
		if ${hfqdn}; then
			if [ -n "$old_domain_name" -a \
			    "$old_host_name" = "${old_host_name#*.}" ]
			then
				[ "$hostname" = \
				    "$old_host_name.$old_domain_name" ]
			else
				[ "$hostname" = "$old_host_name" ]
			fi
		elif ${hshort}; then
			[ "$hostname" = "${old_host_name%%.*}" ]
		else
			[ "$hostname" = "$old_host_name" ]
		fi
	else
		# No old hostname
		false
	fi
}

try_hostname()
{

	[ "$hostname" = "$1" ] && return 0
	if valid_domainname "$1"; then
		syslog info "Setting hostname: $1"
		_hostname "$1"
	else
		syslog err "Invalid hostname: $1"
	fi
}

set_hostname()
{
	local hfqdn=false hshort=false

	need_hostname || return

	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac

	if [ -n "$new_fqdn" ]; then
		if ${hfqdn} || ! ${hshort}; then
			try_hostname "$new_fqdn"
		else
			try_hostname "${new_fqdn%%.*}"
		fi
	elif [ -n "$new_host_name" ]; then
		if ${hfqdn}; then
			if [ -n "$new_domain_name" -a \
			    "$new_host_name" = "${new_host_name#*.}" ]
			then
				try_hostname "$new_host_name.$new_domain_name"
			else
				try_hostname "$new_host_name"
			fi
		elif ${hshort}; then
			try_hostname "${new_host_name%%.*}"
		else
			try_hostname "$new_host_name"
		fi
	elif [ -n "${hostname_default+x}" ]; then
		try_hostname "$hostname_default"
	fi
}

# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_fqdn="$new_dhcp6_fqdn"
	old_fqdn="$old_dhcp6_fqdn"
	;;
esac

if $if_up; then
	set_hostname
fi
@


1.1.1.1.4.1
log
@file 30-hostname was added on branch pgoyette-localcount on 2017-04-26 02:52:23 +0000
@
text
@d1 165
@


1.1.1.1.4.2
log
@Sync with HEAD
@
text
@a0 165
# Set the hostname from DHCP data if required

# A hostname can either be a short hostname or a FQDN.
# hostname_fqdn=true
# hostname_fqdn=false
# hostname_fqdn=server

# A value of server means just what the server says, don't manipulate it.
# This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
# where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
# DHCPv6 has no hostname option.
# RFC4702 section 3.1 says FQDN should be prefered over hostname.
#
# As such, the default is hostname_fqdn=true so that a consistent hostname
# is always assigned.
: ${hostname_fqdn:=true}

# If we used to set the hostname, but relinquish control of it, we should
# reset to the default value.
: ${hostname_default=localhost}

# Some systems don't have hostname(1)
_hostname()
{
	local name=

	if [ -z "${1+x}" ]; then
		if type hostname >/dev/null 2>&1; then
			hostname
		elif [ -r /proc/sys/kernel/hostname ]; then
			read name </proc/sys/kernel/hostname && echo "$name"
		elif sysctl kern.hostname >/dev/null 2>&1; then
			sysctl -n kern.hostname
		elif sysctl kernel.hostname >/dev/null 2>&1; then
			sysctl -n kernel.hostname
		else
			return 1
		fi
		return $?
	fi

	# Always prefer hostname(1) if we have it
	if type hostname >/dev/null 2>&1; then
		hostname "$1"
	elif [ -w /proc/sys/kernel/hostname ]; then
		echo "$1" >/proc/sys/kernel/hostname
	elif sysctl kern.hostname >/dev/null 2>&1; then
		sysctl -w "kern.hostname=$1"
	elif sysctl kernel.hostname >/dev/null 2>&1; then
		sysctl -w "kernel.hostname=$1"
	else
		# We know this will fail, but it will now fail
		# with an error to stdout
		hostname "$1"
	fi
}

need_hostname()
{
	local hfqdn=false hshort=false

	# Always load the hostname variable for future use
	hostname="$(_hostname)"
	case "$hostname" in
	""|"(none)"|localhost|localhost.localdomain|"$hostname_default")
		return 0;;
	esac

	case "$force_hostname" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) return 0;;
	esac

	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac

	if [ -n "$old_fqdn" ]; then
		if ${hfqdn} || ! ${hsort}; then
			[ "$hostname" = "$old_fqdn" ]
		else
			[ "$hostname" = "${old_fqdn%%.*}" ]
		fi
	elif [ -n "$old_host_name" ]; then
		if ${hfqdn}; then
			if [ -n "$old_domain_name" -a \
			    "$old_host_name" = "${old_host_name#*.}" ]
			then
				[ "$hostname" = \
				    "$old_host_name.$old_domain_name" ]
			else
				[ "$hostname" = "$old_host_name" ]
			fi
		elif ${hshort}; then
			[ "$hostname" = "${old_host_name%%.*}" ]
		else
			[ "$hostname" = "$old_host_name" ]
		fi
	else
		# No old hostname
		false
	fi
}

try_hostname()
{

	[ "$hostname" = "$1" ] && return 0
	if valid_domainname "$1"; then
		syslog info "Setting hostname: $1"
		_hostname "$1"
	else
		syslog err "Invalid hostname: $1"
	fi
}

set_hostname()
{
	local hfqdn=false hshort=false

	need_hostname || return

	case "$hostname_fqdn" in
	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)	hfqdn=true;;
	""|[Ss][Ee][Rr][Vv][Ee][Rr])		;;
	*)					hshort=true;;
	esac

	if [ -n "$new_fqdn" ]; then
		if ${hfqdn} || ! ${hshort}; then
			try_hostname "$new_fqdn"
		else
			try_hostname "${new_fqdn%%.*}"
		fi
	elif [ -n "$new_host_name" ]; then
		if ${hfqdn}; then
			if [ -n "$new_domain_name" -a \
			    "$new_host_name" = "${new_host_name#*.}" ]
			then
				try_hostname "$new_host_name.$new_domain_name"
			else
				try_hostname "$new_host_name"
			fi
		elif ${hshort}; then
			try_hostname "${new_host_name%%.*}"
		else
			try_hostname "$new_host_name"
		fi
	elif [ -n "${hostname_default+x}" ]; then
		try_hostname "$hostname_default"
	fi
}

# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_fqdn="$new_dhcp6_fqdn"
	old_fqdn="$old_dhcp6_fqdn"
	;;
esac

if $if_up; then
	set_hostname
fi
@


