feat(libc): implement IPv4 address helpers #2231
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2231"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T12:33:35Z.
What
Implement the guest libc IPv4 address helpers used by the current homebrew audit:
__inet_atonparses the FreeBSD one-to-four-part IPv4 forms, including octal and hexadecimal components, and leaves the output untouched on invalid input.__inet_addrreturns the parsed address in network byte order orINADDR_NONE, preserving FreeBSD's one-part unsigned wrap behavior.__inet_ntoaformats the address bytes in network order into a per-thread buffer.The tests cover dotted and abbreviated forms, octal and hexadecimal forms, whitespace termination, invalid input/output preservation, FreeBSD wrap cases, buffer reuse, and round trips across all three functions.
This PR consolidates the work in #1848, #1972, and #2208 into the previously reviewed IPv4-helper change from #1766. The original authors' commits are preserved in this branch history. Those three PRs currently overlap this implementation; this PR is intended as the single canonical change after the current-head Build is reviewed.
Tested
Linux x86-64, GCC 12.2, Release:
guest_stringspassed (1/1) on the final source tree.tools/check_conventions.py --base upstream/mainpassed.git diff --check upstream/main...HEADpassed.libcandlibstargets plus a full all-target build completed. GCC 12.2 cannot compile the unrelatedstd::chrono::clock_castin currentmain, so the local full-build run temporarily applied the equivalent file-clock conversion from #1260; that unrelated source edit was restored before the final focused test and is not part of this PR.A full upstream Build on this head is still needed. No PS5 hardware or title was run locally.
Additional title stop evidence (not run with this PR)
A contributor reported that RetroArch (PPSA99169) and Porpoise (PPSA99764) both stop on
__inet_addron currentmain, then stop on__inet_ntoaafter adding only__inet_addr. The report used Linux title runs with an__inet_addrimplementation and did not run this PR; it supports the imports' relevance but does not establish title compatibility. See the report.Native Windows evidence on pre-rebase head
6923a54eA Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release run passed
guest_stringswith no skipped cases. The aggregate CTest run passed 519/519, but that build included 38 other PRs and needed local fixes to unrelated #1611, #1796, and #1824. This is not an unmodified upstream Build for this PR. No title was run.Current head after rebase
Current head
863ff49fed19b11b21d4c3974ef09d3bc3e14b47is based on current upstreammainf8c2f072463465f875dedb0d20b66c339160c1a1.guest_string_tests;guest_stringspassed (1/1).python3 tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main...HEADpass.Checklist
main; #1848, #1972, and #2208 still overlap this IPv4 helper family. Their authors have been told why #2231 is the preferred combined target; maintainers decide whether to land it as one PR.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T12:34:01Z.
The full local Linux build completed with the GCC 12 compatibility workaround documented above, and the focused
guest_stringsCTest and Conventions pass on the final source tree. Under CONTRIBUTING, the full Linux/Windows Build and relinker matrix needs an authorized collaborator. Could a collaborator run Actions → Build for PR #2231 so this exact head is checked before the overlapping PRs are closed?Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T12:40:30Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)__inet_ntoa_nid_postfixImported from boykopovar/AnyPS5. Originally posted by CouchRiv on 2026-10-09T13:08:51Z.
On the "no title stop for
__inet_ntoa" point: two catalog titles stop on it once__inet_addrexists. Linux (CachyOS, GCC, Release), titles relinked and run in a bubblewrap sandbox,mainf1451396plus an__inet_addrimplementation (our closed #1974, same behaviour as #1972):main__inet_addrundefined symbol: 7p7kTAJcuGg(__inet_addr)undefined symbol: 6i5aLrxRhG0(__inet_ntoa)undefined symbol: 7p7kTAJcuGgundefined symbol: 6i5aLrxRhG0Not run with this PR.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T14:00:19Z.
Thanks for running the full Linux/Windows Build workflow for #2208 and confirming your
__inet_ntoacommit is preserved in this PR. Would you be able to run the same fork workflow against #2231’s exact current head6923a54e? Your #2208 run is strong evidence for the shared commit, but this head also integrates the other IPv4 helpers and round-trip tests, so an exact-head run would close the remaining Windows/full-suite gap while the upstream manual Build is pending.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:47:17Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
6923a54e, merged ontomaind70b8998in one build with 38 other PRs that had no Windows run.guest_strings. None of them reported skipping a case.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T17:34:28Z.
Thanks for running the exact
6923a54ehead and recording the Windows results. I added the focusedguest_stringspass and the 519/519 batch CTest result to the PR description, with the three unrelated local Windows fixes clearly called out. The full upstream Build and title compatibility are still outstanding, so I have left those limitations explicit.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T17:42:12Z.
Update: #2231 is now rebased onto current
main(f8c2f072) at head863ff49f. The diff remains limited toStringExtensions.cppandGuestStrings.cpp; Linuxguest_stringspasses 1/1 and Conventions passes. The Windows 519/519 aggregate evidence was on the pre-rebase head and is labeled that way in the description. Exact-head Windows and the required upstream Build matrix remain outstanding; could an authorized collaborator run the Build on this head?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T18:30:10Z.
Maintainer decision needed
The exact-head Conventions run 37968104485 fails because the checklist still reports open overlapping PRs. The successful run on the same head does not clear that finding.
The authors of #1848 and #1972 have said they prefer to keep their PRs open until a maintainer chooses which implementation to land. #2208 is also still open. The current #2231 branch contains the three original implementation commits with their authorship, plus round-trip tests. I recommend keeping #2231 as the canonical combined change.
The rebased head
863ff49fis based on currentmainf8c2f072; Linuxguest_stringspasses. The 519/519 Windows CTest report is from pre-rebase head6923a54e, and the full upstream Build/relinker run on the current head is still missing.Could a maintainer decide whether to keep #2231 or the three individual PRs? After that choice, the overlapping branches and checklist can be updated accurately, then the exact head can receive its required Build run.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:10:33Z.
Closing in favour of #1848, #1972 and #2208: each adds one of these functions with a title stop, and they'll go in in that order. The round-trip test can come as a follow-up once they're in.
Pull request closed