pae module from Gunter... problems

Gunter Burchardt gbur
Tue Jan 25 05:44:21 PST 2005


>     Nop. There is no packet going through the pae.... damn !
>     Well. This is obviously due to the layer2-patch that does not work for
> 2.6. I wonder if there are so many differences between the netfilters-2.4
> and the netfilters-2.6 files ?
>     Could you send me the files in version 2.4 that are concerned with your
> patch please ? I could have a look at them then...
>     Could you send them *without* the patch applied please ?
>     Many thanks !
>     David.

Original layer2 patch didn't apply on 2.6. net/core/dev.c has changed. I
applied the layer2 patch on 2.6.8 . The result is the attached patch. I hope
this will work. I could not test it.

If it works please send me your required modifications to pae for 2.6.
I will include this modifications in my tree.

regards
gunter
-------------- next part --------------
diff -Nur linux-2.6.8.1-uc0.org/include/linux/netfilter_packet.h linux-2.6.8.1-uc0/include/linux/netfilter_packet.h
--- linux-2.6.8.1-uc0.org/include/linux/netfilter_packet.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.8.1-uc0/include/linux/netfilter_packet.h	2005-01-25 14:25:43.000000000 +0100
@@ -0,0 +1,17 @@
+#ifndef __LINUX_NETFILTER_PACKET_H
+#define __LINUX_NETFILTER_PACKET_H
+
+/* PF_PACKET-specific defines for netfilter.
+ * Written by Marc Zyngier <Marc.Zyngier at evidian.com>
+ * (C)2002 Evidian -- This code is GPL.
+ */
+
+#include <linux/config.h>
+#include <linux/netfilter.h>
+
+/* PF_PACKET filter hooks */
+
+#define NF_PACKET_INPUT		0
+#define NF_PACKET_OUTPUT	1
+
+#endif /* __LINUX_NETFILTER_PACKET_H */
diff -Nur linux-2.6.8.1-uc0.org/net/core/dev.c linux-2.6.8.1-uc0/net/core/dev.c
--- linux-2.6.8.1-uc0.org/net/core/dev.c	2004-08-14 12:55:32.000000000 +0200
+++ linux-2.6.8.1-uc0/net/core/dev.c	2005-01-25 14:25:43.000000000 +0100
@@ -105,6 +105,7 @@
 #include <linux/init.h>
 #include <linux/kmod.h>
 #include <linux/module.h>
+#include <linux/netfilter_packet.h>
 #include <linux/kallsyms.h>
 #include <linux/netpoll.h>
 #include <linux/rcupdate.h>
@@ -1276,6 +1277,8 @@
 		/* NOTHING */;
 }
 
+static inline int dev_queue_xmit_finish(struct sk_buff *skb);
+
 /**
  *	dev_queue_xmit - transmit a buffer
  *	@skb: buffer to transmit
@@ -1292,8 +1295,6 @@
 int dev_queue_xmit(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
-	struct Qdisc *q;
-	int rc = -ENOMEM;
 
 	if (skb_shinfo(skb)->frag_list &&
 	    !(dev->features & NETIF_F_FRAGLIST) &&
@@ -1318,6 +1319,17 @@
 	      skb->protocol != htons(ETH_P_IP))))
 	      	if (skb_checksum_help(&skb, 0))
 	      		goto out_kfree_skb;
+	
+	return NF_HOOK(PF_PACKET, NF_PACKET_OUTPUT, skb, NULL, dev,
+				   dev_queue_xmit_finish);
+}
+
+
+static inline int dev_queue_xmit_finish(struct sk_buff *skb)
+{
+	struct net_device *dev = skb->dev;
+	struct Qdisc *q;
+	int rc = -ENOMEM;
 
 	rcu_read_lock();
 	/* Updates of qdisc are serialized by queue_lock. 
@@ -1756,6 +1768,8 @@
 }
 #endif
 
+static inline int netif_receive_skb_finish(struct sk_buff *skb);
+
 int netif_receive_skb(struct sk_buff *skb)
 {
 	struct packet_type *ptype, *pt_prev;
@@ -1779,6 +1793,16 @@
 	skb->h.raw = skb->nh.raw = skb->data;
 	skb->mac_len = skb->nh.raw - skb->mac.raw;
 
+	return NF_HOOK(PF_PACKET, NF_PACKET_INPUT, skb, skb->dev, NULL,
+		       netif_receive_skb_finish);
+}
+
+static inline int netif_receive_skb_finish(struct sk_buff *skb)
+{
+	struct packet_type *ptype, *pt_prev;
+	int ret = NET_RX_DROP;
+	unsigned short type;
+
 	pt_prev = NULL;
 #ifdef CONFIG_NET_CLS_ACT
 	if (skb->tc_verd & TC_NCLS) {
diff -Nur linux-2.6.8.1-uc0.org/net/packet/af_packet.c linux-2.6.8.1-uc0/net/packet/af_packet.c
--- linux-2.6.8.1-uc0.org/net/packet/af_packet.c	2004-08-14 12:55:47.000000000 +0200
+++ linux-2.6.8.1-uc0/net/packet/af_packet.c	2005-01-25 14:25:43.000000000 +0100
@@ -75,6 +75,10 @@
 #include <net/inet_common.h>
 #endif
 
+#ifdef CONFIG_NETFILTER
+#include <linux/netfilter.h>
+#endif
+ 
 #define CONFIG_SOCK_PACKET	1
 
 /*
@@ -1342,7 +1346,12 @@
 	}
 #endif
 	default:
+#ifdef CONFIG_NETFILTER
+	        return nf_setsockopt(sock->sk, PF_PACKET, optname, optval,
+				     optlen);
+#else
 		return -ENOPROTOOPT;
+#endif
 	}
 }
 
@@ -1380,7 +1389,12 @@
 		break;
 	}
 	default:
+#ifdef CONFIG_NETFILTER
+	  	return nf_getsockopt(sock->sk, PF_PACKET, optname, optval,
+				     optlen);
+#else
 		return -ENOPROTOOPT;
+#endif
 	}
 
   	if (put_user(len, optlen))



More information about the Hostap mailing list