aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-07-15 15:21:30 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-07-22 19:41:42 +0200
commit181efaa3fa24ad9c6e758ba0d7db67185eb98df0 (patch)
treefb2abb51e768a46e1c184826f491f946696e3c3f
parenta47ac6160b37d2f80670e8d146ce24af5a52e077 (diff)
downloadpasst-181efaa3fa24ad9c6e758ba0d7db67185eb98df0.tar
passt-181efaa3fa24ad9c6e758ba0d7db67185eb98df0.tar.gz
passt-181efaa3fa24ad9c6e758ba0d7db67185eb98df0.tar.bz2
passt-181efaa3fa24ad9c6e758ba0d7db67185eb98df0.tar.lz
passt-181efaa3fa24ad9c6e758ba0d7db67185eb98df0.tar.xz
passt-181efaa3fa24ad9c6e758ba0d7db67185eb98df0.tar.zst
passt-181efaa3fa24ad9c6e758ba0d7db67185eb98df0.zip
tests: Correctly handle domain search list in dhclient-script
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>
-rwxr-xr-xtest/passt.mbuto6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/passt.mbuto b/test/passt.mbuto
index b33c0a8..c515a0c 100755
--- a/test/passt.mbuto
+++ b/test/passt.mbuto
@@ -34,13 +34,13 @@ set >> \$LOG
[ -n "\${new_ip_address}" ] && ip addr add \${new_ip_address}/\${new_subnet_mask} dev \${interface}
[ -n "\${new_routers}" ] && for r in \${new_routers}; do ip route add default via \${r} dev \${interface}; done
+:> /etc/resolv.conf
[ -n "\${new_domain_name_servers}" ] && for d in \${new_domain_name_servers}; do echo "nameserver \${d}" >> /etc/resolv.conf; done
-[ -n "\${new_domain_name}" ] && (printf "search"; for d in \${new_domain_name}; do printf " %s" "\${d}"; done; printf "\n") >> /etc/resolv.conf
-
+[ -n "\${new_domain_name}" ] && echo "search \${new_domain_name}" >> /etc/resolf.conf
+[ -n "\${new_domain_search}" ] && (printf "search"; for d in \${new_domain_search}; do printf " %s" "\${d}"; done; printf "\n") >> /etc/resolv.conf
[ -n "\${new_ip6_address}" ] && ip addr add \${new_ip6_address}/\${new_ip6_prefixlen} dev \${interface}
[ -n "\${new_dhcp6_name_servers}" ] && for d in \${new_dhcp6_name_servers}; do echo "nameserver \${d}%\${interface}" >> /etc/resolv.conf; done
[ -n "\${new_dhcp6_domain_search}" ] && (printf "search"; for d in \${new_dhcp6_domain_search}; do printf " %s" "\${d}"; done; printf "\n") >> /etc/resolv.conf
-
[ -n "\${new_host_name}" ] && hostname "\${new_host_name}"
exit 0
EOF