Browse Source

[dns] Report current DNS query as job progress status message

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 years ago
parent
commit
9faf069126
1 changed files with 18 additions and 0 deletions
  1. 18
    0
      src/net/udp/dns.c

+ 18
- 0
src/net/udp/dns.c View File

42
 #include <ipxe/tcpip.h>
42
 #include <ipxe/tcpip.h>
43
 #include <ipxe/settings.h>
43
 #include <ipxe/settings.h>
44
 #include <ipxe/features.h>
44
 #include <ipxe/features.h>
45
+#include <ipxe/job.h>
45
 #include <ipxe/dhcp.h>
46
 #include <ipxe/dhcp.h>
46
 #include <ipxe/dhcpv6.h>
47
 #include <ipxe/dhcpv6.h>
47
 #include <ipxe/dns.h>
48
 #include <ipxe/dns.h>
867
 	dns_done ( dns, rc );
868
 	dns_done ( dns, rc );
868
 }
869
 }
869
 
870
 
871
+/**
872
+ * Report job progress
873
+ *
874
+ * @v dns		DNS request
875
+ * @v progress		Progress report to fill in
876
+ * @ret ongoing_rc	Ongoing job status code (if known)
877
+ */
878
+static int dns_progress ( struct dns_request *dns,
879
+			  struct job_progress *progress ) {
880
+
881
+	/* Show current question as progress message */
882
+	dns_decode ( &dns->name, progress->message,
883
+		     sizeof ( progress->message ) );
884
+	return 0;
885
+}
886
+
870
 /** DNS socket interface operations */
887
 /** DNS socket interface operations */
871
 static struct interface_operation dns_socket_operations[] = {
888
 static struct interface_operation dns_socket_operations[] = {
872
 	INTF_OP ( xfer_deliver, struct dns_request *, dns_xfer_deliver ),
889
 	INTF_OP ( xfer_deliver, struct dns_request *, dns_xfer_deliver ),
879
 
896
 
880
 /** DNS resolver interface operations */
897
 /** DNS resolver interface operations */
881
 static struct interface_operation dns_resolv_op[] = {
898
 static struct interface_operation dns_resolv_op[] = {
899
+	INTF_OP ( job_progress, struct dns_request *, dns_progress ),
882
 	INTF_OP ( intf_close, struct dns_request *, dns_done ),
900
 	INTF_OP ( intf_close, struct dns_request *, dns_done ),
883
 };
901
 };
884
 
902
 

Loading…
Cancel
Save