https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288322

            Bug ID: 288322
           Summary: ipfw: failed to configure port_range for NAT
           Product: Base System
           Version: 14.3-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: [email protected]
          Reporter: [email protected]

If the following configuration is attempted for NAT, it will fail.

ipfw nat 25 config if gif0 log deny_in unreg_only reset port_range 42900-42915

This will work correctly by fixing the following part.

diff --git a/sbin/ipfw/nat.c b/sbin/ipfw/nat.c
index a96da30c9f8..ddb93530020 100644
--- a/sbin/ipfw/nat.c
+++ b/sbin/ipfw/nat.c
@@ -762,11 +762,12 @@ nat_port_alias_parse(char *str, u_short *lpout, u_short
*hpout) {
                return 0;
        if (!ptr || *ptr != '-')
                return 0;
+       str = ptr + 1;
        /* Upper port parsing */
-       hp = (long) strtol(ptr, &ptr, 10);
+       hp = (long) strtol(str, &ptr, 10);
        if (hp < 1024 || hp > 65535)
                return 0;
-       if (ptr)
+       if (ptr == str)
                return 0;

        *lpout = (u_short) lp;

I don't know the correct way to check the result of strtol, so I would
appreciate the appropriate method for fixing it :)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to