mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 21:41:43 +03:00
A working name resolution framework
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <gpxe/uri.h>
|
||||
#include <gpxe/buffer.h>
|
||||
#include <gpxe/download.h>
|
||||
#include <gpxe/resolv.h>
|
||||
#include <gpxe/http.h>
|
||||
|
||||
static struct async_operations http_async_operations;
|
||||
@@ -391,17 +392,12 @@ int http_get ( struct uri *uri, struct buffer *buffer, struct async *parent ) {
|
||||
http->buffer = buffer;
|
||||
async_init ( &http->async, &http_async_operations, parent );
|
||||
|
||||
|
||||
#warning "Quick name resolution hack"
|
||||
extern int dns_resolv ( const char *name,
|
||||
struct sockaddr *sa,
|
||||
struct async *parent );
|
||||
|
||||
if ( ( rc = dns_resolv ( uri->host, &http->server,
|
||||
&http->async ) ) != 0 )
|
||||
/* Start name resolution. The download proper will start when
|
||||
* name resolution completes.
|
||||
*/
|
||||
if ( ( rc = resolv ( uri->host, &http->server, &http->async ) ) != 0 )
|
||||
goto err;
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <byteswap.h>
|
||||
#include <gpxe/async.h>
|
||||
#include <gpxe/udp.h>
|
||||
#include <gpxe/resolv.h>
|
||||
#include <gpxe/dns.h>
|
||||
|
||||
/** @file
|
||||
@@ -468,3 +469,9 @@ int dns_resolv ( const char *name, struct sockaddr *sa,
|
||||
free ( dns );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/** DNS name resolver */
|
||||
struct resolver dns_resolver __resolver = {
|
||||
.name = "DNS",
|
||||
.resolv = dns_resolv,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user