head	1.8;
access;
symbols
	perseant-exfatfs-base-20250801:1.8
	perseant-exfatfs-base-20240630:1.8
	perseant-exfatfs:1.8.0.12
	perseant-exfatfs-base:1.8
	cjep_sun2x:1.8.0.10
	cjep_sun2x-base:1.8
	cjep_staticlib_x-base1:1.8
	cjep_staticlib_x:1.8.0.8
	cjep_staticlib_x-base:1.8
	phil-wifi-20200421:1.8
	phil-wifi-20200411:1.8
	phil-wifi-20200406:1.8
	pgoyette-compat-merge-20190127:1.8
	pgoyette-compat-20190127:1.8
	pgoyette-compat-20190118:1.8
	pgoyette-compat-1226:1.8
	pgoyette-compat-1126:1.8
	pgoyette-compat-1020:1.8
	pgoyette-compat-0930:1.8
	pgoyette-compat-0906:1.8
	netbsd-7-2-RELEASE:1.1.1.13.2.2
	pgoyette-compat-0728:1.8
	pgoyette-compat-0625:1.8
	pgoyette-compat-0521:1.8
	pgoyette-compat-0502:1.8
	pgoyette-compat-0422:1.8
	pgoyette-compat-0415:1.8
	pgoyette-compat-0407:1.8
	pgoyette-compat-0330:1.8
	pgoyette-compat-0322:1.8
	pgoyette-compat-0315:1.8
	netbsd-7-1-2-RELEASE:1.1.1.13.2.1
	pgoyette-compat:1.8.0.6
	pgoyette-compat-base:1.8
	netbsd-7-1-1-RELEASE:1.1.1.13.2.1
	perseant-stdc-iso10646:1.8.0.4
	perseant-stdc-iso10646-base:1.8
	prg-localcount2-base3:1.8
	prg-localcount2-base2:1.8
	prg-localcount2-base1:1.8
	prg-localcount2:1.8.0.2
	prg-localcount2-base:1.8
	pgoyette-localcount-20170426:1.8
	bouyer-socketcan-base1:1.8
	pgoyette-localcount-20170320:1.7
	netbsd-7-1:1.1.1.13.2.1.0.6
	netbsd-7-1-RELEASE:1.1.1.13.2.1
	netbsd-7-1-RC2:1.1.1.13.2.1
	netbsd-7-nhusb-base-20170116:1.1.1.13.2.1
	bouyer-socketcan:1.7.0.4
	bouyer-socketcan-base:1.7
	pgoyette-localcount-20170107:1.7
	netbsd-7-1-RC1:1.1.1.13.2.1
	pgoyette-localcount-20161104:1.7
	netbsd-7-0-2-RELEASE:1.1.1.13.2.1
	dhcpcd-6-11-4-reimport:1.1.1.17
	dhcpcd-6-11-4:1.1.1.17
	localcount-20160914:1.7
	netbsd-7-nhusb:1.1.1.13.2.1.0.4
	netbsd-7-nhusb-base:1.1.1.13.2.1
	dhcpcd-6-11-3:1.1.1.17
	pgoyette-localcount-20160806:1.7
	dhcpcd-6-11-2:1.1.1.17
	pgoyette-localcount-20160726:1.7
	pgoyette-localcount:1.7.0.2
	pgoyette-localcount-base:1.7
	dhcpcd-6-11-1:1.1.1.17
	netbsd-7-0-1-RELEASE:1.1.1.13.2.1
	dhcpcd-6-11-0:1.1.1.17
	dhcpcd-6-10-3:1.1.1.17
	dhcpcd-6-10-2:1.1.1.17
	dhcpcd-6-10-1:1.1.1.17
	dhcpcd-6-10-0:1.1.1.17
	dhcpcd-6-9-4:1.1.1.17
	netbsd-7-0:1.1.1.13.2.1.0.2
	netbsd-7-0-RELEASE:1.1.1.13.2.1
	dhcpcd-6-9-3:1.1.1.16
	dhcpcd-6-9-2:1.1.1.16
	netbsd-7-0-RC3:1.1.1.13.2.1
	netbsd-7-0-RC2:1.1.1.13.2.1
	dhcpcd-6-9-1:1.1.1.16
	netbsd-7-0-RC1:1.1.1.13.2.1
	dhcpcd-6-9-0:1.1.1.16
	dhcpcd-6-8-2:1.1.1.16
	dhcpcd-6-8-1:1.1.1.16
	dhcpcd-6-8-0:1.1.1.16
	dhcpcd-6-7-1:1.1.1.16
	dhcpcd-6-7-0:1.1.1.16
	dhcpcd-6-6-7:1.1.1.16
	dhcpcd-6-6-6:1.1.1.16
	dhcpcd-6-6-5:1.1.1.16
	dhcpcd-6-6-4:1.1.1.16
	dhcpcd-6-6-3:1.1.1.16
	netbsd-5-2-3-RELEASE:1.1.1.2.6.4
	netbsd-5-1-5-RELEASE:1.1.1.2.6.4
	dhcpcd-6-6-2:1.1.1.16
	dhcpcd-6-6-1-nb1:1.1.1.16
	dhcpcd-6-6-1:1.1.1.15
	dhcpcd-6-6-0:1.1.1.14
	dhcpcd-6-5-1:1.1.1.14
	dhcpcd-6-5-0:1.1.1.14
	dhcpcd-6-4-7:1.1.1.14
	dhcpcd-6-4-6:1.1.1.14
	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.14
	dhcpcd-6-4-4:1.1.1.14
	netbsd-7:1.1.1.13.0.2
	netbsd-7-base:1.1.1.13
	dhcpcd-6-4-3:1.1.1.13
	dhcpcd-6-4-2:1.1.1.13
	dhcpcd-6-4-1:1.1.1.13
	dhcpcd-6-4-0:1.1.1.13
	yamt-pagecache-base9:1.1.1.12
	yamt-pagecache-tag8:1.1.1.8.6.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.12.0.2
	tls-earlyentropy-base:1.1.1.13
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.12
	riastradh-drm2-base3:1.1.1.12
	dhcpcd-6-3-2:1.1.1.12
	dhcpcd-6-3-1:1.1.1.11
	dhcpcd-6-3-0:1.1.1.11
	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.4
	netbsd-5-1-4-RELEASE:1.1.1.2.6.4
	dhcpcd-6-2-1:1.1.1.11
	dhcpcd-6-2-0:1.1.1.11
	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.4
	netbsd-5-1-3-RELEASE:1.1.1.2.6.4
	dhcpcd-6-1-0:1.1.1.11
	netbsd-6-1-1-RELEASE:1.1.1.9.2.1
	dhcpcd-6-0-5:1.1.1.11
	dhcpcd-6-0-4:1.1.1.11
	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.4.0.6
	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.4
	netbsd-5-2-RC1:1.1.1.2.6.4
	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.13
	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.4
	dhcpcd-5-5-1:1.1.1.9
	dhcpcd-5-5-0:1.1.1.9
	netbsd-5-1-1-RELEASE:1.1.1.2.6.4
	yamt-pagecache-base3:1.1.1.8
	yamt-pagecache-base2:1.1.1.8
	yamt-pagecache:1.1.1.8.0.6
	yamt-pagecache-base:1.1.1.8
	cherry-xenmp:1.1.1.8.0.4
	cherry-xenmp-base:1.1.1.8
	dhcpcd-5-2-12:1.1.1.8
	bouyer-quota2-nbase:1.1.1.8
	dhcpcd-5-2-11:1.1.1.8
	bouyer-quota2:1.1.1.8.0.2
	bouyer-quota2-base:1.1.1.8
	dhcpcd-5-2-10:1.1.1.8
	matt-mips64-premerge-20101231:1.1.1.8
	matt-nb5-mips64-premerge-20101231:1.1.1.2.6.1.4.1
	matt-nb5-pq3:1.1.1.2.6.4.0.4
	matt-nb5-pq3-base:1.1.1.2.6.4
	dhcpcd-5-2-9:1.1.1.8
	netbsd-5-1:1.1.1.2.6.4.0.2
	netbsd-5-1-RELEASE:1.1.1.2.6.4
	dhcpcd-5-2-8:1.1.1.7
	netbsd-5-1-RC4:1.1.1.2.6.4
	matt-nb5-mips64-k15:1.1.1.2.6.1.4.1
	netbsd-5-1-RC3:1.1.1.2.6.4
	dhcpcd-5-2-4:1.1.1.6
	netbsd-5-1-RC2:1.1.1.2.6.4
	netbsd-5-1-RC1:1.1.1.2.6.4
	dhcpcd-5-2-2:1.1.1.6
	dhcpcd-5-2-1:1.1.1.6
	dhcpcd-5-2-0:1.1.1.6
	netbsd-5-0-2-RELEASE:1.1.1.2.6.1
	dhcpcd-5-1-5:1.1.1.6
	dhcpcd-5-1-4:1.1.1.6
	matt-nb5-mips64-premerge-20091211:1.1.1.2.6.1
	matt-premerge-20091211:1.1.1.6
	dhcpcd-5-1-3:1.1.1.6
	dhcpcd-5-1-2:1.1.1.6
	dhcpcd-5-1-1:1.1.1.6
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.1.1.2.6.1
	matt-nb4-mips64-k7-u2a-k9b:1.1.1.2.6.1
	matt-nb5-mips64-u1-k1-k5:1.1.1.2.6.1
	matt-nb5-mips64:1.1.1.2.6.1.0.4
	netbsd-5-0-1-RELEASE:1.1.1.2.6.1
	dhcpcd-5-0-7:1.1.1.6
	dhcpcd-5-0-6:1.1.1.6
	dhcpcd-5-0-5:1.1.1.5
	dhcpcd-5-0-4:1.1.1.5
	jym-xensuspend-nbase:1.1.1.5
	dhcpcd-5-0-3:1.1.1.5
	dhcpcd-5-0-2a:1.1.1.5
	dhcpcd-5-0-2:1.1.1.5
	dhcpcd-5-0-1:1.1.1.4
	dhcpcd-5-0-0:1.1.1.4
	netbsd-5-0:1.1.1.2.6.1.0.2
	netbsd-5-0-RELEASE:1.1.1.2.6.1
	dhcpcd-4-0-13:1.1.1.3
	netbsd-5-0-RC4:1.1.1.2.6.1
	netbsd-5-0-RC3:1.1.1.2.6.1
	dhcpcd-4-0-12:1.1.1.3
	dhcpcd-4-0-11:1.1.1.3
	netbsd-5-0-RC2:1.1.1.2.6.1
	jym-xensuspend:1.1.1.3.0.2
	jym-xensuspend-base:1.1.1.5
	dhcpcd-4-0-10:1.1.1.3
	dhcpcd-4-0-9:1.1.1.3
	dhcpcd-4-0-8:1.1.1.3
	roy:1.1.1
	netbsd-5-0-RC1:1.1.1.2.6.1
	haad-dm-base:1.1.1.3
	haad-dm-base2:1.1.1.3
	haad-nbase2:1.1.1.3
	dhcpcd-4-0-7:1.1.1.3
	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.8
