X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/30b0659725eb63ca3f78e37bd33fff888d226e96..5785f5fb36825712d454aa00e3fc225e237465d1:/sys/netinet6/nd6_rtr.c diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 9c20dff857..138b7ef2aa 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -47,7 +47,6 @@ #include #include -#include #include #include @@ -80,8 +79,8 @@ static struct nd_pfxrouter *find_pfxlist_reachable_router (struct nd_prefix *); static void defrouter_addifreq (struct ifnet *); -static void in6_init_address_ltimes (struct nd_prefix *ndpr, - struct in6_addrlifetime *lt6); +static void in6_init_address_ltimes(struct nd_prefix *ndpr, + struct in6_addrlifetime *lt6); static int rt6_deleteroute (struct radix_node *, void *); @@ -116,9 +115,6 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); struct nd_router_solicit *nd_rs; struct in6_addr saddr6 = ip6->ip6_src; -#if 0 - struct in6_addr daddr6 = ip6->ip6_dst; -#endif char *lladdr = NULL; int lladdrlen = 0; #if 0 @@ -178,7 +174,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) nd6log((LOG_INFO, "nd6_rs_input: lladdrlen mismatch for %s " "(if %d, RS packet %d)\n", - ip6_sprintf(&saddr6), ifp->if_addrlen, lladdrlen - 2)); + ip6_sprintf(&saddr6), ifp->if_addrlen, lladdrlen - 2)); goto bad; } @@ -339,17 +335,14 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) pr.ndpr_ifp = (struct ifnet *)m->m_pkthdr.rcvif; pr.ndpr_raf_onlink = (pi->nd_opt_pi_flags_reserved & - ND_OPT_PI_FLAG_ONLINK) ? 1 : 0; + ND_OPT_PI_FLAG_ONLINK) ? 1 : 0; pr.ndpr_raf_auto = (pi->nd_opt_pi_flags_reserved & - ND_OPT_PI_FLAG_AUTO) ? 1 : 0; + ND_OPT_PI_FLAG_AUTO) ? 1 : 0; pr.ndpr_plen = pi->nd_opt_pi_prefix_len; pr.ndpr_vltime = ntohl(pi->nd_opt_pi_valid_time); - pr.ndpr_pltime = - ntohl(pi->nd_opt_pi_preferred_time); - + pr.ndpr_pltime = ntohl(pi->nd_opt_pi_preferred_time); if (in6_init_prefix_ltimes(&pr)) continue; /* prefix lifetime init failed */ - prelist_update(&pr, dr, m); } } @@ -358,36 +351,32 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) * MTU */ if (ndopts.nd_opts_mtu && ndopts.nd_opts_mtu->nd_opt_mtu_len == 1) { - u_int32_t mtu = ntohl(ndopts.nd_opts_mtu->nd_opt_mtu_mtu); + u_long mtu, maxmtu; + + mtu = ntohl(ndopts.nd_opts_mtu->nd_opt_mtu_mtu); /* lower bound */ if (mtu < IPV6_MMTU) { nd6log((LOG_INFO, "nd6_ra_input: bogus mtu option " - "mtu=%d sent from %s, ignoring\n", + "mtu=%ld sent from %s, ignoring\n", mtu, ip6_sprintf(&ip6->ip6_src))); goto skip; } /* upper bound */ - if (ndi->maxmtu) { - if (mtu <= ndi->maxmtu) { - int change = (ndi->linkmtu != mtu); - - ndi->linkmtu = mtu; - if (change) /* in6_maxmtu may change */ - in6_setmaxmtu(); - } else { - nd6log((LOG_INFO, "nd6_ra_input: bogus mtu " - "mtu=%d sent from %s; " - "exceeds maxmtu %d, ignoring\n", - mtu, ip6_sprintf(&ip6->ip6_src), - ndi->maxmtu)); - } + maxmtu = (ndi->maxmtu && ndi->maxmtu < ifp->if_mtu) ? + ndi->maxmtu : ifp->if_mtu; + if (mtu <= maxmtu) { + int change = (ndi->linkmtu != mtu); + + ndi->linkmtu = mtu; + if (change) /* in6_maxmtu may change */ + in6_setmaxmtu(); } else { - nd6log((LOG_INFO, "nd6_ra_input: mtu option " - "mtu=%d sent from %s; maxmtu unknown, " - "ignoring\n", - mtu, ip6_sprintf(&ip6->ip6_src))); + nd6log((LOG_INFO, "nd6_ra_input: bogus mtu " + "mtu=%lu sent from %s; " + "exceeds maxmtu %lu, ignoring\n", + mtu, ip6_sprintf(&ip6->ip6_src), maxmtu)); } } @@ -409,7 +398,7 @@ skip: nd6log((LOG_INFO, "nd6_ra_input: lladdrlen mismatch for %s " "(if %d, RA packet %d)\n", - ip6_sprintf(&saddr6), ifp->if_addrlen, lladdrlen - 2)); + ip6_sprintf(&saddr6), ifp->if_addrlen, lladdrlen - 2)); goto bad; } @@ -469,19 +458,18 @@ defrouter_addreq(struct nd_defrouter *new) bzero(&mask, sizeof(mask)); bzero(&gate, sizeof(gate)); - def.sin6_len = mask.sin6_len = gate.sin6_len - = sizeof(struct sockaddr_in6); + def.sin6_len = mask.sin6_len = gate.sin6_len = + sizeof(struct sockaddr_in6); def.sin6_family = mask.sin6_family = gate.sin6_family = AF_INET6; gate.sin6_addr = new->rtaddr; rtrequest_global(RTM_ADD, (struct sockaddr *)&def, - (struct sockaddr *)&gate, (struct sockaddr *)&mask, - RTF_GATEWAY); + (struct sockaddr *)&gate, (struct sockaddr *)&mask, RTF_GATEWAY); return; } /* Add a route to a given interface as default */ -void +static void defrouter_addifreq(struct ifnet *ifp) { struct sockaddr_in6 def, mask; @@ -507,11 +495,8 @@ defrouter_addifreq(struct ifnet *ifp) } flags = ifa->ifa_flags; - error = rtrequest_global(RTM_ADD, - (struct sockaddr *)&def, - ifa->ifa_addr, - (struct sockaddr *)&mask, - flags); + error = rtrequest_global(RTM_ADD, (struct sockaddr *)&def, + ifa->ifa_addr, (struct sockaddr *)&mask, flags); if (error != 0) { nd6log((LOG_ERR, "defrouter_addifreq: failed to install a route to " @@ -543,16 +528,13 @@ defrouter_delreq(struct nd_defrouter *dr, int dofree) bzero(&mask, sizeof(mask)); bzero(&gate, sizeof(gate)); - def.sin6_len = mask.sin6_len = gate.sin6_len - = sizeof(struct sockaddr_in6); + def.sin6_len = mask.sin6_len = gate.sin6_len = + sizeof(struct sockaddr_in6); def.sin6_family = mask.sin6_family = gate.sin6_family = AF_INET6; gate.sin6_addr = dr->rtaddr; - rtrequest_global(RTM_DELETE, - (struct sockaddr *)&def, - (struct sockaddr *)&gate, - (struct sockaddr *)&mask, - RTF_GATEWAY); + rtrequest_global(RTM_DELETE, (struct sockaddr *)&def, + (struct sockaddr *)&gate, (struct sockaddr *)&mask, RTF_GATEWAY); if (dofree) /* XXX: necessary? */ kfree(dr, M_IP6NDP); } @@ -567,10 +549,8 @@ defrtrlist_del(struct nd_defrouter *dr) * Flush all the routing table entries that use the router * as a next hop. */ - if (!ip6_forwarding && ip6_accept_rtadv) { - /* above is a good condition? */ + if (!ip6_forwarding && ip6_accept_rtadv) /* XXX: better condition? */ rt6_flush(&dr->rtaddr, dr->ifp); - } if (dr == TAILQ_FIRST(&nd_defrouter)) deldr = dr; /* The router is primary. */ @@ -746,10 +726,7 @@ pfxrtr_add(struct nd_prefix *pr, struct nd_defrouter *dr) { struct nd_pfxrouter *new; - new = (struct nd_pfxrouter *)kmalloc(sizeof(*new), M_IP6NDP, - M_NOWAIT | M_ZERO); - if (new == NULL) - return; + new = kmalloc(sizeof(*new), M_IP6NDP, M_INTWAIT | M_ZERO); new->router = dr; LIST_INSERT_HEAD(&pr->ndpr_advrtrs, new, pfr_entry); @@ -773,11 +750,8 @@ nd6_prefix_lookup(struct nd_prefix *pr) if (pr->ndpr_ifp == search->ndpr_ifp && pr->ndpr_plen == search->ndpr_plen && in6_are_prefix_equal(&pr->ndpr_prefix.sin6_addr, - &search->ndpr_prefix.sin6_addr, - pr->ndpr_plen) - ) { + &search->ndpr_prefix.sin6_addr, pr->ndpr_plen)) break; - } } return (search); @@ -790,21 +764,19 @@ nd6_prelist_add(struct nd_prefix *pr, struct nd_defrouter *dr, struct nd_prefix *new = NULL; int i; - new = (struct nd_prefix *)kmalloc(sizeof(*new), M_IP6NDP, - M_NOWAIT | M_ZERO); - if (new == NULL) - return ENOMEM; + new = kmalloc(sizeof(*new), M_IP6NDP, M_INTWAIT); *new = *pr; if (newp != NULL) *newp = new; - /* initilization */ + /* initialization */ LIST_INIT(&new->ndpr_advrtrs); in6_prefixlen2mask(&new->ndpr_mask, new->ndpr_plen); /* make prefix in the canonical form */ - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { new->ndpr_prefix.sin6_addr.s6_addr32[i] &= - new->ndpr_mask.s6_addr32[i]; + new->ndpr_mask.s6_addr32[i]; + } mtx_lock(&nd6_mtx); /* link ndpr_entry to nd_prefix list */ @@ -824,9 +796,8 @@ nd6_prelist_add(struct nd_prefix *pr, struct nd_defrouter *dr, } } - if (dr) { + if (dr) pfxrtr_add(new, dr); - } return 0; } @@ -901,12 +872,11 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) * both IP header and IP datagrams, doesn't it ? */ #if defined(M_AUTHIPHDR) && defined(M_AUTHIPDGM) - auth = (m->m_flags & M_AUTHIPHDR - && m->m_flags & M_AUTHIPDGM) ? 1 : 0; + auth = ((m->m_flags & M_AUTHIPHDR) && + (m->m_flags & M_AUTHIPDGM)); #endif } - if ((pr = nd6_prefix_lookup(new)) != NULL) { /* * nd6_prefix_lookup() ensures that pr and new have the same @@ -962,8 +932,8 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) "nd6_prelist_add failed for %s/%d on %s " "errno=%d, returnpr=%p\n", ip6_sprintf(&new->ndpr_prefix.sin6_addr), - new->ndpr_plen, if_name(new->ndpr_ifp), - error, newpr)); + new->ndpr_plen, if_name(new->ndpr_ifp), + error, newpr)); goto end; /* we should just give up in this case. */ } @@ -971,7 +941,7 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) * XXX: from the ND point of view, we can ignore a prefix * with the on-link bit being zero. However, we need a * prefix structure for references from autoconfigured - * addresses. Thus, we explicitly make suret that the prefix + * addresses. Thus, we explicitly make sure that the prefix * itself expires now. */ if (newpr->ndpr_raf_onlink == 0) { @@ -1030,8 +1000,7 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) ifa_plen = in6_mask2len(&ifa6->ia_prefixmask.sin6_addr, NULL); if (ifa_plen != new->ndpr_plen || !in6_are_prefix_equal(&ifa6->ia_addr.sin6_addr, - &new->ndpr_prefix.sin6_addr, - ifa_plen)) + &new->ndpr_prefix.sin6_addr, ifa_plen)) continue; if (ia6_match == NULL) /* remember the first one */ @@ -1099,13 +1068,13 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) lt6_tmp.ia6t_expire > ifa6->ia6_lifetime.ia6t_expire) { lt6_tmp.ia6t_expire = - ifa6->ia6_lifetime.ia6t_expire; + ifa6->ia6_lifetime.ia6t_expire; } if (lt6_tmp.ia6t_preferred == 0 || /* no expire */ lt6_tmp.ia6t_preferred > ifa6->ia6_lifetime.ia6t_preferred) { lt6_tmp.ia6t_preferred = - ifa6->ia6_lifetime.ia6t_preferred; + ifa6->ia6_lifetime.ia6t_preferred; } } @@ -1123,11 +1092,6 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) pr->ndpr_refcnt++; ia6->ia6_ndpr = pr; -#if 0 - /* XXXYYY Don't do this, according to Jinmei. */ - pr->ndpr_addr = new->ndpr_addr; -#endif - /* * RFC 3041 3.3 (2). * When a new public address is created as described @@ -1184,14 +1148,13 @@ find_pfxlist_reachable_router(struct nd_prefix *pr) for (pfxrtr = LIST_FIRST(&pr->ndpr_advrtrs); pfxrtr; pfxrtr = LIST_NEXT(pfxrtr, pfr_entry)) { if ((rt = nd6_lookup(&pfxrtr->router->rtaddr, 0, - pfxrtr->router->ifp)) && + pfxrtr->router->ifp)) && (ln = (struct llinfo_nd6 *)rt->rt_llinfo) && ND6_IS_LLINFO_PROBREACH(ln)) break; /* found */ } return (pfxrtr); - } /* @@ -1333,10 +1296,18 @@ pfxlist_onlink_check(void) if (ifa->ia6_ndpr == NULL) /* XXX: see above. */ continue; - if (find_pfxlist_reachable_router(ifa->ia6_ndpr)) - ifa->ia6_flags &= ~IN6_IFF_DETACHED; - else - ifa->ia6_flags |= IN6_IFF_DETACHED; + if (find_pfxlist_reachable_router(ifa->ia6_ndpr)) { + if (ifa->ia6_flags & IN6_IFF_DETACHED) { + ifa->ia6_flags &= ~IN6_IFF_DETACHED; + ifa->ia6_flags |= IN6_IFF_TENTATIVE; + nd6_dad_start((struct ifaddr *)ifa, 0); + } + } else { + if ((ifa->ia6_flags & IN6_IFF_DETACHED) == 0) { + ifa->ia6_flags |= IN6_IFF_DETACHED; + in6_newaddrmsg((struct ifaddr *)ifa); + } + } } } else { @@ -1345,6 +1316,8 @@ pfxlist_onlink_check(void) continue; ifa->ia6_flags &= ~IN6_IFF_DETACHED; + ifa->ia6_flags |= IN6_IFF_TENTATIVE; + nd6_dad_start((struct ifaddr *)ifa, 0); } } } @@ -1383,8 +1356,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) if (opr->ndpr_plen == pr->ndpr_plen && in6_are_prefix_equal(&pr->ndpr_prefix.sin6_addr, - &opr->ndpr_prefix.sin6_addr, - pr->ndpr_plen)) + &opr->ndpr_prefix.sin6_addr, pr->ndpr_plen)) return (0); } @@ -1393,8 +1365,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) */ /* search for a link-local addr */ ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, - IN6_IFF_NOTREADY| - IN6_IFF_ANYCAST); + IN6_IFF_NOTREADY| IN6_IFF_ANYCAST); if (ifa == NULL) { struct ifaddr_container *ifac; @@ -1439,15 +1410,11 @@ nd6_prefix_onlink(struct nd_prefix *pr) */ rtflags &= ~RTF_CLONING; } - error = rtrequest_global(RTM_ADD, - (struct sockaddr *)&pr->ndpr_prefix, - ifa->ifa_addr, - (struct sockaddr *)&mask6, - rtflags); + error = rtrequest_global(RTM_ADD, (struct sockaddr *)&pr->ndpr_prefix, + ifa->ifa_addr, (struct sockaddr *)&mask6, rtflags); if (error == 0) { pr->ndpr_stateflags |= NDPRF_ONLINK; - } - else { + } else { nd6log((LOG_ERR, "nd6_prefix_onlink: failed to add route for a" " prefix (%s/%d) on %s, gw=%s, mask=%s, flags=%lx " "errno = %d\n", @@ -1479,16 +1446,13 @@ nd6_prefix_offlink(struct nd_prefix *pr) sa6.sin6_family = AF_INET6; sa6.sin6_len = sizeof(sa6); bcopy(&pr->ndpr_prefix.sin6_addr, &sa6.sin6_addr, - sizeof(struct in6_addr)); + sizeof(struct in6_addr)); bzero(&mask6, sizeof(mask6)); mask6.sin6_family = AF_INET6; mask6.sin6_len = sizeof(sa6); bcopy(&pr->ndpr_mask, &mask6.sin6_addr, sizeof(struct in6_addr)); - error = rtrequest_global(RTM_DELETE, - (struct sockaddr *)&sa6, - NULL, - (struct sockaddr *)&mask6, - 0); + error = rtrequest_global(RTM_DELETE, (struct sockaddr *)&sa6, NULL, + (struct sockaddr *)&mask6, 0); if (error == 0) { pr->ndpr_stateflags &= ~NDPRF_ONLINK; @@ -1515,8 +1479,7 @@ nd6_prefix_offlink(struct nd_prefix *pr) if (opr->ndpr_plen == pr->ndpr_plen && in6_are_prefix_equal(&pr->ndpr_prefix.sin6_addr, - &opr->ndpr_prefix.sin6_addr, - pr->ndpr_plen)) { + &opr->ndpr_prefix.sin6_addr, pr->ndpr_plen)) { int e; if ((e = nd6_prefix_onlink(opr)) != 0) { @@ -1530,8 +1493,7 @@ nd6_prefix_offlink(struct nd_prefix *pr) } } } - } - else { + } else { /* XXX: can we still set the NDPRF_ONLINK flag? */ nd6log((LOG_ERR, "nd6_prefix_offlink: failed to delete route: " @@ -1558,7 +1520,7 @@ in6_ifadd(struct nd_prefix *pr, struct in6_addr *ifid) struct in6_addr mask; int prefixlen = pr->ndpr_plen; - in6_len2mask(&mask, prefixlen); + in6_prefixlen2mask(&mask, prefixlen); /* * find a link-local address (will be interface ID). @@ -1584,7 +1546,7 @@ in6_ifadd(struct nd_prefix *pr, struct in6_addr *ifid) * ID. This is to not break connections when moving addresses between * interfaces. */ - ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0);/* 0 is OK? */ + ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0); /* 0 is OK? */ if (ifa) ib = (struct in6_ifaddr *)ifa; else @@ -1619,7 +1581,7 @@ in6_ifadd(struct nd_prefix *pr, struct in6_addr *ifid) ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); /* prefix */ bcopy(&pr->ndpr_prefix.sin6_addr, &ifra.ifra_addr.sin6_addr, - sizeof(ifra.ifra_addr.sin6_addr)); + sizeof(ifra.ifra_addr.sin6_addr)); ifra.ifra_addr.sin6_addr.s6_addr32[0] &= mask.s6_addr32[0]; ifra.ifra_addr.sin6_addr.s6_addr32[1] &= mask.s6_addr32[1]; ifra.ifra_addr.sin6_addr.s6_addr32[2] &= mask.s6_addr32[2]; @@ -1628,20 +1590,20 @@ in6_ifadd(struct nd_prefix *pr, struct in6_addr *ifid) /* interface ID */ if (ifid == NULL || IN6_IS_ADDR_UNSPECIFIED(ifid)) ifid = &ib->ia_addr.sin6_addr; - ifra.ifra_addr.sin6_addr.s6_addr32[0] - |= (ifid->s6_addr32[0] & ~mask.s6_addr32[0]); - ifra.ifra_addr.sin6_addr.s6_addr32[1] - |= (ifid->s6_addr32[1] & ~mask.s6_addr32[1]); - ifra.ifra_addr.sin6_addr.s6_addr32[2] - |= (ifid->s6_addr32[2] & ~mask.s6_addr32[2]); - ifra.ifra_addr.sin6_addr.s6_addr32[3] - |= (ifid->s6_addr32[3] & ~mask.s6_addr32[3]); + ifra.ifra_addr.sin6_addr.s6_addr32[0] |= + (ifid->s6_addr32[0] & ~mask.s6_addr32[0]); + ifra.ifra_addr.sin6_addr.s6_addr32[1] |= + (ifid->s6_addr32[1] & ~mask.s6_addr32[1]); + ifra.ifra_addr.sin6_addr.s6_addr32[2] |= + (ifid->s6_addr32[2] & ~mask.s6_addr32[2]); + ifra.ifra_addr.sin6_addr.s6_addr32[3] |= + (ifid->s6_addr32[3] & ~mask.s6_addr32[3]); /* new prefix mask. */ ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); ifra.ifra_prefixmask.sin6_family = AF_INET6; bcopy(&mask, &ifra.ifra_prefixmask.sin6_addr, - sizeof(ifra.ifra_prefixmask.sin6_addr)); + sizeof(ifra.ifra_prefixmask.sin6_addr)); /* * lifetime. @@ -1679,7 +1641,7 @@ in6_ifadd(struct nd_prefix *pr, struct in6_addr *ifid) ia = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr); - return (ia); /* this must NOT be NULL. */ + return (ia); /* this is always non-NULL */ } /* @@ -1704,18 +1666,17 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcegen) ifra.ifra_prefixmask = ia0->ia_prefixmask; /* clear the old IFID */ for (i = 0; i < 4; i++) { - ifra.ifra_addr.sin6_addr.s6_addr32[i] - &= ifra.ifra_prefixmask.sin6_addr.s6_addr32[i]; + ifra.ifra_addr.sin6_addr.s6_addr32[i] &= + ifra.ifra_prefixmask.sin6_addr.s6_addr32[i]; } again: in6_get_tmpifid(ifp, (u_int8_t *)randid, - (const u_int8_t *)&ia0->ia_addr.sin6_addr.s6_addr[8], - forcegen); - ifra.ifra_addr.sin6_addr.s6_addr32[2] - |= (randid[0] & ~(ifra.ifra_prefixmask.sin6_addr.s6_addr32[2])); - ifra.ifra_addr.sin6_addr.s6_addr32[3] - |= (randid[1] & ~(ifra.ifra_prefixmask.sin6_addr.s6_addr32[3])); + (const u_int8_t *)&ia0->ia_addr.sin6_addr.s6_addr[8], forcegen); + ifra.ifra_addr.sin6_addr.s6_addr32[2] |= + (randid[0] & ~(ifra.ifra_prefixmask.sin6_addr.s6_addr32[2])); + ifra.ifra_addr.sin6_addr.s6_addr32[3] |= + (randid[1] & ~(ifra.ifra_prefixmask.sin6_addr.s6_addr32[3])); /* * If by chance the new temporary address is the same as an address @@ -1741,18 +1702,18 @@ again: * DESYNC_FACTOR. */ if (ia0->ia6_lifetime.ia6t_expire != 0) { - vltime0 = IFA6_IS_INVALID(ia0) ? 0 : - (ia0->ia6_lifetime.ia6t_expire - time_uptime); + vltime0 = IFA6_IS_INVALID(ia0) ? + 0 : (ia0->ia6_lifetime.ia6t_expire - time_uptime); if (vltime0 > ip6_temp_valid_lifetime) vltime0 = ip6_temp_valid_lifetime; } else vltime0 = ip6_temp_valid_lifetime; if (ia0->ia6_lifetime.ia6t_preferred != 0) { - pltime0 = IFA6_IS_DEPRECATED(ia0) ? 0 : - (ia0->ia6_lifetime.ia6t_preferred - time_uptime); + pltime0 = IFA6_IS_DEPRECATED(ia0) ? + 0 : (ia0->ia6_lifetime.ia6t_preferred - time_uptime); if (pltime0 > ip6_temp_preferred_lifetime - ip6_desync_factor) { pltime0 = ip6_temp_preferred_lifetime - - ip6_desync_factor; + ip6_desync_factor; } } else pltime0 = ip6_temp_preferred_lifetime - ip6_desync_factor; @@ -1877,8 +1838,8 @@ rt6_deleteroute(struct radix_node *rn, void *arg) if (!(rt->rt_flags & RTF_HOST)) return (0); - return (rtrequest(RTM_DELETE, rt_key(rt), - rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0)); + return (rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), + rt->rt_flags, 0)); #undef SIN6 }