--- nono/vm/ethernet.cpp 2026/04/29 17:04:32 1.1.1.2 +++ nono/vm/ethernet.cpp 2026/04/29 17:04:50 1.1.1.4 @@ -1,10 +1,11 @@ // // nono -// Copyright (C) 2019 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // -#include "config.h" #include "ethernet.h" +#include "config.h" #include "netdriver_bpf.h" #include "netdriver_tap.h" #include "netdriver_none.h" @@ -26,14 +27,18 @@ EthernetDevice::~EthernetDevice() bool EthernetDevice::Create() { - const ConfigItem& item = gConfig->Get("ethernet-hostdriver"); + const ConfigItem& item = gConfig->Find("ethernet-hostdriver"); const std::string& type = item.AsString(); + if (type == "none") { gNetDriver.reset(new NetDriverNone()); } else if (type == "tap") { #if defined(NETDRIVER_TAP) + const ConfigItem& item_devpath = gConfig->Find("ethernet-hostdevice"); + const std::string& devpath = item_devpath.AsString(); + try { - gNetDriver.reset(new NetDriverTap(this, &mtx, &cv)); + gNetDriver.reset(new NetDriverTap(this, &mtx, &cv, devpath)); } catch (...) { warnx("Creating NetDriverTap failed"); return false;