Skip to content

Commit

Permalink
[dns] Report current DNS query as job progress status message
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Sep 6, 2017
1 parent 53f273a commit 9faf069
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/net/udp/dns.c
Expand Up @@ -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>
Expand Down Expand Up @@ -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 ),
Expand All @@ -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 ),
};

Expand Down

0 comments on commit 9faf069

Please sign in to comment.