return sla->prefix_len;
}
-int
-dhcp6_has_public_addr(const struct interface *ifp)
-{
- const struct dhcp6_state *state = D6_CSTATE(ifp);
- const struct ipv6_addr *ia;
-
- if (state == NULL)
- return 0;
- TAILQ_FOREACH(ia, &state->addrs, next) {
- if (ipv6_publicaddr(ia))
- return 1;
- }
- return 0;
-}
-
static int
dhcp6_makemessage(struct interface *ifp)
{
eloop_timeout_add_sec(ifp->ctx->eloop,
(time_t)state->expire, dhcp6_startexpire, ifp);
- ipv6nd_runignoredra(ifp);
ipv6_addaddrs(&state->addrs);
if (state->state == DH6S_INFORMED)
struct ipv6_addr *dhcp6_findaddr(struct dhcpcd_ctx *, const struct in6_addr *,
short);
size_t dhcp6_find_delegates(struct interface *);
-int dhcp6_has_public_addr(const struct interface *);
int dhcp6_start(struct interface *, enum DH6S);
void dhcp6_reboot(struct interface *);
void dhcp6_renew(struct interface *);
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd February 14, 2016
+.Dd February 15, 2016
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
the default route only.
This allows dhcpcd to prefer an interface for outbound traffic based on metric
and/or user selection rather than the kernel.
-.It Ic ipv6ra_accept_nopublic
-Some IPv6 routers advertise themselves as a default router without any
-public prefixes or managed addresses.
-Generally, this is incorrect behaviour and
-.Nm dhcpcd
-will ignore the advertisement unless this option is turned on.
.It Ic ipv6rs
Enables IPv6 Router Advertisment solicitation.
This is on by default, but is documented here in the case where it is disabled
#define O_IPV6RA_AUTOCONF O_BASE + 38
#define O_IPV6RA_NOAUTOCONF O_BASE + 39
#define O_REJECT O_BASE + 40
-#define O_IPV6RA_ACCEPT_NOPUBLIC O_BASE + 41
#define O_BOOTP O_BASE + 42
#define O_DEFINEND O_BASE + 43
#define O_NODELAY O_BASE + 44
{"ipv6ra_fork", no_argument, NULL, O_IPV6RA_FORK},
{"ipv6ra_own", no_argument, NULL, O_IPV6RA_OWN},
{"ipv6ra_own_default", no_argument, NULL, O_IPV6RA_OWN_D},
- {"ipv6ra_accept_nopublic", no_argument, NULL, O_IPV6RA_ACCEPT_NOPUBLIC},
{"ipv4", no_argument, NULL, O_IPV4},
{"noipv4", no_argument, NULL, O_NOIPV4},
{"ipv6", no_argument, NULL, O_IPV6},
case O_IPV6RA_OWN_D:
ifo->options |= DHCPCD_IPV6RA_OWN_DEFAULT;
break;
- case O_IPV6RA_ACCEPT_NOPUBLIC:
- ifo->options |= DHCPCD_IPV6RA_ACCEPT_NOPUBLIC;
- break;
case O_IPV6RA_AUTOCONF:
ifo->options |= DHCPCD_IPV6RA_AUTOCONF;
break;
#define DHCPCD_RTM_PPID (1ULL << 53)
#define DHCPCD_IPV6RA_AUTOCONF (1ULL << 54)
#define DHCPCD_ROUTER_HOST_ROUTE_WARNED (1ULL << 55)
-#define DHCPCD_IPV6RA_ACCEPT_NOPUBLIC (1ULL << 56)
+// unassigned (1ULL << 56)
#define DHCPCD_BOOTP (1ULL << 57)
#define DHCPCD_INITIAL_DELAY (1ULL << 58)
#define DHCPCD_PRINT_PIDFILE (1ULL << 59)
return 0;
}
-int
-ipv6_publicaddr(const struct ipv6_addr *ia)
-{
- return (ia->prefix_pltime &&
- (ia->addr.s6_addr[0] & 0xfe) != 0xfc &&
- !(ia->addr_flags & IN6_IFF_NOTUSEABLE));
-}
int
ipv6_findaddrmatch(const struct ipv6_addr *addr, const struct in6_addr *match,
}
}
if (rap->lifetime && rap->iface->options->options &
- (DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT) &&
- !rap->no_public_warned)
+ (DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT))
{
rt = make_router(rap);
if (rt)
const char *, const struct in6_addr *, uint8_t, int);
int ipv6_handleifa_addrs(int, struct ipv6_addrhead *,
const struct in6_addr *, int);
-int ipv6_publicaddr(const struct ipv6_addr *);
struct ipv6_addr *ipv6_iffindaddr(struct interface *,
const struct in6_addr *, int);
int ipv6_hasaddr(const struct interface *);
}
}
-static int
-ipv6nd_has_public_addr(const struct interface *ifp)
-{
- const struct ra *rap;
- const struct ipv6_addr *ia;
-
- TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
- if (rap->iface == ifp) {
- TAILQ_FOREACH(ia, &rap->addrs, next) {
- if (ia->flags & IPV6_AF_AUTOCONF &&
- ipv6_publicaddr(ia))
- return 1;
- }
- }
- }
- return 0;
-}
-
static void
ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp,
struct icmp6_hdr *icp, size_t len, int hoplimit)
if (rap) {
free(rap->data);
rap->data_len = 0;
- rap->no_public_warned = 0;
}
new_data = 1;
} else
if (new_rap)
add_router(ifp->ctx->ipv6, rap);
- if (!ipv6nd_has_public_addr(rap->iface) &&
- !(rap->iface->options->options & DHCPCD_IPV6RA_ACCEPT_NOPUBLIC) &&
- (!(rap->flags & ND_RA_FLAG_MANAGED) ||
- !dhcp6_has_public_addr(rap->iface)))
- {
- logger(rap->iface->ctx,
- rap->no_public_warned ? LOG_DEBUG : LOG_WARNING,
- "%s: ignoring RA from %s"
- " (no public prefix, no managed address)",
- rap->iface->name, rap->sfrom);
- rap->no_public_warned = 1;
- goto handle_flag;
- }
if (ifp->ctx->options & DHCPCD_TEST) {
script_runreason(ifp, "TEST");
goto handle_flag;
ipv6nd_expirera(ifp);
}
-/* Run RA's we ignored becuase they had no public addresses
- * This should only be called when DHCPv6 applies a public address */
-void
-ipv6nd_runignoredra(struct interface *ifp)
-{
- struct ra *rap;
-
- TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
- if (rap->iface == ifp &&
- !rap->expired &&
- rap->no_public_warned)
- {
- rap->no_public_warned = 0;
- logger(rap->iface->ctx, LOG_INFO,
- "%s: applying ignored RA from %s",
- rap->iface->name, rap->sfrom);
- if (ifp->ctx->options & DHCPCD_TEST) {
- script_runreason(ifp, "TEST");
- continue;
- }
- if (ipv6nd_scriptrun(rap))
- return;
- eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
- eloop_timeout_delete(ifp->ctx->eloop, NULL, rap);
- }
- }
-}
-
int
ipv6nd_hasra(const struct interface *ifp)
{
struct ipv6_addrhead addrs;
uint8_t hasdns;
uint8_t expired;
- uint8_t no_public_warned;
};
TAILQ_HEAD(ra_head, ra);
void ipv6nd_expirera(void *arg);
int ipv6nd_hasra(const struct interface *);
int ipv6nd_hasradhcp(const struct interface *);
-void ipv6nd_runignoredra(struct interface *);
void ipv6nd_handleifa(struct dhcpcd_ctx *, int,
const char *, const struct in6_addr *, int);
int ipv6nd_dadcompleted(const struct interface *);