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:
Ravi kumar Veeramally 2016-05-30 13:29:16 +03:00 committed by Jukka Rissanen
parent 0224e3577e
commit 803de8d14e
2 changed files with 6 additions and 4 deletions

View file

@ -145,9 +145,8 @@ udp_socket_sendto(struct net_buf *buf, struct udp_socket *c,
}
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));
return datalen;
}
return -1;
}

View file

@ -401,8 +401,11 @@ static inline int udp_prepare_and_send(struct net_context *context,
ip_buf_appdatalen(buf),
&NET_BUF_IP(buf)->destipaddr,
uip_ntohs(NET_BUF_UDP(buf)->destport));
if (!ret) {
if (ret <= 0) {
ret = -EINVAL;
NET_DBG("Packet could not be sent properly.\n");
} else {
ret = 0;
}
#ifdef CONFIG_NETWORKING_IPV6_NO_ND
@ -412,7 +415,7 @@ static inline int udp_prepare_and_send(struct net_context *context,
}
#endif
return !ret;
return ret;
}
#ifdef CONFIG_NETWORKING_WITH_TCP