@@ -57,7 +57,7 @@ typedef QSIMPLEQ_HEAD(ACLList, ACLRule) ACLList;
static void usage(void)
{
fprintf(stderr,
- "Usage: qemu-bridge-helper [--use-vnet] --br=bridge --fd=unixfd\n");
+ "Usage: qemu-bridge-helper [--use-vnet] --br=bridge --fd=unixfd
[--ifname=name]\n");
}
static int parse_acl_file(const char *filename, ACLList *acl_list)
@@ -223,6 +223,7 @@ int main(int argc, char **argv)
int use_vnet = 0;
int mtu;
const char *bridge = NULL;
+ const char *ifname = NULL;
char iface[IFNAMSIZ];
int index;
ACLRule *acl_rule;
@@ -249,6 +250,8 @@ int main(int argc, char **argv)
bridge = &argv[index][5];
} else if (strncmp(argv[index], "--fd=", 5) == 0) {
unixfd = atoi(&argv[index][5]);
+ } else if (strncmp(argv[index], "--ifname=", 9) == 0) {
+ ifname = &argv[index][9];
} else {
usage();
return EXIT_FAILURE;
@@ -320,7 +323,11 @@ int main(int argc, char **argv)
/* request a tap device, disable PI, and add vnet header support if
* requested and it's available. */
- prep_ifreq(&ifr, "tap%d");
+ if (ifname == NULL) {
+ prep_ifreq(&ifr, "tap%d");
+ } else {
+ prep_ifreq(&ifr, ifname);
+ }
ifr.ifr_flags = IFF_TAP|IFF_NO_PI;
if (use_vnet && has_vnet_hdr(fd)) {
ifr.ifr_flags |= IFF_VNET_HDR;
--
2.9.5
From 35a24821d437d1955c00dc64f7cd82d24e31ecda Mon Sep 17 00:00:00 2001
From: Shaun Reitan <shaun.reitan@ndchost.com>
Date: Mon, 15 Jan 2018 17:42:32 -0800
Subject: [PATCH 2/4] Add ifname to NetdevBridgeOptions
Signed-off-by: Shaun Reitan <shaun.reitan@ndchost.com>
---
qapi/net.json | 1 +
1 file changed, 1 insertion(+)
@@ -402,6 +402,7 @@
{ 'struct': 'NetdevBridgeOptions',
'data': {
'*br': 'str',
+ '*ifname': 'str',
'*helper': 'str' } }
##
--
2.9.5
From 92bbc897a04628358e6d698d70c5a257a912b67c Mon Sep 17 00:00:00 2001
From: Shaun Reitan <shaun.reitan@ndchost.com>
Date: Mon, 15 Jan 2018 17:43:24 -0800
Subject: [PATCH 3/4] Add ifname support to -netdev bridge options
Signed-off-by: Shaun Reitan <shaun.reitan@ndchost.com>
---
qemu-options.hx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -1961,7 +1961,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
" use 'queues=n' to specify the number of queues to be created for
multiqueue TAP\n"
" use 'poll-us=n' to speciy the maximum number of microseconds that
could be\n"
" spent on busy polling for vhost net\n"
- "-netdev bridge,id=str[,br=bridge][,helper=helper]\n"
+ "-netdev bridge,id=str[,br=bridge][,helper=helper][,ifname=name]\n"
" configure a host TAP network backend with ID 'str' that is\n"
" connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
" using the program 'helper (default=" DEFAULT_BRIDGE_HELPER ")\n"
--
2.9.5
From 797ca0174430ffd0dc8c5a36ce86380816ff2eee Mon Sep 17 00:00:00 2001
From: Shaun Reitan <shaun.reitan@ndchost.com>
Date: Mon, 15 Jan 2018 17:43:42 -0800
Subject: [PATCH 4/4] Add ability to set ifname when using -netdev bridge
and
-netdev tap when using a helper
Signed-off-by: Shaun Reitan <shaun.reitan@ndchost.com>
---
net/tap.c | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
@@ -472,7 +472,7 @@ static int recv_fd(int c)
}
static int net_bridge_run_helper(const char *helper, const char
*bridge,
- Error **errp)
+ const char *ifname, Error **errp)
{
sigset_t oldmask, mask;