date	2017.03.31.20.53.56;	author roy;	state dead;
branches;
next	1.7;
commitid	dLxJqjjcfoFGgKLz;

1.7
date	2015.11.30.16.33.00;	author roy;	state Exp;
branches
	1.7.2.1
	1.7.4.1;
next	1.6;
commitid	r6sgSE1PawCBt8Ly;

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.7.2.1
date	2017.04.26.02.52.23;	author pgoyette;	state dead;
branches;
next	;
commitid	ojV02aOSdzvBqZOz;

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

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;
next	1.1.1.3;

1.1.1.3
date	2008.12.09.19.34.59;	author roy;	state Exp;
branches
	1.1.1.3.2.1;
next	1.1.1.4;

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

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

1.1.1.6
date	2009.07.08.22.33.28;	author roy;	state Exp;
branches;
next	1.1.1.7;

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

1.1.1.8
date	2010.11.27.11.24.15;	author roy;	state Exp;
branches
	1.1.1.8.6.1;
next	1.1.1.9;

1.1.1.9
date	2012.01.25.14.33.04;	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	2014.03.14.11.27.41;	author roy;	state Exp;
branches
	1.1.1.12.2.1;
next	1.1.1.13;
commitid	ymVo31IPWxMxTEsx;

1.1.1.13
date	2014.06.14.20.51.09;	author roy;	state Exp;
branches
	1.1.1.13.2.1;
next	1.1.1.14;
commitid	MoRU3isFNd4R3xEx;

1.1.1.14
date	2014.09.16.22.23.21;	author roy;	state Exp;
branches;
next	1.1.1.15;
commitid	VYSyBEUwq9SmyCQx;

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

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

1.1.1.17
date	2015.11.30.16.25.09;	author roy;	state Exp;
branches;
next	;
commitid	8WRzU4UTI5mEq8Ly;

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.01.09.03.13.50;	author snj;	state Exp;
branches
	1.1.1.2.6.1.4.1;
next	1.1.1.2.6.2;

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

1.1.1.2.6.3
date	2009.05.18.21.23.34;	author bouyer;	state Exp;
branches;
next	1.1.1.2.6.4;

1.1.1.2.6.4
date	2009.11.23.03.13.29;	author snj;	state Exp;
branches;
next	;

1.1.1.2.6.1.4.1
date	2010.04.21.05.23.08;	author matt;	state Exp;
branches;
next	;

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

1.1.1.8.6.1
date	2012.04.17.00.03.06;	author yamt;	state Exp;
branches;
next	1.1.1.8.6.2;

1.1.1.8.6.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.12.2.1
date	2014.08.10.07.06.59;	author tls;	state Exp;
branches;
next	;
commitid	6GtpeveLcuaaGMLx;

1.1.1.13.2.1
date	2014.12.29.16.18.05;	author martin;	state Exp;
branches;
next	1.1.1.13.2.2;
commitid	rwbq7QmIjmQl9X3y;

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


desc
@@


1.8
log
@Sync
@
text
@# $NetBSD: 50-ntp.conf,v 1.7 2015/11/30 16:33:00 roy Exp $

