More updates from FreeBSD.

This commit is contained in:
Ralf Corsepius
2007-03-25 05:40:14 +00:00
parent c922991bf2
commit 4c672b9308
2 changed files with 6 additions and 8 deletions

View File

@@ -37,13 +37,14 @@
#ifndef _NET_RAW_CB_H_ #ifndef _NET_RAW_CB_H_
#define _NET_RAW_CB_H_ #define _NET_RAW_CB_H_
#include <sys/queue.h>
/* /*
* Raw protocol interface control block. Used * Raw protocol interface control block. Used
* to tie a socket to the generic raw interface. * to tie a socket to the generic raw interface.
*/ */
struct rawcb { struct rawcb {
struct rawcb *rcb_next; /* doubly linked list */ LIST_ENTRY(rawcb) list;
struct rawcb *rcb_prev;
struct socket *rcb_socket; /* back pointer to socket */ struct socket *rcb_socket; /* back pointer to socket */
struct sockaddr *rcb_faddr; /* destination address */ struct sockaddr *rcb_faddr; /* destination address */
struct sockaddr *rcb_laddr; /* socket's address */ struct sockaddr *rcb_laddr; /* socket's address */
@@ -59,7 +60,7 @@ struct rawcb {
#define RAWRCVQ 8192 #define RAWRCVQ 8192
#ifdef _KERNEL #ifdef _KERNEL
extern struct rawcb rawcb; /* head of list */ extern LIST_HEAD(rawcb_list_head, rawcb) rawcb_list;
int raw_attach(struct socket *, int); int raw_attach(struct socket *, int);
void raw_ctlinput(int, struct sockaddr *, void *); void raw_ctlinput(int, struct sockaddr *, void *);

View File

@@ -56,7 +56,7 @@ void
raw_init() raw_init()
{ {
rawcb.rcb_next = rawcb.rcb_prev = &rawcb; LIST_INIT(&rawcb_list);
} }
@@ -76,11 +76,10 @@ raw_input(m0, proto, src, dst)
{ {
register struct rawcb *rp; register struct rawcb *rp;
register struct mbuf *m = m0; register struct mbuf *m = m0;
register int sockets = 0;
struct socket *last; struct socket *last;
last = 0; last = 0;
for (rp = rawcb.rcb_next; rp != &rawcb; rp = rp->rcb_next) { LIST_FOREACH(rp, &rawcb_list, list) {
if (rp->rcb_proto.sp_family != proto->sp_family) if (rp->rcb_proto.sp_family != proto->sp_family)
continue; continue;
if (rp->rcb_proto.sp_protocol && if (rp->rcb_proto.sp_protocol &&
@@ -110,7 +109,6 @@ raw_input(m0, proto, src, dst)
m_freem(n); m_freem(n);
else { else {
sorwakeup(last); sorwakeup(last);
sockets++;
} }
} }
} }
@@ -122,7 +120,6 @@ raw_input(m0, proto, src, dst)
m_freem(m); m_freem(m);
else { else {
sorwakeup(last); sorwakeup(last);
sockets++;
} }
} else } else
m_freem(m); m_freem(m);