Page MenuHomeFreeBSD

D35143.id105748.diff
No OneTemporary

D35143.id105748.diff

Index: usr.sbin/bhyve/net_backends.c
===================================================================
--- usr.sbin/bhyve/net_backends.c
+++ usr.sbin/bhyve/net_backends.c
@@ -954,11 +954,11 @@
cp = strchr(opts, ',');
if (cp == NULL) {
- set_config_value_node(nvl, "backend", opts);
+ set_config_value_node(nvl, "net_backend", opts);
return (0);
}
backend = strndup(opts, cp - opts);
- set_config_value_node(nvl, "backend", backend);
+ set_config_value_node(nvl, "net_backend", backend);
free(backend);
return (pci_parse_legacy_config(nvl, cp + 1));
}
@@ -980,22 +980,32 @@
void *param)
{
struct net_backend **pbe, *nbe, *tbe = NULL;
- const char *value;
+ const char *value, *backend;
char *devname;
int err;
- value = get_config_value_node(nvl, "backend");
+ value = get_config_value_node(nvl, "net_backend");
if (value == NULL) {
return (-1);
}
devname = strdup(value);
+ /* Derive the backend by devname prefix by default */
+ backend = devname;
+
+ value = get_config_value_node(nvl, "backend");
+
+ /* Use the explicitly specified backend if such configuration exists */
+ if (value != NULL) {
+ backend = value;
+ }
+
/*
* Find the network backend that matches the user-provided
* device name. net_backend_set is built using a linker set.
*/
SET_FOREACH(pbe, net_backend_set) {
- if (strncmp(devname, (*pbe)->prefix,
+ if (strncmp(backend, (*pbe)->prefix,
strlen((*pbe)->prefix)) == 0) {
tbe = *pbe;
assert(tbe->init != NULL);
Index: usr.sbin/bhyve/pci_virtio_net.c
===================================================================
--- usr.sbin/bhyve/pci_virtio_net.c
+++ usr.sbin/bhyve/pci_virtio_net.c
@@ -617,7 +617,7 @@
sc->vsc_config.mtu = mtu;
/* Permit interfaces without a configured backend. */
- if (get_config_value_node(nvl, "backend") != NULL) {
+ if (get_config_value_node(nvl, "net_backend") != NULL) {
err = netbe_init(&sc->vsc_be, nvl, pci_vtnet_rx_callback, sc);
if (err) {
free(sc);

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 6:19 PM (20 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14702473
Default Alt Text
D35143.id105748.diff (1 KB)

Event Timeline