# Sample dhcpcd hook script for NTP
# It will configure either one of NTP, OpenNTP or Chrony (in that order)
# and will default to NTP if no default config is found.

# Like our resolv.conf hook script, we store a database of ntp.conf files
# and merge into /etc/ntp.conf

# You can set the env var NTP_CONF to override the derived default on
# systems with >1 NTP client installed.
# Here is an example for OpenNTP
#   dhcpcd -e NTP_CONF=/usr/pkg/etc/ntpd.conf
# or by adding this to /etc/dhcpcd.conf
#   env NTP_CONF=/usr/pkg/etc/ntpd.conf
# or by adding this to /etc/dhcpcd.enter-hook
#   NTP_CONF=/usr/pkg/etc/ntpd.conf
# To use Chrony instead, simply change ntpd.conf to chrony.conf in the
# above examples.

: ${ntp_confs:=ntp.conf ntpd.conf chrony.conf}
: ${ntp_conf_dirs=/etc /usr/pkg/etc /usr/local/etc}
ntp_conf_dir="$state_dir/ntp.conf"

# If NTP_CONF is not set, work out a good default
if [ -z "$NTP_CONF" ]; then
	for d in ${ntp_conf_dirs}; do
		for f in ${ntp_confs}; do
			if [ -e "$d/$f" ]; then
				NTP_CONF="$d/$f"
				break 2
			fi
		done
	done
	[ -e "$NTP_CONF" ] || NTP_CONF=/etc/ntp.conf
fi

# Derive service name from configuration
if [ -z "$ntp_service" ]; then
	case "$NTP_CONF" in
	*chrony.conf)		ntp_service=chronyd;;
	*)			ntp_service=ntpd;;
	esac
fi

# Debian has a seperate file for DHCP config to avoid stamping on
# the master.
if [ "$ntp_service" = ntpd ] && type invoke-rc.d >/dev/null 2>&1; then
	[ -e /var/lib/ntp ] || mkdir /var/lib/ntp
	: ${ntp_service:=ntp}
	: ${NTP_DHCP_CONF:=/var/lib/ntp/ntp.conf.dhcp}
fi

: ${ntp_restart_cmd:=service_condcommand $ntp_service restart}

ntp_conf=${NTP_CONF}
NL="
"

build_ntp_conf()
{
	local cf="$state_dir/ntp.conf.$ifname"
	local interfaces= header= srvs= servers= x=

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

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

		# Build a server list
		srvs=$(cd "$ntp_conf_dir";
			key_get_value "server " $interfaces)
		if [ -n "$srvs" ]; then
			for x in $(uniqify $srvs); do
				servers="${servers}server $x$NL"
			done
		fi
	fi

	# Merge our config into ntp.conf
	[ -e "$cf" ] && rm -f "$cf"
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"

	if [ -n "$NTP_DHCP_CONF" ]; then
		[ -e "$ntp_conf" ] && cp "$ntp_conf" "$cf"
		ntp_conf="$NTP_DHCP_CONF"
	elif [ -e "$ntp_conf" ]; then
		remove_markers "$signature_base" "$signature_base_end" \
			"$ntp_conf" > "$cf"
	fi

	if [ -n "$servers" ]; then
		echo "$signature_base${header:+ $from }$header" >> "$cf"
		printf %s "$servers" >> "$cf"
		echo "$signature_base_end${header:+ $from }$header" >> "$cf"
	else
		[ -e "$ntp_conf" -a -e "$cf" ] || return
	fi

	# If we changed anything, restart ntpd
	if change_file "$ntp_conf" "$cf"; then
		[ -n "$ntp_restart_cmd" ] && eval $ntp_restart_cmd
	fi
}

add_ntp_conf()
{
	local cf="$ntp_conf_dir/$ifname" x=

	[ -e "$cf" ] && rm "$cf"
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
	if [ -n "$new_ntp_servers" ]; then
		for x in $new_ntp_servers; do
			echo "server $x" >> "$cf"
		done
	fi
	build_ntp_conf
}

remove_ntp_conf()
{
	if [ -e "$ntp_conf_dir/$ifname" ]; then
		rm "$ntp_conf_dir/$ifname"
	fi
	build_ntp_conf
}

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

if $if_up; then
	add_ntp_conf
elif $if_down; then
	remove_ntp_conf
fi
@


1.7
log
@Sync
@
text
@d1 1
a1 1
# $NetBSD: 50-ntp.conf,v 1.6 2014/11/07 20:51:03 roy Exp $
@


1.7.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: 50-ntp.conf,v 1.7 2015/11/30 16:33:00 roy Exp $
@


1.7.4.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
# $NetBSD: 50-ntp.conf,v 1.7 2015/11/30 16:33:00 roy Exp $
@


1.6
log
@Add RCSIDs
@
text
@d1 5
a5 1
# $NetBSD: $
a6 1
# Sample dhcpcd hook script for ntp
d10 3
a12 1
# You can set the env var NTP_CONF to another file like this
d14 2
d18 19
a36 1
# to use OpenNTPD instead of the default NTP.
d38 11
a48 3
if type invoke-rc.d >/dev/null 2>&1; then
	# Debian has a seperate file for DHCP config to avoid stamping on
	# the master.
a53 1
: ${ntp_service:=ntpd}
a54 9
ntp_conf_dir="$state_dir/ntp.conf"

# If we have installed OpenNTPD but not NTP then prefer it
# XXX If both exist then update both?
if [ -z "$NTP_CONF" -a -e /etc/ntpd.conf -a ! -e /etc/ntp.conf ]; then
	: ${NTP_CONF:=/etc/ntpd.conf}
else
	: ${NTP_CONF:=/etc/ntp.conf}
fi
@


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
d4 20
d25 6
a30 8
# Detect OpenRC or BSD rc
# Distributions may want to just have their command here instead of this
if type rc-service >/dev/null 2>&1 && rc-service --exists ntpd; then
	ntpd_restart_cmd="rc-service ntpd -- --ifstarted --quiet restart"
elif [ -x /etc/rc.d/ntpd ]; then
	ntpd_restart_cmd="/etc/rc.d/ntpd restart"
elif [ -x /usr/local/etc/rc.d/ntpd ]; then
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd restart"
d33 5
a37 1
make_ntp_conf()
d39 38
a76 15
	[ -z "${new_ntp_servers}" ] && return 0
	local cf=/etc/ntp.conf."${interface}" x=
	echo "${signature}" > "${cf}"
	echo "restrict default noquery notrust nomodify" >> "${cf}"
	echo "restrict 127.0.0.1" >> "${cf}"
	for x in ${new_ntp_servers}; do
		echo "restrict ${x} nomodify notrap noquery" >> "${cf}"
		echo "server ${x}" >> "${cf}"
	done
	if [ ! -e /etc/ntp.conf ]; then
		false	
	elif type cmp >/dev/null 2>&1; then
		cmp -s /etc/ntp.conf "${cf}"
	elif type diff >/dev/null 2>&1; then
		diff -q /etc/ntp.conf "${cf}" >/dev/null
d78 6
a83 1
		false
