mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-10 11:29:38 +00:00
Merge pull request #168 from darconeous/pull-requests/core-net-resolv-misc
Miscellaneous small DNS resolver updates and fixes
This commit is contained in:
commit
86dc97ca8c
@ -272,7 +272,7 @@ struct namemap {
|
|||||||
uip_ipaddr_t ipaddr;
|
uip_ipaddr_t ipaddr;
|
||||||
uint8_t err;
|
uint8_t err;
|
||||||
#if RESOLV_CONF_SUPPORTS_MDNS
|
#if RESOLV_CONF_SUPPORTS_MDNS
|
||||||
uint8_t is_mdns:1, is_probe:1;
|
int is_mdns:1, is_probe:1;
|
||||||
#endif
|
#endif
|
||||||
char name[RESOLV_CONF_MAX_DOMAIN_NAME_SIZE + 1];
|
char name[RESOLV_CONF_MAX_DOMAIN_NAME_SIZE + 1];
|
||||||
};
|
};
|
||||||
@ -331,11 +331,6 @@ static int mdns_needs_host_announce;
|
|||||||
PROCESS(mdns_probe_process, "mDNS probe");
|
PROCESS(mdns_probe_process, "mDNS probe");
|
||||||
#endif /* RESOLV_CONF_SUPPORTS_MDNS */
|
#endif /* RESOLV_CONF_SUPPORTS_MDNS */
|
||||||
|
|
||||||
#if RESOLV_AUTO_REMOVE_TRAILING_DOTS
|
|
||||||
/* For removing trailing dots in resolv_query() and resolve_lookup2(). */
|
|
||||||
static char dns_name_without_dots[RESOLV_CONF_MAX_DOMAIN_NAME_SIZE + 1];
|
|
||||||
#endif /* RESOLV_AUTO_REMOVE_TRAILING_DOTS */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if RESOLV_VERIFY_ANSWER_NAMES || VERBOSE_DEBUG
|
#if RESOLV_VERIFY_ANSWER_NAMES || VERBOSE_DEBUG
|
||||||
/** \internal
|
/** \internal
|
||||||
@ -806,7 +801,7 @@ newdata(void)
|
|||||||
queryptr = skip_name(queryptr) + sizeof(struct dns_question),
|
queryptr = skip_name(queryptr) + sizeof(struct dns_question),
|
||||||
--nquestions
|
--nquestions
|
||||||
) {
|
) {
|
||||||
|
#if RESOLV_CONF_SUPPORTS_MDNS
|
||||||
if(!is_request) {
|
if(!is_request) {
|
||||||
/* If this isn't a request, we don't need to bother
|
/* If this isn't a request, we don't need to bother
|
||||||
* looking at the individual questions. For the most
|
* looking at the individual questions. For the most
|
||||||
@ -815,7 +810,6 @@ newdata(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RESOLV_CONF_SUPPORTS_MDNS
|
|
||||||
{
|
{
|
||||||
struct dns_question *question = (struct dns_question *)skip_name(queryptr);
|
struct dns_question *question = (struct dns_question *)skip_name(queryptr);
|
||||||
|
|
||||||
@ -931,9 +925,11 @@ newdata(void)
|
|||||||
ans = (struct dns_answer *)skip_name(queryptr);
|
ans = (struct dns_answer *)skip_name(queryptr);
|
||||||
|
|
||||||
#if !ARCH_DOESNT_NEED_ALIGNED_STRUCTS
|
#if !ARCH_DOESNT_NEED_ALIGNED_STRUCTS
|
||||||
static struct dns_answer aligned;
|
{
|
||||||
memcpy(&aligned, ans, sizeof(aligned));
|
static struct dns_answer aligned;
|
||||||
ans = &aligned;
|
memcpy(&aligned, ans, sizeof(aligned));
|
||||||
|
ans = &aligned;
|
||||||
|
}
|
||||||
#endif /* !ARCH_DOESNT_NEED_ALIGNED_STRUCTS */
|
#endif /* !ARCH_DOESNT_NEED_ALIGNED_STRUCTS */
|
||||||
|
|
||||||
#if VERBOSE_DEBUG
|
#if VERBOSE_DEBUG
|
||||||
@ -1011,16 +1007,16 @@ newdata(void)
|
|||||||
nanswers = 1;
|
nanswers = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is disabled for now, so that we don't fail on CNAME records.
|
||||||
#if RESOLV_VERIFY_ANSWER_NAMES
|
#if RESOLV_VERIFY_ANSWER_NAMES
|
||||||
if(namemapptr &&
|
if(namemapptr && !dns_name_isequal(queryptr, namemapptr->name, uip_appdata)) {
|
||||||
!dns_name_isequal(queryptr, namemapptr->name, uip_appdata)) {
|
|
||||||
DEBUG_PRINTF("resolver: Answer name doesn't match question...!\n");
|
DEBUG_PRINTF("resolver: Answer name doesn't match question...!\n");
|
||||||
goto skip_to_next_answer;
|
goto skip_to_next_answer;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
DEBUG_PRINTF("resolver: Answer for \"%s\" is usable.\n",
|
DEBUG_PRINTF("resolver: Answer for \"%s\" is usable.\n", namemapptr->name);
|
||||||
namemapptr->name);
|
|
||||||
|
|
||||||
namemapptr->state = STATE_DONE;
|
namemapptr->state = STATE_DONE;
|
||||||
#if RESOLV_SUPPORTS_RECORD_EXPIRATION
|
#if RESOLV_SUPPORTS_RECORD_EXPIRATION
|
||||||
@ -1193,6 +1189,7 @@ PROCESS_THREAD(resolv_process, ev, data)
|
|||||||
#if RESOLV_AUTO_REMOVE_TRAILING_DOTS
|
#if RESOLV_AUTO_REMOVE_TRAILING_DOTS
|
||||||
static const char *
|
static const char *
|
||||||
remove_trailing_dots(const char *name) {
|
remove_trailing_dots(const char *name) {
|
||||||
|
static char dns_name_without_dots[RESOLV_CONF_MAX_DOMAIN_NAME_SIZE + 1];
|
||||||
size_t len = strlen(name);
|
size_t len = strlen(name);
|
||||||
|
|
||||||
if(name[len - 1] == '.') {
|
if(name[len - 1] == '.') {
|
||||||
|
@ -131,6 +131,8 @@ set_connection_address(uip_ipaddr_t *ipaddr)
|
|||||||
status = RESOLV_STATUS_RESOLVING;
|
status = RESOLV_STATUS_RESOLVING;
|
||||||
} else if(status == RESOLV_STATUS_CACHED && resolved_addr != NULL) {
|
} else if(status == RESOLV_STATUS_CACHED && resolved_addr != NULL) {
|
||||||
PRINTF("Lookup of \"%s\" succeded!\n",QUOTEME(UDP_CONNECTION_ADDR));
|
PRINTF("Lookup of \"%s\" succeded!\n",QUOTEME(UDP_CONNECTION_ADDR));
|
||||||
|
} else if(status == RESOLV_STATUS_RESOLVING) {
|
||||||
|
PRINTF("Still looking up \"%s\"...\n",QUOTEME(UDP_CONNECTION_ADDR));
|
||||||
} else {
|
} else {
|
||||||
PRINTF("Lookup of \"%s\" failed. status = %d\n",QUOTEME(UDP_CONNECTION_ADDR),status);
|
PRINTF("Lookup of \"%s\" failed. status = %d\n",QUOTEME(UDP_CONNECTION_ADDR),status);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user