Changeset View
Changeset View
Standalone View
Standalone View
sys/netipsec/ipsec_output.c
Show First 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
default: | default: | ||||
key_freesav(&sav); | key_freesav(&sav); | ||||
return (0); | return (0); | ||||
} | } | ||||
key_freesav(&sav); | key_freesav(&sav); | ||||
pmtu = tcp_hc_getmtu(&inc); | pmtu = tcp_hc_getmtu(&inc); | ||||
/* No entry in hostcache. */ | /* No entry in hostcache. Use link MTU instead. */ | ||||
if (pmtu == 0) { | |||||
switch (dst->sa.sa_family) { | |||||
melifaro: Why can't we reuse the previous `case`? | |||||
Done Inline ActionsIn my option this way is clearer what the code does. And I don’t think we should call tcp_maxmtu when we don’t need it, because it searches through the routing table. bag_semihalf.com: In my option this way is clearer what the code does. And I don’t think we should call… | |||||
case AF_INET: | |||||
pmtu = tcp_maxmtu(&inc, NULL); | |||||
break; | |||||
#ifdef INET6 | |||||
case AF_INET6: | |||||
pmtu = tcp_maxmtu6(&inc, NULL); | |||||
break; | |||||
#endif | |||||
} | |||||
if (pmtu == 0) | if (pmtu == 0) | ||||
return (0); | return (0); | ||||
tcp_hc_updatemtu(&inc, pmtu); | |||||
} | |||||
hlen = ipsec_hdrsiz_internal(sp); | hlen = ipsec_hdrsiz_internal(sp); | ||||
if (m_length(m, NULL) + hlen > pmtu) { | if (m_length(m, NULL) + hlen > pmtu) { | ||||
/* | /* | ||||
* If we're forwarding generate ICMP message here, | * If we're forwarding generate ICMP message here, | ||||
* so that it contains pmtu and not link mtu. | * so that it contains pmtu substraced by header size. | ||||
* Set error to EINPROGRESS, in order for the frame | * Set error to EINPROGRESS, in order for the frame | ||||
* to be dropped silently. | * to be dropped silently. | ||||
*/ | */ | ||||
if (forwarding) { | if (forwarding) { | ||||
if (pmtu > hlen) | if (pmtu > hlen) | ||||
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, | icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, | ||||
0, pmtu - hlen); | 0, pmtu - hlen); | ||||
else | else | ||||
▲ Show 20 Lines • Show All 720 Lines • Show Last 20 Lines |
Why can't we reuse the previous case?