d85 12
a96 6
	if [ $? = 0 ]; then
		rm -f "${cf}"
	else
		save_conf /etc/ntp.conf
		mv -f "${cf}" /etc/ntp.conf
		[ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd}
d98 1
d101 1
a101 1
restore_ntp_conf()
d103 4
a106 2
	restore_conf /etc/ntp.conf || return 0
	[ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd}
d109 5
a113 3
case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)	make_ntp_conf;;
EXPIRE|FAIL|IPV4LL|RELEASE|STOP)		restore_ntp_conf;;
d115 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
@a1 2
# Like our resolv.conf hook script, we store a database of ntp.conf files
# and merge into /etc/ntp.conf
d13 1
a13 3
ntp_conf_dir="${state_dir}/ntp.conf"

build_ntp_conf()
d15 17
a31 20
	local cf="/etc/ntp.conf.${interface}"
	local interfaces= header= srvs= servers= x=

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

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

		# Build a server list
		srvs=$(cd "${ntp_conf_dir}";
			key_get_value "server " ${interfaces})
		if [ -n "${srvs}" ]; then
			for x in $(uniqify ${srvs}); do
				servers="${servers}server ${x}\n"
			done
		fi
d33 5
a37 13

	# Merge our config into ntp.conf
	[ -e "${cf}" ] && rm -f "${cf}"
	remove_markers "${signature_base}" "${signature_base_end}" \
		/etc/ntp.conf > "${cf}"
	if [ -n "${servers}" ]; then
		echo "${signature_base}${header:+ ${from} }${header}" >> "${cf}"
		printf "${search}${servers}" >> "${cf}"
		echo "${signature_base_end}${header:+ ${from} }${header}" >> "${cf}"
	fi

	# If we changed anything, restart ntpd
	if change_file /etc/ntp.conf "${cf}"; then
d42 1
a42 1
add_ntp_conf()
d44 2
a45 18
	local cf="${ntp_conf_dir}/${interface}" x=

	[ -e "${cf}" ] && rm "${cf}"
	[ -d "${ntp_conf_dir}" ] || mkdir -p "${ntp_conf_dir}"
	if [ -n "${new_ntp_servers}" ]; then
		for x in ${new_ntp_servers}; do
			echo "server ${x}" >> "${cf}"
		done
	fi
	build_ntp_conf
}

remove_ntp_conf()
{
	if [ -e "${ntp_conf_dir}/${interface}" ]; then
		rm "${ntp_conf_dir}/${interface}"
	fi
	build_ntp_conf
d49 2
a50 2
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) 	add_ntp_conf add;;
PREINIT|EXPIRE|FAIL|IPV4LL|RELEASE|STOP)	remove_ntp_conf del;;
@


1.1.1.2.6.1
log
@Pull up following revision(s) (requested by roy in ticket #240):
	sys/net/rtsock.c: revision 1.119
	external/bsd/dhcpcd/dist/README
	external/bsd/dhcpcd/dist/client.c
	external/bsd/dhcpcd/dist/common.c
	external/bsd/dhcpcd/dist/config.h
	external/bsd/dhcpcd/dist/configure.c
	external/bsd/dhcpcd/dist/dhcp.c
	external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
	external/bsd/dhcpcd/dist/dhdpcd.8.in
	external/bsd/dhcpcd/dist/dhcpcd.c
	external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
	external/bsd/dhcpcd/dist/if-bsd.c
	external/bsd/dhcpcd/dist/net.c
	external/bsd/dhcpcd/dist/net.h
	external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf
Import dhcpcd-4.0.7 with the following changes from dhcpcd-4.0.1

DHCP_DECLINE now includes the IP and Server in the message.
Trailing NULLs are stripped from string options.
ntpd is only restarted if it is already running.
ClientID is no longer sent by default.
CSR comes before routers and static routes as per RFC 3442.
Host routes are now added correctly.
If a the interface link flaps but status does not change, do not reset
the timer.
@
text
@a4 6
# You can set the env var NTP_CONF to another file like this
#   dhcpcd -e NTP_CONF=/usr/pkg/etc/ntpd.conf
# or by adding this to /etc/dhcpcd.enter-hook
#   NTP_CONF=/usr/pkg/etc/ntpd.conf
# to use openntpd from pkgsrc instead of the system provided ntp.

d10 1
a10 1
	ntpd_restart_cmd="/etc/rc.d/ntpd status && /etc/rc.d/ntpd restart"
d12 1
a12 1
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status && /usr/local/etc/rc.d/ntpd restart"
a15 1
ntp_conf=${NTP_CONF:-/etc/ntp.conf}
d19 1
a19 1
	local cf="${ntp_conf}.${interface}"
d52 2
a53 2
	if change_file "${ntp_conf}" "${cf}"; then
		[ -n "${ntpd_restart_cmd}" ] && eval ${ntpd_restart_cmd}
@


1.1.1.2.6.1.4.1
log
@sync to netbsd-5
@
text
@d14 1
a14 1
	ntpd_restart_cmd="rc-service ntpd -- -Ds restart"
d16 1
a16 1
	ntpd_restart_cmd="/etc/rc.d/ntpd status >/dev/null 2>&1 && /etc/rc.d/ntpd restart"
d18 1
a18 1
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status >/dev/null 2>&1 && /usr/local/etc/rc.d/ntpd restart"
d21 1
a21 1
ntp_conf_dir="$state_dir/ntp.conf"
d26 1
a26 1
	local cf="$state_dir/ntp.conf.$interface"
d30 1
a30 1
	interfaces=$(list_interfaces "$ntp_conf_dir")
d32 1
a32 1
	if [ -n "$interfaces" ]; then
d35 1
a35 1
			header="$header${header:+, }$x"
d39 5
a43 5
		srvs=$(cd "$ntp_conf_dir";
			key_get_value "server " $interfaces)
		if [ -n "$srvs" ]; then
			for x in $(uniqify $srvs); do
				servers="${servers}server $x\n"
d49 7
a55 10
	[ -e "$cf" ] && rm -f "$cf"
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
	if [ -e "$ntp_conf" ]; then
		remove_markers "$signature_base" "$signature_base_end" \
			"$ntp_conf" > "$cf"
	fi
	if [ -n "$servers" ]; then
		echo "$signature_base${header:+ $from }$header" >> "$cf"
		printf "$search$servers" >> "$cf"
		echo "$signature_base_end${header:+ $from }$header" >> "$cf"
d59 2
a60 2
	if change_file "$ntp_conf" "$cf"; then
		[ -n "$ntpd_restart_cmd" ] && eval $ntpd_restart_cmd
d66 1
a66 1
	local cf="$ntp_conf_dir/$interface" x=
d68 5
a72 5
	[ -e "$cf" ] && rm "$cf"
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
	if [ -n "$new_ntp_servers" ]; then
		for x in $new_ntp_servers; do
			echo "server $x" >> "$cf"
d80 2
a81 2
	if [ -e "$ntp_conf_dir/$interface" ]; then
		rm "$ntp_conf_dir/$interface"
d86 3
a88 3
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) 	add_ntp_conf add;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)	remove_ntp_conf del;;
@


