mirror of
https://passt.top/passt
synced 2025-02-22 10:52:21 +00:00
tap: Use different io vector bases depending on tap type
Currently tap_send_frames() expects the frames it is given to include the vnet_len field, even in pasta mode which doesn't use it (although it need not be initialized in that case). To match, tap_iov_base() and tap_iov_len() construct the frame in that way. This will inconvenience future changes, so alter things to set the buffers to include just the frame needed by the tap backend type. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
2416310a17
commit
0fb7b2b908
5
tap.c
5
tap.c
@ -317,8 +317,7 @@ static void tap_send_frames_pasta(struct ctx *c,
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if (write(c->fd_tap, (char *)iov->iov_base + 4,
|
||||
iov->iov_len - 4) < 0) {
|
||||
if (write(c->fd_tap, (char *)iov->iov_base, iov->iov_len) < 0) {
|
||||
debug("tap write: %s", strerror(errno));
|
||||
if (errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
tap_handler(c, c->fd_tap, EPOLLERR, NULL);
|
||||
@ -383,7 +382,7 @@ void tap_send_frames(struct ctx *c, const struct iovec *iov, size_t n)
|
||||
else
|
||||
tap_send_frames_pasta(c, iov, n);
|
||||
|
||||
pcap_multiple(iov, n, sizeof(uint32_t));
|
||||
pcap_multiple(iov, n, c->mode == MODE_PASST ? sizeof(uint32_t) : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user