# define LEASEFILE6 DBDIR "/" PACKAGE "-%s.lease6"
#endif
#ifndef PIDFILE
-# define PIDFILE RUNDIR "/" PACKAGE "%s%s.pid"
+# define PIDFILE RUNDIR "/" PACKAGE "%s%s%s.pid"
#endif
#ifndef CONTROLSOCKET
# define CONTROLSOCKET RUNDIR "/" PACKAGE "%s%s.sock"
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 7, 2014
+.Dd May 29, 2014
.Dt DHCPCD 8
.Os
.Sh NAME
requires a Berkley Packet Filter, or BPF device on BSD based systems and a
Linux Socket Filter, or LPF device on Linux based systems for all IPv4
configuration.
+.Pp
+If restricting
+.Nm
+to a single interface and optionally address family via the command-line
+then all futher calls to
+.Nm
+to rebind, reconfigure or exit need to include the same restrictive flags
+so that
+.Nm
+knows which process to signal.
.Sh FILES
.Bl -ohang
.It Pa @SYSCONFDIR@/dhcpcd.conf
main(int argc, char **argv)
{
struct dhcpcd_ctx ctx;
- char pidfile[sizeof(PIDFILE) + IF_NAMESIZE];
+ char pidfile[sizeof(PIDFILE) + IF_NAMESIZE + 1];
struct if_options *ifo;
struct interface *ifp;
uint16_t family = 0;
{
switch (opt) {
case '4':
+ if (family) {
+ syslog(LOG_ERR, "cannot specify more than one"
+ " address family");
+ goto exit_failure;
+ }
family = AF_INET;
break;
case '6':
+ if (family) {
+ syslog(LOG_ERR, "cannot specify more than one"
+ " address family");
+ goto exit_failure;
+ }
family = AF_INET6;
break;
case 'f':
/* If we have any other args, we should run as a single dhcpcd
* instance for that interface. */
if (optind == argc - 1 && !(ctx.options & DHCPCD_MASTER)) {
+ const char *per;
+
if (strlen(argv[optind]) > IF_NAMESIZE) {
syslog(LOG_ERR, "%s: interface name too long",
argv[optind]);
goto exit_failure;
}
+ /* Allow a dhcpcd interface per address family */
+ switch(family) {
+ case AF_INET:
+ per = "-4";
+ break;
+ case AF_INET6:
+ per = "-6";
+ break;
+ default:
+ per = "";
+ }
snprintf(pidfile, sizeof(pidfile),
- PIDFILE, "-", argv[optind]);
+ PIDFILE, "-", argv[optind], per);
}
else {
- snprintf(pidfile, sizeof(pidfile), PIDFILE, "", "");
+ snprintf(pidfile, sizeof(pidfile), PIDFILE, "", "", "");
ctx.options |= DHCPCD_MASTER;
}
}