Rework r316770 to make it protocol independent and general, like we
do for streaming sockets. And do more cleanup in the sbappendaddr_locked_internal() to prevent leak information from existing mbuf to the one, that will be possible created later by netgraph. Suggested by: glebius Tested by: Irina Liakh <spell at itl ua> MFC after: 1 week
This commit is contained in:
parent
d2c2bbeaee
commit
c33a231337
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316822
@ -794,8 +794,20 @@ sbappendaddr_locked_internal(struct sockbuf *sb, const struct sockaddr *asa,
|
||||
return (0);
|
||||
m->m_len = asa->sa_len;
|
||||
bcopy(asa, mtod(m, caddr_t), asa->sa_len);
|
||||
if (m0)
|
||||
if (m0) {
|
||||
m_clrprotoflags(m0);
|
||||
m_tag_delete_chain(m0);
|
||||
/*
|
||||
* Clear some persistent info from pkthdr.
|
||||
* We don't use m_demote(), because some netgraph consumers
|
||||
* expect M_PKTHDR presence.
|
||||
*/
|
||||
m0->m_pkthdr.rcvif = NULL;
|
||||
m0->m_pkthdr.flowid = 0;
|
||||
m0->m_pkthdr.csum_flags = 0;
|
||||
m0->m_pkthdr.fibnum = 0;
|
||||
m0->m_pkthdr.rsstype = 0;
|
||||
}
|
||||
if (ctrl_last)
|
||||
ctrl_last->m_next = m0; /* concatenate data to control */
|
||||
else
|
||||
|
@ -372,9 +372,6 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off,
|
||||
append_sa = (struct sockaddr *)&udp_in[0];
|
||||
m_adj(n, off);
|
||||
|
||||
/* Clear any h/w csum flags as they are no longer valid. */
|
||||
n->m_pkthdr.csum_flags &= ~(CSUM_DATA_VALID | CSUM_IP_VALID);
|
||||
|
||||
so = inp->inp_socket;
|
||||
SOCKBUF_LOCK(&so->so_rcv);
|
||||
if (sbappendaddr_locked(&so->so_rcv, append_sa, n, opts) == 0) {
|
||||
|
@ -187,9 +187,6 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off,
|
||||
}
|
||||
m_adj(n, off + sizeof(struct udphdr));
|
||||
|
||||
/* Clear any h/w csum flags as they are no longer valid. */
|
||||
n->m_pkthdr.csum_flags &= ~CSUM_DATA_VALID;
|
||||
|
||||
so = inp->inp_socket;
|
||||
SOCKBUF_LOCK(&so->so_rcv);
|
||||
if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)&fromsa[0], n,
|
||||
|
Loading…
Reference in New Issue
Block a user