taps: MVE
EIO crash in CH was caused by CH trying to writev before the interface has been assigned any addresses; adding an address prior to passing the FD (via 80-vm-vt.network) solves the issue. It is still unclear what causes the interrupt=None in the vhost_user/passt branch
This commit is contained in:
parent
1c5e2b7e89
commit
17bde34c96
3 changed files with 284 additions and 41 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* secure_getenv */
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -15,10 +16,12 @@
|
|||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define __UAPI_DEF_IF_IFNAMSIZ 1
|
||||
#include <linux/if_tun.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/virtio_net.h>
|
||||
|
||||
#include "sendfd.h"
|
||||
|
||||
|
|
@ -108,6 +111,11 @@ int tuntap_alloc(char *dev, short openFlags, short ifrFlags, int *out_fd) {
|
|||
|
||||
strncpy(dev, ifr.ifr_name, IFNAMSIZ);
|
||||
*out_fd = fd;
|
||||
|
||||
{
|
||||
int sz = sizeof(struct virtio_net_hdr_v1);
|
||||
DO_OR_DIE(ioctl(fd, TUNSETVNETHDRSZ, &sz));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -257,6 +265,13 @@ void cleanup(int signo, siginfo_t *info, void *_context) {
|
|||
errx(EXIT_FAILURE, "Exiting with signal %d", signo);
|
||||
}
|
||||
|
||||
/* skarlibs under ISC */
|
||||
int uncoe (int fd)
|
||||
{
|
||||
int flags = fcntl(fd, F_GETFD, 0) ;
|
||||
return flags < 0 ? flags : flags & FD_CLOEXEC ? fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) : 0 ;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
struct sigaction act = { 0 };
|
||||
act.sa_flags = SA_SIGINFO;
|
||||
|
|
@ -266,7 +281,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
bool cmdServe = false;
|
||||
bool cmdPass = false;
|
||||
char *ifname = "vt%d";
|
||||
char *ifname = "vt-%d";
|
||||
|
||||
char **rest = argv + 1;
|
||||
char **end = argv + argc;
|
||||
|
|
@ -303,7 +318,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
const char *servePath = secure_getenv("TAPS_SOCK");
|
||||
if (servePath == NULL) {
|
||||
servePath = "taps.sock";
|
||||
servePath = "/run/taps/taps.sock";
|
||||
}
|
||||
|
||||
if (cmdServe) {
|
||||
|
|
@ -317,6 +332,7 @@ int main(int argc, char **argv) {
|
|||
close(fd);
|
||||
fd = 3;
|
||||
}
|
||||
uncoe(fd);
|
||||
DO_OR_DIE(execvp(nextArgv[0], nextArgv));
|
||||
} else {
|
||||
error(EINVAL, EINVAL, "subcommand args");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue