@ -611,8 +611,8 @@ int net_init_bridge(const Netdev *netdev, const char *name,
assert ( netdev - > type = = NET_CLIENT_DRIVER_BRIDGE ) ;
bridge = & netdev - > u . bridge ;
helper = bridge - > has_h elper ? bridge - > helper : NULL ;
br = bridge - > has_ br ? bridge - > br : DEFAULT_BRIDGE_INTERFACE ;
helper = bridge - > helper ;
br = bridge - > br ? : DEFAULT_BRIDGE_INTERFACE ;
fd = net_bridge_run_helper ( helper , br , errp ) ;
if ( fd = = - 1 ) {
@ -688,9 +688,9 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
goto failed ;
}
if ( tap - > has_ fd | | tap - > has_ fds) {
if ( tap - > fd | | tap - > fds ) {
qemu_set_info_str ( & s - > nc , " fd=%d " , fd ) ;
} else if ( tap - > has_h elper ) {
} else if ( tap - > helper ) {
qemu_set_info_str ( & s - > nc , " helper=%s " , tap - > helper ) ;
} else {
qemu_set_info_str ( & s - > nc , " ifname=%s,script=%s,downscript=%s " , ifname ,
@ -812,21 +812,21 @@ int net_init_tap(const Netdev *netdev, const char *name,
assert ( netdev - > type = = NET_CLIENT_DRIVER_TAP ) ;
tap = & netdev - > u . tap ;
queues = tap - > has_queues ? tap - > queues : 1 ;
vhostfdname = tap - > has_ vhostfd ? tap - > vhostfd : NULL ;
script = tap - > has_ script ? tap - > script : NULL ;
downscript = tap - > has_ downscript ? tap - > downscript : NULL ;
vhostfdname = tap - > vhostfd ;
script = tap - > script ;
downscript = tap - > downscript ;
/* QEMU hubs do not support multiqueue tap, in this case peer is set.
* For - netdev , peer is always NULL . */
if ( peer & & ( tap - > has_queues | | tap - > has_ fds | | tap - > has_ vhostfds) ) {
if ( peer & & ( tap - > has_queues | | tap - > fds | | tap - > vhostfds ) ) {
error_setg ( errp , " Multiqueue tap cannot be used with hubs " ) ;
return - 1 ;
}
if ( tap - > has_ fd) {
if ( tap - > has_ ifname | | tap - > has_ script | | tap - > has_ downscript | |
tap - > has_vnet_hdr | | tap - > has_h elper | | tap - > has_queues | |
tap - > has_ fds | | tap - > has_ vhostfds) {
if ( tap - > fd ) {
if ( tap - > ifname | | tap - > script | | tap - > downscript | |
tap - > has_vnet_hdr | | tap - > helper | | tap - > has_queues | |
tap - > fds | | tap - > vhostfds ) {
error_setg ( errp , " ifname=, script=, downscript=, vnet_hdr=, "
" helper=, queues=, fds=, and vhostfds= "
" are invalid with fd= " ) ;
@ -859,14 +859,14 @@ int net_init_tap(const Netdev *netdev, const char *name,
close ( fd ) ;
return - 1 ;
}
} else if ( tap - > has_ fds) {
} else if ( tap - > fds ) {
char * * fds ;
char * * vhost_fds ;
int nfds = 0 , nvhosts = 0 ;
if ( tap - > has_ ifname | | tap - > has_ script | | tap - > has_ downscript | |
tap - > has_vnet_hdr | | tap - > has_h elper | | tap - > has_queues | |
tap - > has_ vhostfd) {
if ( tap - > ifname | | tap - > script | | tap - > downscript | |
tap - > has_vnet_hdr | | tap - > helper | | tap - > has_queues | |
tap - > vhostfd ) {
error_setg ( errp , " ifname=, script=, downscript=, vnet_hdr=, "
" helper=, queues=, and vhostfd= "
" are invalid with fds= " ) ;
@ -877,7 +877,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
vhost_fds = g_new0 ( char * , MAX_TAP_QUEUES ) ;
nfds = get_fds ( tap - > fds , fds , MAX_TAP_QUEUES ) ;
if ( tap - > has_ vhostfds) {
if ( tap - > vhostfds ) {
nvhosts = get_fds ( tap - > vhostfds , vhost_fds , MAX_TAP_QUEUES ) ;
if ( nfds ! = nvhosts ) {
error_setg ( errp , " The number of fds passed does not match "
@ -916,7 +916,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
net_init_tap_one ( tap , peer , " tap " , name , ifname ,
script , downscript ,
tap - > has_ vhostfds ? vhost_fds [ i ] : NULL ,
tap - > vhostfds ? vhost_fds [ i ] : NULL ,
vnet_hdr , fd , & err ) ;
if ( err ) {
error_propagate ( errp , err ) ;
@ -935,17 +935,16 @@ free_fail:
g_free ( fds ) ;
g_free ( vhost_fds ) ;
return ret ;
} else if ( tap - > has_h elper ) {
if ( tap - > has_ ifname | | tap - > has_ script | | tap - > has_ downscript | |
tap - > has_vnet_hdr | | tap - > has_queues | | tap - > has_ vhostfds) {
} else if ( tap - > helper ) {
if ( tap - > ifname | | tap - > script | | tap - > downscript | |
tap - > has_vnet_hdr | | tap - > has_queues | | tap - > vhostfds ) {
error_setg ( errp , " ifname=, script=, downscript=, vnet_hdr=, "
" queues=, and vhostfds= are invalid with helper= " ) ;
return - 1 ;
}
fd = net_bridge_run_helper ( tap - > helper ,
tap - > has_br ?
tap - > br : DEFAULT_BRIDGE_INTERFACE ,
tap - > br ? : DEFAULT_BRIDGE_INTERFACE ,
errp ) ;
if ( fd = = - 1 ) {
return - 1 ;
@ -972,7 +971,7 @@ free_fail:
} else {
g_autofree char * default_script = NULL ;
g_autofree char * default_downscript = NULL ;
if ( tap - > has_ vhostfds) {
if ( tap - > vhostfds ) {
error_setg ( errp , " vhostfds= is invalid if fds= wasn't specified " ) ;
return - 1 ;
}
@ -985,7 +984,7 @@ free_fail:
get_relocated_path ( DEFAULT_NETWORK_DOWN_SCRIPT ) ;
}
if ( tap - > has_ ifname) {
if ( tap - > ifname ) {
pstrcpy ( ifname , sizeof ifname , tap - > ifname ) ;
} else {
ifname [ 0 ] = ' \0 ' ;
@ -998,7 +997,7 @@ free_fail:
return - 1 ;
}
if ( queues > 1 & & i = = 0 & & ! tap - > has_ ifname) {
if ( queues > 1 & & i = = 0 & & ! tap - > ifname ) {
if ( tap_fd_get_ifname ( fd , ifname ) ) {
error_setg ( errp , " Fail to get ifname " ) ;
close ( fd ) ;