mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 07:33:11 +00:00
Correct a few uses of sizeof(ip6_addr_t) to sizeof(ip6_addr_p_t)
The ip6_addr_t structure may have an addition slot so is not necessarily the size of an ipv6 address, so some uses of sizeof(ip6_addr_t) were not correct. Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
parent
7b13fae833
commit
5eff45cac0
@ -528,7 +528,7 @@ mdns_build_reverse_v6_domain(struct mdns_domain *domain, const ip6_addr_t *addr)
|
|||||||
}
|
}
|
||||||
memset(domain, 0, sizeof(struct mdns_domain));
|
memset(domain, 0, sizeof(struct mdns_domain));
|
||||||
ptr = (const u8_t *) addr;
|
ptr = (const u8_t *) addr;
|
||||||
for (i = sizeof(ip6_addr_t) - 1; i >= 0; i--) {
|
for (i = sizeof(ip6_addr_p_t) - 1; i >= 0; i--) {
|
||||||
char buf;
|
char buf;
|
||||||
u8_t byte = ptr[i];
|
u8_t byte = ptr[i];
|
||||||
int j;
|
int j;
|
||||||
@ -1163,7 +1163,7 @@ mdns_add_aaaa_answer(struct mdns_outpacket *reply, u16_t cache_flush, struct net
|
|||||||
struct mdns_domain host;
|
struct mdns_domain host;
|
||||||
mdns_build_host_domain(&host, NETIF_TO_HOST(netif));
|
mdns_build_host_domain(&host, NETIF_TO_HOST(netif));
|
||||||
LWIP_DEBUGF(MDNS_DEBUG, ("MDNS: Responding with AAAA record\n"));
|
LWIP_DEBUGF(MDNS_DEBUG, ("MDNS: Responding with AAAA record\n"));
|
||||||
return mdns_add_answer(reply, &host, DNS_RRTYPE_AAAA, DNS_RRCLASS_IN, cache_flush, (NETIF_TO_HOST(netif))->dns_ttl, (const u8_t *) netif_ip6_addr(netif, addrindex), sizeof(ip6_addr_t), NULL);
|
return mdns_add_answer(reply, &host, DNS_RRTYPE_AAAA, DNS_RRCLASS_IN, cache_flush, (NETIF_TO_HOST(netif))->dns_ttl, (const u8_t *) netif_ip6_addr(netif, addrindex), sizeof(ip6_addr_p_t), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Write a x.y.z.ip6.arpa -> hostname.local PTR RR to outpacket */
|
/** Write a x.y.z.ip6.arpa -> hostname.local PTR RR to outpacket */
|
||||||
@ -1628,7 +1628,7 @@ mdns_handle_question(struct mdns_packet *pkt)
|
|||||||
#endif
|
#endif
|
||||||
} else if (match & REPLY_HOST_AAAA) {
|
} else if (match & REPLY_HOST_AAAA) {
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
if (ans.rd_length == sizeof(ip6_addr_t) &&
|
if (ans.rd_length == sizeof(ip6_addr_p_t) &&
|
||||||
/* TODO this clears all AAAA responses if first addr is set as known */
|
/* TODO this clears all AAAA responses if first addr is set as known */
|
||||||
pbuf_memcmp(pkt->pbuf, ans.rd_offset, netif_ip6_addr(pkt->netif, 0), ans.rd_length) == 0) {
|
pbuf_memcmp(pkt->pbuf, ans.rd_offset, netif_ip6_addr(pkt->netif, 0), ans.rd_length) == 0) {
|
||||||
LWIP_DEBUGF(MDNS_DEBUG, ("MDNS: Skipping known answer: AAAA\n"));
|
LWIP_DEBUGF(MDNS_DEBUG, ("MDNS: Skipping known answer: AAAA\n"));
|
||||||
|
@ -1265,17 +1265,17 @@ dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
|
|||||||
}
|
}
|
||||||
#endif /* LWIP_IPV4 */
|
#endif /* LWIP_IPV4 */
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
if ((ans.type == PP_HTONS(DNS_RRTYPE_AAAA)) && (ans.len == PP_HTONS(sizeof(ip6_addr_t)))) {
|
if ((ans.type == PP_HTONS(DNS_RRTYPE_AAAA)) && (ans.len == PP_HTONS(sizeof(ip6_addr_p_t)))) {
|
||||||
#if LWIP_IPV4 && LWIP_IPV6
|
#if LWIP_IPV4 && LWIP_IPV6
|
||||||
if (LWIP_DNS_ADDRTYPE_IS_IPV6(entry->reqaddrtype))
|
if (LWIP_DNS_ADDRTYPE_IS_IPV6(entry->reqaddrtype))
|
||||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||||
{
|
{
|
||||||
ip6_addr_t ip6addr;
|
ip6_addr_p_t ip6addr;
|
||||||
/* read the IP address after answer resource record's header */
|
/* read the IP address after answer resource record's header */
|
||||||
if (pbuf_copy_partial(p, &ip6addr, sizeof(ip6_addr_t), res_idx) != sizeof(ip6_addr_t)) {
|
if (pbuf_copy_partial(p, &ip6addr, sizeof(ip6_addr_p_t), res_idx) != sizeof(ip6_addr_p_t)) {
|
||||||
goto memerr; /* ignore this packet */
|
goto memerr; /* ignore this packet */
|
||||||
}
|
}
|
||||||
ip_addr_copy_from_ip6(dns_table[i].ipaddr, ip6addr);
|
ip_addr_copy_from_ip6_packed(dns_table[i].ipaddr, ip6addr);
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
/* handle correct response */
|
/* handle correct response */
|
||||||
dns_correct_response(i, lwip_ntohl(ans.ttl));
|
dns_correct_response(i, lwip_ntohl(ans.ttl));
|
||||||
|
Loading…
Reference in New Issue
Block a user