recvfrom() on raw sockets sometimes gives bad source address
Larry Allen
lwa at mit-mrclean.ARPA
Sun Nov 18 10:13:29 AEST 1984
I think the diffs in my message may have confused you. Here's the
final version of the code:
if (last) {
if (sbappendaddr(&last->so_rcv, &rh->raw_src,
m->m_next, (struct mbuf *)0) == 0)
goto drop;
m_free(m); /* header */
sorwakeup(last);
goto next;
}
drop:
m_freem(m);
goto next;
Notice that sbappendaddr is called with m->m_next as its pointer; thus
it frees everything in the chain EXCEPT the header mbuf (containing
the addressing information) if successful. On error, it doesn't
free anything, so the entire chain (beginning at m) should be freed.
-Larry Allen
More information about the Comp.unix.wizards
mailing list