Deleted Added
full compact
raw_usrreq.c (180385) raw_usrreq.c (181803)
1/*-
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * @(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93
1/*-
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * @(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93
31 * $FreeBSD: head/sys/net/raw_usrreq.c 180385 2008-07-09 15:48:16Z rwatson $
31 * $FreeBSD: head/sys/net/raw_usrreq.c 181803 2008-08-17 23:27:27Z bz $
32 */
33
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/lock.h>
37#include <sys/malloc.h>
38#include <sys/mbuf.h>
39#include <sys/mutex.h>
40#include <sys/priv.h>
41#include <sys/protosw.h>
42#include <sys/signalvar.h>
43#include <sys/socket.h>
44#include <sys/socketvar.h>
45#include <sys/sx.h>
46#include <sys/systm.h>
32 */
33
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/lock.h>
37#include <sys/malloc.h>
38#include <sys/mbuf.h>
39#include <sys/mutex.h>
40#include <sys/priv.h>
41#include <sys/protosw.h>
42#include <sys/signalvar.h>
43#include <sys/socket.h>
44#include <sys/socketvar.h>
45#include <sys/sx.h>
46#include <sys/systm.h>
47#include <sys/vimage.h>
47
48#include <net/raw_cb.h>
49
50MTX_SYSINIT(rawcb_mtx, &rawcb_mtx, "rawcb", MTX_DEF);
51
52/*
53 * Initialize raw connection block q.
54 */
55void
56raw_init(void)
57{
58
48
49#include <net/raw_cb.h>
50
51MTX_SYSINIT(rawcb_mtx, &rawcb_mtx, "rawcb", MTX_DEF);
52
53/*
54 * Initialize raw connection block q.
55 */
56void
57raw_init(void)
58{
59
59 LIST_INIT(&rawcb_list);
60 LIST_INIT(&V_rawcb_list);
60}
61
62/*
63 * Raw protocol input routine. Find the socket associated with the packet(s)
64 * and move them over. If nothing exists for this packet, drop it.
65 */
66/*
67 * Raw protocol interface.
68 */
69void
70raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src)
71{
72 struct rawcb *rp;
73 struct mbuf *m = m0;
74 struct socket *last;
75
76 last = 0;
77 mtx_lock(&rawcb_mtx);
61}
62
63/*
64 * Raw protocol input routine. Find the socket associated with the packet(s)
65 * and move them over. If nothing exists for this packet, drop it.
66 */
67/*
68 * Raw protocol interface.
69 */
70void
71raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src)
72{
73 struct rawcb *rp;
74 struct mbuf *m = m0;
75 struct socket *last;
76
77 last = 0;
78 mtx_lock(&rawcb_mtx);
78 LIST_FOREACH(rp, &rawcb_list, list) {
79 LIST_FOREACH(rp, &V_rawcb_list, list) {
79 if (rp->rcb_proto.sp_family != proto->sp_family)
80 continue;
81 if (rp->rcb_proto.sp_protocol &&
82 rp->rcb_proto.sp_protocol != proto->sp_protocol)
83 continue;
84 if (last) {
85 struct mbuf *n;
86 n = m_copy(m, 0, (int)M_COPYALL);

--- 176 unchanged lines hidden ---
80 if (rp->rcb_proto.sp_family != proto->sp_family)
81 continue;
82 if (rp->rcb_proto.sp_protocol &&
83 rp->rcb_proto.sp_protocol != proto->sp_protocol)
84 continue;
85 if (last) {
86 struct mbuf *n;
87 n = m_copy(m, 0, (int)M_COPYALL);

--- 176 unchanged lines hidden ---