1.1.1.2.6.2
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
@d21 1
a21 1
ntp_conf_dir="$state_dir/ntp.conf"
d26 1
a26 1
	local cf="$state_dir/ntp.conf.$interface"
d30 1
a30 1
	interfaces=$(list_interfaces "$ntp_conf_dir")
d32 1
a32 1
	if [ -n "$interfaces" ]; then
d35 1
a35 1
			header="$header${header:+, }$x"
d39 5
a43 5
		srvs=$(cd "$ntp_conf_dir";
			key_get_value "server " $interfaces)
		if [ -n "$srvs" ]; then
			for x in $(uniqify $srvs); do
				servers="${servers}server $x\n"
d49 7
a55 7
	[ -e "$cf" ] && rm -f "$cf"
	remove_markers "$signature_base" "$signature_base_end" \
		"$ntp_conf" > "$cf"
	if [ -n "$servers" ]; then
		echo "$signature_base${header:+ $from }$header" >> "$cf"
		printf "$search$servers" >> "$cf"
		echo "$signature_base_end${header:+ $from }$header" >> "$cf"
d59 2
a60 2
	if change_file "$ntp_conf" "$cf"; then
		[ -n "$ntpd_restart_cmd" ] && eval $ntpd_restart_cmd
d66 1
a66 1
	local cf="$ntp_conf_dir/$interface" x=
d68 5
a72 5
	[ -e "$cf" ] && rm "$cf"
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
	if [ -n "$new_ntp_servers" ]; then
		for x in $new_ntp_servers; do
			echo "server $x" >> "$cf"
d80 2
a81 2
	if [ -e "$ntp_conf_dir/$interface" ]; then
		rm "$ntp_conf_dir/$interface"
d86 3
a88 3
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) 	add_ntp_conf add;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)	remove_ntp_conf del;;
@


1.1.1.2.6.3
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
@d14 1
a14 1
	ntpd_restart_cmd="rc-service ntpd -- -Ds restart"
d16 1
a16 1
	ntpd_restart_cmd="/etc/rc.d/ntpd status >/dev/null 2>&1 && /etc/rc.d/ntpd restart"
d18 1
a18 1
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status >/dev/null 2>&1 && /usr/local/etc/rc.d/ntpd restart"
a49 1
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
@


1.1.1.2.6.4
log
@Apply patch (requested by roy in ticket 1099):
Update dhcpcd to 5.1.3.
@
text
@d51 2
a52 4
	if [ -e "$ntp_conf" ]; then
		remove_markers "$signature_base" "$signature_base_end" \
			"$ntp_conf" > "$cf"
	fi
@


1.1.1.3
log
@Import dhcpcd-4.0.7 with the following changes from dhcpcd-4.0.1

DHCP_DECLINE now includes the IP and Server in the message.
Trailing NULLs are stripped from string options.
ntpd is only restarted if it is already running.
ClientID is no longer sent by default.
CSR comes before routers and static routes as per RFC 3442.
Host routes are now added correctly.
If a the interface link flaps but status does not change, do not reset the timer.
@
text
@a4 6
# You can set the env var NTP_CONF to another file like this
#   dhcpcd -e NTP_CONF=/usr/pkg/etc/ntpd.conf
# or by adding this to /etc/dhcpcd.enter-hook
#   NTP_CONF=/usr/pkg/etc/ntpd.conf
# to use openntpd from pkgsrc instead of the system provided ntp.

d10 1
a10 1
	ntpd_restart_cmd="/etc/rc.d/ntpd status && /etc/rc.d/ntpd restart"
d12 1
a12 1
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status && /usr/local/etc/rc.d/ntpd restart"
a15 1
ntp_conf=${NTP_CONF:-/etc/ntp.conf}
d19 1
a19 1
	local cf="${ntp_conf}.${interface}"
d52 2
a53 2
	if change_file "${ntp_conf}" "${cf}"; then
		[ -n "${ntpd_restart_cmd}" ] && eval ${ntpd_restart_cmd}
@


1.1.1.3.2.1
log
@Sync with HEAD.

Second commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
@
text
@d14 1
a14 1
	ntpd_restart_cmd="rc-service ntpd -- -Ds restart"
d16 1
a16 1
	ntpd_restart_cmd="/etc/rc.d/ntpd status >/dev/null 2>&1 && /etc/rc.d/ntpd restart"
d18 1
a18 1
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status >/dev/null 2>&1 && /usr/local/etc/rc.d/ntpd restart"
d21 1
a21 1
ntp_conf_dir="$state_dir/ntp.conf"
d26 1
a26 1
	local cf="$state_dir/ntp.conf.$interface"
d30 1
a30 1
	interfaces=$(list_interfaces "$ntp_conf_dir")
d32 1
a32 1
	if [ -n "$interfaces" ]; then
d35 1
a35 1
			header="$header${header:+, }$x"
d39 5
a43 5
		srvs=$(cd "$ntp_conf_dir";
			key_get_value "server " $interfaces)
		if [ -n "$srvs" ]; then
			for x in $(uniqify $srvs); do
				servers="${servers}server $x\n"
d49 7
a55 8
	[ -e "$cf" ] && rm -f "$cf"
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
	remove_markers "$signature_base" "$signature_base_end" \
		"$ntp_conf" > "$cf"
	if [ -n "$servers" ]; then
		echo "$signature_base${header:+ $from }$header" >> "$cf"
		printf "$search$servers" >> "$cf"
		echo "$signature_base_end${header:+ $from }$header" >> "$cf"
d59 2
a60 2
	if change_file "$ntp_conf" "$cf"; then
		[ -n "$ntpd_restart_cmd" ] && eval $ntpd_restart_cmd
d66 1
a66 1
	local cf="$ntp_conf_dir/$interface" x=
d68 5
a72 5
	[ -e "$cf" ] && rm "$cf"
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
	if [ -n "$new_ntp_servers" ]; then
		for x in $new_ntp_servers; do
			echo "server $x" >> "$cf"
d80 2
a81 2
	if [ -e "$ntp_conf_dir/$interface" ]; then
		rm "$ntp_conf_dir/$interface"
d86 3
a88 3
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) 	add_ntp_conf add;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)	remove_ntp_conf del;;
@


1.1.1.4
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
@d21 1
a21 1
ntp_conf_dir="$state_dir/ntp.conf"
d26 1
a26 1
	local cf="$state_dir/ntp.conf.$interface"
d30 1
a30 1
	interfaces=$(list_interfaces "$ntp_conf_dir")
d32 1
a32 1
	if [ -n "$interfaces" ]; then
d35 1
a35 1
			header="$header${header:+, }$x"
d39 5
a43 5
		srvs=$(cd "$ntp_conf_dir";
			key_get_value "server " $interfaces)
		if [ -n "$srvs" ]; then
			for x in $(uniqify $srvs); do
				servers="${servers}server $x\n"
d49 7
a55 7
	[ -e "$cf" ] && rm -f "$cf"
	remove_markers "$signature_base" "$signature_base_end" \
		"$ntp_conf" > "$cf"
	if [ -n "$servers" ]; then
		echo "$signature_base${header:+ $from }$header" >> "$cf"
		printf "$search$servers" >> "$cf"
		echo "$signature_base_end${header:+ $from }$header" >> "$cf"
