Selaa lähdekoodia

[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 vuotta sitten
vanhempi
commit
9faf069126
1 muutettua tiedostoa jossa 18 lisäystä ja 0 poistoa
  1. 18
    0
      src/net/udp/dns.c

+ 18
- 0
src/net/udp/dns.c Näytä tiedosto

@@ -42,6 +42,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
42 42
 #include <ipxe/tcpip.h>
43 43
 #include <ipxe/settings.h>
44 44
 #include <ipxe/features.h>
45
+#include <ipxe/job.h>
45 46
 #include <ipxe/dhcp.h>
46 47
 #include <ipxe/dhcpv6.h>
47 48
 #include <ipxe/dns.h>
@@ -867,6 +868,22 @@ static void dns_xfer_close ( struct dns_request *dns, int rc ) {
867 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 887
 /** DNS socket interface operations */
871 888
 static struct interface_operation dns_socket_operations[] = {
872 889
 	INTF_OP ( xfer_deliver, struct dns_request *, dns_xfer_deliver ),
@@ -879,6 +896,7 @@ static struct interface_descriptor dns_socket_desc =
879 896
 
880 897
 /** DNS resolver interface operations */
881 898
 static struct interface_operation dns_resolv_op[] = {
899
+	INTF_OP ( job_progress, struct dns_request *, dns_progress ),
882 900
 	INTF_OP ( intf_close, struct dns_request *, dns_done ),
883 901
 };
884 902
 

Loading…
Peruuta
Tallenna