1/* 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 |
30 * $FreeBSD: head/sys/netinet/raw_ip.c 131151 2004-06-26 19:10:39Z rwatson $ |
31 */ 32 33#include "opt_inet6.h" 34#include "opt_ipsec.h" 35#include "opt_mac.h" 36#include "opt_random_ip_id.h" 37 38#include <sys/param.h> --- 116 unchanged lines hidden (view full) --- 155 } 156#endif /*IPSEC || FAST_IPSEC*/ 157#ifdef MAC 158 if (!policyfail && mac_check_inpcb_deliver(last, n) != 0) 159 policyfail = 1; 160#endif 161 if (!policyfail) { 162 struct mbuf *opts = NULL; |
163 struct socket *so; |
164 |
165 so = last->inp_socket; |
166 if ((last->inp_flags & INP_CONTROLOPTS) || |
167 (so->so_options & SO_TIMESTAMP)) |
168 ip_savecontrol(last, &opts, ip, n); |
169 SOCKBUF_LOCK(&so->so_rcv); 170 if (sbappendaddr_locked(&so->so_rcv, |
171 (struct sockaddr *)&ripsrc, n, opts) == 0) { 172 /* should notify about lost packet */ 173 m_freem(n); 174 if (opts) 175 m_freem(opts); |
176 SOCKBUF_UNLOCK(&so->so_rcv); |
177 } else |
178 sorwakeup_locked(so); |
179 } else 180 m_freem(n); 181 return policyfail; 182} 183 184/* 185 * Setup generic address and protocol structures 186 * for raw_input routine, then pass them along with --- 694 unchanged lines hidden --- |