open5gs/lib/ipfw
Sukchan Lee e7f9c50013 IPFW: reject invalid Flow-Description without crashing
Validate Flow-Description strings before passing them to the bundled
ipfw parser.

The parser accepts syntax that ogs_ipfw_rule_t cannot represent and may
silently truncate or discard parts of malformed rules. Some invalid
inputs can also reach errx() paths in the vendored parser and terminate
the process.

Validate the supported IPFilterRule subset, including:

- action and direction
- protocol names and numbers
- IPv4 and IPv6 addresses and prefixes
- source and destination address-family consistency
- port numbers and ranges
- unsupported trailing tokens and port lists
- unsupported source-side "assigned"

Protocol 41 with an IPv4 literal is rejected because the bundled parser
uses protocol 41 as an address-family selector and passes the literal to
the IPv6 address parser. Although an IPv4 outer address is valid for
IPv6 encapsulation, this combination is not currently supported by the
bundled parser and can terminate the process.

Propagate compile_rule() failures to the caller and only swap uplink
rules after successful compilation.

The Flow-Description form reported in #4711 now fails cleanly with a
diagnostic and is not installed. This does not add support for
"assigned" in the source position.

The parser already uses static storage and is not reentrant, and its
current callers run serially in the event loop, so the parse-error flag
does not introduce an additional concurrency limitation.

Reported-in: #4711
2026-08-07 14:46:03 +09:00
..
objs/include_e [Alpine] Add Dockerfile and Document 2021-04-30 22:13:04 +09:00
dummynet.c clang scan-build static analysis findings/resolutions (#3387) 2024-08-16 16:42:12 +09:00
expand_number.c Initial proposal CUPS using PFCP 2020-04-26 15:36:05 -04:00
glue.c test: Porting FreeBSD 2021-02-08 14:25:40 -05:00
glue.h [Alpine] remove GLIBC macro (#957) 2021-04-30 22:16:07 +09:00
humanize_number.c Initial proposal CUPS using PFCP 2020-04-26 15:36:05 -04:00
ipfw2.c IPFW: reject invalid Flow-Description without crashing 2026-08-07 14:46:03 +09:00
ipfw2.h [IPFilter] Assert if getprotobyname() problem (#977) 2021-05-07 10:47:10 +09:00
ipv6.c [ipfw] Fix memory leak when parsing ipv6 2023-09-27 20:35:33 +09:00
meson.build [NRF] Fixed library load error 2022-08-26 10:57:11 +09:00
missing.h Initial proposal CUPS using PFCP 2020-04-26 15:36:05 -04:00
ogs-ipfw.c IPFW: reject invalid Flow-Description without crashing 2026-08-07 14:46:03 +09:00
ogs-ipfw.h [SMF] Added Bi-Directional Flow (#2909) 2024-02-17 20:43:15 +01:00
tables.c clang scan-build static analysis findings/resolutions (#3387) 2024-08-16 16:42:12 +09:00