- merge revision 1.16
authorMark Huang <mlhuang@cs.princeton.edu>
Fri, 4 Mar 2005 13:59:08 +0000 (13:59 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Fri, 4 Mar 2005 13:59:08 +0000 (13:59 +0000)
date: 2005/02/01 03:16:01;  author: mlhuang;  state: Exp;  lines: +9 -9
- bound vnet mods by #ifdef
- bound runtime vnet code by if (vnet_active)

net/ipv4/tcp_ipv4.c

index 8751f21..200003f 100644 (file)
@@ -1762,10 +1762,6 @@ csum_err:
        goto discard;
 }
 
-extern struct proto_ops inet_stream_ops;
-
-extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
-
 /*
  *     From tcp_input.c
  */
@@ -1817,11 +1813,11 @@ int tcp_v4_rcv(struct sk_buff *skb)
                goto no_tcp_socket;
 
 process:
-       /* Silently drop if VNET is active (if INET bind() has been
-        * overridden) and the context is not entitled to read the
-        * packet.
+#if defined(CONFIG_VNET) || defined(CONFIG_VNET_MODULE)
+       /* Silently drop if VNET is active and the context is not
+        * entitled to read the packet.
         */
-       if (inet_stream_ops.bind != inet_bind) {
+       if (vnet_active) {
                /* Transfer ownership of reusable TIME_WAIT buckets to
                 * whomever VNET decided should own the packet.
                 */
@@ -1831,6 +1827,7 @@ process:
                if ((int) sk->sk_xid > 0 && sk->sk_xid != skb->xid)
                        goto discard_it;
        }
+#endif
 
        if (sk->sk_state == TCP_TIME_WAIT)
                goto do_time_wait;
@@ -1863,8 +1860,11 @@ no_tcp_socket:
        if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
 bad_packet:
                TCP_INC_STATS_BH(TCP_MIB_INERRS);
-       } else if (!skb->sk) {
+#if defined(CONFIG_VNET) || defined(CONFIG_VNET_MODULE)
+       } else if (vnet_active && skb->sk) {
                /* VNET: Suppress RST if the port was bound to a (presumably raw) socket */
+#endif
+       } else {
                tcp_v4_send_reset(skb);
        }