Skip to contentSkip to conversation

image.bbclass: add function to disable SSH DNS Lookup for Qemu

PATCH New Saul Wold 1 participant 1 message Mar 31, 2014

lore
Share & tools
lore

Saul Wold

author
#0 lore raw

PATCH 1/1 image.bbclass: add function to disable SSH DNS Lookup for Qemu

This function disables the reverse DNS lookup on QEMU targets to reduce the delay when using static IP address. By disabling DNS lookup we can save a great deal of time during automated testing on the autobuilder (on the order of ~400 seconds per ssh tranaction). This is seen when using the testimage, there is a delay getting logged-in from the server to target.

It's enabled for all qemu imgaes by default and can be overridden by setting the SSH_DISABLE_DNS_LOOKUP variable.

[YOCTO #5954]

---
 meta/classes/image.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/image.bbclass +10 -0
index 29309f5..ea035fe 100644
@@ -304,6 +304,16 @@ ssh_allow_empty_password () {
 	fi
 }
 
+# Disable DNS lookups, the SSH_DISABLE_DNS_LOOKUP can be overridden to allow
+# distros to choose not to take this change
+SSH_DISABLE_DNS_LOOKUP ?= " ssh_disable_dns_lookup ; "
+ROOTFS_POSTPROCESS_COMMAND_append_qemuall = "${SSH_DISABLE_DNS_LOOKUP}"
+ssh_disable_dns_lookup () {
+	if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then
+		sed -i -e 's:#UseDNS yes:UseDNS no:' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
+	fi
+}
+
 # Enable postinst logging if debug-tweaks is enabled
 postinst_enable_logging () {
 	mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/default
Signature · 1 line
1.8.3.1