Bug in if_spppsubr.c ?

Jacques Fourie jf at trispen.com
Mon Sep 29 05:26:07 PDT 2003


Hi,

I've come across what I believe to be a bug in if_spppsubr.c. I have
verified that it also exists in 4-STABLE. When using PPP encapsulation and  
header compression, m->m_pkthdr.len is never adjusted after the call to
sl_compress_tcp(). Included is a patch against 4-STABLE that seems to fix 
the problem.       

regards,  
jacques
-------------- next part --------------
--- if_spppsubr.c.orig	Mon Sep 29 14:12:17 2003
+++ if_spppsubr.c	Mon Sep 29 14:17:31 2003
@@ -778,6 +778,7 @@
 	int s, rv = 0;
 	int ipproto = PPP_IP;
 	int debug = ifp->if_flags & IFF_DEBUG;
+	int uc_len;
 
 	s = splimp();
 
@@ -864,7 +865,9 @@
 		 * Do IP Header compression
 		 */
 		if (sp->pp_mode != IFF_CISCO && (sp->ipcp.flags & IPCP_VJ) &&
-		    ip->ip_p == IPPROTO_TCP)
+		    ip->ip_p == IPPROTO_TCP) {
+			uc_len = m->m_len;  
+		
 			switch (sl_compress_tcp(m, ip, sp->pp_comp,
 						sp->ipcp.compress_cid)) {
 			case TYPE_COMPRESSED_TCP:
@@ -881,6 +884,10 @@
 				splx(s);
 				return (EINVAL);
 			}
+		
+			if (m->m_flags & M_PKTHDR)
+		    		m->m_pkthdr.len += m->m_len - uc_len;	
+		}    						
 	}
 #endif
 


More information about the freebsd-hackers mailing list