head	1.11;
access;
symbols
	perseant-exfatfs-base-20261102:1.11
	perseant-exfatfs-base-20250801:1.11
	perseant-exfatfs-base-20240630:1.11
	perseant-exfatfs:1.11.0.12
	perseant-exfatfs-base:1.11
	cjep_sun2x:1.11.0.10
	cjep_sun2x-base:1.11
	cjep_staticlib_x-base1:1.11
	cjep_staticlib_x:1.11.0.8
	cjep_staticlib_x-base:1.11
	phil-wifi-20200421:1.11
	phil-wifi-20200411:1.11
	phil-wifi-20200406:1.11
	pgoyette-compat-merge-20190127:1.11
	pgoyette-compat-20190127:1.11
	pgoyette-compat-20190118:1.11
	pgoyette-compat-1226:1.11
	pgoyette-compat-1126:1.11
	pgoyette-compat-1020:1.11
	pgoyette-compat-0930:1.11
	pgoyette-compat-0906:1.11
	netbsd-7-2-RELEASE:1.1.1.15.2.2
	pgoyette-compat-0728:1.11
	pgoyette-compat-0625:1.11
	pgoyette-compat-0521:1.11
	pgoyette-compat-0502:1.11
	pgoyette-compat-0422:1.11
	pgoyette-compat-0415:1.11
	pgoyette-compat-0407:1.11
	pgoyette-compat-0330:1.11
	pgoyette-compat-0322:1.11
	pgoyette-compat-0315:1.11
	netbsd-7-1-2-RELEASE:1.1.1.15.2.1
	pgoyette-compat:1.11.0.6
	pgoyette-compat-base:1.11
	netbsd-7-1-1-RELEASE:1.1.1.15.2.1
	perseant-stdc-iso10646:1.11.0.4
	perseant-stdc-iso10646-base:1.11
	prg-localcount2-base3:1.11
	prg-localcount2-base2:1.11
	prg-localcount2-base1:1.11
	prg-localcount2:1.11.0.2
	prg-localcount2-base:1.11
	pgoyette-localcount-20170426:1.11
	bouyer-socketcan-base1:1.11
	pgoyette-localcount-20170320:1.10
	netbsd-7-1:1.1.1.15.2.1.0.6
	netbsd-7-1-RELEASE:1.1.1.15.2.1
	netbsd-7-1-RC2:1.1.1.15.2.1
	netbsd-7-nhusb-base-20170116:1.1.1.15.2.1
	bouyer-socketcan:1.10.0.2
	bouyer-socketcan-base:1.10
	pgoyette-localcount-20170107:1.10
	netbsd-7-1-RC1:1.1.1.15.2.1
	pgoyette-localcount-20161104:1.10
	netbsd-7-0-2-RELEASE:1.1.1.15.2.1
	dhcpcd-6-11-4-reimport:1.1.1.21
	dhcpcd-6-11-4:1.1.1.21
	localcount-20160914:1.10
	netbsd-7-nhusb:1.1.1.15.2.1.0.4
	netbsd-7-nhusb-base:1.1.1.15.2.1
	dhcpcd-6-11-3:1.1.1.21
	pgoyette-localcount-20160806:1.10
	dhcpcd-6-11-2:1.1.1.21
	pgoyette-localcount-20160726:1.9
	pgoyette-localcount:1.9.0.2
	pgoyette-localcount-base:1.9
	dhcpcd-6-11-1:1.1.1.20
	netbsd-7-0-1-RELEASE:1.1.1.15.2.1
	dhcpcd-6-11-0:1.1.1.19
	dhcpcd-6-10-3:1.1.1.19
	dhcpcd-6-10-2:1.1.1.19
	dhcpcd-6-10-1:1.1.1.19
	dhcpcd-6-10-0:1.1.1.19
	dhcpcd-6-9-4:1.1.1.19
	netbsd-7-0:1.1.1.15.2.1.0.2
	netbsd-7-0-RELEASE:1.1.1.15.2.1
	dhcpcd-6-9-3:1.1.1.19
	dhcpcd-6-9-2:1.1.1.19
	netbsd-7-0-RC3:1.1.1.15.2.1
	netbsd-7-0-RC2:1.1.1.15.2.1
	dhcpcd-6-9-1:1.1.1.18
	netbsd-7-0-RC1:1.1.1.15.2.1
	dhcpcd-6-9-0:1.1.1.18
	dhcpcd-6-8-2:1.1.1.17
	dhcpcd-6-8-1:1.1.1.17
	dhcpcd-6-8-0:1.1.1.17
	dhcpcd-6-7-1:1.1.1.17
	dhcpcd-6-7-0:1.1.1.17
	dhcpcd-6-6-7:1.1.1.17
	dhcpcd-6-6-6:1.1.1.17
	dhcpcd-6-6-5:1.1.1.17
	dhcpcd-6-6-4:1.1.1.17
	dhcpcd-6-6-3:1.1.1.17
	netbsd-5-2-3-RELEASE:1.1.1.2.6.3
	netbsd-5-1-5-RELEASE:1.1.1.2.6.2.2.1
	dhcpcd-6-6-2:1.1.1.17
	dhcpcd-6-6-1-nb1:1.1.1.17
	dhcpcd-6-6-1:1.1.1.16
	dhcpcd-6-6-0:1.1.1.15
	dhcpcd-6-5-1:1.1.1.15
	dhcpcd-6-5-0:1.1.1.15
	dhcpcd-6-4-7:1.1.1.15
	dhcpcd-6-4-6:1.1.1.15
	netbsd-6-0-6-RELEASE:1.1.1.9
	netbsd-6-1-5-RELEASE:1.1.1.9.2.1
	dhcpcd-6-4-5:1.1.1.15
	dhcpcd-6-4-4:1.1.1.15
	netbsd-7:1.1.1.15.0.2
	netbsd-7-base:1.1.1.15
	dhcpcd-6-4-3:1.1.1.15
	dhcpcd-6-4-2:1.1.1.15
	dhcpcd-6-4-1:1.1.1.15
	dhcpcd-6-4-0:1.1.1.14
	yamt-pagecache-base9:1.1.1.14
	yamt-pagecache-tag8:1.1.1.6.4.1
	netbsd-6-1-4-RELEASE:1.1.1.9.2.1
	netbsd-6-0-5-RELEASE:1.1.1.9
	tls-earlyentropy:1.1.1.14.0.2
	tls-earlyentropy-base:1.1.1.15
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.14
	riastradh-drm2-base3:1.1.1.14
	dhcpcd-6-3-2:1.1.1.14
	dhcpcd-6-3-1:1.1.1.14
	dhcpcd-6-3-0:1.1.1.14
	netbsd-6-1-3-RELEASE:1.1.1.9.2.1
	netbsd-6-0-4-RELEASE:1.1.1.9
	netbsd-5-2-2-RELEASE:1.1.1.2.6.3
	netbsd-5-1-4-RELEASE:1.1.1.2.6.2.2.1
	dhcpcd-6-2-1:1.1.1.14
	dhcpcd-6-2-0:1.1.1.14
	netbsd-6-1-2-RELEASE:1.1.1.9.2.1
	netbsd-6-0-3-RELEASE:1.1.1.9
	netbsd-5-2-1-RELEASE:1.1.1.2.6.3
	netbsd-5-1-3-RELEASE:1.1.1.2.6.2.2.1
	dhcpcd-6-1-0:1.1.1.14
	netbsd-6-1-1-RELEASE:1.1.1.9.2.1
	dhcpcd-6-0-5:1.1.1.13
	dhcpcd-6-0-4:1.1.1.12
	riastradh-drm2-base2:1.1.1.11
	riastradh-drm2-base1:1.1.1.11
	dhcpcd-6-0-3:1.1.1.11
	riastradh-drm2:1.1.1.11.0.2
	riastradh-drm2-base:1.1.1.11
	dhcpcd-6-0-1:1.1.1.11
	dhcpcd_6_0_0:1.1.1.11
	netbsd-6-1:1.1.1.9.2.1.0.2
	netbsd-6-0-2-RELEASE:1.1.1.9
	netbsd-6-1-RELEASE:1.1.1.9.2.1
	khorben-n900:1.1.1.10.0.8
	netbsd-6-1-RC4:1.1.1.9.2.1
	netbsd-6-1-RC3:1.1.1.9.2.1
	agc-symver:1.1.1.10.0.6
	agc-symver-base:1.1.1.10
	netbsd-6-1-RC2:1.1.1.9.2.1
	netbsd-6-1-RC1:1.1.1.9.2.1
	dhcpcd-5-6-7:1.1.1.10
	yamt-pagecache-base8:1.1.1.10
	dhcpcd-5-6-6:1.1.1.10
	netbsd-5-2:1.1.1.2.6.3.0.2
	netbsd-6-0-1-RELEASE:1.1.1.9
	yamt-pagecache-base7:1.1.1.10
	dhcpcd-5-6-4:1.1.1.10
	netbsd-5-2-RELEASE:1.1.1.2.6.3
	netbsd-5-2-RC1:1.1.1.2.6.3
	matt-nb6-plus-nbase:1.1.1.9
	yamt-pagecache-base6:1.1.1.10
	netbsd-6-0:1.1.1.9.0.6
	netbsd-6-0-RELEASE:1.1.1.9
	netbsd-6-0-RC2:1.1.1.9
	tls-maxphys:1.1.1.10.0.2
	tls-maxphys-base:1.1.1.15
	dhcpcd-5-6-2:1.1.1.10
	matt-nb6-plus:1.1.1.9.0.4
	matt-nb6-plus-base:1.1.1.9
	netbsd-6-0-RC1:1.1.1.9
	dhcpcd-5-6-1:1.1.1.10
	yamt-pagecache-base5:1.1.1.10
	yamt-pagecache-base4:1.1.1.10
	dhcpcd-5-5-6:1.1.1.10
	dhcpcd-5-5-5:1.1.1.9
	netbsd-6:1.1.1.9.0.2
	netbsd-6-base:1.1.1.9
	dhcpcd-5-5-4:1.1.1.9
	dhcpcd-5-5-3:1.1.1.9
	dhcpcd-5-5-2:1.1.1.9
	netbsd-5-1-2-RELEASE:1.1.1.2.6.2.2.1
	dhcpcd-5-5-1:1.1.1.8
	dhcpcd-5-5-0:1.1.1.7
	netbsd-5-1-1-RELEASE:1.1.1.2.6.2.2.1
	yamt-pagecache-base3:1.1.1.6
	yamt-pagecache-base2:1.1.1.6
	yamt-pagecache:1.1.1.6.0.4
	yamt-pagecache-base:1.1.1.6
	cherry-xenmp:1.1.1.6.0.2
	cherry-xenmp-base:1.1.1.6
	dhcpcd-5-2-12:1.1.1.6
	bouyer-quota2-nbase:1.1.1.5
	dhcpcd-5-2-11:1.1.1.5
	bouyer-quota2:1.1.1.5.0.2
	bouyer-quota2-base:1.1.1.5
	dhcpcd-5-2-10:1.1.1.5
	matt-mips64-premerge-20101231:1.1.1.5
	matt-nb5-mips64-premerge-20101231:1.1.1.2.12.1
	matt-nb5-pq3:1.1.1.2.6.2.0.4
	matt-nb5-pq3-base:1.1.1.2.6.2
	dhcpcd-5-2-9:1.1.1.5
	netbsd-5-1:1.1.1.2.6.2.0.2
	netbsd-5-1-RELEASE:1.1.1.2.6.2
	dhcpcd-5-2-8:1.1.1.5
	netbsd-5-1-RC4:1.1.1.2.6.2
	matt-nb5-mips64-k15:1.1.1.2.12.1
	netbsd-5-1-RC3:1.1.1.2.6.2
	dhcpcd-5-2-4:1.1.1.4
	netbsd-5-1-RC2:1.1.1.2.6.2
	netbsd-5-1-RC1:1.1.1.2.6.2
	dhcpcd-5-2-2:1.1.1.4
	dhcpcd-5-2-1:1.1.1.4
	dhcpcd-5-2-0:1.1.1.4
	netbsd-5-0-2-RELEASE:1.1.1.2
	dhcpcd-5-1-5:1.1.1.4
	dhcpcd-5-1-4:1.1.1.4
	matt-nb5-mips64-premerge-20091211:1.1.1.2
	matt-premerge-20091211:1.1.1.4
	dhcpcd-5-1-3:1.1.1.4
	dhcpcd-5-1-2:1.1.1.4
	dhcpcd-5-1-1:1.1.1.4
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.1.1.2
	matt-nb4-mips64-k7-u2a-k9b:1.1.1.2
	matt-nb5-mips64-u1-k1-k5:1.1.1.2
	matt-nb5-mips64:1.1.1.2.0.12
	netbsd-5-0-1-RELEASE:1.1.1.2
	dhcpcd-5-0-7:1.1.1.4
	dhcpcd-5-0-6:1.1.1.4
	dhcpcd-5-0-5:1.1.1.4
	dhcpcd-5-0-4:1.1.1.4
	jym-xensuspend-nbase:1.1.1.4
	dhcpcd-5-0-3:1.1.1.4
	dhcpcd-5-0-2a:1.1.1.4
	dhcpcd-5-0-2:1.1.1.4
	dhcpcd-5-0-1:1.1.1.3
	dhcpcd-5-0-0:1.1.1.3
	netbsd-5-0:1.1.1.2.0.10
	netbsd-5-0-RELEASE:1.1.1.2
	dhcpcd-4-0-13:1.1.1.2
	netbsd-5-0-RC4:1.1.1.2
	netbsd-5-0-RC3:1.1.1.2
	dhcpcd-4-0-12:1.1.1.2
	dhcpcd-4-0-11:1.1.1.2
	netbsd-5-0-RC2:1.1.1.2
	jym-xensuspend:1.1.1.2.0.8
	jym-xensuspend-base:1.1.1.4
	dhcpcd-4-0-10:1.1.1.2
	dhcpcd-4-0-9:1.1.1.2
	dhcpcd-4-0-8:1.1.1.2
	roy:1.1.1
	netbsd-5-0-RC1:1.1.1.2
	haad-dm-base:1.1.1.2
	haad-dm-base2:1.1.1.2
	haad-nbase2:1.1.1.2
	dhcpcd-4-0-7:1.1.1.2
	dhcpcd:1.1.1
	netbsd-5:1.1.1.2.0.6
	netbsd-5-base:1.1.1.2
	matt-mips64-base2:1.1.1.2
	haad-dm:1.1.1.2.0.4
	haad-dm-base1:1.1.1.2
	dhcpcd-4-0-1:1.1.1.2
	wrstuden-revivesa-base-3:1.1.1.1
	wrstuden-revivesa:1.1.1.1.0.2
	wrstuden-revivesa-base-2:1.1.1.1
	dhcpcd-4-0-0-rc3:1.1.1.1
	DHCPCD:1.1.1;
locks; strict;
comment	@# @;


1.11
date	2017.03.31.20.53.56;	author roy;	state dead;
branches;
next	1.10;
commitid	dLxJqjjcfoFGgKLz;

1.10
date	2016.07.29.10.07.58;	author roy;	state Exp;
branches
	1.10.2.1;
next	1.9;
commitid	D5Soq6OlQqwfzcgz;

1.9
date	2016.06.17.19.42.32;	author roy;	state Exp;
branches
	1.9.2.1;
next	1.8;
commitid	6xuwCMCfSdS46Raz;

1.8
date	2015.08.21.10.39.00;	author roy;	state Exp;
branches;
next	1.7;
commitid	83r82VWy9OvsL7yy;

1.7
date	2015.05.16.23.31.32;	author roy;	state Exp;
branches;
next	1.6;
commitid	YXlJTXZYY8RM9Jly;

1.6
date	2014.11.07.20.51.03;	author roy;	state Exp;
branches;
next	1.5;
commitid	75oEB7w8hHnrniXx;

1.5
date	2014.11.07.20.43.33;	author roy;	state Exp;
branches;
next	1.4;
commitid	hAQ3M4m1B34VkiXx;

1.4
date	2014.11.07.20.32.05;	author roy;	state Exp;
branches;
next	1.3;
commitid	SjGER4FFqwIXgiXx;

1.3
date	2014.10.17.23.42.25;	author roy;	state Exp;
branches;
next	1.2;
commitid	9G64jKP8UtP60CUx;

1.2
date	2014.10.06.18.22.30;	author roy;	state Exp;
branches;
next	1.1;
commitid	brDOONtoZlOhAaTx;

1.1
date	2008.07.27.18.06.30;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;

1.10.2.1
date	2017.04.21.16.51.23;	author bouyer;	state dead;
branches;
next	;
commitid	dUG7nkTKALCadqOz;

1.9.2.1
date	2016.08.06.00.18.41;	author pgoyette;	state Exp;
branches;
next	1.9.2.2;
commitid	da8LmcQp9HeG2bhz;

1.9.2.2
date	2017.04.26.02.52.23;	author pgoyette;	state dead;
branches;
next	;
commitid	ojV02aOSdzvBqZOz;

1.1.1.1
date	2008.07.27.18.06.30;	author joerg;	state Exp;
branches
	1.1.1.1.2.1;
next	1.1.1.2;

1.1.1.2
date	2008.09.19.22.59.58;	author joerg;	state Exp;
branches
	1.1.1.2.4.1
	1.1.1.2.6.1
	1.1.1.2.8.1
	1.1.1.2.10.1
	1.1.1.2.12.1;
next	1.1.1.3;

1.1.1.3
date	2009.04.28.22.14.22;	author roy;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2009.05.10.16.44.27;	author roy;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	2010.10.07.14.35.58;	author roy;	state Exp;
branches;
next	1.1.1.6;

1.1.1.6
date	2011.04.06.09.06.42;	author roy;	state Exp;
branches
	1.1.1.6.4.1;
next	1.1.1.7;

1.1.1.7
date	2012.01.25.14.33.04;	author roy;	state Exp;
branches;
next	1.1.1.8;

1.1.1.8
date	2012.01.31.09.39.47;	author roy;	state Exp;
branches;
next	1.1.1.9;

1.1.1.9
date	2012.02.02.23.35.42;	author roy;	state Exp;
branches
	1.1.1.9.2.1;
next	1.1.1.10;

1.1.1.10
date	2012.03.28.10.19.32;	author roy;	state Exp;
branches
	1.1.1.10.2.1;
next	1.1.1.11;

1.1.1.11
date	2013.06.21.19.33.08;	author roy;	state Exp;
branches;
next	1.1.1.12;
commitid	SXn20EEvZ4In4wUw;

1.1.1.12
date	2013.07.29.20.35.33;	author roy;	state Exp;
branches;
next	1.1.1.13;
commitid	pPBD0UghW9mDgpZw;

1.1.1.13
date	2013.08.03.10.30.01;	author roy;	state Exp;
branches;
next	1.1.1.14;
commitid	zwGoc8oHgz1kJZZw;

1.1.1.14
date	2013.09.20.10.51.30;	author roy;	state Exp;
branches
	1.1.1.14.2.1;
next	1.1.1.15;
commitid	cFBSUArq5rpyja6x;

1.1.1.15
date	2014.07.14.11.45.06;	author roy;	state Exp;
branches
	1.1.1.15.2.1;
next	1.1.1.16;
commitid	Mi8tFV9mGmDF4lIx;

1.1.1.16
date	2014.11.07.20.24.03;	author roy;	state Exp;
branches;
next	1.1.1.17;
commitid	r3g7iXT9fDtAdiXx;

1.1.1.17
date	2014.11.07.20.41.32;	author roy;	state Exp;
branches;
next	1.1.1.18;
commitid	oii7SeL5oq7JjiXx;

1.1.1.18
date	2015.05.16.23.25.43;	author roy;	state Exp;
branches;
next	1.1.1.19;
commitid	4GxdCMxWBIXk7Jly;

1.1.1.19
date	2015.08.21.10.35.52;	author roy;	state Exp;
branches;
next	1.1.1.20;
commitid	D7aAVhJgoSHJJ7yy;

1.1.1.20
date	2016.06.17.19.37.44;	author roy;	state Exp;
branches;
next	1.1.1.21;
commitid	OLpliFQkCdVd4Raz;

1.1.1.21
date	2016.07.29.09.58.32;	author roy;	state Exp;
branches;
next	;
commitid	KJUNBNrOF4aCvcgz;

1.1.1.1.2.1
date	2008.07.27.18.06.30;	author wrstuden;	state dead;
branches;
next	1.1.1.1.2.2;

1.1.1.1.2.2
date	2008.09.18.05.14.27;	author wrstuden;	state Exp;
branches;
next	;

1.1.1.2.4.1
date	2008.09.19.22.59.58;	author haad;	state dead;
branches;
next	1.1.1.2.4.2;

1.1.1.2.4.2
date	2008.10.19.22.39.49;	author haad;	state Exp;
branches;
next	;

1.1.1.2.6.1
date	2009.05.10.21.22.26;	author snj;	state Exp;
branches;
next	1.1.1.2.6.2;

1.1.1.2.6.2
date	2009.05.18.21.23.34;	author bouyer;	state Exp;
branches
	1.1.1.2.6.2.2.1;
next	1.1.1.2.6.3;

1.1.1.2.6.3
date	2011.05.19.19.50.54;	author bouyer;	state Exp;
branches;
next	;

1.1.1.2.6.2.2.1
date	2011.05.19.19.51.01;	author bouyer;	state Exp;
branches;
next	;

1.1.1.2.8.1
date	2009.05.13.18.51.51;	author jym;	state Exp;
branches;
next	;

1.1.1.2.10.1
date	2011.05.21.13.31.00;	author bouyer;	state Exp;
branches;
next	;

