diff options
-rw-r--r-- | udp_vu.c | 28 |
1 files changed, 13 insertions, 15 deletions
@@ -281,30 +281,28 @@ void udp_vu_reply_sock_data(const struct ctx *c, union epoll_ref ref, { flow_sidx_t tosidx = flow_sidx_opposite(ref.flowside); const struct flowside *toside = flowside_at_sidx(tosidx); + bool v6 = !(inany_v4(&toside->eaddr) && inany_v4(&toside->oaddr)); struct udp_flow *uflow = udp_at_sidx(ref.flowside); int from_s = uflow->s[ref.flowside.sidei]; struct vu_dev *vdev = c->vdev; struct vu_virtq *vq = &vdev->vq[VHOST_USER_RX_QUEUE]; + uint8_t topif = pif_at_sidx(tosidx); int i; - for (i = 0; i < UDP_MAX_FRAMES; i++) { - uint8_t topif = pif_at_sidx(tosidx); - ssize_t dlen; - int iov_used; - bool v6; - - ASSERT(uflow); + ASSERT(uflow); - if (topif != PIF_TAP) { - uint8_t frompif = pif_at_sidx(ref.flowside); + if (topif != PIF_TAP) { + uint8_t frompif = pif_at_sidx(ref.flowside); - flow_err(uflow, - "No support for forwarding UDP from %s to %s", - pif_name(frompif), pif_name(topif)); - continue; - } + flow_err(uflow, + "No support for forwarding UDP from %s to %s", + pif_name(frompif), pif_name(topif)); + return; + } - v6 = !(inany_v4(&toside->eaddr) && inany_v4(&toside->oaddr)); + for (i = 0; i < UDP_MAX_FRAMES; i++) { + ssize_t dlen; + int iov_used; iov_used = udp_vu_sock_recv(c, from_s, v6, &dlen); if (iov_used <= 0) |