Date: Thu, 15 Feb 2007 11:55:58 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 114553 for review Message-ID: <200702151155.l1FBtwJi039763@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=114553 Change 114553 by piso@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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702151155.l1FBtwJi039763>