Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!bonnie!akgua!mcnc!decvax!wivax!cadmus!harvard!seismo!brl-tgr!internet!Larry Allen From: Larry Allen Newsgroups: net.unix-wizards Subject: Re: recvfrom() on raw sockets sometimes gives bad source address Message-ID: <5862@brl-tgr.ARPA> Date: Sat, 17-Nov-84 19:13:29 EST Article-I.D.: brl-tgr.5862 Posted: Sat Nov 17 19:13:29 1984 Date-Received: Tue, 20-Nov-84 02:40:50 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 20 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