Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Apr 2009 13:07:51 +0000 (UTC)
From:      Paolo Pisati <piso@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r190998 - user/piso/ipfw/sys/netinet/libalias
Message-ID:  <200904131307.n3DD7pMw072525@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: piso
Date: Mon Apr 13 13:07:51 2009
New Revision: 190998
URL: http://svn.freebsd.org/changeset/base/190998

Log:
  o pass mbufs down to modules too.
  o deploy a compatibility mechanism for legacy modules unable to grok mbufs.

Modified:
  user/piso/ipfw/sys/netinet/libalias/alias.c
  user/piso/ipfw/sys/netinet/libalias/alias_cuseeme.c
  user/piso/ipfw/sys/netinet/libalias/alias_db.c
  user/piso/ipfw/sys/netinet/libalias/alias_dummy.c
  user/piso/ipfw/sys/netinet/libalias/alias_ftp.c
  user/piso/ipfw/sys/netinet/libalias/alias_irc.c
  user/piso/ipfw/sys/netinet/libalias/alias_local.h
  user/piso/ipfw/sys/netinet/libalias/alias_mod.c
  user/piso/ipfw/sys/netinet/libalias/alias_mod.h
  user/piso/ipfw/sys/netinet/libalias/alias_nbt.c
  user/piso/ipfw/sys/netinet/libalias/alias_pptp.c
  user/piso/ipfw/sys/netinet/libalias/alias_skinny.c
  user/piso/ipfw/sys/netinet/libalias/alias_smedia.c

Modified: user/piso/ipfw/sys/netinet/libalias/alias.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -761,7 +761,9 @@ UdpAliasIn(struct libalias *la, pkt_t pt
 		proxy_port = GetProxyPort(lnk);
 
 		/* Walk out chain. */		
-		error = find_handler(IN, UDP, la, pip, &ad);
+		error = find_handler(IN, UDP, la, ptr, &ad);
+		PULLUP_UDPHDR(pip, ptr);
+		ud = (struct udphdr *)ip_next(pip);	
 		/* If we cannot figure out the packet, ignore it. */
 		if (error < 0)
 			return (PKT_ALIAS_IGNORED);
@@ -886,7 +888,9 @@ UdpAliasOut(struct libalias *la, pkt_t p
 		alias_port = GetAliasPort(lnk);
 
 		/* Walk out chain. */		
-		error = find_handler(OUT, UDP, la, pip, &ad);
+		error = find_handler(OUT, UDP, la, ptr, &ad);
+		PULLUP_UDPHDR(pip, ptr);
+		ud = (struct udphdr *)ip_next(pip);
 
 /* If UDP checksum is not zero, adjust since source port is */
 /* being aliased and source address is being altered        */
@@ -954,7 +958,9 @@ TcpAliasIn(struct libalias *la, pkt_t pt
 		};
 
 		/* Walk out chain. */		
-		error = find_handler(IN, TCP, la, pip, &ad);
+		error = find_handler(IN, TCP, la, ptr, &ad);
+		PULLUP_TCPHDR(pip, ptr);
+                tc = (struct tcphdr *)ip_next(pip);
 
 		alias_address = GetAliasAddress(lnk);
 		original_address = GetOriginalAddress(lnk);
@@ -1118,7 +1124,9 @@ TcpAliasOut(struct libalias *la, pkt_t p
 		TcpMonitorOut(tc->th_flags, lnk);
 		
 		/* Walk out chain. */		
-		error = find_handler(OUT, TCP, la, pip, &ad);
+		error = find_handler(OUT, TCP, la, ptr, &ad);
+                PULLUP_TCPHDR(pip, ptr);
+                tc = (struct tcphdr *)ip_next(pip);
 
 /* Adjust TCP checksum since source port is being aliased */
 /* and source address is being altered                    */
@@ -1362,7 +1370,8 @@ LibAliasInLocked(struct libalias *la, pk
 			};
 			
 			/* Walk out chain. */		
-			error = find_handler(IN, IP, la, pip, &ad);
+			error = find_handler(IN, IP, la, ptr, &ad);
+			PULLUP_IPHDR(pip, ptr);
 			if (error ==  0)
 				iresult = PKT_ALIAS_OK;
 			else
@@ -1512,7 +1521,8 @@ LibAliasOutLocked(struct libalias *la, p
 				.maxpktsize = 0                  
 			};
 			/* Walk out chain. */		
-			error = find_handler(OUT, IP, la, pip, &ad);
+			error = find_handler(OUT, IP, la, ptr, &ad);
+			PULLUP_IPHDR(pip, ptr);
 			if (error == 0)
  				iresult = PKT_ALIAS_OK;
  			else

Modified: user/piso/ipfw/sys/netinet/libalias/alias_cuseeme.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_cuseeme.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_cuseeme.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$");
 
 #ifdef _KERNEL
 #include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
 #else
@@ -49,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/libalias/alias_local.h>
 #include <netinet/libalias/alias_mod.h>
 #else
+#include "alias.h"
 #include "alias_local.h"
 #include "alias_mod.h"
 #endif
@@ -75,17 +78,31 @@ fingerprint(struct libalias *la, struct 
 }
 
 static int 
-protohandlerin(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandlerin(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+	struct ip *pip;
+
+#ifdef _KERNEL
+	if (ptr == NULL)
+		pip = (struct ip *)la->buf;
+	else
+#endif
+	PULLUP_IPHDR(pip, ptr);
 	AliasHandleCUSeeMeIn(la, pip, *ah->oaddr);
 	return (0);
 }
 
 static int 
-protohandlerout(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandlerout(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip;
+
+#ifdef _KERNEL 
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+	PULLUP_IPHDR(pip, ptr);
 	AliasHandleCUSeeMeOut(la, pip, ah->lnk);
 	return (0);
 }
@@ -96,6 +113,7 @@ struct proto_handler handlers[] = {
 	  .pri = 120, 
 	  .dir = OUT, 
 	  .proto = UDP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandlerout
 	}, 
@@ -103,6 +121,7 @@ struct proto_handler handlers[] = {
 	  .pri = 120, 
 	  .dir = IN, 
 	  .proto = UDP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandlerin
 	}, 

Modified: user/piso/ipfw/sys/netinet/libalias/alias_db.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_db.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_db.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -2495,6 +2495,14 @@ LibAliasInit(struct libalias *la)
 		la = calloc(sizeof *la, 1);
 		if (la == NULL)
 			return (la);
+#ifdef _KERNEL
+	la->buf = malloc(IP_MAXPACKET+1);
+	if (la->buf == NULL) {
+		free (la);
+		return (NULL);
+	}
+#endif
+
 
 #ifndef	_KERNEL		/* kernel cleans up on module unload */
 		if (LIST_EMPTY(&instancehead))
@@ -2568,6 +2576,7 @@ LibAliasUninit(struct libalias *la)
 	LIBALIAS_LOCK(la);
 #ifdef _KERNEL
 	AliasSctpTerm(la);
+	free (la->buf);
 #endif
 	la->deleteAllLinks = 1;
 	CleanupAliasData(la);

Modified: user/piso/ipfw/sys/netinet/libalias/alias_dummy.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_dummy.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_dummy.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #ifdef _KERNEL
 #include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
 #else
@@ -49,9 +51,11 @@ __FBSDID("$FreeBSD$");
 #include <netinet/udp.h>
 
 #ifdef _KERNEL
+#include <netinet/libalias/alias.h>
 #include <netinet/libalias/alias_local.h>
 #include <netinet/libalias/alias_mod.h>
 #else
+#include "alias.h"
 #include "alias_local.h"
 #include "alias_mod.h"
 #endif
@@ -86,9 +90,16 @@ fingerprint(struct libalias *la, struct 
  */
 
 static int 
-protohandler(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandler(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip;
+
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	AliasHandleDummy(la, pip, ah);
 	return (0);
 }
@@ -106,6 +117,7 @@ struct proto_handler handlers [] = {
 	  .pri = 666, 
 	  .dir = IN|OUT, 
 	  .proto = UDP|TCP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandler
 	}, 

Modified: user/piso/ipfw/sys/netinet/libalias/alias_ftp.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_ftp.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_ftp.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -71,6 +71,8 @@ __FBSDID("$FreeBSD$");
 /* Includes */
 #ifdef _KERNEL
 #include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
 #include <sys/ctype.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -93,6 +95,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/libalias/alias_local.h>
 #include <netinet/libalias/alias_mod.h>
 #else
+#include "alias.h"
 #include "alias_local.h"
 #include "alias_mod.h"
 #endif
@@ -117,9 +120,16 @@ fingerprint(struct libalias *la, struct 
 }
 
 static int 
-protohandler(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandler(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip; 
+
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	AliasHandleFtpOut(la, pip, ah->lnk, ah->maxpktsize);
 	return (0);
 }
@@ -129,6 +139,7 @@ struct proto_handler handlers[] = {
 	  .pri = 80, 
 	  .dir = OUT, 
 	  .proto = TCP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandler
 	}, 

Modified: user/piso/ipfw/sys/netinet/libalias/alias_irc.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_irc.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_irc.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$");
 /* Includes */
 #ifdef _KERNEL
 #include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
 #include <sys/ctype.h>
 #include <sys/limits.h>
 #include <sys/systm.h>
@@ -75,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/libalias/alias_local.h>
 #include <netinet/libalias/alias_mod.h>
 #else
+#include "alias.h"
 #include "alias_local.h"
 #include "alias_mod.h"
 #endif
@@ -106,9 +109,16 @@ fingerprint(struct libalias *la, struct 
 }
 
 static int 
-protohandler(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandler(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
+        struct ip *pip;
 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	newpacket = malloc(PKTSIZE);
 	if (newpacket) {
 		AliasHandleIrcOut(la, pip, ah->lnk, ah->maxpktsize);
@@ -122,6 +132,7 @@ struct proto_handler handlers[] = {
 	  .pri = 90, 
 	  .dir = OUT, 
 	  .proto = TCP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandler
 	}, 

Modified: user/piso/ipfw/sys/netinet/libalias/alias_local.h
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_local.h	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_local.h	Mon Apr 13 13:07:51 2009	(r190998)
@@ -178,6 +178,9 @@ struct libalias {
 	 * avoid races in libalias: every public function has to use it.
 	 */
 	struct mtx mutex;
+
+	/* for legacy modules that can't handle mbufs yet */
+	caddr_t	buf;
 #endif
 };
 

Modified: user/piso/ipfw/sys/netinet/libalias/alias_mod.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_mod.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_mod.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -30,6 +30,8 @@ __FBSDID("$FreeBSD$");
 #ifdef _KERNEL
 #include <sys/libkern.h>
 #include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
 #include <sys/lock.h>
 #include <sys/rwlock.h>
 #else
@@ -44,9 +46,11 @@ __FBSDID("$FreeBSD$");
 #include <netinet/ip.h>
 
 #ifdef _KERNEL
+#include <netinet/libalias/alias.h>
 #include <netinet/libalias/alias_local.h>
 #include <netinet/libalias/alias_mod.h>
 #else
+#include "alias.h"
 #include "alias_local.h"
 #include "alias_mod.h"
 #endif
@@ -219,7 +223,7 @@ detach_handler(struct proto_handler *_p)
 }
 
 int
-find_handler(int8_t dir, int8_t proto, struct libalias *la, __unused struct ip *pip, 
+find_handler(int8_t dir, int8_t proto, struct libalias *la, pkt_t ptr, 
     struct alias_data *ad)
 {
 	struct proto_handler *p;
@@ -230,7 +234,16 @@ find_handler(int8_t dir, int8_t proto, s
 	LIST_FOREACH(p, &handler_chain, entries) {
 		if ((p->dir & dir) && (p->proto & proto))
 			if (p->fingerprint(la, ad) == 0) {
-				error = p->protohandler(la, pip, ad);
+#ifdef _KERNEL
+				if (p->legacy) {
+					m_copydata(*ptr, 0, m_length(*ptr, NULL), la->buf);
+					error = p->protohandler(la, NULL, ad);
+					m_copyback(*ptr, 0, ((struct ip *)la->buf)->ip_len,
+					    la->buf);
+					break;
+				}
+#endif
+				error = p->protohandler(la, ptr, ad);
 				break;
 			}
 	}

Modified: user/piso/ipfw/sys/netinet/libalias/alias_mod.h
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_mod.h	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_mod.h	Mon Apr 13 13:07:51 2009	(r190998)
@@ -80,10 +80,11 @@ struct proto_handler {
 	u_int pri;                                              /* Handler priority. */
         int16_t dir;                                            /* Flow direction. */
 	uint8_t proto;                                          /* Working protocol. */	
+	uint8_t legacy;						/* Does it handle mbuf or not? */
 	int (*fingerprint)(struct libalias *,                   /* Fingerprint * function. */
 	    struct alias_data *);                
 	int (*protohandler)(struct libalias *,                  /* Aliasing * function. */
-	    struct ip *, struct alias_data *);                 
+	    pkt_t, struct alias_data *);                 
 	LIST_ENTRY(proto_handler) entries;
 };
 
@@ -114,7 +115,7 @@ int             LibAliasAttachHandlers(s
 int             LibAliasDetachHandlers(struct proto_handler *);
 int             detach_handler(struct proto_handler *);
 int             find_handler(int8_t, int8_t, struct libalias *, 
-			   struct ip *, struct alias_data *);
+		    pkt_t, struct alias_data *);
 struct proto_handler *first_handler(void);
 
 /* Functions used with dll module. */

Modified: user/piso/ipfw/sys/netinet/libalias/alias_nbt.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_nbt.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_nbt.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$");
 #ifdef _KERNEL
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
 #else
@@ -59,9 +61,11 @@ __FBSDID("$FreeBSD$");
 #include <netinet/udp.h>
 
 #ifdef _KERNEL
+#include <netinet/libalias/alias.h>
 #include <netinet/libalias/alias_local.h>
 #include <netinet/libalias/alias_mod.h>
 #else
+#include "alias.h"
 #include "alias_local.h"
 #include "alias_mod.h"
 #endif
@@ -71,11 +75,12 @@ __FBSDID("$FreeBSD$");
 
 static int
 AliasHandleUdpNbt(struct libalias *, struct ip *, struct alias_link *, 
-		  struct in_addr *, u_short);
+  struct in_addr *, u_short);
 
 static int
 AliasHandleUdpNbtNS(struct libalias *, struct ip *, struct alias_link *,
-		    struct in_addr *, u_short *, struct in_addr *, u_short *);
+    struct in_addr *, u_short *, struct in_addr *, u_short *);
+
 static int 
 fingerprint1(struct libalias *la, struct alias_data *ah)
 {
@@ -90,9 +95,16 @@ fingerprint1(struct libalias *la, struct
 }
 
 static int 
-protohandler1(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandler1(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	return (AliasHandleUdpNbt(la, pip, ah->lnk, ah->aaddr, *ah->aport));
 }
 
@@ -110,18 +122,32 @@ fingerprint2(struct libalias *la, struct
 }
 
 static int 
-protohandler2in(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandler2in(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	AliasHandleUdpNbtNS(la, pip, ah->lnk, ah->aaddr, ah->aport,
- 			    ah->oaddr, ah->dport);
+ 	    ah->oaddr, ah->dport);
 	return (0);
 }
 
 static int 
-protohandler2out(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandler2out(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	return (AliasHandleUdpNbtNS(la, pip, ah->lnk, &pip->ip_src, ah->sport,
  	    ah->aaddr, ah->aport));
 }
@@ -132,6 +158,7 @@ struct proto_handler handlers[] = {
 	  .pri = 130, 
 	  .dir = IN|OUT, 
 	  .proto = UDP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint1, 
 	  .protohandler = &protohandler1
 	}, 
@@ -139,6 +166,7 @@ struct proto_handler handlers[] = {
 	  .pri = 140, 
 	  .dir = IN, 
 	  .proto = UDP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint2, 
 	  .protohandler = &protohandler2in
 	}, 
@@ -146,6 +174,7 @@ struct proto_handler handlers[] = {
 	  .pri = 140, 
 	  .dir = OUT, 
 	  .proto = UDP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint2, 
 	  .protohandler = &protohandler2out
 	}, 

Modified: user/piso/ipfw/sys/netinet/libalias/alias_pptp.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_pptp.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_pptp.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
 /* Includes */
 #ifdef _KERNEL
 #include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
 #include <sys/limits.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
@@ -98,25 +100,46 @@ fingerprintgre(struct libalias *la, stru
 }
 
 static int 
-protohandlerin(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandlerin(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	AliasHandlePptpIn(la, pip, ah->lnk);
 	return (0);
 }
 
 static int 
-protohandlerout(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandlerout(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	AliasHandlePptpOut(la, pip, ah->lnk);
 	return (0);
 }
 
 static int 
-protohandlergrein(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandlergrein(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY ||
 	    AliasHandlePptpGreIn(la, pip) == 0)
 		return (0);
@@ -124,9 +147,16 @@ protohandlergrein(struct libalias *la, s
 }
 
 static int 
-protohandlergreout(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandlergreout(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	if (AliasHandlePptpGreOut(la, pip) == 0)
 		return (0);
 	return (-1);
@@ -138,6 +168,7 @@ struct proto_handler handlers[] = {
 	  .pri = 200, 
 	  .dir = IN, 
 	  .proto = TCP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandlerin
 	},
@@ -145,6 +176,7 @@ struct proto_handler handlers[] = {
 	  .pri = 210, 
 	  .dir = OUT, 
 	  .proto = TCP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandlerout
 	},
@@ -157,6 +189,7 @@ struct proto_handler handlers[] = {
 	  .pri = INT_MAX, 
 	  .dir = IN, 
 	  .proto = IP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprintgre, 
 	  .protohandler = &protohandlergrein
 	},
@@ -164,6 +197,7 @@ struct proto_handler handlers[] = {
 	  .pri = INT_MAX, 
 	  .dir = OUT, 
 	  .proto = IP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprintgre, 
 	  .protohandler = &protohandlergreout
 	}, 

Modified: user/piso/ipfw/sys/netinet/libalias/alias_skinny.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_skinny.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_skinny.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -32,6 +32,8 @@
 
 #ifdef _KERNEL
 #include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
 #else
@@ -46,9 +48,11 @@
 #include <netinet/tcp.h>
 
 #ifdef _KERNEL
+#include <netinet/libalias/alias.h>
 #include <netinet/libalias/alias_local.h>
 #include <netinet/libalias/alias_mod.h>
 #else
+#include "alias.h"
 #include "alias_local.h"
 #include "alias_mod.h"
 #endif
@@ -69,9 +73,16 @@ fingerprint(struct libalias *la, struct 
 }
 
 static int 
-protohandler(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandler(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
         AliasHandleSkinny(la, pip, ah->lnk);
 	return (0);
 }
@@ -81,6 +92,7 @@ struct proto_handler handlers[] = {
 	  .pri = 110, 
 	  .dir = IN|OUT, 
 	  .proto = TCP, 
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandler
 	}, 

Modified: user/piso/ipfw/sys/netinet/libalias/alias_smedia.c
==============================================================================
--- user/piso/ipfw/sys/netinet/libalias/alias_smedia.c	Mon Apr 13 11:54:22 2009	(r190997)
+++ user/piso/ipfw/sys/netinet/libalias/alias_smedia.c	Mon Apr 13 13:07:51 2009	(r190998)
@@ -101,6 +101,8 @@ __FBSDID("$FreeBSD$");
 #ifdef _KERNEL
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
 #else
@@ -120,6 +122,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/libalias/alias_local.h>
 #include <netinet/libalias/alias_mod.h>
 #else
+#include "alias.h"
 #include "alias_local.h"
 #include "alias_mod.h"
 #endif
@@ -150,9 +153,16 @@ fingerprint(struct libalias *la, struct 
 }
 
 static int 
-protohandler(struct libalias *la, struct ip *pip, struct alias_data *ah)
+protohandler(struct libalias *la, pkt_t ptr, struct alias_data *ah)
 {
-	
+        struct ip *pip; 
+ 
+#ifdef _KERNEL
+        if (ptr == NULL)
+                pip = (struct ip *)la->buf;
+        else
+#endif
+        PULLUP_IPHDR(pip, ptr);
 	if (ntohs(*ah->dport) == TFTP_PORT_NUMBER)
 		FindRtspOut(la, pip->ip_src, pip->ip_dst,
  			    *ah->sport, *ah->aport, IPPROTO_UDP);
@@ -165,6 +175,7 @@ struct proto_handler handlers[] = {
 	  .pri = 100, 
 	  .dir = OUT, 
 	  .proto = TCP|UDP,
+	  .legacy = 1,
 	  .fingerprint = &fingerprint, 
 	  .protohandler = &protohandler
 	}, 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904131307.n3DD7pMw072525>