- Fix thinko. Bypass xid checks if socket was created in the root
authorMark Huang <mlhuang@cs.princeton.edu>
Fri, 1 Oct 2004 20:09:49 +0000 (20:09 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Fri, 1 Oct 2004 20:09:49 +0000 (20:09 +0000)
context, like the freaking comment says.

include/net/sock.h
net/ipv4/tcp_ipv4.c
net/packet/af_packet.c

index a2aba08..0d3da11 100644 (file)
@@ -1086,7 +1086,7 @@ static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
         * packet.
         */
        if (inet_stream_ops.bind != inet_bind &&
-           (int) sk->sk_xid >= 0 && sk->sk_xid != skb->xid)
+           (int) sk->sk_xid > 0 && sk->sk_xid != skb->xid)
                goto out;
 
        /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
index 7bbe1cb..70945b4 100644 (file)
@@ -1822,7 +1822,7 @@ process:
         * packet.
         */
        if (inet_stream_ops.bind != inet_bind &&
-           (int) sk->sk_xid >= 0 && sk->sk_xid != skb->xid)
+           (int) sk->sk_xid > 0 && sk->sk_xid != skb->xid)
                goto discard_it;
 
        if (sk->sk_state == TCP_TIME_WAIT)
index 5edc92c..844a087 100644 (file)
@@ -451,7 +451,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,  struct packe
        sk = pt->af_packet_priv;
        po = pkt_sk(sk);
 
-       if (sk->sk_xid && sk->sk_xid != skb->xid)
+       if ((int) sk->sk_xid > 0 && sk->sk_xid != skb->xid)
                goto drop;
 
        skb->dev = dev;