Created attachment 233165 [details] IPFW NAT config: port range parsing fix Hello, Colleagues. In ipfw error with parsing "ipfw nat 11 config port_range 1025-65535". Forever "You need a range of port(s) from 1024 <= x < 65536". Two errors in /usr/src/sbin/ipfw/nat.c nat_port_alias_parse(). Patch attached. Thanks.
Thank you for reporting this issue. I wonder why the error occurs at all. Somebody should tested this during development.
You don't need the checks for !ptr (which should have been written as ptr == NULL anyway), strtol() does not seem to set endptr to NULL ever.
Also after applying the patch nat_show_cfg() doesn't display port_range by cmd: ipfw nat 1 show config But looks like the patch works regardless of a room for improvement there
^Triage: committer's bit was taken in for safekeeping.
Created attachment 258037 [details] IPFW NAT config: port range parsing fix ^Triage: rebase patch.
Created attachment 258057 [details] fix for port range parsing I wonder if this won't be enough (check for dash presence, check there is something after dash and try to parse it)
Created attachment 261503 [details] fix for port range parsing (2) The patch from the attachment solved the problem of parsing the port range for me, the values are correctly passed to libalias, ipfw nat works as expected.
*** Bug 288322 has been marked as a duplicate of this bug. ***
Created attachment 263952 [details] nat.c.patch ^Triage: rebase patch so that it applies.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6eba055fcf5b0bbfbebcac59f5982d13815001b0 commit 6eba055fcf5b0bbfbebcac59f5982d13815001b0 Author: Vyacheslav Terehov <terehovv@mail.ru> AuthorDate: 2026-05-21 07:15:22 +0000 Commit: Andrey V. Elsukov <ae@FreeBSD.org> CommitDate: 2026-05-21 07:15:22 +0000 ipfw: fix parsing error in nat config port_range Also fix the corresponding tests. PR: 263240 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D57010 sbin/ipfw/ipfw.8 | 3 ++- sbin/ipfw/nat.c | 29 ++++++++++++++++------------- tests/sys/netpfil/common/nat.sh | 26 ++++++++++++++------------ 3 files changed, 32 insertions(+), 26 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=33cafd3fadd07ea49b18559a4fe397951c6a844f commit 33cafd3fadd07ea49b18559a4fe397951c6a844f Author: Vyacheslav Terehov <terehovv@mail.ru> AuthorDate: 2026-05-21 07:15:22 +0000 Commit: Andrey V. Elsukov <ae@FreeBSD.org> CommitDate: 2026-05-29 08:01:00 +0000 ipfw: fix parsing error in nat config port_range Also fix the corresponding tests. PR: 263240 Differential Revision: https://reviews.freebsd.org/D57010 (cherry picked from commit 6eba055fcf5b0bbfbebcac59f5982d13815001b0) sbin/ipfw/ipfw.8 | 3 ++- sbin/ipfw/nat.c | 29 ++++++++++++++++------------- tests/sys/netpfil/common/nat.sh | 26 ++++++++++++++------------ 3 files changed, 32 insertions(+), 26 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=d2e63a09519364f9a9e328666302b28d7ee95c47 commit d2e63a09519364f9a9e328666302b28d7ee95c47 Author: Vyacheslav Terehov <terehovv@mail.ru> AuthorDate: 2026-05-21 07:15:22 +0000 Commit: Andrey V. Elsukov <ae@FreeBSD.org> CommitDate: 2026-05-29 08:02:49 +0000 ipfw: fix parsing error in nat config port_range Also fix the corresponding tests. PR: 263240 Differential Revision: https://reviews.freebsd.org/D57010 (cherry picked from commit 6eba055fcf5b0bbfbebcac59f5982d13815001b0) sbin/ipfw/ipfw.8 | 3 ++- sbin/ipfw/nat.c | 29 ++++++++++++++++------------- tests/sys/netpfil/common/nat.sh | 26 ++++++++++++++------------ 3 files changed, 32 insertions(+), 26 deletions(-)