1.1.1.2.12.1
date	2010.04.21.05.23.07;	author matt;	state Exp;
branches;
next	;

1.1.1.6.4.1
date	2012.04.17.00.03.06;	author yamt;	state Exp;
branches;
next	1.1.1.6.4.2;

1.1.1.6.4.2
date	2014.05.22.15.44.40;	author yamt;	state Exp;
branches;
next	;
commitid	bCgsIAYejpvb7yBx;

1.1.1.9.2.1
date	2012.10.17.21.48.32;	author riz;	state Exp;
branches;
next	;

1.1.1.10.2.1
date	2013.06.23.06.26.31;	author tls;	state Exp;
branches;
next	1.1.1.10.2.2;
commitid	OnlO1cBgtQRcIHUw;

1.1.1.10.2.2
date	2014.08.19.23.46.43;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.14.2.1
date	2014.08.10.07.06.59;	author tls;	state Exp;
branches;
next	;
commitid	6GtpeveLcuaaGMLx;

1.1.1.15.2.1
date	2014.12.29.16.18.05;	author martin;	state Exp;
branches;
next	1.1.1.15.2.2;
commitid	rwbq7QmIjmQl9X3y;

1.1.1.15.2.2
date	2018.07.27.10.43.20;	author martin;	state dead;
branches;
next	;
commitid	HmTKhyRj9OTCmLLA;


desc
@@


1.11
log
@Sync
@
text
@# $NetBSD: 20-resolv.conf,v 1.10 2016/07/29 10:07:58 roy Exp $

# Generate /etc/resolv.conf
# Support resolvconf(8) if available
# We can merge other dhcpcd resolv.conf files into one like resolvconf,
# but resolvconf is preferred as other applications like VPN clients
# can readily hook into it.
# Also, resolvconf can configure local nameservers such as bind
# or dnsmasq. This is important as the libc resolver isn't that powerful.

resolv_conf_dir="$state_dir/resolv.conf"
NL="
"
: ${resolvconf:=resolvconf}

build_resolv_conf()
{
	local cf="$state_dir/resolv.conf.$ifname"
	local interfaces= header= search= srvs= servers= x=

	# Build a list of interfaces
	interfaces=$(list_interfaces "$resolv_conf_dir")

	# Build the resolv.conf
	if [ -n "$interfaces" ]; then
		# Build the header
		for x in ${interfaces}; do
			header="$header${header:+, }$x"
		done

		# Build the search list
		domain=$(cd "$resolv_conf_dir"; \
			key_get_value "domain " ${interfaces})
		search=$(cd "$resolv_conf_dir"; \
			key_get_value "search " ${interfaces})
		set -- ${domain}
		domain="$1"
		[ -n "$2" ] && search="$search $*"
		[ -n "$search" ] && search="$(uniqify $search)"
		[ "$domain" = "$search" ] && search=
		[ -n "$domain" ] && domain="domain $domain$NL"
		[ -n "$search" ] && search="search $search$NL"

		# Build the nameserver list
		srvs=$(cd "$resolv_conf_dir"; \
			key_get_value "nameserver " ${interfaces})
		for x in $(uniqify ${srvs}); do
			servers="${servers}nameserver $x$NL"
		done
	fi
	header="$signature_base${header:+ $from }$header"

	# Assemble resolv.conf using our head and tail files
	[ -f "$cf" ] && rm -f "$cf"
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
	echo "$header" > "$cf"
	if [ -f /etc/resolv.conf.head ]; then
		cat /etc/resolv.conf.head >> "$cf"
	else
		echo "# /etc/resolv.conf.head can replace this line" >> "$cf"
	fi
	printf %s "$domain$search$servers" >> "$cf"
	if [ -f /etc/resolv.conf.tail ]; then
		cat /etc/resolv.conf.tail >> "$cf"
	else
		echo "# /etc/resolv.conf.tail can replace this line" >> "$cf"
	fi
	if change_file /etc/resolv.conf "$cf"; then
		chmod 644 /etc/resolv.conf
	fi
	rm -f "$cf"
}

# Extract any ND DNS options from the RA
# For now, we ignore the lifetime of the DNS options unless they
# are absent or zero.
# In this case they are removed from consideration.
# See draft-gont-6man-slaac-dns-config-issues-01 for issues
# regarding DNS option lifetime in ND messages.
eval_nd_dns()
{

	eval ltime=\$nd${i}_rdnss${j}_lifetime
	if [ -z "$ltime" -o "$ltime" = 0 ]; then
		rdnss=
	else
		eval rdnss=\$nd${i}_rdnss${j}_servers
	fi
	eval ltime=\$nd${i}_dnssl${j}_lifetime
	if [ -z "$ltime" -o "$ltime" = 0 ]; then
		dnssl=
	else
		eval dnssl=\$nd${i}_dnssl${j}_search
	fi

	[ -z "$rdnss" -a -z "$dnssl" ] && return 1

	[ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
	[ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
	j=$(($j + 1))
	return 0
}

add_resolv_conf()
{
	local x= conf="$signature$NL" warn=true
	local i j ltime rdnss dnssl new_rdnss new_dnssl

	# Loop to extract the ND DNS options using our indexed shell values
	i=1
	j=1
	while true; do
		while true; do
			eval_nd_dns || break
		done
		i=$(($i + 1))
		j=1
		eval_nd_dns || break
	done
	[ -n "$new_rdnss" ] && \
	    new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$new_rdnss"
	[ -n "$new_dnssl" ] && \
	    new_domain_search="$new_domain_search${new_domain_search:+ }$new_dnssl"

	# Derive a new domain from our various hostname options
	if [ -z "$new_domain_name" ]; then
		if [ "$new_dhcp6_fqdn" != "${new_dhcp6_fqdn#*.}" ]; then
			new_domain_name="${new_dhcp6_fqdn#*.}"
		elif [ "$new_fqdn" != "${new_fqdn#*.}" ]; then
			new_domain_name="${new_fqdn#*.}"
		elif [ "$new_host_name" != "${new_host_name#*.}" ]; then
			new_domain_name="${new_host_name#*.}"
		fi
	fi

	# If we don't have any configuration, remove it
	if [ -z "$new_domain_name_servers" -a \
		-z "$new_domain_name" -a \
		-z "$new_domain_search" ]; then
		remove_resolv_conf
		return $?
	fi

	if [ -n "$new_domain_name" ]; then
		set -- $new_domain_name
		if valid_domainname "$1"; then
			conf="${conf}domain $1$NL"
		else
			syslog err "Invalid domain name: $1"
		fi
		# If there is no search this, make this one
		if [ -z "$new_domain_search" ]; then
			new_domain_search="$new_domain_name"
			[ "$new_domain_name" = "$1" ] && warn=true
		fi
	fi
	if [ -n "$new_domain_search" ]; then
		if valid_domainname_list $new_domain_search; then
			conf="${conf}search $new_domain_search$NL"
		elif ! $warn; then
			syslog err "Invalid domain name in list:" \
			    "$new_domain_search"
		fi
	fi
	for x in ${new_domain_name_servers}; do
		conf="${conf}nameserver $x$NL"
	done
	if type "$resolvconf" >/dev/null 2>&1; then
		[ -n "$ifmetric" ] && export IF_METRIC="$ifmetric"
		printf %s "$conf" | "$resolvconf" -a "$ifname"
		return $?
	fi

	if [ -e "$resolv_conf_dir/$ifname" ]; then
		rm -f "$resolv_conf_dir/$ifname"
	fi
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
	printf %s "$conf" > "$resolv_conf_dir/$ifname"
	build_resolv_conf
}

remove_resolv_conf()
{
	if type "$resolvconf" >/dev/null 2>&1; then
		"$resolvconf" -d "$ifname" -f
	else
		if [ -e "$resolv_conf_dir/$ifname" ]; then
			rm -f "$resolv_conf_dir/$ifname"
		fi
		build_resolv_conf
	fi
}

# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_domain_name_servers="$new_dhcp6_name_servers"
	new_domain_search="$new_dhcp6_domain_search"
	;;
esac

if $if_up || [ "$reason" = ROUTERADVERT ]; then
	add_resolv_conf
elif $if_down; then
	remove_resolv_conf
fi
@


1.10
log
@Sync
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.9 2016/06/17 19:42:32 roy Exp $
@


1.10.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.10 2016/07/29 10:07:58 roy Exp $
@


1.9
log
@Sync
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.8 2015/08/21 10:39:00 roy Exp $
d14 1
d168 1
a168 1
	if type resolvconf >/dev/null 2>&1; then
d170 1
a170 1
		printf %s "$conf" | resolvconf -a "$ifname"
d184 2
a185 2
	if type resolvconf >/dev/null 2>&1; then
		resolvconf -d "$ifname" -f
@


1.9.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.10 2016/07/29 10:07:58 roy Exp $
a13 1
: ${resolvconf:=resolvconf}
d167 1
a167 1
	if type "$resolvconf" >/dev/null 2>&1; then
d169 1
a169 1
		printf %s "$conf" | "$resolvconf" -a "$ifname"
d183 2
a184 2
	if type "$resolvconf" >/dev/null 2>&1; then
		"$resolvconf" -d "$ifname" -f
@


1.9.2.2
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.9.2.1 2016/08/06 00:18:41 pgoyette Exp $
@


1.8
log
@Sync
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.7 2015/05/16 23:31:32 roy Exp $
d97 2
a98 2
	new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
	new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
d119 4
a122 2
	new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$new_rdnss"
	new_domain_search="$new_domain_search${new_domain_search:+ }$new_dnssl"
@


1.7
log
@Sync
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.6 2014/11/07 20:51:03 roy Exp $
a121 8
	# If we don't have any configuration, remove it
	if [ -z "$new_domain_name_servers" -a \
		-z "$new_domain_name" -a \
		-z "$new_domain_search" ]; then
		remove_resolv_conf
		return $?
	fi

d133 8
@


1.6
log
@Add RCSIDs
@
text
@d1 1
a1 1
# $NetBSD: $
d73 30
d105 2
a106 1
	local x= conf="$signature$NL" i=${ra_count:-0} ra= warn=true
d108 10
a117 6
	while [ $i -ne 0 ]; do
		eval ra=\$ra${i}_rdnss
		new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$ra"
		eval ra=\$ra${i}_dnssl
		new_domain_search="$new_domain_search${new_domain_search:+ }$ra"
		i=$(($i - 1))
d119 2
@


1.5
log
@Sync
@
text
@d1 2
@


1.4
log
@Sync
@
text
@a0 2


@


1.3
log
@Sync
@
text
@d1 1
a1 1
# $NetBSD: $
@


1.2
log
@Sync
@
text
@@


1.1
log
@Initial revision
@
text
@d1 2
d5 67
d73 1
a73 1
make_resolv_conf()
d75 49
a123 10
	if [ -z "${new_domain_name_servers}" -a \
		-z "${new_domain_name}" -a \
		-z "${new_domain_search}" ]; then
		return 0
	fi
	local x= conf="${signature}\n"
	if [ -n "${new_domain_search}" ]; then
		conf="${conf}search ${new_domain_search}\n"
	elif [ -n "${new_domain_name}" ]; then
		conf="${conf}search ${new_domain_name}\n"
d126 1
a126 1
		conf="${conf}nameserver ${x}\n"
d129 7
a135 4
		printf "${conf}" | resolvconf -a "${interface}"
	else
		save_conf /etc/resolv.conf
		printf "${conf}" > /etc/resolv.conf
d137 3
d142 1
a142 1
restore_resolv_conf()
d145 1
a145 1
		resolvconf -d "${interface}" -f
d147 4
a150 1
		restore_conf /etc/resolv.conf || return 0
d154 6
a159 3
case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)	make_resolv_conf;;
EXPIRE|FAIL|IPV4LL|RELEASE|STOP)		restore_resolv_conf;;
d161 6
@


