net: icmp: Fix return values of ICMP error send function

The return code from net_icmpv{4|6}_send_error() was not correct
if the error message could be sent. Now 0 is returned if sending
succeed, and <0 otherwise.

Change-Id: Iff67f097a9d9519c9f11d4cbc9cf428a7c74ec1b
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-03-15 12:40:51 +02:00
parent 8ae7bb257f
commit 430e271751
2 changed files with 2 additions and 8 deletions

View file

@ -272,7 +272,7 @@ int net_icmpv4_send_error(struct net_buf *orig, uint8_t type, uint8_t code)
if (net_send_data(buf) >= 0) {
net_stats_update_icmp_sent();
return -EIO;
return 0;
}
drop:
@ -281,8 +281,5 @@ drop:
drop_no_buf:
net_stats_update_icmp_drop();
/* Note that we always return < 0 so that the caller knows to
* discard the original buffer.
*/
return err;
}

View file

@ -310,7 +310,7 @@ int net_icmpv6_send_error(struct net_buf *orig, uint8_t type, uint8_t code,
if (net_send_data(buf) >= 0) {
net_stats_update_icmp_sent();
return -EIO;
return 0;
}
drop:
@ -319,9 +319,6 @@ drop:
drop_no_buf:
net_stats_update_icmp_drop();
/* Note that we always return < 0 so that the caller knows to
* discard the original buffer.
*/
return err;
}