[2092] in linux-net channel archive

home help back first fref pref prev next nref lref last post

New ppp code in 1.3.72 reveals bug in SOCK_PACKET code, patch included.

daemon@ATHENA.MIT.EDU (Eric Schenk)
Thu Mar 14 18:40:26 1996

To: linux-net@vger.rutgers.edu, linux-kernel@vger.rutgers.edu
cc: Alan Cox <alan@cymru.net>
Date: 	Thu, 14 Mar 1996 12:17:36 -0500
From: Eric Schenk <schenk@rnode84.cs.toronto.edu>


The new ppp code that appeared in 1.3.72 has revealed a minor
bug in the SOCK_PACKET code. The new ppp code checks the
skb->protocol field to determine whether it is handling an
IP or IPX packet, and then takes appropriate action.
(The old code just assumed that it was dealing with an IP packet).

It turns out that packets sent directly to a device through
SOCK_PACKET sockets don't set the skb->protocol field,
and as a result any such packets get dropped by the PPP driver.
This breaks diald under some circumstances.

The following patch fixes the problem.

--- CUT HERE --------------------------------------------------------------
--- linux/net/ipv4/packet.c.orig	Thu Mar 14 00:12:10 1996
+++ linux/net/ipv4/packet.c	Thu Mar 14 00:12:57 1996
@@ -183,6 +183,7 @@
 	 
 	skb->sk = sk;
 	skb->free = 1;
+        skb->protocol = htons(ETH_P_IP);
 	memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
 	skb->arp = 1;		/* No ARP needs doing on this (complete) frame */
 
--- CUT HERE --------------------------------------------------------------

-- eric

---------------------------------------------------------------------------
Eric Schenk                          www: http://www.cs.toronto.edu/~schenk
Department of Computer Science                 email: schenk@cs.toronto.edu
University of Toronto


home help back first fref pref prev next nref lref last post