summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-07-10 09:45:28 +0000
committerrwatson <rwatson@FreeBSD.org>2008-07-10 09:45:28 +0000
commit7371e4322f8c311aef71f30254c40ca66aff07b7 (patch)
tree2ebec58bb733691b59c424eb070b3b6209a87e70
parent95d503c43c61fb307036e5b65ab02970c5e4fb8a (diff)
downloadFreeBSD-src-7371e4322f8c311aef71f30254c40ca66aff07b7.zip
FreeBSD-src-7371e4322f8c311aef71f30254c40ca66aff07b7.tar.gz
Apply the MAC label to an outgoing UDP packet when other inpcb properties are
processed, meaning that we avoid the cost of MAC label assignment if we're going to drop the packet due to mbuf exhaustion, etc. MFC after: 3 weeks
-rw-r--r--sys/netinet/udp_usrreq.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 312dcfc..8843d0d 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -854,10 +854,6 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
INP_RLOCK(inp);
}
-#ifdef MAC
- mac_inpcb_create_mbuf(inp, m);
-#endif
-
/*
* If the IP_SENDSRCADDR control message was specified, override the
* source address for this datagram. Its use is invalidated if the
@@ -968,6 +964,10 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
if (inp->inp_flags & INP_ONESBCAST)
ipflags |= IP_SENDONES;
+#ifdef MAC
+ mac_inpcb_create_mbuf(inp, m);
+#endif
+
/*
* Set up checksum and output datagram.
*/
OpenPOWER on IntegriCloud