net: Fix return value from uip_udp_packet_sendto
udp_socket_sendto returns always datalen irrespective of uip_udp_packet_sendto return value. Change-Id: Ib1c5a25ae89ddaa0826d35d4fd53f9c2ccea7b93 Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This commit is contained in:
parent
0224e3577e
commit
803de8d14e
2 changed files with 6 additions and 4 deletions
|
@ -145,9 +145,8 @@ udp_socket_sendto(struct net_buf *buf, struct udp_socket *c,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c->udp_conn != NULL) {
|
if(c->udp_conn != NULL) {
|
||||||
uip_udp_packet_sendto(buf, c->udp_conn, data, datalen,
|
return uip_udp_packet_sendto(buf, c->udp_conn, data, datalen,
|
||||||
to, UIP_HTONS(port));
|
to, UIP_HTONS(port));
|
||||||
return datalen;
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,8 +401,11 @@ static inline int udp_prepare_and_send(struct net_context *context,
|
||||||
ip_buf_appdatalen(buf),
|
ip_buf_appdatalen(buf),
|
||||||
&NET_BUF_IP(buf)->destipaddr,
|
&NET_BUF_IP(buf)->destipaddr,
|
||||||
uip_ntohs(NET_BUF_UDP(buf)->destport));
|
uip_ntohs(NET_BUF_UDP(buf)->destport));
|
||||||
if (!ret) {
|
if (ret <= 0) {
|
||||||
|
ret = -EINVAL;
|
||||||
NET_DBG("Packet could not be sent properly.\n");
|
NET_DBG("Packet could not be sent properly.\n");
|
||||||
|
} else {
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
|
||||||
|
@ -412,7 +415,7 @@ static inline int udp_prepare_and_send(struct net_context *context,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return !ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NETWORKING_WITH_TCP
|
#ifdef CONFIG_NETWORKING_WITH_TCP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue