[netfilter-cvslog] r4242 - trunk/patch-o-matic-ng/patchlets/osf/linux/net/ipv4/netfilter

laforge at netfilter.org laforge at netfilter.org
Sat Aug 13 18:31:41 CEST 2005


Author: laforge at netfilter.org
Date: 2005-08-13 18:31:40 +0200 (Sat, 13 Aug 2005)
New Revision: 4242

Modified:
   trunk/patch-o-matic-ng/patchlets/osf/linux/net/ipv4/netfilter/ipt_osf.c
Log:
revert 2.6.x "skb_header_pointer" fix that should never have gone into the 2.4.x branch anyway


Modified: trunk/patch-o-matic-ng/patchlets/osf/linux/net/ipv4/netfilter/ipt_osf.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/osf/linux/net/ipv4/netfilter/ipt_osf.c	2005-08-12 13:55:44 UTC (rev 4241)
+++ trunk/patch-o-matic-ng/patchlets/osf/linux/net/ipv4/netfilter/ipt_osf.c	2005-08-13 16:31:40 UTC (rev 4242)
@@ -157,30 +157,20 @@
       int *hotdrop)
 {
 	struct ipt_osf_info *info = (struct ipt_osf_info *)matchinfo;
-	struct iphdr _iph, *ip;
-	struct tcphdr _tcph, *tcp;
+	struct iphdr *ip = skb->nh.iph;
+	struct tcphdr *tcp;
 	int fmatch = FMATCH_WRONG, fcount = 0;
 	unsigned long totlen, optsize = 0, window;
 	unsigned char df, *optp = NULL, *_optp = NULL;
-	unsigned char opts[MAX_IPOPTLEN];
 	char check_WSS = 0;
 	struct list_head *ent;
 	struct osf_finger *f;
-	int off;
 
-	if (!info)
+	if (!ip || !info)
 		return 0;
-	
-	off = 0;
-	
-	ip = skb_header_pointer(skb, off, sizeof(_iph), &_iph);
-	if (!ip)
-		return 0;
 				
-	tcp = skb_header_pointer(skb, off + ip->ihl * 4, sizeof(_tcph), &_tcph);
-	if (!tcp)
-		return 0;
-	
+	tcp = (struct tcphdr *)((u_int32_t *)ip + ip->ihl);
+
 	if (!tcp->syn)
 		return 0;
 	
@@ -190,6 +180,7 @@
 	
 	if (tcp->doff*4 > sizeof(struct tcphdr))
 	{
+		_optp = optp = (char *)(tcp+1);
 		optsize = tcp->doff*4 - sizeof(struct tcphdr);
 
 		if (optsize > sizeof(opts))
@@ -198,8 +189,6 @@
 					__func__, optsize, sizeof(opts));
 			optsize = sizeof(opts);
 		}
-		
-		_optp = optp = skb_header_pointer(skb, off + ip->ihl*4 + sizeof(_tcph), optsize, opts);
 	}
 
 	/* Actually we can create hash/table of all genres and search
@@ -392,7 +381,7 @@
 		if (optp)
 		{
 			optsize = tcp->doff * 4 - sizeof(struct tcphdr);
-			if (skb_copy_bits(skb, off + ip->ihl*4 + sizeof(struct tcphdr),
+			if (skb_copy_bits(skb, ip->ihl*4 + sizeof(struct tcphdr),
 					  opt, optsize) < 0)
 			{
 				if (info->flags & IPT_OSF_LOG)




More information about the netfilter-cvslog mailing list