* Look-up the routing entry to the peer of this inpcb. If no route * is found and it cannot be allocated, then return 0. This routine * is called by TCP routines that access the rmx structure and by * tcp_mss_update to get the peer/interface MTU. */
| 2939 | * tcp_mss_update to get the peer/interface MTU. |
| 2940 | */ |
| 2941 | uint32_t |
| 2942 | tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *cap) |
| 2943 | { |
| 2944 | struct nhop_object *nh; |
| 2945 | struct ifnet *ifp; |
| 2946 | uint32_t maxmtu = 0; |
| 2947 | |
| 2948 | KASSERT(inc != NULL, ("tcp_maxmtu with NULL in_conninfo pointer")); |
| 2949 | |
| 2950 | if (inc->inc_faddr.s_addr != INADDR_ANY) { |
| 2951 | nh = fib4_lookup(inc->inc_fibnum, inc->inc_faddr, 0, NHR_NONE, 0); |
| 2952 | if (nh == NULL) |
| 2953 | return (0); |
| 2954 | |
| 2955 | ifp = nh->nh_ifp; |
| 2956 | maxmtu = nh->nh_mtu; |
| 2957 | |
| 2958 | /* Report additional interface capabilities. */ |
| 2959 | if (cap != NULL) { |
| 2960 | if (ifp->if_capenable & IFCAP_TSO4 && |
| 2961 | ifp->if_hwassist & CSUM_TSO) { |
| 2962 | cap->ifcap |= CSUM_TSO; |
| 2963 | cap->tsomax = ifp->if_hw_tsomax; |
| 2964 | cap->tsomaxsegcount = ifp->if_hw_tsomaxsegcount; |
| 2965 | cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize; |
| 2966 | } |
| 2967 | } |
| 2968 | } |
| 2969 | return (maxmtu); |
| 2970 | } |
| 2971 | #endif /* INET */ |
| 2972 | |
| 2973 | #ifdef INET6 |
no test coverage detected