mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-10 17:43:39 +08:00
Fixed bug #41787 DHCP Discovery is invalid when an IP is set to thet netif (send discover, request and decline from 'any').
Addd functions to send udp/ipv4/ipv6 packets with source address 'any' although netif has an address assigned
This commit is contained in:
@@ -744,6 +744,29 @@ err_t
|
||||
ip6_output_if(struct pbuf *p, ip6_addr_t *src, ip6_addr_t *dest,
|
||||
u8_t hl, u8_t tc,
|
||||
u8_t nexth, struct netif *netif)
|
||||
{
|
||||
ip6_addr_t *src_used = src;
|
||||
if (dest != IP_HDRINCL) {
|
||||
if (src != NULL && ip6_addr_isany(src)) {
|
||||
src = ip6_select_source_address(netif, dest);
|
||||
if ((src == NULL) || ip6_addr_isany(src)) {
|
||||
/* No appropriate source address was found for this packet. */
|
||||
LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip6_output: No suitable source address for packet.\n"));
|
||||
IP6_STATS_INC(ip6.rterr);
|
||||
return ERR_RTE;
|
||||
}
|
||||
}
|
||||
return ip6_output_if_src(p, src_used, dest, hl, tc, nexth, netif);
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as ip6_output_if() but 'src' address is not replaced by netif address
|
||||
* when it is 'any'.
|
||||
*/
|
||||
err_t
|
||||
ip6_output_if_src(struct pbuf *p, ip6_addr_t *src, ip6_addr_t *dest,
|
||||
u8_t hl, u8_t tc,
|
||||
u8_t nexth, struct netif *netif)
|
||||
{
|
||||
struct ip6_hdr *ip6hdr;
|
||||
ip6_addr_t dest_addr;
|
||||
@@ -777,15 +800,6 @@ ip6_output_if(struct pbuf *p, ip6_addr_t *src, ip6_addr_t *dest,
|
||||
if (src == NULL) {
|
||||
src = IP6_ADDR_ANY;
|
||||
}
|
||||
else if (ip6_addr_isany(src)) {
|
||||
src = ip6_select_source_address(netif, dest);
|
||||
if ((src == NULL) || ip6_addr_isany(src)) {
|
||||
/* No appropriate source address was found for this packet. */
|
||||
LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip6_output: No suitable source address for packet.\n"));
|
||||
IP6_STATS_INC(ip6.rterr);
|
||||
return ERR_RTE;
|
||||
}
|
||||
}
|
||||
/* src cannot be NULL here */
|
||||
ip6_addr_copy(ip6hdr->src, *src);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user