Commit 60612a3f authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

net/udp: getfrag: fix frag preparation status

This fixes a regression introduced by #a69c4ac5, making the UDP stack
basically unusable since no xmit could ever take place due to the
wrong return value.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent ed517f82
......@@ -553,8 +553,10 @@ static int rt_udp_getfrag(const void *p, unsigned char *to,
// We should optimize this function a bit (copy+csum...)!
if (offset)
return rtnet_read_from_iov(ufh->fd, ufh->iov, ufh->iovlen, to, fraglen);
if (offset) {
ret = rtnet_read_from_iov(ufh->fd, ufh->iov, ufh->iovlen, to, fraglen);
return ret < 0 ? ret : 0;
}
/* Checksum of the complete data part of the UDP message: */
for (i = 0; i < ufh->iovlen; i++) {
......@@ -565,7 +567,7 @@ static int rt_udp_getfrag(const void *p, unsigned char *to,
ret = rtnet_read_from_iov(ufh->fd, ufh->iov, ufh->iovlen,
to + sizeof(struct udphdr),
fraglen - sizeof(struct udphdr));
if (ret)
if (ret < 0)
return ret;
/* Checksum of the udp header: */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment