PERFORCE change 114553 for review

Paolo Pisati piso at FreeBSD.org
Thu Feb 15 11:56:00 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=114553

Change 114553 by piso at piso_newluxor on 2007/02/15 11:54:57

	Teach mbuf to alias_pptp.

Affected files ...

.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_pptp.c#15 edit

Differences ...

==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_pptp.c#15 (text+ko) ====

@@ -307,8 +307,15 @@
 	u_int16_t ctl_type;	/* control message type */
 	struct ip *pip;
 	struct tcphdr *tc;
+	int size;
 
-	PULLUP_IPHDR(pip, ptr);
+	PULLUP_IPTCPHDR(pip, ptr);
+	if (pip == NULL)
+		return;
+	tc = (struct tcphdr *)ip_next(pip);
+	size = ((pip->ip_hl + tc->th_off) << 2) +
+	    (sizeof(struct pptpMsgHead) + sizeof(struct pptpCallIds));
+	PULLUP_SIZE(pip, ptr, size);
 	if (pip == NULL)
 		return;
 	/* Verify valid PPTP control message */
@@ -349,10 +356,6 @@
 		cptr->cid1 = GetAliasPort(pptp_lnk);
 
 		/* Compute TCP checksum for revised packet */
-		PULLUP_TCPHDR(pip ,ptr);
-		if (pip == NULL)
-			return;
-		tc = (struct tcphdr *)ip_next(pip);
 		accumulate -= cptr->cid1;
 		ADJUST_CHECKSUM(accumulate, tc->th_sum);
 
@@ -386,8 +389,15 @@
 	u_int16_t ctl_type;	/* control message type */
 	struct ip *pip;
 	struct tcphdr *tc;
+	int size;
 
-	PULLUP_IPHDR(pip ,ptr);
+	PULLUP_IPTCPHDR(pip, ptr);
+	if (pip == NULL)
+		return;
+	tc = (struct tcphdr *)ip_next(pip);
+	size = ((pip->ip_hl + tc->th_off) << 2) +
+	    (sizeof(struct pptpMsgHead) + sizeof(struct pptpCallIds));
+	PULLUP_SIZE(pip, ptr, size);
 	if (pip == NULL)
 		return;
 	/* Verify valid PPTP control message */
@@ -428,10 +438,6 @@
 		*pcall_id = GetOriginalPort(pptp_lnk);
 
 		/* Compute TCP checksum for modified packet */
-		PULLUP_TCPHDR(pip, ptr);
-		if (pip == NULL)
-			return;
-		tc = (struct tcphdr *)ip_next(pip);
 		accumulate -= *pcall_id;
 		ADJUST_CHECKSUM(accumulate, tc->th_sum);
 
@@ -492,8 +498,10 @@
 	struct alias_link *lnk;
 	struct ip *pip;
 
-	// XXX broken
 	PULLUP_IPHDR(pip, ptr);
+	PULLUP_SIZE(pip, ptr, (pip->ip_hl << 2) + sizeof(GreHdr));
+	if (pip == NULL)
+		return (-1);
 	gr = (GreHdr *) ip_next(pip);
 
 	/* Check GRE header bits. */
@@ -519,8 +527,10 @@
 	struct alias_link *lnk;
 	struct ip *pip;
 
-	// XXX broken
 	PULLUP_IPHDR(pip, ptr);
+	PULLUP_SIZE(pip, ptr, (pip->ip_hl << 2) + sizeof(GreHdr));
+	if (pip == NULL)
+		return (-1);
 	gr = (GreHdr *) ip_next(pip);
 
 	/* Check GRE header bits. */


More information about the p4-projects mailing list