summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 58395f5..8816bc6 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1661,13 +1661,13 @@ tcp_twstart(tp)
so->so_pcb = NULL;
tw->tw_cred = crhold(so->so_cred);
tw->tw_so_options = so->so_options;
+ if (acknow)
+ tcp_twrespond(tw, so, NULL, TH_ACK);
sotryfree(so);
inp->inp_socket = NULL;
inp->inp_ppcb = (caddr_t)tw;
inp->inp_vflag |= INP_TIMEWAIT;
tcp_timer_2msl_reset(tw, tw_time);
- if (acknow)
- tcp_twrespond(tw, TH_ACK);
INP_UNLOCK(inp);
}
@@ -1693,8 +1693,13 @@ tcp_twclose(struct tcptw *tw, int reuse)
return (NULL);
}
+/*
+ * One of so and msrc must be non-NULL for use by the MAC Framework to
+ * construct a label for ay resulting packet.
+ */
int
-tcp_twrespond(struct tcptw *tw, int flags)
+tcp_twrespond(struct tcptw *tw, struct socket *so, struct mbuf *msrc,
+ int flags)
{
struct inpcb *inp = tw->tw_inpcb;
struct tcphdr *th;
@@ -1708,11 +1713,21 @@ tcp_twrespond(struct tcptw *tw, int flags)
int isipv6 = inp->inp_inc.inc_isipv6;
#endif
+ KASSERT(so != NULL || msrc != NULL,
+ ("tcp_twrespond: so and msrc NULL"));
+
m = m_gethdr(M_DONTWAIT, MT_HEADER);
if (m == NULL)
return (ENOBUFS);
m->m_data += max_linkhdr;
+#ifdef MAC
+ if (so != NULL)
+ mac_create_mbuf_from_socket(so, m);
+ else
+ mac_create_mbuf_netlayer(msrc, m);
+#endif
+
#ifdef INET6
if (isipv6) {
hdrlen = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
OpenPOWER on IntegriCloud