Fix for sheep net driver

Andreas Schwab mol-devel@lists.maconlinux.org
Tue, 06 Jan 2004 00:34:11 +0100


In 2.6 the data field of struct packet_type has been renamed to
af_packet_priv.  Here is a patch to make the sheep net driver compile
again under both 2.4 and 2.6.

Andreas.

--- mol-0.9.69.orig/src/netdriver/sheep.c	2003-12-17 14:21:17.000000000 +01=
00
+++ mol-0.9.69/src/netdriver/sheep.c	2003-12-17 14:28:37.000000000 +0100
@@ -75,6 +75,7 @@
 #else
 #define compat_sk_alloc		sk_alloc
 #define skt_set_dead(skt)	(skt)->dead =3D 1
+#define af_packet_priv		data
 #endif
=20
 /************************************************************************/
@@ -149,7 +150,7 @@
 sheep_net_receiver( struct sk_buff *skb, struct net_device *dev, struct pa=
cket_type *pt )
 {
 	int multicast =3D (skb->mac.ethernet->h_dest[0] & ETH_ADDR_MULTICAST);
-	struct SheepVars *v =3D (struct SheepVars *)pt->data;
+	struct SheepVars *v =3D (struct SheepVars *)pt->af_packet_priv;
 	const char *laddr =3D dev->dev_addr;
 	struct sk_buff *skb2;
=20=09
@@ -499,7 +500,7 @@
 		v->pt.type =3D htons(ETH_P_ALL);
 		v->pt.dev =3D v->ether;
 		v->pt.func =3D sheep_net_receiver;
-		v->pt.data =3D v;
+		v->pt.af_packet_priv =3D v;
 		dev_add_pack( &v->pt );
 		return 0;
 error:
@@ -590,7 +591,9 @@
 };
=20
 static struct miscdevice sheep_net_device =3D {
-	SHEEP_NET_MINOR, "sheep_net", &sheep_net_fops, NULL, NULL
+	.minor		=3D SHEEP_NET_MINOR,
+	.name		=3D "sheep_net",
+	.fops		=3D &sheep_net_fops,
 };
=20
 int=20

--=20
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstra=C3=9Fe 5, 90409 N=C3=BCrnberg, Germany
Key fingerprint =3D 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."