fix(libkernel): follow FreeBSD inet text rules #3530

Merged
MarcZX10 merged 1 commit from upstream-pr/3530 into main 2026-10-11 21:32:19 +00:00
MarcZX10 commented 2026-10-11 12:34:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T12:34:01Z.


What

Replace the host inet_pton and inet_ntop calls in libkernel with explicit parsing and formatting that follows the guest's observed FreeBSD 11.4 text rules. This avoids platform differences such as accepting leading zeros in dotted IPv4 tails and printing IPv4-mapped IPv6 addresses as hexadecimal groups. The implementation and behavior assumptions are recorded in TechnicalDebt.md because console behavior remains unverified.

This carries the implementation originally submitted in the now-closed #2768. The commit keeps its original author, Hussein Kadhim.

Closes #3126.

Tested

Linux x86-64, GCC 12.2, Release:

  • Full CMake build passed on the rebased PR head.
  • guest_addresses passed three consecutive CTest runs.
  • python3 tools/check_conventions.py --base upstream/main and git diff --check upstream/main...HEAD passed.

I did not independently run the Windows differential suite or test on console hardware. The issue author reports extensive differential comparisons against FreeBSD 11.4 with no divergences.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4819077836 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3530). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T12:34:01Z. --- ### What Replace the host `inet_pton` and `inet_ntop` calls in libkernel with explicit parsing and formatting that follows the guest's observed FreeBSD 11.4 text rules. This avoids platform differences such as accepting leading zeros in dotted IPv4 tails and printing IPv4-mapped IPv6 addresses as hexadecimal groups. The implementation and behavior assumptions are recorded in `TechnicalDebt.md` because console behavior remains unverified. This carries the implementation originally submitted in the now-closed #2768. The commit keeps its original author, Hussein Kadhim. Closes #3126. ### Tested Linux x86-64, GCC 12.2, Release: - Full CMake build passed on the rebased PR head. - `guest_addresses` passed three consecutive CTest runs. - `python3 tools/check_conventions.py --base upstream/main` and `git diff --check upstream/main...HEAD` passed. I did not independently run the Windows differential suite or test on console hardware. The issue author reports extensive differential comparisons against FreeBSD 11.4 with no divergences. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
MarcZX10 commented 2026-10-11 12:35:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T12:35:51Z.


CI finished checking this head: intake, eligibility, report, Linux/macOS register-context, and macOS write-watch checks pass. Full Linux/Windows builds are skipped by the repository's contributor workflow. Conventions and all three relinker jobs fail during checkout, before evaluating this diff, with No url found for submodule path '3rdparty/imgui' in .gitmodules on base 1e8fff68. Open PR #3511 tracks the shared checkout issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109082474 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3530#issuecomment-6109082474). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T12:35:51Z. --- CI finished checking this head: intake, eligibility, report, Linux/macOS register-context, and macOS write-watch checks pass. Full Linux/Windows builds are skipped by the repository's contributor workflow. Conventions and all three relinker jobs fail during checkout, before evaluating this diff, with `No url found for submodule path '3rdparty/imgui' in .gitmodules` on base `1e8fff68`. Open PR #3511 tracks the shared checkout issue.
MarcZX10 commented 2026-10-11 12:47:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T12:47:11Z.


Update: #3511 merged and removed the orphan gitlink from main. I rebased this PR onto a11c8f7f; the full Linux Release build and three repeated guest_addresses runs pass on the new head. Conventions and diff checks pass locally. CI is running again against the fixed base.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109175943 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3530#issuecomment-6109175943). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T12:47:11Z. --- Update: #3511 merged and removed the orphan gitlink from `main`. I rebased this PR onto `a11c8f7f`; the full Linux Release build and three repeated `guest_addresses` runs pass on the new head. Conventions and diff checks pass locally. CI is running again against the fixed base.
MarcZX10 commented 2026-10-11 12:52:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T12:52:56Z.


The rerun on current main has finished: conventions, eligibility/report, Ubuntu and Intel macOS register-context/write-watch, and all three relinker jobs pass. Full Linux/Windows builds remain skipped by the contributor workflow. The local Release build and three repeated guest_addresses runs also pass on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109222768 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3530#issuecomment-6109222768). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T12:52:56Z. --- The rerun on current `main` has finished: conventions, eligibility/report, Ubuntu and Intel macOS register-context/write-watch, and all three relinker jobs pass. Full Linux/Windows builds remain skipped by the contributor workflow. The local Release build and three repeated `guest_addresses` runs also pass on this head.
adriadam10 commented 2026-10-11 21:32:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:32:15Z.


Checked against FreeBSD releng/11.4 inet_pton.c / inet_ntop.c (leading zeros, single ::, dotted tail only last, longest-zero-run rule, dotted output only for ::a.b.c.d / ::ffff:a.b.c.d, ENOSPC bound). Also ran a differential fuzz of the new code against glibc's inet_pton/inet_ntop on Linux (30M random texts and 30M binary addresses, both families): 0 divergences. guest_addresses passes on the PR merged onto current main; conventions CI is green. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114006704 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3530#issuecomment-6114006704). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T21:32:15Z. --- Checked against FreeBSD releng/11.4 `inet_pton.c` / `inet_ntop.c` (leading zeros, single `::`, dotted tail only last, longest-zero-run rule, dotted output only for `::a.b.c.d` / `::ffff:a.b.c.d`, ENOSPC bound). Also ran a differential fuzz of the new code against glibc's `inet_pton`/`inet_ntop` on Linux (30M random texts and 30M binary addresses, both families): 0 divergences. `guest_addresses` passes on the PR merged onto current `main`; conventions CI is green. Merging.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3530
No description provided.