mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-09 09:03:49 +08:00
fixed bug #38061 (wrong multicast routing in IPv4) by adding an optional default netif for multicast routing
This commit is contained in:
@@ -98,6 +98,18 @@ struct ip_globals ip_data;
|
||||
/** The IP header ID of the next outgoing IP packet */
|
||||
static u16_t ip_id;
|
||||
|
||||
#if LWIP_IGMP
|
||||
/** The default netif used for multicast */
|
||||
static struct netif* ip_default_multicast_netif;
|
||||
|
||||
/** Set a default netif for IPv4 multicast. */
|
||||
void
|
||||
ip_set_default_multicast_netif(struct netif* default_multicast_netif)
|
||||
{
|
||||
ip_default_multicast_netif = default_multicast_netif;
|
||||
}
|
||||
#endif /* LWIP_IGMP */
|
||||
|
||||
/**
|
||||
* Finds the appropriate network interface for a given IP address. It
|
||||
* searches the list of network interfaces linearly. A match is found
|
||||
@@ -119,6 +131,13 @@ ip_route(const ip_addr_t *dest)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LWIP_IGMP
|
||||
/* Use administratively selected interface for multicast by default */
|
||||
if (ip_addr_ismulticast(dest) && ip_default_multicast_netif) {
|
||||
return ip_default_multicast_netif;
|
||||
}
|
||||
#endif /* LWIP_IGMP */
|
||||
|
||||
/* iterate through netifs */
|
||||
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||
/* network mask matches? */
|
||||
|
||||
Reference in New Issue
Block a user