.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 3, 2008
+.Dd September 11, 2008
.Dt DHCPCD 8 SMM
.Sh NAME
.Nm dhcpcd
.Op Fl t , -timeout Ar seconds
.Op Fl u , -userclass Ar class
.Op Fl v , -vendor Ar code , Ar value
+.Op Fl z , -allowinterfaces Ar pattern
.Op Fl C , -nohook Ar hook
.Op Fl F , -fqdn Ar FQDN
.Op Fl I , -clientid Ar clientid
.Op Fl O , -nooption Ar option
.Op Fl Q , -require Ar option
.Op Fl X , -blacklist Ar address
+.Op Fl Z , -denyinterfaces Ar pattern
.Op interface
.Op ...
.Nm
If a list of interfaces are given on the command line, then
.Nm
only works with those interfaces.
-If no interfaces are given then we detect all available interfaces and
+If no interfaces are given then we discover available interfaces and
attempt to configure all of them.
+See options below for controlling what interfaces we allow and deny through
+the use of patterns.
.Ss Hooking into DHCP events
.Nm
runs
.Nm
on the command line, only warnings and errors will be displayed.
The messages are still logged though.
+.It Fl z , -allowinterfaces Ar pattern
+When discovering interfaces, the interface name must match
+.Ar pattern
+which is a space or comma separated list of patterns passed to
+.Xr fnmatch 3 .
+If the same interface is matched in
+.Fl Z , -denyinterfaces
+then it is still denied.
.It Fl A , -noarp
Don't request or claim the address by ARP.
This also disables IPv4LL.
This may be expanded in future releases to ignore all packets
matching either the IP or hardware
.Ar address .
+.It Fl Z , -denyinterfaces Ar pattern
+When discovering interfaces, the interface name must not match
+.Ar pattern
+which is a space or comma separated list of patterns passed to
+.Xr fnmatch 3 .
.El
.Sh NOTES
.Nm
.Xr dhcpcd-run-hooks 8 ,
.Xr resolv.conf 5 ,
.Xr resolvconf 8 ,
+.Xr fnmatch 3
.Sh STANDARDS
RFC 2131, RFC 2132, RFC 2855, RFC 3004, RFC 3361, RFC 3396, RFC 3397,
RFC 3442, RFC 3927, RFC 4361, RFC 4390, RFC 4702.
#define OPTS "bc:df:h:i:kl:m:no:pqr:s:t:u:v:xABC:DEF:GI:KLO:Q:TVX:"
const struct option cf_options[] = {
- {"background", no_argument, NULL, 'b'},
- {"script", required_argument, NULL, 'c'},
- {"debug", no_argument, NULL, 'd'},
- {"config", required_argument, NULL, 'f'},
- {"hostname", optional_argument, NULL, 'h'},
- {"vendorclassid", optional_argument, NULL, 'i'},
- {"release", no_argument, NULL, 'k'},
- {"leasetime", required_argument, NULL, 'l'},
- {"metric", required_argument, NULL, 'm'},
- {"rebind", no_argument, NULL, 'n'},
- {"option", required_argument, NULL, 'o'},
- {"persistent", no_argument, NULL, 'p'},
- {"quiet", no_argument, NULL, 'q'},
- {"request", optional_argument, NULL, 'r'},
- {"inform", optional_argument, NULL, 's'},
- {"timeout", required_argument, NULL, 't'},
- {"userclass", required_argument, NULL, 'u'},
- {"vendor", required_argument, NULL, 'v'},
- {"exit", no_argument, NULL, 'x'},
- {"noarp", no_argument, NULL, 'A'},
- {"nobackground", no_argument, NULL, 'B'},
- {"nohook", required_argument, NULL, 'C'},
- {"duid", no_argument, NULL, 'D'},
- {"lastlease", no_argument, NULL, 'E'},
- {"fqdn", optional_argument, NULL, 'F'},
- {"nogateway", no_argument, NULL, 'G'},
- {"clientid", optional_argument, NULL, 'I'},
- {"nolink", no_argument, NULL, 'K'},
- {"noipv4ll", no_argument, NULL, 'L'},
- {"nooption", optional_argument, NULL, 'O'},
- {"require", required_argument, NULL, 'Q'},
- {"test", no_argument, NULL, 'T'},
- {"variables", no_argument, NULL, 'V'},
- {"blacklist", required_argument, NULL, 'X'},
- {NULL, 0, NULL, '\0'}
+ {"background", no_argument, NULL, 'b'},
+ {"script", required_argument, NULL, 'c'},
+ {"debug", no_argument, NULL, 'd'},
+ {"config", required_argument, NULL, 'f'},
+ {"hostname", optional_argument, NULL, 'h'},
+ {"vendorclassid", optional_argument, NULL, 'i'},
+ {"release", no_argument, NULL, 'k'},
+ {"leasetime", required_argument, NULL, 'l'},
+ {"metric", required_argument, NULL, 'm'},
+ {"rebind", no_argument, NULL, 'n'},
+ {"option", required_argument, NULL, 'o'},
+ {"persistent", no_argument, NULL, 'p'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"request", optional_argument, NULL, 'r'},
+ {"inform", optional_argument, NULL, 's'},
+ {"timeout", required_argument, NULL, 't'},
+ {"userclass", required_argument, NULL, 'u'},
+ {"vendor", required_argument, NULL, 'v'},
+ {"exit", no_argument, NULL, 'x'},
+ {"allowinterfaces", required_argument, NULL, 'z'},
+ {"noarp", no_argument, NULL, 'A'},
+ {"nobackground", no_argument, NULL, 'B'},
+ {"nohook", required_argument, NULL, 'C'},
+ {"duid", no_argument, NULL, 'D'},
+ {"lastlease", no_argument, NULL, 'E'},
+ {"fqdn", optional_argument, NULL, 'F'},
+ {"nogateway", no_argument, NULL, 'G'},
+ {"clientid", optional_argument, NULL, 'I'},
+ {"nolink", no_argument, NULL, 'K'},
+ {"noipv4ll", no_argument, NULL, 'L'},
+ {"nooption", optional_argument, NULL, 'O'},
+ {"require", required_argument, NULL, 'Q'},
+ {"test", no_argument, NULL, 'T'},
+ {"variables", no_argument, NULL, 'V'},
+ {"blacklist", required_argument, NULL, 'X'},
+ {"denyinterfaces", required_argument, NULL, 'Z'},
+ {NULL, 0, NULL, '\0'}
};
static int
return l;
}
+static char **
+splitv(int *argc, char **argv, const char *arg)
+{
+ char **v = argv;
+ char *o = xstrdup(arg), *p, *t;
+
+ p = o;
+ while ((t = strsep(&p, ", "))) {
+ (*argc)++;
+ v = xrealloc(v, *argc);
+ v[(*argc) - 1] = xstrdup(t);
+ }
+ free(o);
+ return v;
+}
+
static int
parse_option(struct if_options *ifo, int opt, const char *arg)
{
ifo->vendor[0] += s + 2;
}
break;
+ case 'z':
+ /* We only set this if we haven't got any interfaces */
+ if (!ifaces)
+ ifav = splitv(&ifac, ifav, arg);
+ break;
case 'A':
ifo->options &= ~DHCPCD_ARP;
/* IPv4LL requires ARP */
ifo->blacklist[ifo->blacklist_len] = addr.s_addr;
ifo->blacklist_len++;
break;
+ case 'Z':
+ /* We only set this if we haven't got any interfaces */
+ if (!ifaces)
+ ifdv = splitv(&ifdc, ifdv, arg);
+ break;
default:
return 0;
}