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
This commit is contained in:
Robert Watson 2008-07-10 09:45:28 +00:00
parent f4841b5380
commit 1175d9d56d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180422

View File

@ -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.
*/