if (ifp->options->options & (DHCPCD_STATIC | DHCPCD_INFORM)) {
if (ifp->options->req_addr.s_addr != INADDR_ANY) {
lease->mask = ifp->options->req_mask;
- lease->brd.s_addr =
- lease->addr.s_addr | ~lease->mask.s_addr;
+ if (ifp->options->req_brd.s_addr != INADDR_ANY)
+ lease->brd = ifp->options->req_brd;
+ else
+ lease->brd.s_addr =
+ lease->addr.s_addr | ~lease->mask.s_addr;
} else {
const struct ipv4_addr *ia;
.Op Fl Q , Fl Fl require Ar option
.Op Fl r , Fl Fl request Ar address
.Op Fl S , Fl Fl static Ar value
-.Op Fl s , Fl Fl inform Ar address Ns Op Ar /cidr
+.Op Fl s , Fl Fl inform Ar address Ns Op Ar /cidr Ns Op Ar /broadcast_address
.Op Fl Fl inform6
.Op Fl t , Fl Fl timeout Ar seconds
.Op Fl u , Fl Fl userclass Ar class
is given then the first address currently assigned to the
.Ar interface
is used.
-.It Fl s , Fl Fl inform Ar address Ns Op Ar /cidr
+.It Fl s , Fl Fl inform Ar address Ns Op Ar /cidr Ns Op Ar /broadcast_address
Behaves like
.Fl r , Fl Fl request
as above, but sends a DHCP INFORM instead of DISCOVER/REQUEST.
is given then the first address currently assigned to the
.Ar interface
is used.
-.It Ic inform Op Ar address Ns Op Ar /cidr
+.It Ic inform Op Ar address Ns Op Ar /cidr Ns Op Ar /broadcast_address
Behaves like
.Ic request
as above, but sends a DHCP INFORM instead of DISCOVER/REQUEST.
.Nm dhcpcd
will continue auto-configuation as normal.
.Pp
-Here is an example which configures two static address, an IPv4 router, DNS
-and disables IPv6 auto-configuration.
+Here is an example which configures two static address, overriding the default
+IPv4 broadcast address, an IPv4 router, DNS and disables IPv6 auto-configuration.
You could also use the
.Ic inform6
command here if you wished to obtain more information via DHCPv6.
.D1 interface eth0
.D1 noipv6rs
.D1 static ip_address=192.168.0.10/24
+.D1 static broadcast_address=192.168.0.63
.D1 static ip6_address=fd51:42f8:caae:d92e::ff/64
.D1 static routers=192.168.0.1
.D1 static domain_name_servers=192.168.0.1 fd51:42f8:caae:d92e::1
break;
case 's':
if (arg && *arg != '\0') {
- if (parse_addr(&ifo->req_addr, &ifo->req_mask, arg)
- != 0)
+ /* Strip out a broadcast address */
+ p = strchr(arg, '/');
+ if (p != NULL) {
+ p = strchr(p + 1, '/');
+ if (p != NULL)
+ *p = '\0';
+ }
+ i = parse_addr(&ifo->req_addr, &ifo->req_mask, arg);
+ if (p != NULL) {
+ /* Ensure the original string is preserved */
+ *p++ = '/';
+ if (i == 0)
+ i = parse_addr(&ifo->req_brd, NULL, p);
+ }
+ if (i != 0)
return -1;
} else {
ifo->req_addr.s_addr = 0;
{
if (parse_addr(&ifo->req_mask, NULL, p) != 0)
return -1;
+ } else if (strncmp(arg, "broadcast_address=",
+ strlen("broadcast_address=")) == 0)
+ {
+ if (parse_addr(&ifo->req_brd, NULL, p) != 0)
+ return -1;
} else if (strncmp(arg, "routes=", strlen("routes=")) == 0 ||
strncmp(arg, "static_routes=",
strlen("static_routes=")) == 0 ||
struct in_addr req_addr;
struct in_addr req_mask;
+ struct in_addr req_brd;
struct rt_head routes;
struct in6_addr req_addr6;
uint8_t req_prefix_len;
}
}
- if (!(ctx->options & (DHCPCD_DUMPLEASE | DHCPCD_TEST))) {
+ if (active &&
+ !(ctx->options & (DHCPCD_DUMPLEASE | DHCPCD_TEST)))
+ {
/* Handle any platform init for the interface */
if (active != IF_INACTIVE && if_init(ifp) == -1) {
logerr("%s: if_init", ifp->name);