d59 2
a60 2
	if change_file "$ntp_conf" "$cf"; then
		[ -n "$ntpd_restart_cmd" ] && eval $ntpd_restart_cmd
d66 1
a66 1
	local cf="$ntp_conf_dir/$interface" x=
d68 5
a72 5
	[ -e "$cf" ] && rm "$cf"
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
	if [ -n "$new_ntp_servers" ]; then
		for x in $new_ntp_servers; do
			echo "server $x" >> "$cf"
d80 2
a81 2
	if [ -e "$ntp_conf_dir/$interface" ]; then
		rm "$ntp_conf_dir/$interface"
d86 3
a88 3
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) 	add_ntp_conf add;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)	remove_ntp_conf del;;
@


1.1.1.5
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
@d14 1
a14 1
	ntpd_restart_cmd="rc-service ntpd -- -Ds restart"
d16 1
a16 1
	ntpd_restart_cmd="/etc/rc.d/ntpd status >/dev/null 2>&1 && /etc/rc.d/ntpd restart"
d18 1
a18 1
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status >/dev/null 2>&1 && /usr/local/etc/rc.d/ntpd restart"
a49 1
	[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
@


1.1.1.6
log
@Update to dhcpcd-5.0.6

Changes from dhcpcd-5.0.5 include
 * Fix crash on MIPS, fixes PR bin/41682
   Thanks to Tim McIntosh <tmcintos@@eskimo.com> for the patch
 * Save and restore interface MTU when changing
 * IP whitelist
 * Ensure that the lease and pidfile directories exist at startup
@
text
@d51 2
a52 4
	if [ -e "$ntp_conf" ]; then
		remove_markers "$signature_base" "$signature_base_end" \
			"$ntp_conf" > "$cf"
	fi
@


1.1.1.7
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
@d11 8
a18 6
: ${ntpd_restart_cmd:="service_condcommand ntpd restart || service_condcommand ntp restart"}
if type invoke-rc.d >/dev/null 2>&1; then
	# Debian has a seperate file for DHCP config to avoid stamping on
	# the master.
	[ -e /var/lib/ntp ] || mkdir /var/lib/ntp
	: ${NTP_DHCP_CONF:=/var/lib/ntp/ntp.conf.dhcp}
d51 1
a51 5

	if [ -n "$NTP_DHCP_CONF" ]; then
		cp "$ntp_conf" "$cf"
		ntp_conf="$NTP_DHCP_CONF"
	elif [ -e "$ntp_conf" ]; then
a54 1

a58 2
	else
		[ -e "$ntp_conf" ] || return
d89 4
a92 5
if $if_up; then
	add_ntp_conf add
elif $if_down; then
	remove_ntp_conf del
fi
@


1.1.1.8
log
@Import dhcpcd-5.2.9 with the following changes:
* syntax in 50-ypbind hook has been fixed
* man page corrections
* report hwaddr used by dhcpcd when debug is enabled
* Fix detecting inet address for INFORM support
* document reason RELEASE in dhcpcd-run-hooks
* Support RTM_CHGADDR in the upcoming NetBSD-6
  This is used to work out if the hwaddr has changed as the interface
  does not go down/up unlike other OSes
* ntp hook no longer attempts to restart ntpd if 1st attempt failed
@
text
@d11 1
a11 1
: ${ntpd_restart_cmd:=service_condcommand ntpd restart}
@


1.1.1.8.6.1
log
@sync with head
@
text
@d11 1
a15 1
	: ${ntp_service:=ntp}
a18 2
: ${ntp_service:=ntpd}
: ${ntp_restart_cmd:=service_condcommand $ntp_service restart}
a20 2
NL="
"
d24 1
a24 1
	local cf="$state_dir/ntp.conf.$ifname"
d41 1
a41 1
				servers="${servers}server $x$NL"
d51 1
a51 1
		[ -e "$ntp_conf" ] && cp "$ntp_conf" "$cf"
d60 1
a60 1
		printf %s "$servers" >> "$cf"
d63 1
a63 1
		[ -e "$ntp_conf" -a -e "$cf" ] || return
d68 1
a68 1
		[ -n "$ntp_restart_cmd" ] && eval $ntp_restart_cmd
d74 1
a74 1
	local cf="$ntp_conf_dir/$ifname" x=
d88 2
a89 2
	if [ -e "$ntp_conf_dir/$ifname" ]; then
		rm "$ntp_conf_dir/$ifname"
@


1.1.1.8.6.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$

d9 1
a9 1
# to use OpenNTPD instead of the default NTP.
d22 1
a22 10

# If we have installed OpenNTPD but not NTP then prefer it
# XXX If both exist then update both?
if [ -z "$NTP_CONF" -a -e /etc/ntpd.conf -a ! -e /etc/ntp.conf ]; then
	: ${NTP_CONF:=/etc/ntpd.conf}
else
	: ${NTP_CONF:=/etc/ntp.conf}
fi

ntp_conf=${NTP_CONF}
a97 7
# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_ntp_servers="$new_dhcp6_sntp_servers"
;;
esac

@


1.1.1.9
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
@d11 1
a15 1
	: ${ntp_service:=ntp}
a18 2
: ${ntp_service:=ntpd}
: ${ntp_restart_cmd:=service_condcommand $ntp_service restart}
a20 2
NL="
"
d41 1
a41 1
				servers="${servers}server $x$NL"
d51 1
a51 1
		[ -e "$ntp_conf" ] && cp "$ntp_conf" "$cf"
d60 1
a60 1
		printf %s "$servers" >> "$cf"
d63 1
a63 1
		[ -e "$ntp_conf" -a -e "$cf" ] || return
d68 1
a68 1
		[ -n "$ntp_restart_cmd" ] && eval $ntp_restart_cmd
@


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

Update dhcpcd to version 5.6.2.
@
text
@d28 1
a28 1
	local cf="$state_dir/ntp.conf.$ifname"
d78 1
a78 1
	local cf="$ntp_conf_dir/$ifname" x=
d92 2
a93 2
	if [ -e "$ntp_conf_dir/$ifname" ]; then
		rm "$ntp_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
@d28 1
a28 1
	local cf="$state_dir/ntp.conf.$ifname"
d78 1
a78 1
	local cf="$ntp_conf_dir/$ifname" x=
d92 2
a93 2
	if [ -e "$ntp_conf_dir/$ifname" ]; then
		rm "$ntp_conf_dir/$ifname"
@


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

a97 7
# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_ntp_servers="$new_dhcp6_sntp_servers"
;;
esac

@


1.1.1.10.2.2
log
@Rebase to HEAD as of a few days ago.
@
text
@d11 1
a11 1
# to use OpenNTPD instead of the default NTP.
d22 1
a22 1
: ${ntp_restart_cmd:=service_condcommand $ntp_service restart &}
d24 1
a24 10

# If we have installed OpenNTPD but not NTP then prefer it
# XXX If both exist then update both?
if [ -z "$NTP_CONF" -a -e /etc/ntpd.conf -a ! -e /etc/ntp.conf ]; then
	: ${NTP_CONF:=/etc/ntpd.conf}
else
	: ${NTP_CONF:=/etc/ntp.conf}
fi

ntp_conf=${NTP_CONF}
d108 1
a108 1
	add_ntp_conf
d110 1
a110 1
	remove_ntp_conf
@


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: $

a97 7
# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
	new_ntp_servers="$new_dhcp6_sntp_servers"
;;
esac

@


1.1.1.12
log
@Import dhcpcd-6.3.2 with the following changes:

  * Improvements to autoconf build emulation
  * CARRIER/NOCARRIER are now run outside of the IPv4 runs
  * validate domains correctly which contain a - on non bash shells
  * don't remove IPv6 addresses from internal state when added as tentative
  * HUP now rebinds, ALRM now releases - the -x and -k flags work as
    they used to
  * Add -M, --master option to force dhcpcd into master mode even if one
    interface is specified on the command line
  * Fix a crash when receiving a reconfigure key
  * Dumping a DHCPv4 lease works again
  * SEND_DAD code removed
  * hoplimit is no longer defined for DHCPv6 messages
  * hoplimit of 255 for IPv6 RS/ND message is now defined at the socket
    instead of ancillary data with the message
@
text
@d11 1
a11 1
# to use OpenNTPD instead of the default NTP.
d24 1
a24 10

# If we have installed OpenNTPD but not NTP then prefer it
# XXX If both exist then update both?
if [ -z "$NTP_CONF" -a -e /etc/ntpd.conf -a ! -e /etc/ntp.conf ]; then
	: ${NTP_CONF:=/etc/ntpd.conf}
else
	: ${NTP_CONF:=/etc/ntp.conf}
fi

ntp_conf=${NTP_CONF}
@


1.1.1.12.2.1
log
@Rebase.
@
text
@d1 1
a1 1
# $NetBSD: 50-ntp.conf,v 1.1.1.13 2014/06/14 20:51:09 roy Exp $
d22 1
a22 1
: ${ntp_restart_cmd:=service_condcommand $ntp_service restart &}
d117 1
a117 1
	add_ntp_conf
d119 1
a119 1
	remove_ntp_conf
@


1.1.1.13
log
@Import dhcpcd-6.4.0 with the following changes:

  *  Only fork when the RA has a RDNSS option AND a valid prefix OR no DHCPv6 instruction.
  *  Handle BSD per interface rtadv kernel flag.
  *  Add a reject route for the delegated prefix so that unassigned prefixes don't go back upstream.
  *  If not specified, Delegated Prefixes will get an automatic SLA of the interface index. If the biggest SLA and the assigned prefix fits into a /64 then dhcpcd creates a /64 prefix so that SLAAC works. If bigger than /64 is needed then dhcpcd creates one rounded upto the nearest multiple of 8. Unless a configured SLA of 0 is assigned, a reject route for the Delegated Prefix is installed to stop unassigned addresses trying to be resolved upstream. Addresses added from Delegated Prefixes now have a default address suffix of 1 instead of using a SLAAC style address.
  *  Don't spam timezone updates unless its actually changed.
  *  Support ND6_IFF_OVERRIDE_RTADV on BSD.
  *  Document why we don't send both FQDN and hostname options.
  *  Respect RFC4861 MAX_RTR_SOLICITATION_DELAY as specified in section 6.3.7.
  *  RFC2131 section 4.4.1 states the client SHOULD wait a random time between one and ten seconds to desynchronize the use of DHCP at startup. Instead we wait a random time between zero and one second to mirror the more modern IPv6RS and DHCPv6 standards unless overridden by defining RFC2131_STRICT.
  *  Always send a carrier as it's no longer encapsulated in the IPv4 stack. When stopping and not departed, run with the STOPPED reason but do not process it in hooks.
  *  Poll kernel neighbour reachability (SIOCGNBRINFO_IN6) for each router instead of sending and listening for Neighbour Soliciation/Advertisement packets. The kernel is privy to a lot more reachability information than userland is.
  *  Ensure that ND6_IFF_PERFORMNUD is set.
  *  controlgroup option changes group ownership of the control socket.
  *  Should use arc4random_uniform when wanting a randon number between 1 and N. Improve the compat arc4random function a little and re-stir on fork.
  *  -4 and -6 are now mutually exclusive and when running on a single interface per protocol pidfiles are created. This means that other control options suchs as -x and -n will require the -4 or -6 option as well.
  *  Implement Stable Private Addresses for SLAAC as per RFC7217. Enable this as default in dhcpcd.conf.
  *  Log error condition if a new or changed Router Advertisment to avoid spamming the log.
  *  Add an IPv6 link-local address before upping the interface if needed. Bring an interface up when we start it and not during discovery. As such, stop waiting on carrier for a second if we did.
  *  Add gateway option to enable the gateway or an interface/profile. Ensure the option and require options disable the nooption option - last wins.
  *  Restarting ntp/yp are not critical and their initialisation continues in the background as well so we may as well background the restart commands for faster dhcpcd performance.
@
text
@d22 1
a22 1
: ${ntp_restart_cmd:=service_condcommand $ntp_service restart &}
d117 1
a117 1
	add_ntp_conf
d119 1
a119 1
	remove_ntp_conf
@


1.1.1.13.2.1
log
@Pullup the import of dhcpcd-6.6.7, requested by roy in #207
@
text
@d1 1
a1 1
# $NetBSD: 50-ntp.conf,v 1.6 2014/11/07 20:51:03 roy Exp $
d22 1
a22 1
: ${ntp_restart_cmd:=service_condcommand $ntp_service restart}
@


1.1.1.13.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: 50-ntp.conf,v 1.1.1.13.2.1 2014/12/29 16:18:05 martin Exp $
@


1.1.1.14
log
@Import dhcpcd-6.4.4 with the following changes:
  *  Many bounds checking fixes from Tobias Stoeckmann
  *  Improve error when the authentication token cannot be found
  *  close the IPv4 specific UDP socket when done sending
  *  Implemented a write queue to the control sockets
  *  Only send interfaces to control sockets when in a BOUND state
  *  Add a sample controlgroup directive to dhcpcd.conf to make setup easier
  *  Add variables if_oneup and if_ipwaited so hook scripts know the overall
     state of dhcpcd better
  *  Pass RC_SVCNAME from enviromment to hooks so that a service hook can
     know it's name (may not be dhcpcd)
  *  Document every variable set for dhcpcd-run-hooks(8)
  *  Allow SSIDs with non printable characters to be used in ssid selection
     in dhcpcd.conf
  *  Add an unprivileged control socket so that normal users can obtain
     dhcpcd running state
@
text
@d22 1
a22 1
: ${ntp_restart_cmd:=service_condcommand $ntp_service restart}
@


1.1.1.15
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.16
log
@Reimport dhcpcd-6.6.1 with correct hooks
@
text
@d1 2
@


1.1.1.17
log
@Import dhcpcd-6.9.4 with the following changes:
  *  dhcpcd will now configure chrony if installed and ntp isn't
  *  dhcpcd no longer attempts temporary address management on Linux
  *  replace the SixRD decode function with a generic definition
  *  try harder to ensure only 1 lladdr exists per interface on BSD
  *  change IPv6 routes on MTU change
  *  -p works with -x on an already running process started without -p
  *  fix TEST for IPv4LL
  *  Correct size allocation for prefix delegation, thanks to Jade
  *  Add an option to enable DHCPv6 Information Request without the
     need for dhcpcd to recieve an IPv6 Router Advertisement with the
     Other Configuration bit set.
  *  Introduce the optional option type, which allows embedded options
     to be optional
  *  Mark our logger function as sysloglike because we enjoy using %m
  *  Don't check link state if not instruted to before working out if
     we can fork early or not.
  *  Add a -N --renew option to renew any existing address early
  *  Obey the hostname_short option even for configured FQDN hostnames
  *  -U, --dumplease now works with standard input.
     It no longer works with a filename.
  *  If dumping leases, skip authentication and address expiry checks
  *  Fix adding static routes via a gateway on BSD
  *  Always send LOG_DEBUG to syslog(3) even if we are in quiet mode.
     It's upto syslog to filter it.
  *  If testing or dumping leases, don't send to syslog only
     stdout/stderr.
@
text
@d1 1
a1 4
# Sample dhcpcd hook script for NTP
# It will configure either one of NTP, OpenNTP or Chrony (in that order)
# and will default to NTP if no default config is found.

d5 1
a5 3
# You can set the env var NTP_CONF to override the derived default on
# systems with >1 NTP client installed.
# Here is an example for OpenNTP
a6 2
# or by adding this to /etc/dhcpcd.conf
#   env NTP_CONF=/usr/pkg/etc/ntpd.conf
d9 1
a9 19
# To use Chrony instead, simply change ntpd.conf to chrony.conf in the
# above examples.

: ${ntp_confs:=ntp.conf ntpd.conf chrony.conf}
: ${ntp_conf_dirs=/etc /usr/pkg/etc /usr/local/etc}
ntp_conf_dir="$state_dir/ntp.conf"

# If NTP_CONF is not set, work out a good default
if [ -z "$NTP_CONF" ]; then
	for d in ${ntp_conf_dirs}; do
		for f in ${ntp_confs}; do
			if [ -e "$d/$f" ]; then
				NTP_CONF="$d/$f"
				break 2
			fi
		done
	done
	[ -e "$NTP_CONF" ] || NTP_CONF=/etc/ntp.conf
fi
d11 3
a13 11
# Derive service name from configuration
if [ -z "$ntp_service" ]; then
	case "$NTP_CONF" in
	*chrony.conf)		ntp_service=chronyd;;
	*)			ntp_service=ntpd;;
	esac
