aboutgitcodebugslistschat
path: root/test/dhcp
Commit message (Collapse)AuthorAgeFilesLines
* test: Only select a single interface or gateway in testsDavid Gibson2022-08-202-4/+4
| | | | | | | | | | 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>
* Separately locate external interfaces for IPv4 and IPv6David Gibson2022-07-302-2/+4
| | | | | | | | | | | | | | | | | 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-301-1/+1
| | | | | | | | | | | | | 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>
* 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>
* tests: Explicitly list test files in test/run, remove "onlyfor" supportDavid Gibson2022-07-142-2/+0
| | | | | | | | | | | | | | | | | Currently test/run uses wildcards to run all of the tests in a directory. However, that wildcard list is filtered down by the "onlyfor" directives in the test files... usually to a single file. Therefore, just explicitly list the files we *really* want to run for this test mode. This makes it easier to see at the top level what tests will be executed, and to change that list temporarily while debugging specific failures. This means the "onlyfor" directive no longer has any purpose, and we can remove it. "onlyfor" was also the only used of the $MODE variable, so we can remove that too. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Use dhclient instead of udhcpcDavid Gibson2022-06-151-2/+2
| | | | | | | | | | | | For some reason, the passt/pasta tests and examples use dhclient for DHCPv6, but in most cases use udhcpc for DHCPv4. Change it to use dhclient for both DHCPv4 and DHCPv6. This means one less tool we need for testing, plus dhclient is easily available on Fedora whereas udhcpc is not. Note that the passt tests still rely on udhcpc indirectly because mbuto wants to put it into the guest images it generates. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Tweak dhclient arguments for readabilityDavid Gibson2022-06-152-2/+2
| | | | | | | | | | | | | | A number of tests and examples use dhclient in both IPv4 and IPv6 modes. We use "dhclient -6" for IPv6, but usually just "dhclient" for IPv4. Add an explicit "-4" argument to make it more clear and explicit. In addition, when dhclient is run from within pasta it usually won't be "real" root, and so will not have access to write the default global pid file. This results in a mostly harmless but irritating error: Can't create /var/run/dhclient.pid: Permission denied We can avoid that by using the --no-pid flag to dhclient. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Don't abbreviate ip(8) arguments in examples and testsDavid Gibson2022-06-152-21/+21
| | | | | | | | ip(8)'s ability to take abbreviated arguments (e.g. "li sh" instead of "link show") is very handy when using it interactively, but it doesn't make for very readable scripts and examples when shown that way. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* test: Add CI/demo scriptsStefano Brivio2021-09-272-0/+116
Not really quick, definitely dirty. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>