Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_virtio_net.c
Show All 40 Lines | |||||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||
#include <machine/atomic.h> | #include <machine/atomic.h> | ||||
#include <net/ethernet.h> | #include <net/ethernet.h> | ||||
#ifndef NETMAP_WITH_LIBS | #ifndef NETMAP_WITH_LIBS | ||||
#define NETMAP_WITH_LIBS | #define NETMAP_WITH_LIBS | ||||
#endif | #endif | ||||
#include <net/netmap_user.h> | #include <net/netmap_user.h> | ||||
#ifndef WITHOUT_CAPSICUM | |||||
#include <capsicum_helpers.h> | |||||
#endif | |||||
#include <err.h> | #include <err.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stdint.h> | #include <stdint.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <strings.h> | #include <strings.h> | ||||
▲ Show 20 Lines • Show All 717 Lines • ▼ Show 20 Lines | #endif | ||||
if (ioctl(sc->vsc_tapfd, FIONBIO, &opt) < 0) { | if (ioctl(sc->vsc_tapfd, FIONBIO, &opt) < 0) { | ||||
WPRINTF(("tap device O_NONBLOCK failed\n")); | WPRINTF(("tap device O_NONBLOCK failed\n")); | ||||
close(sc->vsc_tapfd); | close(sc->vsc_tapfd); | ||||
sc->vsc_tapfd = -1; | sc->vsc_tapfd = -1; | ||||
} | } | ||||
#ifndef WITHOUT_CAPSICUM | #ifndef WITHOUT_CAPSICUM | ||||
cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); | cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); | ||||
if (cap_rights_limit(sc->vsc_tapfd, &rights) == -1 && errno != ENOSYS) | if (caph_rights_limit(sc->vsc_tapfd, &rights) == -1) | ||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | errx(EX_OSERR, "Unable to apply rights for sandbox"); | ||||
#endif | #endif | ||||
sc->vsc_mevp = mevent_add(sc->vsc_tapfd, | sc->vsc_mevp = mevent_add(sc->vsc_tapfd, | ||||
EVF_READ, | EVF_READ, | ||||
pci_vtnet_rx_callback, | pci_vtnet_rx_callback, | ||||
sc); | sc); | ||||
if (sc->vsc_mevp == NULL) { | if (sc->vsc_mevp == NULL) { | ||||
▲ Show 20 Lines • Show All 202 Lines • Show Last 20 Lines |