PERFORCE change 142621 for review
Gleb Kurtsou
gk at FreeBSD.org
Sat May 31 12:49:11 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=142621
Change 142621 by gk at gk_h1 on 2008/05/31 12:49:07
IFC
Affected files ...
.. //depot/projects/soc2008/gk_l2filter/sys-net/radix_mpath.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/radix_mpath.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_subr.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/udp_usrreq.c#2 integrate
Differences ...
==== //depot/projects/soc2008/gk_l2filter/sys-net/radix_mpath.c#2 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/radix_mpath.c,v 1.5 2008/05/09 23:02:56 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/net/radix_mpath.c,v 1.6 2008/05/30 09:34:35 qingli Exp $");
#include "opt_inet6.h"
@@ -76,10 +76,10 @@
return NULL;
}
-int
+u_int32_t
rn_mpath_count(struct radix_node *rn)
{
- int i;
+ u_int32_t i;
i = 1;
while ((rn = rn_mpath_next(rn)) != NULL)
@@ -255,10 +255,10 @@
}
void
-rtalloc_mpath_fib(struct route *ro, int hash, u_int fibnum)
+rtalloc_mpath_fib(struct route *ro, u_int32_t hash, u_int fibnum)
{
struct radix_node *rn0, *rn;
- int n;
+ u_int32_t n;
/*
* XXX we don't attempt to lookup cached route again; what should
==== //depot/projects/soc2008/gk_l2filter/sys-net/radix_mpath.h#2 (text+ko) ====
@@ -32,7 +32,7 @@
* BE LIABLE FOR ANY INFRINGEMENT OF ANY OTHERS' INTELLECTUAL
* PROPERTIES.
*/
-/* $FreeBSD: src/sys/net/radix_mpath.h,v 1.2 2008/05/09 23:02:56 julian Exp $ */
+/* $FreeBSD: src/sys/net/radix_mpath.h,v 1.3 2008/05/30 09:34:35 qingli Exp $ */
#ifndef _NET_RADIX_MPATH_H_
#define _NET_RADIX_MPATH_H_
@@ -46,11 +46,11 @@
struct sockaddr;
int rn_mpath_capable(struct radix_node_head *);
struct radix_node *rn_mpath_next(struct radix_node *);
-int rn_mpath_count(struct radix_node *);
+u_int32_t rn_mpath_count(struct radix_node *);
struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *);
int rt_mpath_conflict(struct radix_node_head *, struct rtentry *,
struct sockaddr *);
-void rtalloc_mpath_fib(struct route *, int, u_int);
+void rtalloc_mpath_fib(struct route *, u_int32_t, u_int);
#define rtalloc_mpath(_route, _hash) rtalloc_mpath_fib((_route), (_hash), 0)
struct radix_node *rn_mpath_lookup(void *, void *,
struct radix_node_head *);
==== //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_subr.c#2 (text+ko) ====
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/tcp_subr.c,v 1.306 2008/05/09 23:02:57 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/tcp_subr.c,v 1.307 2008/05/29 14:28:26 rwatson Exp $");
#include "opt_compat.h"
#include "opt_inet.h"
@@ -946,7 +946,7 @@
INP_INFO_RLOCK(&tcbinfo);
for (inp = LIST_FIRST(tcbinfo.ipi_listhead), i = 0; inp != NULL && i
< n; inp = LIST_NEXT(inp, inp_list)) {
- INP_WLOCK(inp);
+ INP_RLOCK(inp);
if (inp->inp_gencnt <= gencnt) {
/*
* XXX: This use of cr_cansee(), introduced with
@@ -965,7 +965,7 @@
if (error == 0)
inp_list[i++] = inp;
}
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
}
INP_INFO_RUNLOCK(&tcbinfo);
n = i;
@@ -973,7 +973,7 @@
error = 0;
for (i = 0; i < n; i++) {
inp = inp_list[i];
- INP_WLOCK(inp);
+ INP_RLOCK(inp);
if (inp->inp_gencnt <= gencnt) {
struct xtcpcb xt;
void *inp_ppcb;
@@ -997,10 +997,10 @@
xt.xt_socket.xso_protocol = IPPROTO_TCP;
}
xt.xt_inp.inp_gencnt = inp->inp_gencnt;
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
error = SYSCTL_OUT(req, &xt, sizeof xt);
} else
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
}
if (!error) {
@@ -1042,23 +1042,21 @@
INP_INFO_RLOCK(&tcbinfo);
inp = in_pcblookup_hash(&tcbinfo, addrs[1].sin_addr, addrs[1].sin_port,
addrs[0].sin_addr, addrs[0].sin_port, 0, NULL);
- if (inp == NULL) {
+ if (inp != NULL) {
+ INP_RLOCK(inp);
+ INP_INFO_RUNLOCK(&tcbinfo);
+ if (inp->inp_socket == NULL)
+ error = ENOENT;
+ if (error == 0)
+ error = cr_canseesocket(req->td->td_ucred,
+ inp->inp_socket);
+ if (error == 0)
+ cru2x(inp->inp_socket->so_cred, &xuc);
+ INP_RUNLOCK(inp);
+ } else {
+ INP_INFO_RUNLOCK(&tcbinfo);
error = ENOENT;
- goto outunlocked;
- }
- INP_WLOCK(inp);
- if (inp->inp_socket == NULL) {
- error = ENOENT;
- goto out;
}
- error = cr_canseesocket(req->td->td_ucred, inp->inp_socket);
- if (error)
- goto out;
- cru2x(inp->inp_socket->so_cred, &xuc);
-out:
- INP_WUNLOCK(inp);
-outunlocked:
- INP_INFO_RUNLOCK(&tcbinfo);
if (error == 0)
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
return (error);
@@ -1106,23 +1104,21 @@
inp = in6_pcblookup_hash(&tcbinfo,
&addrs[1].sin6_addr, addrs[1].sin6_port,
&addrs[0].sin6_addr, addrs[0].sin6_port, 0, NULL);
- if (inp == NULL) {
+ if (inp != NULL) {
+ INP_RLOCK(inp);
+ INP_INFO_RUNLOCK(&tcbinfo);
+ if (inp->inp_socket == NULL)
+ error = ENOENT;
+ if (error == 0)
+ error = cr_canseesocket(req->td->td_ucred,
+ inp->inp_socket);
+ if (error == 0)
+ cru2x(inp->inp_socket->so_cred, &xuc);
+ INP_RUNLOCK(inp);
+ } else {
+ INP_INFO_RUNLOCK(&tcbinfo);
error = ENOENT;
- goto outunlocked;
- }
- INP_WLOCK(inp);
- if (inp->inp_socket == NULL) {
- error = ENOENT;
- goto out;
}
- error = cr_canseesocket(req->td->td_ucred, inp->inp_socket);
- if (error)
- goto out;
- cru2x(inp->inp_socket->so_cred, &xuc);
-out:
- INP_WUNLOCK(inp);
-outunlocked:
- INP_INFO_RUNLOCK(&tcbinfo);
if (error == 0)
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
return (error);
==== //depot/projects/soc2008/gk_l2filter/sys-netinet/udp_usrreq.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.221 2008/05/24 15:20:48 bz Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.222 2008/05/29 08:27:14 rwatson Exp $");
#include "opt_ipfw.h"
#include "opt_inet6.h"
@@ -669,11 +669,11 @@
INP_INFO_RLOCK(&udbinfo);
for (inp = LIST_FIRST(udbinfo.ipi_listhead), i = 0; inp && i < n;
inp = LIST_NEXT(inp, inp_list)) {
- INP_WLOCK(inp);
+ INP_RLOCK(inp);
if (inp->inp_gencnt <= gencnt &&
cr_canseesocket(req->td->td_ucred, inp->inp_socket) == 0)
inp_list[i++] = inp;
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
}
INP_INFO_RUNLOCK(&udbinfo);
n = i;
@@ -681,7 +681,7 @@
error = 0;
for (i = 0; i < n; i++) {
inp = inp_list[i];
- INP_WLOCK(inp);
+ INP_RLOCK(inp);
if (inp->inp_gencnt <= gencnt) {
struct xinpcb xi;
bzero(&xi, sizeof(xi));
@@ -691,10 +691,10 @@
if (inp->inp_socket)
sotoxsocket(inp->inp_socket, &xi.xi_socket);
xi.xi_inp.inp_gencnt = inp->inp_gencnt;
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
error = SYSCTL_OUT(req, &xi, sizeof xi);
} else
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
}
if (!error) {
/*
@@ -734,16 +734,21 @@
INP_INFO_RLOCK(&udbinfo);
inp = in_pcblookup_hash(&udbinfo, addrs[1].sin_addr, addrs[1].sin_port,
addrs[0].sin_addr, addrs[0].sin_port, 1, NULL);
- if (inp == NULL || inp->inp_socket == NULL) {
+ if (inp != NULL) {
+ INP_RLOCK(inp);
+ INP_INFO_RUNLOCK(&udbinfo);
+ if (inp->inp_socket == NULL)
+ error = ENOENT;
+ if (error == 0)
+ error = cr_canseesocket(req->td->td_ucred,
+ inp->inp_socket);
+ if (error == 0)
+ cru2x(inp->inp_socket->so_cred, &xuc);
+ INP_RUNLOCK(inp);
+ } else {
+ INP_INFO_RUNLOCK(&udbinfo);
error = ENOENT;
- goto out;
}
- error = cr_canseesocket(req->td->td_ucred, inp->inp_socket);
- if (error)
- goto out;
- cru2x(inp->inp_socket->so_cred, &xuc);
-out:
- INP_INFO_RUNLOCK(&udbinfo);
if (error == 0)
error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
return (error);
More information about the p4-projects
mailing list