1.1.1.1
log
@Import dhpcd-4.0.0rc3. Major changes since beta4:
- support for link state notification (e.g. renew lease after carrier
  returned)
- support to start go into background immediately
- don't cleanup interface state. dhcpcd will leave the interface in the
  same state as before if the lease uses separate addresses. -p still
  stops it from removing the configured address on exit
- various smaller bugfixes, optimisations and cleanups
@
text
@@


1.1.1.2
log
@Import dhcpcd-4.0.1:
- basic resolvconf like functionality to combine the resolv.conf entries
from running instances
- improve timer handling to not break with early wake ups and other edge
cases related to the kernel time granularity
- improve handling of dhcpcd -n and rebinding after carrier loss to
better deal with changing networks
- add option to black list servers based on server id
- don't check for ARP conflict if the interface already has the address
- improve signal handling during vfork/exec
@
text
@a2 5
# We can merge other dhcpcd resolv.conf files into one like resolvconf,
# but resolvconf is preferred as other applications like VPN clients
# can readily hook into it.
# Also, resolvconf can configure local nameservers such as bind
# or dnsmasq. This is important as the libc resolver isn't that powerful.
d4 1
a4 49
resolv_conf_dir="${state_dir}/resolv.conf"

build_resolv_conf()
{
	local cf="/etc/resolv.conf.${interface}"
	local interfaces= header= search= srvs= servers= x=

	# Build a list of interfaces
	interfaces=$(list_interfaces "${resolv_conf_dir}")

	# Build the resolv.conf
	if [ -n "${interfaces}" ]; then
		# Build the header
		for x in ${interfaces}; do
			header="${header}${header:+, }${x}"
		done

		# Build the search list
		search=$(cd "${resolv_conf_dir}"; \
			key_get_value "search " ${interfaces})
		[ -n "${search}" ] && search="search $(uniqify ${search})\n"

		# Build the nameserver list
		srvs=$(cd "${resolv_conf_dir}"; \
			key_get_value "nameserver " ${interfaces})
		for x in $(uniqify ${srvs}); do
			servers="${servers}nameserver ${x}\n"
		done
	fi
	header="${signature_base}${header:+ ${from} }${header}"

	# Assemble resolv.conf using our head and tail files
	[ -f "${cf}" ] && rm -f "${cf}"
	echo "${header}" > "${cf}"
	if [ -f /etc/resolv.conf.head ]; then
		cat /etc/resolv.conf.head >> "${cf}"
	else
		echo "# /etc/resolv.conf.head can replace this line" >> "${cf}"
	fi
	printf "${search}${servers}" >> "${cf}"
	if [ -f /etc/resolv.conf.tail ]; then
		cat /etc/resolv.conf.tail >> "${cf}"
	else
		echo "# /etc/resolv.conf.tail can replace this line" >> "${cf}"
	fi
	mv -f "${cf}" /etc/resolv.conf
}

add_resolv_conf()
a5 3
	local x= conf="${signature}\n"

	# If we don't have any configuration, remove it
d9 1
a9 2
		remove_resolv_conf
		return $?
d11 1
a11 1

d22 3
a24 8
		return $?
	fi

	if [ -e "${resolv_conf_dir}/${interface}" ]; then
		rm -f "${resolv_conf_dir}/${interface}"
	fi
	if [ ! -d "${resolv_conf_dir}" ]; then
		mkdir -p "${resolv_conf_dir}"
a25 2
	printf "${conf}" > "${resolv_conf_dir}/${interface}"
	build_resolv_conf
d28 1
a28 1
remove_resolv_conf()
d33 1
a33 4
		if [ -e "${resolv_conf_dir}/${interface}" ]; then
			rm -f "${resolv_conf_dir}/${interface}"
		fi
		build_resolv_conf
d38 2
a39 2
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)	add_resolv_conf;;
PREINIT|EXPIRE|FAIL|IPV4LL|RELEASE|STOP)	remove_resolv_conf;;
@


1.1.1.2.10.1
log
@Apply patch, requested by spz in ticket 1603:
	external/bsd/dhcpcd/dist/dhcp.c                         patch
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in          patch
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in            patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf    patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname       patch
Escape | and & characters before passing the value to the shell
Ensure we set a valid hostname, DNS domain and NIS domain.
Document the need for input validation in dhcpcd-run-hooks(8).
Fixes CVE-2011-996
@
text
@d70 1
a70 5
		if valid_domainname_list; then
			conf="${conf}search ${new_domain_search}\n"
		else
			syslog err "Invalid domain name in list: $new_domain_search"
		fi
d72 1
a72 7
		set -- $new_domain_name
		new_domain_name="$1"
		if valid_domainname "$new_domain_name"; then
			conf="${conf}search ${new_domain_name}\n"
		else
			syslog err "Invalid domain name: $new_domain_name"
		fi
@


1.1.1.2.12.1
log
@sync to netbsd-5
@
text
@d9 1
a9 1
resolv_conf_dir="$state_dir/resolv.conf"
d13 1
a13 1
	local cf="$state_dir/resolv.conf.$interface"
d17 1
a17 1
	interfaces=$(list_interfaces "$resolv_conf_dir")
d20 1
a20 1
	if [ -n "$interfaces" ]; then
d23 1
a23 1
			header="$header${header:+, }$x"
d27 1
a27 3
		domain=$(cd "$resolv_conf_dir"; \
			key_get_value "domain " ${interfaces})
		search=$(cd "$resolv_conf_dir"; \
d29 1
a29 8
		set -- ${domain}
		unset domain
		if [ -n "$2" ]; then
			search="$search $@@"
		elif [ -n "$1" ]; then
			domain="domain $1\n"
		fi
		[ -n "$search" ] && search="search $(uniqify $search)\n"
d32 1
a32 1
		srvs=$(cd "$resolv_conf_dir"; \
d35 1
a35 1
			servers="${servers}nameserver $x\n"
d38 1
a38 1
	header="$signature_base${header:+ $from }$header"
d41 2
a42 3
	[ -f "$cf" ] && rm -f "$cf"
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
	echo "$header" > "$cf"
d44 1
a44 1
		cat /etc/resolv.conf.head >> "$cf"
d46 1
a46 1
		echo "# /etc/resolv.conf.head can replace this line" >> "$cf"
d48 1
a48 1
	printf "$domain$search$servers" >> "$cf"
d50 1
a50 1
		cat /etc/resolv.conf.tail >> "$cf"
d52 1
a52 1
		echo "# /etc/resolv.conf.tail can replace this line" >> "$cf"
d54 1
a54 3
	cat "$cf" > /etc/resolv.conf
	chmod 644 /etc/resolv.conf
	rm -f "$cf"
d59 1
a59 1
	local x= conf="$signature\n"
d62 3
a64 3
	if [ -z "$new_domain_name_servers" -a \
		-z "$new_domain_name" -a \
		-z "$new_domain_search" ]; then
d69 4
a72 11
	if [ -n "$new_domain_name" ]; then
		set -- $new_domain_name
		new_domain_name="$1"
		conf="${conf}domain $new_domain_name\n"
		# Support RFC violating search in domain
		if [ -z "$new_domain_search" -a -n "$2" ]; then
			new_domain_search="$@@"
		fi
	fi
	if [ -n "$new_domain_search" ]; then
		conf="${conf}search $new_domain_search\n"
d75 1
a75 1
		conf="${conf}nameserver $x\n"
d78 1
a78 2
		[ -n "$metric" ] && export IF_METRIC="$metric"
		printf "$conf" | resolvconf -a "$interface"
d82 5
a86 2
	if [ -e "$resolv_conf_dir/$interface" ]; then
		rm -f "$resolv_conf_dir/$interface"
d88 1
a88 2
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
	printf "$conf" > "$resolv_conf_dir/$interface"
d95 1
a95 1
		resolvconf -d "$interface" -f
d97 2
a98 2
		if [ -e "$resolv_conf_dir/$interface" ]; then
			rm -f "$resolv_conf_dir/$interface"
d104 3
a106 3
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)	add_resolv_conf;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)	remove_resolv_conf;;
@


1.1.1.2.8.1
log
@Sync with HEAD.

Second commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
@
text
@d9 1
a9 1
resolv_conf_dir="$state_dir/resolv.conf"
d13 1
a13 1
	local cf="$state_dir/resolv.conf.$interface"
d17 1
a17 1
	interfaces=$(list_interfaces "$resolv_conf_dir")
d20 1
a20 1
	if [ -n "$interfaces" ]; then
d23 1
a23 1
			header="$header${header:+, }$x"
d27 1
a27 3
		domain=$(cd "$resolv_conf_dir"; \
			key_get_value "domain " ${interfaces})
		search=$(cd "$resolv_conf_dir"; \
d29 1
a29 8
		set -- ${domain}
		unset domain
		if [ -n "$2" ]; then
			search="$search $@@"
		elif [ -n "$1" ]; then
			domain="domain $1\n"
		fi
		[ -n "$search" ] && search="search $(uniqify $search)\n"
d32 1
a32 1
		srvs=$(cd "$resolv_conf_dir"; \
d35 1
a35 1
			servers="${servers}nameserver $x\n"
d38 1
a38 1
	header="$signature_base${header:+ $from }$header"
d41 2
a42 3
	[ -f "$cf" ] && rm -f "$cf"
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
	echo "$header" > "$cf"
d44 1
a44 1
		cat /etc/resolv.conf.head >> "$cf"
d46 1
a46 1
		echo "# /etc/resolv.conf.head can replace this line" >> "$cf"
d48 1
a48 1
	printf "$domain$search$servers" >> "$cf"
d50 1
a50 1
		cat /etc/resolv.conf.tail >> "$cf"
d52 1
a52 1
		echo "# /etc/resolv.conf.tail can replace this line" >> "$cf"
d54 1
a54 3
	cat "$cf" > /etc/resolv.conf
	chmod 644 /etc/resolv.conf
	rm -f "$cf"
d59 1
a59 1
	local x= conf="$signature\n"
d62 3
a64 3
	if [ -z "$new_domain_name_servers" -a \
		-z "$new_domain_name" -a \
		-z "$new_domain_search" ]; then
d69 4
a72 11
	if [ -n "$new_domain_name" ]; then
		set -- $new_domain_name
		new_domain_name="$1"
		conf="${conf}domain $new_domain_name\n"
		# Support RFC violating search in domain
		if [ -z "$new_domain_search" -a -n "$2" ]; then
			new_domain_search="$@@"
		fi
	fi
	if [ -n "$new_domain_search" ]; then
		conf="${conf}search $new_domain_search\n"
d75 1
a75 1
		conf="${conf}nameserver $x\n"
d78 1
a78 2
		[ -n "$metric" ] && export IF_METRIC="$metric"
		printf "$conf" | resolvconf -a "$interface"
d82 5
a86 2
	if [ -e "$resolv_conf_dir/$interface" ]; then
		rm -f "$resolv_conf_dir/$interface"
d88 1
a88 2
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
	printf "$conf" > "$resolv_conf_dir/$interface"
d95 1
a95 1
		resolvconf -d "$interface" -f
d97 2
a98 2
		if [ -e "$resolv_conf_dir/$interface" ]; then
			rm -f "$resolv_conf_dir/$interface"
d104 3
a106 3
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)	add_resolv_conf;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)	remove_resolv_conf;;
@


