]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[dns] Report current DNS query as job progress status message
authorMichael Brown <mcb30@ipxe.org>
Wed, 6 Sep 2017 10:46:13 +0000 (11:46 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 6 Sep 2017 10:46:13 +0000 (11:46 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/udp/dns.c

index e849472defa368277a31919fa501546711305d13..897e0f8579864f090e7709db38e045cb41aff8f2 100644 (file)
@@ -42,6 +42,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #include <ipxe/tcpip.h>
 #include <ipxe/settings.h>
 #include <ipxe/features.h>
+#include <ipxe/job.h>
 #include <ipxe/dhcp.h>
 #include <ipxe/dhcpv6.h>
 #include <ipxe/dns.h>
@@ -867,6 +868,22 @@ static void dns_xfer_close ( struct dns_request *dns, int rc ) {
        dns_done ( dns, rc );
 }
 
+/**
+ * Report job progress
+ *
+ * @v dns              DNS request
+ * @v progress         Progress report to fill in
+ * @ret ongoing_rc     Ongoing job status code (if known)
+ */
+static int dns_progress ( struct dns_request *dns,
+                         struct job_progress *progress ) {
+
+       /* Show current question as progress message */
+       dns_decode ( &dns->name, progress->message,
+                    sizeof ( progress->message ) );
+       return 0;
+}
+
 /** DNS socket interface operations */
 static struct interface_operation dns_socket_operations[] = {
        INTF_OP ( xfer_deliver, struct dns_request *, dns_xfer_deliver ),
@@ -879,6 +896,7 @@ static struct interface_descriptor dns_socket_desc =
 
 /** DNS resolver interface operations */
 static struct interface_operation dns_resolv_op[] = {
+       INTF_OP ( job_progress, struct dns_request *, dns_progress ),
        INTF_OP ( intf_close, struct dns_request *, dns_done ),
 };