mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
dd8ac030fb
virNetDevTapCreateInBridgePort() has always set the new tap device to the current MTU of the bridge it's being attached to. There is one case where we will want to set the new tap device to a different (usually larger) MTU - if that's done with the very first device added to the bridge, the bridge's MTU will be set to the device's MTU. This patch allows for that possibility by adding "int mtu" to the arg list for virNetDevTapCreateInBridgePort(), but all callers are sending -1, so it doesn't yet have any effect. Since the requested MTU isn't necessarily what is used in the end (for example, if there is no MTU requested, the tap device will be set to the current MTU of the bridge), and the hypervisor may want to know the actual MTU used, we also return the actual MTU to the caller (if actualMTU is non-NULL).
55 lines
1.7 KiB
C
55 lines
1.7 KiB
C
#include <config.h>
|
|
|
|
#include "viralloc.h"
|
|
#include "virstring.h"
|
|
#include "virnetdev.h"
|
|
#include "virnetdevtap.h"
|
|
#include "internal.h"
|
|
|
|
#define VIR_FROM_THIS VIR_FROM_BHYVE
|
|
|
|
void virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN],
|
|
virMacAddrPtr addr)
|
|
{
|
|
addr->addr[0] = prefix[0];
|
|
addr->addr[1] = prefix[1];
|
|
addr->addr[2] = prefix[2];
|
|
addr->addr[3] = 0;
|
|
addr->addr[4] = 0;
|
|
addr->addr[5] = 0;
|
|
}
|
|
|
|
int virNetDevTapCreateInBridgePort(const char *brname ATTRIBUTE_UNUSED,
|
|
char **ifname,
|
|
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
|
|
const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
|
const char *tunpath ATTRIBUTE_UNUSED,
|
|
int *tapfd ATTRIBUTE_UNUSED,
|
|
size_t tapfdSize ATTRIBUTE_UNUSED,
|
|
virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED,
|
|
virNetDevVlanPtr virtVlan ATTRIBUTE_UNUSED,
|
|
unsigned int mtu ATTRIBUTE_UNUSED,
|
|
unsigned int *actualMTU ATTRIBUTE_UNUSED,
|
|
unsigned int fakeflags ATTRIBUTE_UNUSED)
|
|
{
|
|
VIR_FREE(*ifname);
|
|
if (VIR_STRDUP(*ifname, "vnet0") < 0)
|
|
return -1;
|
|
return 0;
|
|
}
|
|
|
|
char *virNetDevTapGetRealDeviceName(char *name ATTRIBUTE_UNUSED)
|
|
{
|
|
char *fakename;
|
|
|
|
if (VIR_STRDUP(fakename, "faketapdev") < 0)
|
|
return NULL;
|
|
return fakename;
|
|
}
|
|
|
|
int virNetDevSetOnline(const char *ifname ATTRIBUTE_UNUSED,
|
|
bool online ATTRIBUTE_UNUSED)
|
|
{
|
|
return 0;
|
|
}
|