[email protected]
[Top] [All Lists]

PERFORCE change 114553 for review

Subject: PERFORCE change 114553 for review
From: Paolo Pisati
Date: Thu, 15 Feb 2007 11:55:58 GMT
http://perforce.freebsd.org/chv.cgi?CH=114553

Change 114553 by [email protected]_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. */
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "[email protected]"

<Prev in Thread] Current Thread [Next in Thread>
  • PERFORCE change 114553 for review, Paolo Pisati <=