mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-07 15:04:39 +08:00
ip_route() can be called with IP_ANY_TYPE in src parameter, so remove code associated to that
This commit is contained in:
parent
ccf10a5023
commit
6c236b047e
@ -369,12 +369,7 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr)
|
|||||||
if (netif == NULL)
|
if (netif == NULL)
|
||||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||||
{
|
{
|
||||||
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
|
netif = ip_route(&pcb->local_ip, ipaddr);
|
||||||
/* Don't call ip_route() with IP_ANY_TYPE */
|
|
||||||
netif = ip_route(IP46_ADDR_ANY(IP_GET_TYPE(ipaddr)), ipaddr);
|
|
||||||
} else {
|
|
||||||
netif = ip_route(&pcb->local_ip, ipaddr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,6 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
|||||||
{
|
{
|
||||||
#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
|
#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
const ip_addr_t *src_ip_route;
|
|
||||||
|
|
||||||
if ((pcb == NULL) || (dst_ip == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, dst_ip)) {
|
if ((pcb == NULL) || (dst_ip == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, dst_ip)) {
|
||||||
return ERR_VAL;
|
return ERR_VAL;
|
||||||
@ -515,14 +514,6 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
|||||||
if (pcb->netif_idx != NETIF_NO_INDEX) {
|
if (pcb->netif_idx != NETIF_NO_INDEX) {
|
||||||
netif = netif_get_by_index(pcb->netif_idx);
|
netif = netif_get_by_index(pcb->netif_idx);
|
||||||
} else {
|
} else {
|
||||||
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
|
|
||||||
/* Don't call ip_route() with IP_ANY_TYPE */
|
|
||||||
src_ip_route = IP46_ADDR_ANY(IP_GET_TYPE(dst_ip));
|
|
||||||
} else {
|
|
||||||
src_ip_route = &pcb->local_ip;
|
|
||||||
}
|
|
||||||
LWIP_UNUSED_ARG(src_ip_route); /* IPv4 only and no source based routing */
|
|
||||||
|
|
||||||
#if LWIP_MULTICAST_TX_OPTIONS
|
#if LWIP_MULTICAST_TX_OPTIONS
|
||||||
netif = NULL;
|
netif = NULL;
|
||||||
if (ip_addr_ismulticast(dst_ip)) {
|
if (ip_addr_ismulticast(dst_ip)) {
|
||||||
@ -548,7 +539,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
|||||||
fails, we try regular routing as though no override was set. */
|
fails, we try regular routing as though no override was set. */
|
||||||
if (!ip4_addr_isany_val(pcb->mcast_ip4) &&
|
if (!ip4_addr_isany_val(pcb->mcast_ip4) &&
|
||||||
!ip4_addr_cmp(&pcb->mcast_ip4, IP4_ADDR_BROADCAST)) {
|
!ip4_addr_cmp(&pcb->mcast_ip4, IP4_ADDR_BROADCAST)) {
|
||||||
netif = ip4_route_src(ip_2_ip4(src_ip_route), &pcb->mcast_ip4);
|
netif = ip4_route_src(ip_2_ip4(&pcb->local_ip), &pcb->mcast_ip4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* LWIP_IPV4 */
|
#endif /* LWIP_IPV4 */
|
||||||
@ -558,7 +549,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
|
|||||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||||
{
|
{
|
||||||
/* find the outgoing network interface for this packet */
|
/* find the outgoing network interface for this packet */
|
||||||
netif = ip_route(src_ip_route, dst_ip);
|
netif = ip_route(&pcb->local_ip, dst_ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user