A fix for the userland ppp NAT code..

Don't get stuck in an infinite loop comparing (short++ <= maxshort)

http://www.freebsd.org/cgi/query-pr.cgi?pr=136893

>From FreeBSD


Index: nat_cmd.c
===================================================================
RCS file: /cvs/src/usr.sbin/ppp/ppp/nat_cmd.c,v
retrieving revision 1.26
diff -u -p -r1.26 nat_cmd.c
--- nat_cmd.c   26 Jul 2005 01:32:25 -0000      1.26
+++ nat_cmd.c   28 Jul 2009 00:39:37 -0000
@@ -173,7 +173,7 @@ nat_RedirectPort(struct cmdargs const *a
       return -1;
     }
 
-    while (laliasport <= haliasport) {
+    do {
       link = PacketAliasRedirectPort(localaddr, htons(llocalport),
                                     remoteaddr, htons(lremoteport),
                                      aliasaddr, htons(laliasport),
@@ -185,10 +185,9 @@ nat_RedirectPort(struct cmdargs const *a
         return 1;
       }
       llocalport++;
-      laliasport++;
       if (hremoteport)
         lremoteport++;
-    }
+    } while (laliasport++ < haliasport);
 
     return 0;
   }

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to