[OE-core] [PATCH] image.bbclass: add postprocess func to disable DNS lookups for openssh

Stefan Stanacar stefanx.stanacar at intel.com
Mon Mar 31 15:06:15 UTC 2014


In the default config openssh does reverse DNS resolution, but
if there is no DNS configured on the target (or even worse the
DNS server is unreachable) there is a long timeout when connecting
over ssh. This is most visible on core-image-sato-sdk builds on AB, where the
tests take a long time because each ssh command spends 15 seconds
just connecting to the target, disabling the reverse DNS resolution halves
the total test time.
This isn't a qemu specific problem however and instead of changing the default
config I think it's worth disabling this when debug-tweaks is enabled.

Patch based on a previous version sent by Saul Wold <sgw at linux.intel.com>

[YOCTO #5954]

Signed-off-by: Stefan Stanacar <stefanx.stanacar at intel.com>
---
 meta/classes/image.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 29309f5..846c768 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -146,6 +146,8 @@ MACHINE_POSTPROCESS_COMMAND ?= ""
 ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "ssh_allow_empty_password; ", "",d)}'
 # Enable postinst logging if debug-tweaks is enabled
 ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "postinst_enable_logging; ", "",d)}'
+# Disable DNS lookups if debug-tweaks is enabled
+ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "ssh_disable_dns_lookup; ", "",d)}'
 # Write manifest
 IMAGE_MANIFEST = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest"
 ROOTFS_POSTPROCESS_COMMAND =+ "write_image_manifest ; "
@@ -304,6 +306,12 @@ ssh_allow_empty_password () {
 	fi
 }
 
+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
@@ -374,7 +382,7 @@ rootfs_sysroot_relativelinks () {
 	sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
 }
 
-EXPORT_FUNCTIONS zap_empty_root_password remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup
+EXPORT_FUNCTIONS zap_empty_root_password remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup ssh_disable_dns_lookup
 
 do_fetch[noexec] = "1"
 do_unpack[noexec] = "1"
-- 
1.9.0




More information about the Openembedded-core mailing list