2014-03-27 00:53:49 +08:00
|
|
|
#include <config.h>
|
|
|
|
|
2016-11-13 18:01:34 +08:00
|
|
|
#include "viralloc.h"
|
2014-03-27 00:53:49 +08:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
2019-10-14 20:45:03 +08:00
|
|
|
int virNetDevTapCreateInBridgePort(const char *brname G_GNUC_UNUSED,
|
2014-03-27 00:53:49 +08:00
|
|
|
char **ifname,
|
2019-10-14 20:45:03 +08:00
|
|
|
const virMacAddr *macaddr G_GNUC_UNUSED,
|
|
|
|
const unsigned char *vmuuid G_GNUC_UNUSED,
|
|
|
|
const char *tunpath G_GNUC_UNUSED,
|
|
|
|
int *tapfd G_GNUC_UNUSED,
|
|
|
|
size_t tapfdSize G_GNUC_UNUSED,
|
2019-10-02 01:56:35 +08:00
|
|
|
const virNetDevVPortProfile *virtPortProfile G_GNUC_UNUSED,
|
2019-10-02 00:25:47 +08:00
|
|
|
const virNetDevVlan *virtVlan G_GNUC_UNUSED,
|
2019-10-14 20:45:03 +08:00
|
|
|
virNetDevCoalescePtr coalesce G_GNUC_UNUSED,
|
|
|
|
unsigned int mtu G_GNUC_UNUSED,
|
|
|
|
unsigned int *actualMTU G_GNUC_UNUSED,
|
|
|
|
unsigned int fakeflags G_GNUC_UNUSED)
|
2014-03-27 00:53:49 +08:00
|
|
|
{
|
2016-11-13 18:01:34 +08:00
|
|
|
VIR_FREE(*ifname);
|
2019-10-20 19:49:46 +08:00
|
|
|
*ifname = g_strdup("vnet0");
|
2014-03-27 00:53:49 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-10-14 20:45:03 +08:00
|
|
|
char *virNetDevTapGetRealDeviceName(char *name G_GNUC_UNUSED)
|
2014-03-27 00:53:49 +08:00
|
|
|
{
|
|
|
|
char *fakename;
|
|
|
|
|
2019-10-20 19:49:46 +08:00
|
|
|
fakename = g_strdup("faketapdev");
|
2014-03-27 00:53:49 +08:00
|
|
|
return fakename;
|
|
|
|
}
|
|
|
|
|
2019-10-14 20:45:03 +08:00
|
|
|
int virNetDevSetOnline(const char *ifname G_GNUC_UNUSED,
|
|
|
|
bool online G_GNUC_UNUSED)
|
2014-03-27 00:53:49 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2018-02-06 17:09:09 +08:00
|
|
|
|
2019-10-14 20:45:03 +08:00
|
|
|
int bind(int sockfd G_GNUC_UNUSED,
|
|
|
|
const struct sockaddr *addr G_GNUC_UNUSED,
|
|
|
|
socklen_t addrlen G_GNUC_UNUSED)
|
2018-02-06 17:09:09 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|