Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/ip6_output.c
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_inet.h" | #include "opt_inet.h" | ||||
#include "opt_inet6.h" | #include "opt_inet6.h" | ||||
#include "opt_ipsec.h" | #include "opt_ipsec.h" | ||||
#include "opt_kern_tls.h" | |||||
#include "opt_ratelimit.h" | #include "opt_ratelimit.h" | ||||
#include "opt_route.h" | #include "opt_route.h" | ||||
#include "opt_rss.h" | #include "opt_rss.h" | ||||
#include "opt_sctp.h" | #include "opt_sctp.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/ktls.h> | |||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/errno.h> | #include <sys/errno.h> | ||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/protosw.h> | #include <sys/protosw.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/socketvar.h> | #include <sys/socketvar.h> | ||||
▲ Show 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int hlen, u_char nextproto, | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
ip6_output_send(struct inpcb *inp, struct ifnet *ifp, struct ifnet *origifp, | ip6_output_send(struct inpcb *inp, struct ifnet *ifp, struct ifnet *origifp, | ||||
struct mbuf *m, struct sockaddr_in6 *dst, struct route_in6 *ro) | struct mbuf *m, struct sockaddr_in6 *dst, struct route_in6 *ro) | ||||
{ | { | ||||
#ifdef KERN_TLS | |||||
struct ktls_session *tls = NULL; | |||||
#endif | |||||
struct m_snd_tag *mst; | struct m_snd_tag *mst; | ||||
int error; | int error; | ||||
MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0); | MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0); | ||||
mst = NULL; | mst = NULL; | ||||
#ifdef KERN_TLS | |||||
/* | |||||
* If this is an unencrypted TLS record, save a reference to | |||||
* the record. This local reference is used to call | |||||
* ktls_output_eagain after the mbuf has been freed (thus | |||||
* dropping the mbuf's reference) in if_output. | |||||
*/ | |||||
if (m->m_next != NULL && mbuf_has_tls_session(m->m_next)) { | |||||
tls = ktls_hold(m->m_next->m_ext.ext_pgs->tls); | |||||
mst = tls->snd_tag; | |||||
/* | |||||
* If a TLS session doesn't have a valid tag, it must | |||||
* have had an earlier ifp mismatch, so drop this | |||||
* packet. | |||||
*/ | |||||
if (mst == NULL) { | |||||
error = EAGAIN; | |||||
goto done; | |||||
} | |||||
} | |||||
#endif | |||||
#ifdef RATELIMIT | #ifdef RATELIMIT | ||||
if (inp != NULL) { | if (inp != NULL && mst == NULL) { | ||||
if ((inp->inp_flags2 & INP_RATE_LIMIT_CHANGED) != 0 || | if ((inp->inp_flags2 & INP_RATE_LIMIT_CHANGED) != 0 || | ||||
(inp->inp_snd_tag != NULL && | (inp->inp_snd_tag != NULL && | ||||
inp->inp_snd_tag->ifp != ifp)) | inp->inp_snd_tag->ifp != ifp)) | ||||
in_pcboutput_txrtlmt(inp, ifp, m); | in_pcboutput_txrtlmt(inp, ifp, m); | ||||
if (inp->inp_snd_tag != NULL) | if (inp->inp_snd_tag != NULL) | ||||
mst = inp->inp_snd_tag; | mst = inp->inp_snd_tag; | ||||
} | } | ||||
Show All 10 Lines | if (mst != NULL) { | ||||
m->m_pkthdr.snd_tag = m_snd_tag_ref(mst); | m->m_pkthdr.snd_tag = m_snd_tag_ref(mst); | ||||
m->m_pkthdr.csum_flags |= CSUM_SND_TAG; | m->m_pkthdr.csum_flags |= CSUM_SND_TAG; | ||||
} | } | ||||
error = nd6_output_ifp(ifp, origifp, m, dst, (struct route *)ro); | error = nd6_output_ifp(ifp, origifp, m, dst, (struct route *)ro); | ||||
done: | done: | ||||
/* Check for route change invalidating send tags. */ | /* Check for route change invalidating send tags. */ | ||||
#ifdef KERN_TLS | |||||
if (tls != NULL) { | |||||
if (error == EAGAIN) | |||||
error = ktls_output_eagain(inp, tls); | |||||
ktls_free(tls); | |||||
} | |||||
#endif | |||||
#ifdef RATELIMIT | #ifdef RATELIMIT | ||||
if (error == EAGAIN) | if (error == EAGAIN) | ||||
in_pcboutput_eagain(inp); | in_pcboutput_eagain(inp); | ||||
#endif | #endif | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 2,880 Lines • Show Last 20 Lines |