| 1472 | } |
| 1473 | |
| 1474 | void |
| 1475 | sctp_pathmtu_timer(struct sctp_inpcb *inp, |
| 1476 | struct sctp_tcb *stcb, |
| 1477 | struct sctp_nets *net) |
| 1478 | { |
| 1479 | uint32_t next_mtu, mtu; |
| 1480 | |
| 1481 | next_mtu = sctp_get_next_mtu(net->mtu); |
| 1482 | |
| 1483 | if ((next_mtu > net->mtu) && (net->port == 0)) { |
| 1484 | if ((net->src_addr_selected == 0) || |
| 1485 | (net->ro._s_addr == NULL) || |
| 1486 | (net->ro._s_addr->localifa_flags & SCTP_BEING_DELETED)) { |
| 1487 | if ((net->ro._s_addr != NULL) && (net->ro._s_addr->localifa_flags & SCTP_BEING_DELETED)) { |
| 1488 | sctp_free_ifa(net->ro._s_addr); |
| 1489 | net->ro._s_addr = NULL; |
| 1490 | net->src_addr_selected = 0; |
| 1491 | } else if (net->ro._s_addr == NULL) { |
| 1492 | #if defined(INET6) && defined(SCTP_EMBEDDED_V6_SCOPE) |
| 1493 | if (net->ro._l_addr.sa.sa_family == AF_INET6) { |
| 1494 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; |
| 1495 | |
| 1496 | /* KAME hack: embed scopeid */ |
| 1497 | (void)sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)); |
| 1498 | } |
| 1499 | #endif |
| 1500 | |
| 1501 | net->ro._s_addr = sctp_source_address_selection(inp, |
| 1502 | stcb, |
| 1503 | (sctp_route_t *)&net->ro, |
| 1504 | net, 0, stcb->asoc.vrf_id); |
| 1505 | #if defined(INET6) && defined(SCTP_EMBEDDED_V6_SCOPE) |
| 1506 | if (net->ro._l_addr.sa.sa_family == AF_INET6) { |
| 1507 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; |
| 1508 | |
| 1509 | (void)sa6_recoverscope(sin6); |
| 1510 | } |
| 1511 | #endif /* INET6 */ |
| 1512 | } |
| 1513 | if (net->ro._s_addr) |
| 1514 | net->src_addr_selected = 1; |
| 1515 | } |
| 1516 | if (net->ro._s_addr) { |
| 1517 | mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._s_addr.sa, net->ro.ro_nh); |
| 1518 | #if defined(INET) || defined(INET6) |
| 1519 | if (net->port) { |
| 1520 | mtu -= sizeof(struct udphdr); |
| 1521 | } |
| 1522 | #endif |
| 1523 | if (mtu > next_mtu) { |
| 1524 | net->mtu = next_mtu; |
| 1525 | } else { |
| 1526 | net->mtu = mtu; |
| 1527 | } |
| 1528 | } |
| 1529 | } |
| 1530 | /* restart the timer */ |
| 1531 | sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net); |
no test coverage detected