aboutgitcodebugslistschat
Commit message (Collapse)AuthorAgeFilesLines
* conf: Fix incorrect bounds checking for sock_path parameterDavid Gibson2022-08-241-1/+1
| | | | | | | Looks like a copy-paste error where we're checking against the size of the pcap field, rather than the sock_path field. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Makefile: Use more GNU-style directory variables, explicit docdir for OpenSUSE2022_08_21.7b71094Stefano Brivio2022-08-212-11/+21
| | | | | | | | | | | | | It turns out that, while on most distributions "docdir" would be /usr/share/doc, it's /usr/share/doc/packages/ on OpenSUSE Tumbleweed. Use an explicit docdir as shown in: https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto and don't unnecessarily hardcode directory variables in the Makefile. Otherwise, RPM builds for OpenSUSE will fail now that we have a README there. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* test: debian: Export DEBIAN_FRONTEND=noninteractive for sid2022_08_20.f233d6cStefano Brivio2022-08-201-0/+3
| | | | | | | We start getting prompts about restarting outdated services: we're using daily images but they might have been cached for a while now. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* test: Kill qemu by pidfile rather than ^CDavid Gibson2022-08-201-8/+12
| | | | | | | | | | | | | Currently in at least some of the testcases we kill qemu processes we're done with by issuing a Control-C to the tmux panel it's running in. That makes things harder as we try to move towards allowing "headless" testing without tmux. So, instead always use an explicit kill on a pid derived from a pidfile for killing qemu. Note that we don't need to remove the pidfiles afterwards, because qemu does that itself when terminated. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Log debugging output from test scriptDavid Gibson2022-08-201-0/+2
| | | | | | | | | | | | | | | | | | | The test scripts run with sh -e, which means they will stop if any commands return an error. That's generally desirable, because we won't continue after things are hopeless due to an earlier step failing. Unfortunately, the tmux setup we run the script in means it's not obvious where any error messages related to such a failure will go. Depending on exactly where the error occurs they might go to the original terminal hidden behind tmux, or they might go to a tmux panel that's not visible in the normal layouts. To make it easier to find such error message, redirect direct output and errors from the test script itself to a 'script.log' file in the logs directory. When in DEBUG=1 mode, additionaly 'set -x' so we log all the commands we execute to that file. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Use shutdown test for pastaDavid Gibson2022-08-203-5/+4
| | | | | | | | | For the passt and passt_in_ns tests we have a "shutdown" testcase that checks for any errors from the passt process we were using (including valgrind warnings). Do the same for pasta tests, so that we catch any error codes from the pasta process. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Rename slightly misleading "valgrind" testsDavid Gibson2022-08-204-12/+13
| | | | | | | | | | | | | | | | | | | The "valgrind" test cases are designed to pick up errors reported when passt is running under valgrind. But what it actually does is just kill the passt process, then see if it had a non-zero exit code. That means it will equally well pick up any other problems which caused passt to exit with an error status: either something detected within passt or as a result of passt being killed by an unexpected signal. The fact that the "valgrind" test is actually responsible for shutting down the passt process is non-obvious and can lead to problems when selectively running tests during debugging. Rename the "valgrind" tests to "shutdown" tests and run it regardless of whether we're using valgrind or not. This allows us to remove an ugly speacial case in the passt_in_ns teardown code. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Only select a single interface or gateway in testsDavid Gibson2022-08-204-7/+7
| | | | | | | | | | The queries we use in the test scripts to locate the external interface or gateway can return multiple results. We get away with this because the way we parse command output only looks at the last line. It's not really correct, though, and improvements to our handling of command output will mean it breaks. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Split setup/teardown functions for build and distro testsDavid Gibson2022-08-202-0/+19
| | | | | | | | | | | | Currently the build tests and distro tests share a common setup function. That works for now, but changes we want to make will mean they need slightly different setup, so split the setup functions in preparation. Currently, neither build nor distro tests have any teardown function. Again, future changes are going to mean we need to do some teardown, so create some empty for now teardown functions in preparation. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Ignore video processing temporary filesDavid Gibson2022-08-201-0/+4
| | | | | | | | When recording tests or demos with asciinema we generate several temporary files during post-processing. Add these to the .gitignore file so they're not accidentally comitted. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Remove unused *_XTERM variablesDavid Gibson2022-08-201-4/+0
| | | | | | | The DEMO_XTERM and CI_XTERM variables defined in test/lib/term aren't used anywhere. Remove them. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Split cppcheck and clang-tidy tests into different filesDavid Gibson2022-08-203-5/+20
| | | | | | | | | | Both clang-tidy and cppcheck linting are handled by the same test file, test/build/static_checkers. The two linters are independent of each other though, and each one takes quite a long time. Split them into separate files to make it easier to control which are executed from the top level test script. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Convert distro tests to use socat instead of nc/ncatDavid Gibson2022-08-204-52/+74
| | | | | | | | | | | | | | | | | We've recently converted most of our tests to use socat instead of nc/netcat/ncat, because socat is more powerful and we don't need to deal with the several possible variants of netcat. We still use nc or ncat for the distro tests. Because there we control the guest environment and can pick our tools, there isn't the same reason to switch to socat. However, using socat here as well makes the tests a bit easier to read, and doesn't require people reading or modifying them to become familiar with an additional tool. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: keep using netcat-openbsd in Ubuntu 16.04 ppc64 test, as socat is unavailable there] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* fedora: Fix man pages wildcards in spec fileStefano Brivio2022-08-201-5/+5
| | | | | | | | If the man pages are not compressed, the current wildcards wouldn't match them. Drop the trailing '.' from them. Reported-by: Artur Frenszek-Iwicki <fedora@svgames.pl> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* fedora: Don't hardcode CFLAGS setting, use %set_build_flags macro insteadStefano Brivio2022-08-201-1/+1
| | | | | | | | | This will also set any distribution-specific LDFLAGS. It's not needed anymore starting from Fedora 36, but the package might be built on other versions and distributions too (including e.g. CentOS Stream 8). Reported-by: Artur Frenszek-Iwicki <fedora@svgames.pl> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* fedora: Build SELinux subpackage as noarchStefano Brivio2022-08-201-0/+1
| | | | | | | | Otherwise, passt-selinux will be built separately for each supported architecture. Suggested-by: Artur Frenszek-Iwicki <fedora@svgames.pl> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* fedora: Change source URL to HEAD link with explicit commit SHAStefano Brivio2022-08-202-2/+6
| | | | | | | | | This is required as Fedora doesn't accept a temporary pointer to a source URL. Reported-by: Ralf Corsepius <rc040203@freenet.de> Reported-by: Artur Frenszek-Iwicki <fedora@svgames.pl> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* fedora: Drop VCS tag from spec fileStefano Brivio2022-08-201-1/+0
| | | | | | | | | It seems to be exposed by Koji (https://pagure.io/koji/issue/2541), but it's not actually in use, so we have to drop that. The website the URL tag points to reports all the needed information anyway. Reported-by: Artur Frenszek-Iwicki <fedora@svgames.pl> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* fedora: Start Release tag from 1, not 0Stefano Brivio2022-08-201-1/+1
| | | | | | | | ...as specified by the Fedora Packaging Guidelines: https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/#_simple_versioning Reported-by: Artur Frenszek-Iwicki <fedora@svgames.pl> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* fedora: Introduce own rpkg macro for changelogStefano Brivio2022-08-202-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | git_dir_changelog is useful in theory, but it requires pairs of annotated tags, which should be generated by rpkg itself to make any sense, implying a relatively heavyweight interaction whenever I want to push a new package version. Also, the default content of the changelog entries include the full list of changes, but the Fedora Packaging Guidelines specifically mention that: [t]hey must never simply contain an entire copy of the source CHANGELOG entries. We don't have a CHANGELOG file, but the full git history is conceptually equivalent for this purpose, I guess. Introduce our own passt_git_changelog() rpkg macro, building changelog entries, using tags in the form DATE-SHA, where DATE is an ISO 8601 date representation, and SHA is a short (7-digits) form of the head commit at a given moment (git push). These changelog entries mention, specifically, changes to the packaging information itself (entries under contrib/fedora), and simply report a link to cgit for the ranges between tags. Reported-by: Benson Muite <benson_muite@emailplus.org> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* fedora: Install "plain" README, instead of web version, and demo scriptStefano Brivio2022-08-201-2/+2
| | | | | Suggested-by: Benson Muite <benson_muite@emailplus.org> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* Makefile: Install demo.sh too, uninstall stuff under /usr/shareStefano Brivio2022-08-201-0/+4
| | | | | Suggested-by: Benson Muite <benson_muite@emailplus.org> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* Makefile: Ugly hack to get a "plain" Markdown version of READMEStefano Brivio2022-08-204-6/+30
| | | | | | | | | | | | | | | | | | Distribution packages reasonably expect to have a human-readable Markdown version of the README under /usr/share/doc/, but all we have right now is a heavily web-oriented version. Introduce a ugly hack to strip web-oriented parts from the current README and install it. It should probably work the other way around: a human-readable README could be used as a source for the web page. But cgit needs a file that's in the tree, not something that can be built, and https://passt.top/ is based on cgit. It should eventually be doable to work around this in cgit, instead. Reported-by: Benson Muite <benson_muite@emailplus.org> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* README: Add link to Copr repositoriesStefano Brivio2022-08-181-0/+8
| | | | | | | These have packages covering all recent versions of CentOS Stream, EPEL, Fedora, Mageia and OpenSUSE Tumbleweed. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* doc: Rewrite demo scriptStefano Brivio2022-08-182-125/+244
| | | | | | | | | | | | | | | The original demo script was written when pasta wasn't a thing yet, so it needed to run as root, set up a veth pair, and configure addresses and routes by itself. Now pasta can do all that for us, and become part of the demo as well. Further, extend it to start qemu, optionally preparing a basic demo image with mbuto (https://mbuto.sh), and execute one logical step at a time, for clarity. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* contrib, test: Rebase Podman patch, enable three-way merge on git am in demo2022_08_04.b516d15Stefano Brivio2022-08-012-17/+17
| | | | | | | | Given that a three-way git merge was enough to cope with context changes in man pages, it's probably a good idea to enable that for 'git am' in the demo too. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* passt.1: Default host interfaces are now selected based on IP versionStefano Brivio2022-07-301-6/+7
| | | | | | | Reflect the changes from commit 4b2e018d70f3 ("Allow different external interfaces for IPv4 and IPv6 connectivity") into the manual. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* Make substructures for IPv4 and IPv6 specific context informationDavid Gibson2022-07-3012-212/+232
| | | | | | | | | | | | The context structure contains a batch of fields specific to IPv4 and to IPv6 connectivity. Split those out into a sub-structure. This allows the conf_ip4() and conf_ip6() functions, which take the entire context but touch very little of it, to be given more specific parameters, making it clearer what it affects without stepping through the code. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Separate IPv4 and IPv6 configurationDavid Gibson2022-07-307-94/+102
| | | | | | | | | | | | | | | | | | | After recent changes, conf_ip() now has essentially entirely disjoint paths for IPv4 and IPv6 configuration. So, it's cleaner to split them out into different functions conf_ip4() and conf_ip6(). Splitting these out also lets us make the interface a bit nicer, having them return success or failure directly, rather than manipulating c->v4 and c->v6 to indicate success/failure of the two versions. Since these functions may also initialize the interface index for each protocol, it turns out we can then drop c->v4 and c->v6 entirely, replacing tests on those with tests on whether c->ifi4 or c->ifi6 is non-zero (since a 0 interface index is never valid). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: Whitespace fixes] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* Clarify semantics of c->v4 and c->v6 variablesDavid Gibson2022-07-302-45/+20
| | | | | | | | | | | | | | | | | | | | | The v4 and v6 fields of the context structure can be confusing, because they change meaning part way through the code: Before conf_ip(), they are booleans which indicate whether the -4 or -6 options have been given. After conf_ip() they are DISABLED|ENABLED|PROBE enums which indicate whether the IP version is available (which means both that it was allowed on the command line and we were able to configure it). The PROBE variant of the enum is only used locally within conf_ip() and since recent changes there it no longer has a real purpose different from ENABLED. Simplify this all by making the context fields always just a boolean indicating the availability of the IP version. They both default to 1, but can be set to 0 by either command line options or configuration failures. We use some local variables in conf() for tracking the state of the command line options on their own. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: Minor coding style fix in conf.c] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* Move passt mac_guest init to be more symmetric with pastaDavid Gibson2022-07-302-3/+6
| | | | | | | | | | | | | | | | | In pasta mode, the guest's MAC address is set up in pasta_ns_cobf() called from tap_sock_tun_init(). If we have a guest MAC configured with --ns-mac-addr, this will set the given MAC on the kernel tuntap device, or if we haven't configured one it will update our record of the guest MAC to the kernel assigned one from the device. For passt, we don't initially know the guest's MAC until we receive packets from it, so we have to initially use a broadcast address. This is - oddly - set up in an entirely different place, in conf_ip() conditional on the mode. Move it to the logically matching place for passt - tap_sock_unix_init(). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Initialize host side MAC when in IPv6 only modeDavid Gibson2022-07-301-9/+12
| | | | | | | | | | | | | | | | | | When sending packets to the guest we need a source MAC address, which we currently take from the host side interface we're using (though it's basically arbitrary). However if not given on the command line this MAC is initialized in an IPv4 specific path, and will end up as 00:00:00:00:00:00 when running "passt 6". The MAC address is also used for IPv6 packets, though. Interestingly, we largely seem to get away with using an all-zero MAC, but it's probably not a good idea. Make the IPv6 path pick the MAC address from its interface if the IPv4 path hasn't already done so. While we're there, use the existing MAC_IS_ZERO macro to make the code a little clearer. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Separately locate external interfaces for IPv4 and IPv6David Gibson2022-07-307-80/+33
| | | | | | | | | | | | | | | | | Now that the back end allows passt/pasta to use different external interfaces for IPv4 and IPv6, use that to do the right thing in the case that the host has IPv4 and IPv6 connectivity via different interfaces. If the user hasn't explicitly chosen an interface, separately search for a suitable external interface for each protocol. As a bonus, this substantially simplifies the external interface probe. It also eliminates a subtle confusing case where in some circumstances we would pick the first interface in interface index order, and sometimes in order of routes returned from netlink. On some network configurations that could cause tests to fail, because the logic in the tests was subtly different (it always used route order). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Correct determination of host interface name in testsDavid Gibson2022-07-302-2/+2
| | | | | | | | | | | | | By default, passt itself attaches to the first host interface with a default route. However, when determining the host interface name the tests implicitly select the *last* host interface: they use a jq expression which will list all interfaces with default routes, but the way output detection works in the scripts, it will only pick up the last line. If there are multiple interfaces with default routes on the host, and they each have a different address, this can cause spurious test failures. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Allow different external interfaces for IPv4 and IPv6 connectivityDavid Gibson2022-07-304-21/+27
| | | | | | | | | | | | | | | | It's quite plausible for a host to have both IPv4 and IPv6 connectivity, but only via different interfaces. For example, this will happen in the case that IPv6 connectivity is via a tunnel (e.g. 6in4 or 6rd). It would also happen in the case that IPv4 access is via a tunnel on an otherwise IPv6 only local network, which is a setup that might become more common in the post IPv4 address exhaustion world. In turns out there's no real need for passt/pasta to get its IPv4 and IPv6 connectivity via the same interface, so we can handle this situation fairly easily. Change the core to allow eparate external interfaces for IPv4 and IPv6. We don't actually set these separately for now. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Expand root partition of Debian sid amd64 and aarch64 imagesStefano Brivio2022-07-291-0/+12
| | | | | | | | | | | | | | | A couple of days ago, we started running out of space there as we're about to install gcc -- about 50 MiB are missing. Given that virt-resize (which could be conveniently invoked by the Makefile for tests) reorders partitions if we expand the first one, resize the image using qemu-img from the test script itself, and then take care of expanding root partition and filesystem online later. This is probably a temporary hack, so I'm not looking for a more generic or elegant solution at the moment. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* passt: Truncate PID file on open()Stefano Brivio2022-07-221-1/+1
| | | | | | | Otherwise, if the current PID has fewer digits than a previously written one, the content will be wrong. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* demo: Use git protocol downloadsDavid Gibson2022-07-222-2/+2
| | | | | | | | For some reason using https to clone from the passt git repo is very slow, at least from network-distant places. Use git protocol in the demo instead to avoid a tedious wait to get the source. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: No need to retrieve host ifname in ndp/pastaDavid Gibson2022-07-221-3/+2
| | | | | | | | | With pasta, the namespace interface name is generally the same as the host interface name. We already rely on this in the dhcp/pasta tests, but for no clear reason ndp/pasta separately determines the host interface name. Remove this unnecessary step. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Clean up better after iperf testsDavid Gibson2022-07-221-1/+1
| | | | | | | | | | | | | The iperf based test commands create a bunch of .bw and .pid files for each iperf client and server. The server side .bw files are cleaned up afterwards, but the pid files are not, and none of the client side files are cleaned up. The latter doesn't really matter when the client is run on ephemeral guests, but sometimes we run it in a namespace that shares the filesystem with the host. Clean up all of these files after the tests. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Use dhclient --no-pid for namespaces in two_guests testsDavid Gibson2022-07-221-4/+4
| | | | | | | | | | Before starting the guests, these tests configure addresses in a pasta namespace using dhclient. However, because it's a user namespace, it's not running as "real" root and can't write to the dhclient pid file. This doesn't stop it working, but causes an ugly error message which we can avoid by using the --no-pid option. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Remove unnecessary truncation of temporary files in udp testsDavid Gibson2022-07-223-18/+0
| | | | | | | | | All the UDP tests use :> to truncate some temporary data files. This appears to be so that they're empty before writing data to them with tee. However tee, by default, truncates its output file anyway (you need tee -a to append). So drop the unnecessary truncations. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Remove unnecessary ^D in passt_in_ns teardownDavid Gibson2022-07-221-2/+0
| | | | | | | | | | | | | | | | | teardown_passt_in_ns() sends a ^D to the NS pane, which appears to be intended to terminate the nsenter running there, leaving the namespace. However, we've also sent a ^D to the PASST pane which will exit the pasta instance which created the namespace. With the namespace destroyed the nsenter in the NS pane will be killed, so it does not need to be exited explicitly. In fact sending the extra ^D can be harmful, since it will exit the shell in which the nsenter was run, causing the whole pane to be closed. That can then mean that the "pane_wait NS" hangs indefinitely. I believe this will sometimes work, because there's a race between the various options here, but it should be more reliable without the extra ^D. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Use socat instead of netcatDavid Gibson2022-07-2211-200/+200
| | | | | | | | | | | | | | | Commit 41c02e10 ("tests: Use nmap-ncat instead of openbsd netcat for pasta tests") updated the pasta tests to use the nmap version of ncat instead of the openbsd version, for greater portability. For some upcoming changes, however, we'll be wanting to use socat. "socat" can do everything "ncat" can and more, so let's move all the tests using host tools (either directly on the host or via mbuto generated images) to using socat instead. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: Fix a typo in port specification, 31337 instead of x31337] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* valgrind needs futexDavid Gibson2022-07-221-1/+1
| | | | | | | | | Some versions of valgrind (such as the version on my Fedora laptop - valgrind-3.19.0-3.fc36.x86_64) use futexes. But futex is currently not allowed in the seccomp filter, even with the extra calls added for valgrind builds. Add it, to avoid spurious valgrind failures. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Fix creation of test file in udp passt testsDavid Gibson2022-07-221-1/+1
| | | | | | | | | | In what looks like a copy-and-paste error from the TCP script, the udp/passt test script creates a test file called '__TEMP_BIG__', while the commands it use the variable __TEMP__. Correct this so that a) we actually transfer the data we created for the purpose and b) we don't leave a stale __TEMP_BIG__ file in the current directory. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Fix detection of empty 'hout' responses in passt{,_in_ns} testsDavid Gibson2022-07-221-0/+14
| | | | | | | | | | | | | | The dhcp/passt and dhcp/passt_in_ns tests at least, and maybe others use 'hout' commands that need to be able to detect empty output. However, we don't set PS1, which means the screen-scraping logic which detects this may not be reliable. In addition, if the host is using a recent bash, it will have bracketed paste mode enabled which will also add escape codes which will mess up the empty output detection. Set the prompt and disable bracketed paste mode from the passt and passt_in_ns setups to avoid these problems. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Correctly handle domain search list in dhclient-scriptDavid Gibson2022-07-221-3/+3
| | | | | | | | | | | Currently our small custom dhclient-script only handles the 'domain-name' option, which can just list a single domain, not the 'domain-search' option, which can handle several. Correct it to handle both. We also weren't emptying the resolv.conf file before we began, which could lead to surprising contents after multiple DHCP transactions. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Handle the case of a nameserver on host localhostDavid Gibson2022-07-221-2/+2
| | | | | | | | | | | | We previously introduced a change to passt to handle the case where the host machine is its own nameserver - so resolv.conf points to 127.0.0.1. In this case we advertize the gateway as the DNS server for the guest, which in turn will be redirected back to the host by existing passt logic. The dhcp/passt doesn't handle this case correctly, so add some logic to account for it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: More robust parsing of resolv.conf for DHCP testsDavid Gibson2022-07-221-8/+8
| | | | | | | | | | | | | | | | | To check publishing of DNS information via DHCP, we need to extract a list of nameservers and/or search domains from resolv.conf in the test script. The current version (usually) leaves the result with a trailing ','. That's usually ok because it happens on both guest and host sides. However it's kind of confusing, and might stop working if the host had a resolv.conf without a trailing \n on the last line. It also makes some later changes we'll need more difficult. So, normalize the output from resolv.conf a bit further, removing any trailing ','. It turns out we can do this with a slightly less complex sed expression than the one we already have. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>