.mutex = PTHREAD_MUTEX_INITIALIZER,
.config = {
- .mac = {0x00, 0x15, 0x15, 0x15, 0x15, 0x15},
.status = VIRTIO_NET_S_LINK_UP,
},
.host_features = 1UL << VIRTIO_NET_F_MAC
static bool virtio_net__tap_init(const struct virtio_net_parameters *params)
{
int sock = socket(AF_INET, SOCK_STREAM, 0);
- int i, pid, status, offload, hdr_len;
+ int pid, status, offload, hdr_len;
struct sockaddr_in sin = {0};
struct ifreq ifr;
- for (i = 0 ; i < 6 ; i++)
- ndev.config.mac[i] = params->guest_mac[i];
-
ndev.tap_fd = open("/dev/net/tun", O_RDWR);
if (ndev.tap_fd < 0) {
pr_warning("Unable to open /dev/net/tun");
ndev.base_addr = net_base_addr;
pci__register(&pci_header, dev);
+ for (i = 0 ; i < 6 ; i++)
+ ndev.config.mac[i] = params->guest_mac[i];
+
ndev.mode = params->mode;
if (ndev.mode == NET_MODE_TAP) {
virtio_net__tap_init(params);