1.1.1.2.6.1
log
@Pull up following revision(s) (requested by roy in ticket #534):
	external/bsd/dhcpcd/dist/README: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/arp.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/arp.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/bind.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/bind.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/bpf-filter.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/bpf.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/client.c: removed
	external/bsd/dhcpcd/dist/client.h: removed
	external/bsd/dhcpcd/dist/common.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/common.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/config.h : dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/configure.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/configure.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/control.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/control.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcp.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcp.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd.8.in: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd.conf: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd.conf.5.in: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/duid.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/duid.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/eloop.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/eloop.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/if-bsd.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/if-options.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/if-options.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/if-pref.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/if-pref.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/ipv4ll.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/ipv4ll.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/logger.c: removed
	external/bsd/dhcpcd/dist/logger.h: removed
	external/bsd/dhcpcd/dist/net.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/net.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/signals.c: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/signals.h: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname: dhcpcd-5-0-1
	external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf: dhcpcd-5-0-1
Update to dhcpcd-5.0.1.
@
text
@d9 1
a9 1
resolv_conf_dir="$state_dir/resolv.conf"
d13 1
a13 1
	local cf="$state_dir/resolv.conf.$interface"
d17 1
a17 1
	interfaces=$(list_interfaces "$resolv_conf_dir")
d20 1
a20 1
	if [ -n "$interfaces" ]; then
d23 1
a23 1
			header="$header${header:+, }$x"
d27 1
a27 3
		domain=$(cd "$resolv_conf_dir"; \
			key_get_value "domain " ${interfaces})
		search=$(cd "$resolv_conf_dir"; \
d29 1
a29 8
		set -- ${domain}
		unset domain
		if [ -n "$2" ]; then
			search="$search $@@"
		elif [ -n "$1" ]; then
			domain="domain $1\n"
		fi
		[ -n "$search" ] && search="search $(uniqify $search)\n"
d32 1
a32 1
		srvs=$(cd "$resolv_conf_dir"; \
d35 1
a35 1
			servers="${servers}nameserver $x\n"
d38 1
a38 1
	header="$signature_base${header:+ $from }$header"
d41 2
a42 2
	[ -f "$cf" ] && rm -f "$cf"
	echo "$header" > "$cf"
d44 1
a44 1
		cat /etc/resolv.conf.head >> "$cf"
d46 1
a46 1
		echo "# /etc/resolv.conf.head can replace this line" >> "$cf"
d48 1
a48 1
	printf "$domain$search$servers" >> "$cf"
d50 1
a50 1
		cat /etc/resolv.conf.tail >> "$cf"
d52 1
a52 1
		echo "# /etc/resolv.conf.tail can replace this line" >> "$cf"
d54 1
a54 3
	cat "$cf" > /etc/resolv.conf
	chmod 644 /etc/resolv.conf
	rm -f "$cf"
d59 1
a59 1
	local x= conf="$signature\n"
d62 3
a64 3
	if [ -z "$new_domain_name_servers" -a \
		-z "$new_domain_name" -a \
		-z "$new_domain_search" ]; then
d69 4
a72 11
	if [ -n "$new_domain_name" ]; then
		set -- $new_domain_name
		new_domain_name="$1"
		conf="${conf}domain $new_domain_name\n"
		# Support RFC violating search in domain
		if [ -z "$new_domain_search" -a -n "$2" ]; then
			new_domain_search="$@@"
		fi
	fi
	if [ -n "$new_domain_search" ]; then
		conf="${conf}search $new_domain_search\n"
d75 1
a75 1
		conf="${conf}nameserver $x\n"
d78 1
a78 2
		[ -n "$metric" ] && export IF_METRIC="$metric"
		printf "$conf" | resolvconf -a "$interface"
d82 2
a83 2
	if [ -e "$resolv_conf_dir/$interface" ]; then
		rm -f "$resolv_conf_dir/$interface"
d85 2
a86 2
	if [ ! -d "$resolv_conf_dir" ]; then
		mkdir -p "$resolv_conf_dir"
d88 1
a88 1
	printf "$conf" > "$resolv_conf_dir/$interface"
d95 1
a95 1
		resolvconf -d "$interface" -f
d97 2
a98 2
		if [ -e "$resolv_conf_dir/$interface" ]; then
			rm -f "$resolv_conf_dir/$interface"
d104 3
a106 3
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)	add_resolv_conf;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)	remove_resolv_conf;;
@


1.1.1.2.6.2
log
@external/bsd/dhcpcd/dist/README                         patch
external/bsd/dhcpcd/dist/bind.c                         patch
Apply patch, requested by roy in ticket #759:
	external/bsd/dhcpcd/dist/config.h                       patch
	external/bsd/dhcpcd/dist/dhcpcd.c                       patch
	external/bsd/dhcpcd/dist/dhcpcd.conf                    patch
	external/bsd/dhcpcd/dist/net.c                          patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu            patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf    patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf       patch

Update dhcpcd to 5.0.4.
@
text
@a50 1
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
d104 3
a106 1
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
@


1.1.1.2.6.2.2.1
log
@Pull up following revision(s) (requested by spz in ticket #1603):
	external/bsd/dhcpcd/dist/dhcp.c                         patch
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in          patch
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in            patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf    patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname       patch
Escape | and & characters before passing the value to the shell
Ensure we set a valid hostname, DNS domain and NIS domain.
Document the need for input validation in dhcpcd-run-hooks(8).
Fixes CVE-2011-996
@
text
@d84 1
a84 5
		if valid_domainname "$new_domain_name"; then
			conf="${conf}domain $new_domain_name\n"
		else
			syslog err "Invalid domain name: $new_domain_name"
		fi
d91 1
a91 5
		if valid_domainname_list; then
			conf="${conf}search $new_domain_search\n"
		else
			syslog err "Invalid domain name in list: $new_domain_search"
		fi
@


1.1.1.2.6.3
log
@Pull up following revision(s) (requested by spz in ticket #1603):
	external/bsd/dhcpcd/dist/dhcp.c                         patch
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in          patch
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in            patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf    patch
	external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname       patch
Escape | and & characters before passing the value to the shell
Ensure we set a valid hostname, DNS domain and NIS domain.
Document the need for input validation in dhcpcd-run-hooks(8).
Fixes CVE-2011-996
@
text
@d84 1
a84 5
		if valid_domainname "$new_domain_name"; then
			conf="${conf}domain $new_domain_name\n"
		else
			syslog err "Invalid domain name: $new_domain_name"
		fi
d91 1
a91 5
		if valid_domainname_list; then
			conf="${conf}search $new_domain_search\n"
		else
			syslog err "Invalid domain name in list: $new_domain_search"
		fi
@


1.1.1.3
log
@Import dhcpcd-5.0.0

Major changes from dhcpcd-4 include
 * Single daemon can now run DHCP on multiple interfaces at the same time
 * Configuration profiles per interface, ssid, arping and fallback
 * Listens to 3rd party programs changing routing information
 * Supports DHCP INFORM over PPP
 * Can configure static options for destination address
 * Control socket so 3rd party program can control or listen directly
   to dhcpcd events
 * Is also a BOOTP client
@
text
@d9 1
a9 1
resolv_conf_dir="$state_dir/resolv.conf"
d13 1
a13 1
	local cf="$state_dir/resolv.conf.$interface"
d17 1
a17 1
	interfaces=$(list_interfaces "$resolv_conf_dir")
d20 1
a20 1
	if [ -n "$interfaces" ]; then
d23 1
a23 1
			header="$header${header:+, }$x"
d27 1
a27 3
		domain=$(cd "$resolv_conf_dir"; \
			key_get_value "domain " ${interfaces})
		search=$(cd "$resolv_conf_dir"; \
d29 1
a29 8
		set -- ${domain}
		unset domain
		if [ -n "$2" ]; then
			search="$search $@@"
		elif [ -n "$1" ]; then
			domain="domain $1\n"
		fi
		[ -n "$search" ] && search="search $(uniqify $search)\n"
d32 1
a32 1
		srvs=$(cd "$resolv_conf_dir"; \
d35 1
a35 1
			servers="${servers}nameserver $x\n"
d38 1
a38 1
	header="$signature_base${header:+ $from }$header"
d41 2
a42 2
	[ -f "$cf" ] && rm -f "$cf"
	echo "$header" > "$cf"
d44 1
a44 1
		cat /etc/resolv.conf.head >> "$cf"
d46 1
a46 1
		echo "# /etc/resolv.conf.head can replace this line" >> "$cf"
d48 1
a48 1
	printf "$domain$search$servers" >> "$cf"
d50 1
a50 1
		cat /etc/resolv.conf.tail >> "$cf"
d52 1
a52 1
		echo "# /etc/resolv.conf.tail can replace this line" >> "$cf"
d54 1
a54 3
	cat "$cf" > /etc/resolv.conf
	chmod 644 /etc/resolv.conf
	rm -f "$cf"
d59 1
a59 1
	local x= conf="$signature\n"
d62 3
a64 3
	if [ -z "$new_domain_name_servers" -a \
		-z "$new_domain_name" -a \
		-z "$new_domain_search" ]; then
d69 4
a72 11
	if [ -n "$new_domain_name" ]; then
		set -- $new_domain_name
		new_domain_name="$1"
		conf="${conf}domain $new_domain_name\n"
		# Support RFC violating search in domain
		if [ -z "$new_domain_search" -a -n "$2" ]; then
			new_domain_search="$@@"
		fi
	fi
	if [ -n "$new_domain_search" ]; then
		conf="${conf}search $new_domain_search\n"
d75 1
a75 1
		conf="${conf}nameserver $x\n"
d78 1
a78 2
		[ -n "$metric" ] && export IF_METRIC="$metric"
		printf "$conf" | resolvconf -a "$interface"
d82 2
a83 2
	if [ -e "$resolv_conf_dir/$interface" ]; then
		rm -f "$resolv_conf_dir/$interface"
d85 2
a86 2
	if [ ! -d "$resolv_conf_dir" ]; then
		mkdir -p "$resolv_conf_dir"
d88 1
a88 1
	printf "$conf" > "$resolv_conf_dir/$interface"
d95 1
a95 1
		resolvconf -d "$interface" -f
d97 2
a98 2
		if [ -e "$resolv_conf_dir/$interface" ]; then
			rm -f "$resolv_conf_dir/$interface"
d104 3
a106 3
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)	add_resolv_conf;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)	remove_resolv_conf;;
@


1.1.1.4
log
@Update dhcpcd to 5.0.2

Changes from 5.0.1 include
 * -n option now starts dhcpcd if not already started
 * 29-lookup-hostname hook installed by default, but skipped in dhcpcd.conf
 * Fix warning about missing dirs if we don't have any existing state
 * Fix compile on some Linux distros re linux/wireless.h
@
text
@a50 1
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
d104 3
a106 1
	[ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
@


1.1.1.5
log
@Import dhcpcd-5.2.8 with the following changes from 5.2.4
* Use dynamically sized buffers for reading kernel link events
* Use the active link address
* Added option to dump a lease to stdout
* TEST mode now works correctly if an old lease is NAKed
* routes with the gateway = leased ip are now treated as host routes
@
text
@d122 4
a125 5
if $if_up; then
	add_resolv_conf
elif $if_down; then
	remove_resolv_conf
fi
@


1.1.1.6
log
@Import dhcpcd-5.1.12 with the following changes:
* 20-resolv.conf now uses the correct variable for $IF_METRIC
* Exclude interface values when dumping the lease
* Parse static value subnet_mask when it exists instead of deriving from
  ip address
* logger calls now resemble dhcpcd calls to syslog(3)
* Reject offered IP address if INADDR_BROADCAST or INADDR_ANY
* Change the route if source address has changed
* Note the address we are requesting in the broadcast log entry
* When operating on one interface, respect the timeout for in dhcpcd.conf
* Escape | and & characters before passing the value to the shell
  Ensure we set a valid hostname, DNS domain and NIS domain.
  Document the need for input validation in dhcpcd-run-hooks(8).
  Fixes CVE-2011-996
  Based on a patch to dhcpcd-3 by Marius Tomaschewski <mt@@suse.de>
@
text
@d84 1
a84 5
		if valid_domainname "$new_domain_name"; then
			conf="${conf}domain $new_domain_name\n"
		else
			syslog err "Invalid domain name: $new_domain_name"
		fi
d91 1
a91 5
		if valid_domainname_list; then
			conf="${conf}search $new_domain_search\n"
		else
			syslog err "Invalid domain name in list: $new_domain_search"
		fi
d97 1
a97 1
		[ -n "$ifmetric" ] && export IF_METRIC="$ifmetric"
@


1.1.1.6.4.1
log
@sync with head
@
text
@a9 2
NL="
"
d13 1
a13 1
	local cf="$state_dir/resolv.conf.$ifname"
d34 1
a34 1
			search="$search $*"
d36 1
a36 1
			domain="domain $1$NL"
d38 1
a38 1
		[ -n "$search" ] && search="search $(uniqify $search)$NL"
d44 1
a44 1
			servers="${servers}nameserver $x$NL"
d58 1
a58 1
	printf %s "$domain$search$servers" >> "$cf"
d64 2
a65 3
	if change_file /etc/resolv.conf "$cf"; then
		chmod 644 /etc/resolv.conf
	fi
d71 1
a71 9
	local x= conf="$signature$NL" i=${ra_count:-0} ra=

	while [ $i -ne 0 ]; do
		eval ra=\$ra${i}_rdnss
		new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$ra"
		eval ra=\$ra${i}_dnssl
		new_domain_search="$new_domain_search${new_domain_search:+ }$ra"
		i=$(($i - 1))
	done
d85 1
a85 1
			conf="${conf}domain $new_domain_name$NL"
d91 1
a91 1
			new_domain_search="$*"
d96 1
a96 1
			conf="${conf}search $new_domain_search$NL"
d102 1
a102 1
		conf="${conf}nameserver $x$NL"
d106 1
a106 1
		printf %s "$conf" | resolvconf -a "$ifname"
d110 2
a111 2
	if [ -e "$resolv_conf_dir/$ifname" ]; then
		rm -f "$resolv_conf_dir/$ifname"
d114 1
a114 1
	printf %s "$conf" > "$resolv_conf_dir/$ifname"
d121 1
a121 1
		resolvconf -d "$ifname" -f
d123 2
a124 2
		if [ -e "$resolv_conf_dir/$ifname" ]; then
			rm -f "$resolv_conf_dir/$ifname"
d130 1
a130 1
if $if_up || [ "$reason" = ROUTERADVERT ]; then
@


1.1.1.6.4.2
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
@a0 2
# $NetBSD$

d34 7
a40 6
		domain="$1"
		[ -n "$2" ] && search="$search $*"
		[ -n "$search" ] && search="$(uniqify $search)"
		[ "$domain" = "$search" ] && search=
		[ -n "$domain" ] && domain="domain $domain$NL"
		[ -n "$search" ] && search="search $search$NL"
a91 11
	# Derive a new domain from our various hostname options
	if [ -z "$new_domain_name" ]; then
		if [ "$new_dhcp6_fqdn" != "${new_dhcp6_fqdn#*.}" ]; then
			new_domain_name="${new_dhcp6_fqdn#*.}"
		elif [ "$new_fqdn" != "${new_fqdn#*.}" ]; then
			new_domain_name="${new_fqdn#*.}"
		elif [ "$new_host_name" != "${new_host_name#*.}" ]; then
			new_domain_name="${new_host_name#*.}"
		fi
	fi

d105 2
a106 4
	if [ -n "$new_domain_search" -a \
	    "$new_domain_search" != "$new_domain_name" ]
	then
		if valid_domainname_list $new_domain_search; then
a140 8
# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_domain_name_servers="$new_dhcp6_name_servers"
	new_domain_search="$new_dhcp6_domain_search"
	;;
esac

@


1.1.1.7
log
@Import dhcpcd-5.5.0 with the following changes:

* Shell portability fixes, including proper printf usage.
* Detect a valid ntp.conf before adjusting it
* reboot timeout changed to 5 seconds
* When rebooting and not daemonized, reduce the discover timeout
  to allow for fallback or IPv4LL
* Respect each kernel carrier message
* Optimize some bitwise logic
* Don't remove interfaces for which commands have not been sent
* Store the assigned metric to each route so that we can change metrics on the fly
  dhcpcd -n --metric 100 iwi0
* Add SixRD support, RFC5969
* Fix SIP server support
* Only regen resolv.conf if it has changed
* Fix --reconfigure from spinning
* Add IPv6 Router Solicitation support we regards to RDNSS and DNSSL, RFC6016
@
text
@a9 2
NL="
"
d13 1
a13 1
	local cf="$state_dir/resolv.conf.$interface$ifsuffix"
d34 1
a34 1
			search="$search $*"
d36 1
a36 1
			domain="domain $1$NL"
d38 1
a38 1
		[ -n "$search" ] && search="search $(uniqify $search)$NL"
d44 1
a44 1
			servers="${servers}nameserver $x$NL"
d58 1
a58 1
	printf %s "$domain$search$servers" >> "$cf"
d64 2
a65 3
	if change_file /etc/resolv.conf "$cf"; then
		chmod 644 /etc/resolv.conf
	fi
d71 1
a71 9
	local x= conf="$signature$NL" i=${new_ra_count:-0} ra=

	while [ $i -ne 0 ]; do
		eval ra=\$new_ra${i}_rdnss
		new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$ra"
		eval ra=\$new_ra${i}_dnssl
		new_domain_search="$new_domain_search${new_domain_search:+ }$ra"
		i=$(($i - 1))
	done
d85 1
a85 1
			conf="${conf}domain $new_domain_name$NL"
d91 1
a91 1
			new_domain_search="$*"
d96 1
a96 1
			conf="${conf}search $new_domain_search$NL"
d102 1
a102 1
		conf="${conf}nameserver $x$NL"
d106 1
a106 1
		printf %s "$conf" | resolvconf -a "$interface$ifsuffix"
d110 2
a111 2
	if [ -e "$resolv_conf_dir/$interface$ifsuffix" ]; then
		rm -f "$resolv_conf_dir/$interface$ifsuffix"
d114 1
a114 1
	printf %s "$conf" > "$resolv_conf_dir/$interface$ifsuffix"
d121 1
a121 1
		resolvconf -d "$interface$ifsuffix" -f
d123 2
a124 2
		if [ -e "$resolv_conf_dir/$interface$ifsuffix" ]; then
			rm -f "$resolv_conf_dir/$interface$ifsuffix"
a129 6
if [ "$reason" = ROUTERADVERT ]; then
	ifsuffix=":ra"
else
	ifsuffix=
fi

@


1.1.1.8
log
@Import dhcpcd-5.5.1 with the following changes:
* Don't start IPv6 RS if disabled globally
* Allow dhcpcd to run on a read only filesystem
* Don't attempt to run the script if an empty string or /dev/null
* Stop truncating the netmask sockaddr on routing messages for BSD
@
text
@d15 1
a15 1
	local cf="$state_dir/resolv.conf.$interface$if_suffix"
d117 1
a117 1
		printf %s "$conf" | resolvconf -a "$interface$if_suffix"
d121 2
a122 2
	if [ -e "$resolv_conf_dir/$interface$if_suffix" ]; then
		rm -f "$resolv_conf_dir/$interface$if_suffix"
d125 1
a125 1
	printf %s "$conf" > "$resolv_conf_dir/$interface$if_suffix"
d132 1
a132 1
		resolvconf -d "$interface$if_suffix" -f
d134 2
a135 2
		if [ -e "$resolv_conf_dir/$interface$if_suffix" ]; then
			rm -f "$resolv_conf_dir/$interface$if_suffix"
d141 7
a147 1
if $if_up || [ "$reason" = ROUTERADVERT ]; then
@


1.1.1.9
log
@Import dhcpcd-5.5.2 with the following changes:
* Stop checking IFF_RUNNING in RTM_IFINFO in an unknown link state
* RA expiry now tiggers off the first option if newer than the prefix
* Prefer a DHCP lease over an IPv4LL one
@
text
@d74 1
a74 1
	local x= conf="$signature$NL" i=${ra_count:-0} ra=
d77 1
a77 1
		eval ra=\$ra${i}_rdnss
d79 1
a79 1
		eval ra=\$ra${i}_dnssl
@


1.1.1.9.2.1
log
@Apply patch (requested by roy in ticket #585):

Update dhcpcd to version 5.6.2.
@
text
@d15 1
a15 1
	local cf="$state_dir/resolv.conf.$ifname"
d117 1
a117 1
		printf %s "$conf" | resolvconf -a "$ifname"
d121 2
a122 2
	if [ -e "$resolv_conf_dir/$ifname" ]; then
		rm -f "$resolv_conf_dir/$ifname"
d125 1
a125 1
	printf %s "$conf" > "$resolv_conf_dir/$ifname"
d132 1
a132 1
		resolvconf -d "$ifname" -f
d134 2
a135 2
		if [ -e "$resolv_conf_dir/$ifname" ]; then
			rm -f "$resolv_conf_dir/$ifname"
@


1.1.1.10
log
@* Fixed a potential segfault with IPv6 option handling
* Add a suffix to all our config files so that RA never stamps on IPv4
* All valgrind errors fixed on FreeBSD (with ./configure --debug=YES)
* When started with an interface list, respect that with signal handling
* Fix a potential route table corruption if we failed to add a route
@
text
@d15 1
a15 1
	local cf="$state_dir/resolv.conf.$ifname"
d117 1
a117 1
		printf %s "$conf" | resolvconf -a "$ifname"
d121 2
a122 2
	if [ -e "$resolv_conf_dir/$ifname" ]; then
		rm -f "$resolv_conf_dir/$ifname"
d125 1
a125 1
	printf %s "$conf" > "$resolv_conf_dir/$ifname"
d132 1
a132 1
		resolvconf -d "$ifname" -f
d134 2
a135 2
		if [ -e "$resolv_conf_dir/$ifname" ]; then
			rm -f "$resolv_conf_dir/$ifname"
@


1.1.1.10.2.1
log
@resync from head
@
text
@a0 2
# $NetBSD$

a140 8
# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_domain_name_servers="$new_dhcp6_name_servers"
	new_domain_search="$new_dhcp6_domain_search"
	;;
esac

@


1.1.1.10.2.2
log
@Rebase to HEAD as of a few days ago.
@
text
@d36 7
a42 6
		domain="$1"
		[ -n "$2" ] && search="$search $*"
		[ -n "$search" ] && search="$(uniqify $search)"
		[ "$domain" = "$search" ] && search=
		[ -n "$domain" ] && domain="domain $domain$NL"
		[ -n "$search" ] && search="search $search$NL"
d76 1
a76 1
	local x= conf="$signature$NL" i=${ra_count:-0} ra= warn=true
a93 11
	# Derive a new domain from our various hostname options
	if [ -z "$new_domain_name" ]; then
		if [ "$new_dhcp6_fqdn" != "${new_dhcp6_fqdn#*.}" ]; then
			new_domain_name="${new_dhcp6_fqdn#*.}"
		elif [ "$new_fqdn" != "${new_fqdn#*.}" ]; then
			new_domain_name="${new_fqdn#*.}"
		elif [ "$new_host_name" != "${new_host_name#*.}" ]; then
			new_domain_name="${new_host_name#*.}"
		fi
	fi

d96 3
a98 2
		if valid_domainname "$1"; then
			conf="${conf}domain $1$NL"
d100 1
a100 1
			syslog err "Invalid domain name: $1"
d102 3
a104 4
		# If there is no search this, make this one
		if [ -z "$new_domain_search" ]; then
			new_domain_search="$new_domain_name"
			[ "$new_domain_name" = "$1" ] && warn=true
d108 1
a108 1
		if valid_domainname_list $new_domain_search; then
d110 2
a111 3
		elif ! $warn; then
			syslog err "Invalid domain name in list:" \
			    "$new_domain_search"
@


1.1.1.11
log
@Import dhcpcd-6.0.0 with the following changes:
 * DHCPv6 support
 * wpa_supplicant hook script
 * route IPv4 addresses to 127.0.0.1 for machine centric traffic
 * DHCPv6 Prefix Delegation support
 * DHCPv6 FQDN support
 * Control existing IPv4 routes
 * less spamy to syslog by default
 * IPv6 protocols now wait for a valid LL address before starting
 * IPv6 DAD support now listens to kernel for more accurate timings
 * IPv4 code split out more cleanly so dhcpcd can be compiled for
   IPv4, IPv6 or IPv4 AND IPv6
 * MTU is no longer requested by default
 * a DUID is now generated in /etc/dhcpcd.duid and this is used as a
   client ID for DHCPv4 and DHCPv6
   This does mean that you may get new DHCPv4 addresses

Many bugs have also been fixed along the way and this release addresses
the following PR's

PR bin/47364
PR bin/47502
PR bin/47666
PR bin/47699
PR bin/47775
PR bin/47776
@
text
@a0 2
# $NetBSD: $

a140 8
# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_domain_name_servers="$new_dhcp6_name_servers"
	new_domain_search="$new_dhcp6_domain_search"
	;;
esac

@


1.1.1.12
log
@Import dhcpcd-6.0.4 with the following changes:
* hostname is not stamped on anymore if already set
* hostname will be set to a FQDN when possible as per RFC4702 section 3.1
* a domain is derived from the FQDN if no domain option is set
* add new hostname_short command to send a short hostname for DDNS
* hostname_fqdn is now documented, along with a new server setting and the
  potential problems associated with it
* the FQDN option is no longer sent by default for DHCPv4 messages
@
text
@a93 12
	# Derive a new domain from our various hostname options
	new_domain_name=
	if [ -z "$new_domain_name" ]; then
		if [ "$new_dhcp6_fqdn" != "${new_dhcp6_fqdn#*.}" ]; then
			new_domain_name="${new_dhcp6_fqdn#*.}"
		elif [ "$new_fqdn" != "${new_fqdn#*.}" ]; then
			new_domain_name="${new_fqdn#*.}"
		elif [ "$new_host_name" != "${new_host_name#*.}" ]; then
			new_domain_name="${new_host_name#*.}"
		fi
	fi

@


1.1.1.13
log
@Import dhcpcd-6.0.5
 * Fix the domain option (broken in 6.0.4)
 * Don't write a search line in resolv.con if it matches the domain
@
text
@d36 7
a42 6
		domain="$1"
		[ -n "$2" ] && search="$search $*"
		[ -n "$search" ] && search="$(uniqify $search)"
		[ "$domain" = "$search" ] && search=
		[ -n "$domain" ] && domain="domain $domain$NL"
		[ -n "$search" ] && search="search $search$NL"
d95 1
d119 1
a119 3
	if [ -n "$new_domain_search" -a \
	    "$new_domain_search" != "$new_domain_name" ]
	then
@


1.1.1.14
log
@Import dhcpcd-6.1.0 with the following changes:
* Fixed a segfault when configuring a static route in dhcpcd.conf
* Merged IPv6 ND and RA codebases
* Persistent configuration is now a default option in dhcpcd.conf
* Store configured IPv4 addresses against the interface so we only add
  them if actually missing to avoid RTM_DELADDR/NEWADDR loops on some OS's
* waitip now supports waiting for any, IPv4, IPv6 or both protocols
* DHCPv6 addresses are added with a /128 prefix and should not attempt to
  associate with any existing prefix or make one up as per RFC 5942
* Fix initial carrier status
* Fix requesting >1 DHCPv6 address

Fixes PR bin/48140
@
text
@d120 1
a120 1
		if valid_domainname_list $new_domain_search; then
@


1.1.1.14.2.1
log
@Rebase.
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.1.1.15 2014/07/14 11:45:06 roy Exp $
d75 1
a75 1
	local x= conf="$signature$NL" i=${ra_count:-0} ra= warn=true
d106 3
a108 2
		if valid_domainname "$1"; then
			conf="${conf}domain $1$NL"
d110 1
a110 1
			syslog err "Invalid domain name: $1"
d112 3
a114 4
		# If there is no search this, make this one
		if [ -z "$new_domain_search" ]; then
			new_domain_search="$new_domain_name"
			[ "$new_domain_name" = "$1" ] && warn=true
d117 3
a119 1
	if [ -n "$new_domain_search" ]; then
d122 2
a123 3
		elif ! $warn; then
			syslog err "Invalid domain name in list:" \
			    "$new_domain_search"
@


1.1.1.15
log
@Import dhcpcd-6.4.1 with the following changes:

  *  If just given a domain and no search list, make the search list the domain
  *  Skip arpping directives if we have a profile but not parsing one
  *  Allow the request of a DHCPv6 address or prefix, a prefix length must be
     specified
  *  Add the ability to dump DHCPv6 leases
  *  Improve startup with regards to carrier checking and adding a link-local
     IPv6 address
  *  Start the correct interface reference for added devices
  *  Support
     http://datatracker.ietf.org/doc/draft-ietf-dhc-dhcpv6-stateful-issues-06
     via the ia_pd_mix option
  *  Fix link handling where kernel reported flags in LINK_UP may not be
     valid when we actually process them
  *  Fix defining new options in dhcpcd.conf and requesting them
  *  Fix a potential segfault when reloading configurations
  *  Print user defined options via -V
  *  Add support for RFC6603, Prefix Exclude option
  *  When requesting a IA_PD and another IA type, create a psuedo interface
     to handle the IA_PD
  *  Handle truncated DHCPv6 saved leases
@
text
@d75 1
a75 1
	local x= conf="$signature$NL" i=${ra_count:-0} ra= warn=true
d106 3
a108 2
		if valid_domainname "$1"; then
			conf="${conf}domain $1$NL"
d110 1
a110 1
			syslog err "Invalid domain name: $1"
d112 3
a114 4
		# If there is no search this, make this one
		if [ -z "$new_domain_search" ]; then
			new_domain_search="$new_domain_name"
			[ "$new_domain_name" = "$1" ] && warn=true
d117 3
a119 1
	if [ -n "$new_domain_search" ]; then
d122 2
a123 3
		elif ! $warn; then
			syslog err "Invalid domain name in list:" \
			    "$new_domain_search"
@


1.1.1.15.2.1
log
@Pullup the import of dhcpcd-6.6.7, requested by roy in #207
@
text
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.6 2014/11/07 20:51:03 roy Exp $
@


1.1.1.15.2.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
@d1 1
a1 1
# $NetBSD: 20-resolv.conf,v 1.1.1.15.2.1 2014/12/29 16:18:05 martin Exp $
@


1.1.1.16
log
@Import dhcpcd-6.6.1 with the following changes:
  *  Improve handling of the IPv6LL address at startup
  *  Support old Linux kernels where IFLA_AF_SPEC may not exist
  *  When stopping interfaces, skip past pseudo interfaces instead
     of finding the master as only the masters are sorted correctly

RCSIDs have been removed from the import and will be added afterwards
as patches as technically they are not part of the dhcpcd project directly.
Hopefully this will be future imports less painful.
@
text
@d1 1
a1 1

@


1.1.1.17
log
@Reimport dhcpcd-6.6.1 with correct hooks
@
text
@d1 2
@


1.1.1.18
log
@Import dhcpcd-6.9.0 with the following changes:

  *  Fix IPv6 prefix underflow when confirming deprecated but valid leases
  *  eloop.c and .h are now 100% portable outside of dhcpcd
     (provided the system supports recent POSIX and either you or
     the system provide working TAILQ macros)
  *  Allow waitip to work per interface.
  *  Handle ND options in the same way we handle DHCP and DHCPv6 options.
  *  Add new variable of type bitflags:flags where the flags ABCDEFGH,
     A is 10000000, B is 01000000, etc.
     Variables with the name reserved are no longer processed.
  *  Improve IN_IFF_TENTATIVE with ip sharing.
@
text
@a70 30
# Extract any ND DNS options from the RA
# For now, we ignore the lifetime of the DNS options unless they
# are absent or zero.
# In this case they are removed from consideration.
# See draft-gont-6man-slaac-dns-config-issues-01 for issues
# regarding DNS option lifetime in ND messages.
eval_nd_dns()
{

	eval ltime=\$nd${i}_rdnss${j}_lifetime
	if [ -z "$ltime" -o "$ltime" = 0 ]; then
		rdnss=
	else
		eval rdnss=\$nd${i}_rdnss${j}_servers
	fi
	eval ltime=\$nd${i}_dnssl${j}_lifetime
	if [ -z "$ltime" -o "$ltime" = 0 ]; then
		dnssl=
	else
		eval dnssl=\$nd${i}_dnssl${j}_search
	fi

	[ -z "$rdnss" -a -z "$dnssl" ] && return 1

	new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
	new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
	j=$(($j + 1))
	return 0
}

d73 1
a73 2
	local x= conf="$signature$NL" warn=true
	local i j ltime rdnss dnssl new_rdnss new_dnssl
d75 6
a80 10
	# Loop to extract the ND DNS options using our indexed shell values
	i=1
	j=1
	while true; do
		while true; do
			eval_nd_dns || break
		done
		i=$(($i + 1))
		j=1
		eval_nd_dns || break
a81 2
	new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$new_rdnss"
	new_domain_search="$new_domain_search${new_domain_search:+ }$new_dnssl"
@


1.1.1.19
log
@Import dhcpcd-6.9.2 with the following changes:
  *  Only run the IPv4LL script and rebuild routes on drop when
     an address is actually dropped.
  *  Add noup directive to stop master mode bringing an interface up.
  *  If only IPv4LL addresses exist, assign a default route to the
     interface so that IPv4LL can talk to non IPv4LL on the same link.
  *  Set DHCPv4 MTU on routes instead of the interface.
     This matches IPv6 behaviour and works around dodgy interfaces
     where a MTU change can reset the PHY causing an infinite loop.
  *  MTU is now requested by default in dhcpcd.conf again.
  *  noauthrequired also allows unauthenticated FORCERENEW and
     RECONFIGURE messages.
  *  Simplify the socket code by adding a custom function instead of
     having the same #ifdef mess for systems without SOCK_CLOEXEC.
     Thanks to Christos Zoulas.
  *  Don't do platform init or setting interface MTU if too small when
     testing or dumping leases.
  *  Build new_domain_name from other sources if blank before checking
     it's blank to remove any prior config. Thanks to Paul Walrath.
  *  Describe adding an IPv6 temporary address.
  *  Don't delete dhcpcd assigned IPv6 link-local addresses when
     releasing leases.
  *  Reference old DHCPv6 FQDN when processing the hostname.
@
text
@d120 8
a138 8
	# If we don't have any configuration, remove it
	if [ -z "$new_domain_name_servers" -a \
		-z "$new_domain_name" -a \
		-z "$new_domain_search" ]; then
		remove_resolv_conf
		return $?
	fi

@


1.1.1.20
log
@Import dhcpcd-6.11.1 with the following changes:
  *  Fix truncated packet handling where the DHCP message is less than the
     BOOTP size
  *  Rework the raw socket handling around an fd for initial Solaris support
  *  Only pull one message from the raw socket - eloop will handle the looping
  *  Netmask fixes for STATIC and INFORM
  *  Rework if_address to use struct ipv4_addr, like the ipv6 counter parts
  *  Split BSD handlink into many smaller functions to improve readability
  *  empty DNS entries are no longer created
  *  Test for hostname_fqdn being set to server or blank
  *  Allow an SLA 0 and prefix length of 0 to delegate the whole prefix
     ia_pd 1 wm1/0
  *  Fix prefix delegation address timings on renew
@
text
@d95 2
a96 2
	[ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
	[ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
d117 2
a118 4
	[ -n "$new_rdnss" ] && \
	    new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$new_rdnss"
	[ -n "$new_dnssl" ] && \
	    new_domain_search="$new_domain_search${new_domain_search:+ }$new_dnssl"
@


1.1.1.21
log
@Import dhcpcd-6.11.2 with the following changes:
  *  It's now possible to exclude the vendor-class option.
  *  Fixed a NULL pointer dereference when checking ARP conflicts.
  *  Revert a change in 6.11.1 which causes some packets not to be
     read correctly from the BPF socket.
  *  Commandline options are now applied to profiles.
  *  Simplified route handling on BSD.
  *  Fix expiration of IPv6 routers if a static route was present.
  *  --inactive now starts with all interfaces inactive.
     subsequent calls to dhcpcd can activate/deactivate them.
@
text
@a11 1
: ${resolvconf:=resolvconf}
d165 1
a165 1
	if type "$resolvconf" >/dev/null 2>&1; then
d167 1
a167 1
		printf %s "$conf" | "$resolvconf" -a "$ifname"
d181 2
a182 2
	if type "$resolvconf" >/dev/null 2>&1; then
		"$resolvconf" -d "$ifname" -f
@


1.1.1.2.4.1
log
@file 20-resolv.conf was added on branch haad-dm on 2008-10-19 22:39:49 +0000
@
text
@d1 107
@


1.1.1.2.4.2
log
@Sync with HEAD.
@
text
@a0 107
# Generate /etc/resolv.conf
# Support resolvconf(8) if available
# We can merge other dhcpcd resolv.conf files into one like resolvconf,
# but resolvconf is preferred as other applications like VPN clients
# can readily hook into it.
# Also, resolvconf can configure local nameservers such as bind
# or dnsmasq. This is important as the libc resolver isn't that powerful.

resolv_conf_dir="${state_dir}/resolv.conf"

build_resolv_conf()
{
	local cf="/etc/resolv.conf.${interface}"
	local interfaces= header= search= srvs= servers= x=

	# Build a list of interfaces
	interfaces=$(list_interfaces "${resolv_conf_dir}")

	# Build the resolv.conf
	if [ -n "${interfaces}" ]; then
		# Build the header
		for x in ${interfaces}; do
			header="${header}${header:+, }${x}"
		done

		# Build the search list
		search=$(cd "${resolv_conf_dir}"; \
			key_get_value "search " ${interfaces})
		[ -n "${search}" ] && search="search $(uniqify ${search})\n"

		# Build the nameserver list
		srvs=$(cd "${resolv_conf_dir}"; \
			key_get_value "nameserver " ${interfaces})
		for x in $(uniqify ${srvs}); do
			servers="${servers}nameserver ${x}\n"
		done
	fi
	header="${signature_base}${header:+ ${from} }${header}"

	# Assemble resolv.conf using our head and tail files
	[ -f "${cf}" ] && rm -f "${cf}"
	echo "${header}" > "${cf}"
	if [ -f /etc/resolv.conf.head ]; then
		cat /etc/resolv.conf.head >> "${cf}"
	else
		echo "# /etc/resolv.conf.head can replace this line" >> "${cf}"
	fi
	printf "${search}${servers}" >> "${cf}"
	if [ -f /etc/resolv.conf.tail ]; then
		cat /etc/resolv.conf.tail >> "${cf}"
	else
		echo "# /etc/resolv.conf.tail can replace this line" >> "${cf}"
	fi
	mv -f "${cf}" /etc/resolv.conf
}

add_resolv_conf()
{
	local x= conf="${signature}\n"

	# If we don't have any configuration, remove it
	if [ -z "${new_domain_name_servers}" -a \
		-z "${new_domain_name}" -a \
		-z "${new_domain_search}" ]; then
		remove_resolv_conf
		return $?
	fi

	if [ -n "${new_domain_search}" ]; then
		conf="${conf}search ${new_domain_search}\n"
	elif [ -n "${new_domain_name}" ]; then
		conf="${conf}search ${new_domain_name}\n"
	fi
	for x in ${new_domain_name_servers}; do
		conf="${conf}nameserver ${x}\n"
	done
	if type resolvconf >/dev/null 2>&1; then
		printf "${conf}" | resolvconf -a "${interface}"
		return $?
	fi

	if [ -e "${resolv_conf_dir}/${interface}" ]; then
		rm -f "${resolv_conf_dir}/${interface}"
	fi
	if [ ! -d "${resolv_conf_dir}" ]; then
		mkdir -p "${resolv_conf_dir}"
	fi
	printf "${conf}" > "${resolv_conf_dir}/${interface}"
	build_resolv_conf
}

remove_resolv_conf()
{
	if type resolvconf >/dev/null 2>&1; then
		resolvconf -d "${interface}" -f
	else
		if [ -e "${resolv_conf_dir}/${interface}" ]; then
			rm -f "${resolv_conf_dir}/${interface}"
		fi
		build_resolv_conf
	fi
}

case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)	add_resolv_conf;;
PREINIT|EXPIRE|FAIL|IPV4LL|RELEASE|STOP)	remove_resolv_conf;;
esac
@


1.1.1.1.2.1
log
@file 20-resolv.conf was added on branch wrstuden-revivesa on 2008-09-18 05:14:27 +0000
@
text
@d1 40
@


1.1.1.1.2.2
log
@Sync with wrstuden-revivesa-base-2.
@
text
@a0 40
# Generate /etc/resolv.conf
# Support resolvconf(8) if available

make_resolv_conf()
{
	if [ -z "${new_domain_name_servers}" -a \
		-z "${new_domain_name}" -a \
		-z "${new_domain_search}" ]; then
		return 0
	fi
	local x= conf="${signature}\n"
	if [ -n "${new_domain_search}" ]; then
		conf="${conf}search ${new_domain_search}\n"
	elif [ -n "${new_domain_name}" ]; then
		conf="${conf}search ${new_domain_name}\n"
	fi
	for x in ${new_domain_name_servers}; do
		conf="${conf}nameserver ${x}\n"
	done
	if type resolvconf >/dev/null 2>&1; then
		printf "${conf}" | resolvconf -a "${interface}"
	else
		save_conf /etc/resolv.conf
		printf "${conf}" > /etc/resolv.conf
	fi
}

restore_resolv_conf()
{
	if type resolvconf >/dev/null 2>&1; then
		resolvconf -d "${interface}" -f
	else
		restore_conf /etc/resolv.conf || return 0
	fi
}

case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)	make_resolv_conf;;
EXPIRE|FAIL|IPV4LL|RELEASE|STOP)		restore_resolv_conf;;
esac
@
