raw_ip.c (9185426827e37264385fab187eb55dfce5796471) raw_ip.c (64dddc18727af4db4a6047ff86291d981f6e9042)
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

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 *
33 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
34 * $FreeBSD$
35 */
36
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
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

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 *
33 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
34 * $FreeBSD$
35 */
36
37#include "opt_inet6.h"
38#include "opt_ipsec.h"
39#include "opt_random_ip_id.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/malloc.h>
44#include <sys/mbuf.h>
45#include <sys/protosw.h>
46#include <sys/socket.h>

--- 168 unchanged lines hidden (view full) ---

215 if (((IP_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2))
216 && inp->inp_options)
217 || (ip->ip_len > m->m_pkthdr.len)
218 || (ip->ip_len < (IP_VHL_HL(ip->ip_vhl) << 2))) {
219 m_freem(m);
220 return EINVAL;
221 }
222 if (ip->ip_id == 0)
40
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/kernel.h>
44#include <sys/malloc.h>
45#include <sys/mbuf.h>
46#include <sys/protosw.h>
47#include <sys/socket.h>

--- 168 unchanged lines hidden (view full) ---

216 if (((IP_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2))
217 && inp->inp_options)
218 || (ip->ip_len > m->m_pkthdr.len)
219 || (ip->ip_len < (IP_VHL_HL(ip->ip_vhl) << 2))) {
220 m_freem(m);
221 return EINVAL;
222 }
223 if (ip->ip_id == 0)
224#ifdef RANDOM_IP_ID
225 ip->ip_id = ip_randomid();
226#else
223 ip->ip_id = htons(ip_id++);
227 ip->ip_id = htons(ip_id++);
228#endif
224 /* XXX prevent ip_output from overwriting header fields */
225 flags |= IP_RAWOUTPUT;
226 ipstat.ips_rawout++;
227 }
228
229#ifdef IPSEC
230 ipsec_setsocket(m, so);
231#endif /*IPSEC*/

--- 429 unchanged lines hidden ---
229 /* XXX prevent ip_output from overwriting header fields */
230 flags |= IP_RAWOUTPUT;
231 ipstat.ips_rawout++;
232 }
233
234#ifdef IPSEC
235 ipsec_setsocket(m, so);
236#endif /*IPSEC*/

--- 429 unchanged lines hidden ---