[Bug 288322] ipfw: failed to configure port_range for NAT

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 20 Jul 2025 21:42:01 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288322

--- Comment #2 from Tatsuki Makino <tatsuki_makino@hotmail.com> ---
Created attachment 262308
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=262308&action=edit
patch for sbin/ipfw/nat.c of main

This patch seems more appropriate than my comment #0.
Since the range from 1024 to 65535 does not include 0, it seems that no further
checks using errno or other methods are necessary.
Checking the end pointer is not necessary, but since we need to extract two
numbers from a single string, it is necessary to check the types of characters
that continue.
The hyphen used to connect two numbers is considered the sign of a negative
number, so it needs to be skipped.

It seems that this will work as intended, but it might be convenient to have
the following additional changes.
By specifying the base as 0 instead of decimal, it allows for the use of
hexadecimal, making the bits easier to understand.
In the first place, wouldn't it be more functional to use the StrToPortRange
function that is located above?

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