Repository navigation
Android build: libslirp (-netdev user) and DNS from the app - #146
Merged
Merged
Conversation
…LIRP_RESOLV_CONF build-android.sh builds libslirp 4.9.7 (pinned tarball and sha256) and configures QEMU with -Dslirp=enabled for the executable and the in-process library. Android has no /etc/resolv.conf, so a small libslirp patch reads the resolvers from the file named in SLIRP_RESOLV_CONF; the app writes it from LinkProperties. The patch also turns an abort on a refused socket into a warning. The dep caches are now keyed on native/patches too. docs/NETWORKING.md describes the interface for the app side (#83).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds libslirp to the Android build so
-netdev userexists, and gives it a way to find the resolver on Android.native/build-android.sh: newbuild_libslirpstep (libslirp 4.9.7, pinned tarball and sha256, built withmeson_depagainst our glib). QEMU is configured with-Dslirp=enabledfor the executable and the in-process library. CI's configure log shows "slirp support: YES 4.9.7" for both.native/patches/libslirp-android.patch: libslirp reads its resolvers from the file named inSLIRP_RESOLV_CONFinstead of/etc/resolv.conf(unset means/etc/resolv.conf, as upstream). It also turns ag_error()(abort) on a refused socket into a warning.native/patches/**as well as the build script.docs/NETWORKING.md: new section "libslirp on Android" that defines the interface for the app side (issue 83, PR 148): the app writesnameserver <addr>lines fromLinkProperties.getDnsServers()to a private file, setsSLIRP_RESOLV_CONFbefore QEMU starts, and replaces the file with a rename on network changes. libslirp re-reads it when it changes, at most once a second. If there are no resolvers the app deletes the file.APK size (debug APK from CI, against main at 0492bd5): 11,074,765 to 11,215,929 bytes, +141 KB (+1.3%). Each QEMU .so grows by about 128 KB uncompressed (libqemu-system-aarch64.so 12,459,888 to 12,588,272).
Tested:
-netdev helplistsuser, and-netdev user,id=n0is accepted. The binary has novirtmachine (Inferno builds only the Apple machines), so no Linux guest could run on it.-M virtwith Debian trixie's arm64 netboot kernel and an initramfs that runs udhcpc, ping and wget, on-netdev user.SLIRP_RESOLV_CONFfile withnameserver 1.1.1.1: lease 10.0.2.15, router 10.0.2.2, DNS 10.0.2.3; example.com resolves andwget http://example.com/returns the page.nameserver 192.0.2.1(unreachable): lease ok, example.com doesn't resolve. So the file is what slirp uses, not the host's /etc/resolv.conf.Not tested:
Closes #82