PERFORCE change 43982 for review
Sam Leffler
sam at FreeBSD.org
Tue Dec 16 12:12:02 PST 2003
http://perforce.freebsd.org/chv.cgi?CH=43982
Change 43982 by sam at sam_ebb on 2003/12/16 12:11:40
eliminate LOR between so_rcv and radix head by changing
tcp_twrespond to not require a socket--it had been doing
this to be able to create a MAC label from the socket but
instead it can create it from the inpcb that is always
available
Affected files ...
.. //depot/projects/netperf+sockets/sys/netinet/tcp_input.c#4 edit
.. //depot/projects/netperf+sockets/sys/netinet/tcp_subr.c#4 edit
.. //depot/projects/netperf+sockets/sys/netinet/tcp_var.h#3 edit
Differences ...
==== //depot/projects/netperf+sockets/sys/netinet/tcp_input.c#4 (text+ko) ====
@@ -3044,7 +3044,7 @@
*/
if (thflags != TH_ACK || tlen != 0 ||
th->th_seq != tw->rcv_nxt || th->th_ack != tw->snd_nxt)
- tcp_twrespond(tw, NULL, m, TH_ACK);
+ tcp_twrespond(tw, TH_ACK);
goto drop;
reset:
==== //depot/projects/netperf+sockets/sys/netinet/tcp_subr.c#4 (text+ko) ====
@@ -1573,14 +1573,14 @@
}
tcp_discardcb(tp);
so = inp->inp_socket;
- SOCK_LOCK(so); /* XXX LOR */
+ SOCK_LOCK(so);
so->so_pcb = NULL;
tw->tw_cred = crhold(so->so_cred);
tw->tw_so_options = so->so_options;
+ sotryfree(so); /* NB: drops lock */
+ inp->inp_socket = NULL;
if (acknow)
- tcp_twrespond(tw, so, NULL, TH_ACK);
- sotryfree(so);
- inp->inp_socket = NULL;
+ tcp_twrespond(tw, TH_ACK);
inp->inp_ppcb = (caddr_t)tw;
inp->inp_vflag |= INP_TIMEWAIT;
tcp_timer_2msl_reset(tw, tw_time);
@@ -1644,8 +1644,7 @@
* construct a label for ay resulting packet.
*/
int
-tcp_twrespond(struct tcptw *tw, struct socket *so, struct mbuf *msrc,
- int flags)
+tcp_twrespond(struct tcptw *tw, int flags)
{
struct inpcb *inp = tw->tw_inpcb;
struct tcphdr *th;
@@ -1659,8 +1658,7 @@
int isipv6 = inp->inp_inc.inc_isipv6;
#endif
- KASSERT(so != NULL || msrc != NULL,
- ("tcp_twrespond: so and msrc NULL"));
+ INP_LOCK_ASSERT(inp);
m = m_gethdr(M_DONTWAIT, MT_HEADER);
if (m == NULL)
@@ -1668,10 +1666,7 @@
m->m_data += max_linkhdr;
#ifdef MAC
- if (so != NULL)
- mac_create_mbuf_from_socket(so, m);
- else
- mac_create_mbuf_netlayer(msrc, m);
+ mac_create_mbuf_from_inpcb(so, inp);
#endif
#ifdef INET6
==== //depot/projects/netperf+sockets/sys/netinet/tcp_var.h#3 (text+ko) ====
@@ -509,7 +509,7 @@
tcp_quench(struct inpcb *, int);
void tcp_respond(struct tcpcb *, void *,
struct tcphdr *, struct mbuf *, tcp_seq, tcp_seq, int);
-int tcp_twrespond(struct tcptw *, struct socket *, struct mbuf *, int);
+int tcp_twrespond(struct tcptw *, int);
void tcp_setpersist(struct tcpcb *);
void tcp_slowtimo(void);
struct tcptemp *
More information about the p4-projects
mailing list