ip_route() can be called with IP_ANY_TYPE in src parameter, so remove code associated to that

This commit is contained in:
Dirk Ziegelmeier 2017-05-03 16:42:30 +02:00
parent ccf10a5023
commit 6c236b047e
2 changed files with 3 additions and 17 deletions

View File

@ -369,12 +369,7 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr)
if (netif == NULL)
#endif /* LWIP_MULTICAST_TX_OPTIONS */
{
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
/* 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);
}
netif = ip_route(&pcb->local_ip, ipaddr);
}
}

View File

@ -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 */
struct netif *netif;
const ip_addr_t *src_ip_route;
if ((pcb == NULL) || (dst_ip == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, dst_ip)) {
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) {
netif = netif_get_by_index(pcb->netif_idx);
} 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
netif = NULL;
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. */
if (!ip4_addr_isany_val(pcb->mcast_ip4) &&
!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 */
@ -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 */
{
/* find the outgoing network interface for this packet */
netif = ip_route(src_ip_route, dst_ip);
netif = ip_route(&pcb->local_ip, dst_ip);
}
}