| 1472 | } |
| 1473 | |
| 1474 | static int |
| 1475 | prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr, |
| 1476 | struct mbuf *m, int mcast) |
| 1477 | { |
| 1478 | struct in6_ifaddr *ia6 = NULL, *ia6_match = NULL; |
| 1479 | struct ifaddr *ifa; |
| 1480 | struct ifnet *ifp = new->ndpr_ifp; |
| 1481 | struct nd_prefix *pr; |
| 1482 | int error = 0; |
| 1483 | int auth; |
| 1484 | struct in6_addrlifetime lt6_tmp; |
| 1485 | char ip6buf[INET6_ADDRSTRLEN]; |
| 1486 | |
| 1487 | NET_EPOCH_ASSERT(); |
| 1488 | |
| 1489 | auth = 0; |
| 1490 | if (m) { |
| 1491 | /* |
| 1492 | * Authenticity for NA consists authentication for |
| 1493 | * both IP header and IP datagrams, doesn't it ? |
| 1494 | */ |
| 1495 | #if defined(M_AUTHIPHDR) && defined(M_AUTHIPDGM) |
| 1496 | auth = ((m->m_flags & M_AUTHIPHDR) && |
| 1497 | (m->m_flags & M_AUTHIPDGM)); |
| 1498 | #endif |
| 1499 | } |
| 1500 | |
| 1501 | if ((pr = nd6_prefix_lookup(new)) != NULL) { |
| 1502 | /* |
| 1503 | * nd6_prefix_lookup() ensures that pr and new have the same |
| 1504 | * prefix on a same interface. |
| 1505 | */ |
| 1506 | |
| 1507 | /* |
| 1508 | * Update prefix information. Note that the on-link (L) bit |
| 1509 | * and the autonomous (A) bit should NOT be changed from 1 |
| 1510 | * to 0. |
| 1511 | */ |
| 1512 | if (new->ndpr_raf_onlink == 1) |
| 1513 | pr->ndpr_raf_onlink = 1; |
| 1514 | if (new->ndpr_raf_auto == 1) |
| 1515 | pr->ndpr_raf_auto = 1; |
| 1516 | if (new->ndpr_raf_onlink) { |
| 1517 | pr->ndpr_vltime = new->ndpr_vltime; |
| 1518 | pr->ndpr_pltime = new->ndpr_pltime; |
| 1519 | (void)in6_init_prefix_ltimes(pr); /* XXX error case? */ |
| 1520 | pr->ndpr_lastupdate = time_uptime; |
| 1521 | } |
| 1522 | |
| 1523 | if (new->ndpr_raf_onlink && |
| 1524 | (pr->ndpr_stateflags & NDPRF_ONLINK) == 0) { |
| 1525 | ND6_ONLINK_LOCK(); |
| 1526 | if ((error = nd6_prefix_onlink(pr)) != 0) { |
| 1527 | nd6log((LOG_ERR, |
| 1528 | "%s: failed to make the prefix %s/%d " |
| 1529 | "on-link on %s (errno=%d)\n", __func__, |
| 1530 | ip6_sprintf(ip6buf, |
| 1531 | &pr->ndpr_prefix.sin6_addr), |
no test coverage detected