networking: add Linux-specific TAP mode to network interface
This addition was motivated by my lack of knowledge of VDE and my familiarity with the Linux networking stack. The driver automatically manages the creation of TAP devices and their association with bridges, such that configurations which specify the same bridge will be connected together. It also automatically handles the creation of bridge devices for convenience's sake.
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#define NET_TYPE_SLIRP 1 /* use the SLiRP port forwarder */
|
||||
#define NET_TYPE_PCAP 2 /* use the (Win)Pcap API */
|
||||
#define NET_TYPE_VDE 3 /* use the VDE plug API */
|
||||
#define NET_TYPE_TAP 4 /* use a linux TAP device */
|
||||
|
||||
#define NET_MAX_FRAME 1518
|
||||
/* Queue size must be a power of 2 */
|
||||
@@ -125,6 +126,7 @@ typedef struct netdrv_t {
|
||||
extern const netdrv_t net_pcap_drv;
|
||||
extern const netdrv_t net_slirp_drv;
|
||||
extern const netdrv_t net_vde_drv;
|
||||
extern const netdrv_t net_tap_drv;
|
||||
extern const netdrv_t net_null_drv;
|
||||
|
||||
struct _netcard_t {
|
||||
@@ -154,10 +156,11 @@ typedef struct {
|
||||
int has_slirp;
|
||||
int has_pcap;
|
||||
int has_vde;
|
||||
int has_tap;
|
||||
} network_devmap_t;
|
||||
|
||||
|
||||
#define HAS_NOSLIRP_NET(x) (x.has_pcap || x.has_vde)
|
||||
#define HAS_NOSLIRP_NET(x) (x.has_pcap || x.has_vde || x.has_tap)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
Reference in New Issue
Block a user