fi

# Debian has a seperate file for DHCP config to avoid stamping on
# the master.
if [ "$ntp_service" = ntpd ] && type invoke-rc.d >/dev/null 2>&1; then
d19 1
d21 9
@


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


1.1.1.2.4.2
log
@Sync with HEAD.
@
text
@a0 82
# Sample dhcpcd hook script for ntp
# Like our resolv.conf hook script, we store a database of ntp.conf files
# and merge into /etc/ntp.conf

# Detect OpenRC or BSD rc
# Distributions may want to just have their command here instead of this
if type rc-service >/dev/null 2>&1 && rc-service --exists ntpd; then
	ntpd_restart_cmd="rc-service ntpd -- --ifstarted --quiet restart"
elif [ -x /etc/rc.d/ntpd ]; then
	ntpd_restart_cmd="/etc/rc.d/ntpd restart"
elif [ -x /usr/local/etc/rc.d/ntpd ]; then
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd restart"
fi

ntp_conf_dir="${state_dir}/ntp.conf"

build_ntp_conf()
{
	local cf="/etc/ntp.conf.${interface}"
	local interfaces= header= srvs= servers= x=

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

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

		# Build a server list
		srvs=$(cd "${ntp_conf_dir}";
			key_get_value "server " ${interfaces})
		if [ -n "${srvs}" ]; then
			for x in $(uniqify ${srvs}); do
				servers="${servers}server ${x}\n"
			done
		fi
	fi

	# Merge our config into ntp.conf
	[ -e "${cf}" ] && rm -f "${cf}"
	remove_markers "${signature_base}" "${signature_base_end}" \
		/etc/ntp.conf > "${cf}"
	if [ -n "${servers}" ]; then
		echo "${signature_base}${header:+ ${from} }${header}" >> "${cf}"
		printf "${search}${servers}" >> "${cf}"
		echo "${signature_base_end}${header:+ ${from} }${header}" >> "${cf}"
	fi

	# If we changed anything, restart ntpd
	if change_file /etc/ntp.conf "${cf}"; then
		[ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd}
	fi
}

add_ntp_conf()
{
	local cf="${ntp_conf_dir}/${interface}" x=

	[ -e "${cf}" ] && rm "${cf}"
	[ -d "${ntp_conf_dir}" ] || mkdir -p "${ntp_conf_dir}"
	if [ -n "${new_ntp_servers}" ]; then
		for x in ${new_ntp_servers}; do
			echo "server ${x}" >> "${cf}"
		done
	fi
	build_ntp_conf
}

remove_ntp_conf()
{
	if [ -e "${ntp_conf_dir}/${interface}" ]; then
		rm "${ntp_conf_dir}/${interface}"
	fi
	build_ntp_conf
}

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


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


1.1.1.1.2.2
log
@Sync with wrstuden-revivesa-base-2.
@
text
@a0 51
# Sample dhcpcd hook script for ntp

# Detect OpenRC or BSD rc
# Distributions may want to just have their command here instead of this
if type rc-service >/dev/null 2>&1 && rc-service --exists ntpd; then
	ntpd_restart_cmd="rc-service ntpd -- --ifstarted --quiet restart"
elif [ -x /etc/rc.d/ntpd ]; then
	ntpd_restart_cmd="/etc/rc.d/ntpd restart"
elif [ -x /usr/local/etc/rc.d/ntpd ]; then
	ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd restart"
fi

make_ntp_conf()
{
	[ -z "${new_ntp_servers}" ] && return 0
	local cf=/etc/ntp.conf."${interface}" x=
	echo "${signature}" > "${cf}"
	echo "restrict default noquery notrust nomodify" >> "${cf}"
	echo "restrict 127.0.0.1" >> "${cf}"
	for x in ${new_ntp_servers}; do
		echo "restrict ${x} nomodify notrap noquery" >> "${cf}"
		echo "server ${x}" >> "${cf}"
	done
	if [ ! -e /etc/ntp.conf ]; then
		false	
	elif type cmp >/dev/null 2>&1; then
		cmp -s /etc/ntp.conf "${cf}"
	elif type diff >/dev/null 2>&1; then
		diff -q /etc/ntp.conf "${cf}" >/dev/null
	else
		false
	fi
	if [ $? = 0 ]; then
		rm -f "${cf}"
	else
		save_conf /etc/ntp.conf
		mv -f "${cf}" /etc/ntp.conf
		[ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd}
	fi
}

restore_ntp_conf()
{
	restore_conf /etc/ntp.conf || return 0
	[ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd}
}

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