diff mbox series

[v2,4/4] net: Use bundle mechanism

Message ID 20220226124535.76885-5-akihiko.odaki@gmail.com (mailing list archive)
State New, archived
Headers show
Series cutils: Introduce bundle mechanism | expand

Commit Message

Akihiko Odaki Feb. 26, 2022, 12:45 p.m. UTC
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
---
 configure         | 1 +
 include/net/net.h | 2 +-
 meson.build       | 1 +
 net/tap.c         | 6 +++++-
 qemu-options.hx   | 4 ++--
 5 files changed, 10 insertions(+), 4 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 27, 2022, 4:23 p.m. UTC | #1
On 26/2/22 13:45, Akihiko Odaki wrote:
> Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
> ---
>   configure         | 1 +
>   include/net/net.h | 2 +-
>   meson.build       | 1 +
>   net/tap.c         | 6 +++++-
>   qemu-options.hx   | 4 ++--
>   5 files changed, 10 insertions(+), 4 deletions(-)

> diff --git a/net/tap.c b/net/tap.c
> index c5cbeaa7a2b..3225d91ae00 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -508,7 +508,11 @@ static int net_bridge_run_helper(const char *helper, const char *bridge,
>       sigprocmask(SIG_BLOCK, &mask, &oldmask);
>   
>       if (!helper) {
> -        helper = default_helper = get_relocated_path(DEFAULT_BRIDGE_HELPER);
> +        helper = default_helper = find_bundle(DEFAULT_BUNDLE_BRIDGE_HELPER);
> +        if (!helper) {
> +            error_setg(errp, "birdge helper not found");

Typo "bridge".

> +            return -1;
> +        }
>       }
diff mbox series

Patch

diff --git a/configure b/configure
index 80d36a85bc5..63df8f5886e 100755
--- a/configure
+++ b/configure
@@ -3100,6 +3100,7 @@  done
 
 symlink $source_path/ui/icons/qemu.svg qemu-bundle/share/icons/hicolor/scalable/apps/qemu.svg
 symlink ../../pc-bios qemu-bundle/share/qemu
+symlink ../../qemu-bridge-helper qemu-bundle/libexec/qemu-bridge-helper
 
 (for i in $cross_cc_vars; do
   export $i
diff --git a/include/net/net.h b/include/net/net.h
index 523136c7acb..4a5ed27a4b7 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -228,7 +228,7 @@  NetClientState *net_hub_port_find(int hub_id);
 
 #define DEFAULT_NETWORK_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifup"
 #define DEFAULT_NETWORK_DOWN_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifdown"
-#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
+#define DEFAULT_BUNDLE_BRIDGE_HELPER CONFIG_QEMU_BUNDLE_HELPERDIR "/qemu-bridge-helper"
 #define DEFAULT_BRIDGE_INTERFACE "br0"
 
 void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd);
diff --git a/meson.build b/meson.build
index f7e64a74545..95ee0a7c14e 100644
--- a/meson.build
+++ b/meson.build
@@ -1472,6 +1472,7 @@  config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_c
 config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_DATADIR', qemu_datadir)
 config_host_data.set_quoted('CONFIG_QEMU_DESKTOPDIR', get_option('prefix') / qemu_desktopdir)
 config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH', get_option('qemu_firmwarepath'))
+config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_HELPERDIR', get_option('libexecdir'))
 config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_ICONDIR', qemu_icondir)
 config_host_data.set_quoted('CONFIG_QEMU_LOCALEDIR', get_option('prefix') / get_option('localedir'))
 config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') / get_option('localstatedir'))
diff --git a/net/tap.c b/net/tap.c
index c5cbeaa7a2b..3225d91ae00 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -508,7 +508,11 @@  static int net_bridge_run_helper(const char *helper, const char *bridge,
     sigprocmask(SIG_BLOCK, &mask, &oldmask);
 
     if (!helper) {
-        helper = default_helper = get_relocated_path(DEFAULT_BRIDGE_HELPER);
+        helper = default_helper = find_bundle(DEFAULT_BUNDLE_BRIDGE_HELPER);
+        if (!helper) {
+            error_setg(errp, "birdge helper not found");
+            return -1;
+        }
     }
 
     if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) == -1) {
diff --git a/qemu-options.hx b/qemu-options.hx
index 094a6c1d7c2..a5c03e2caf3 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2665,7 +2665,7 @@  DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "                to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
     "                to deconfigure it\n"
     "                use '[down]script=no' to disable script execution\n"
-    "                use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n"
+    "                use network helper 'helper' (default=" DEFAULT_BUNDLE_BRIDGE_HELPER ") to\n"
     "                configure it\n"
     "                use 'fd=h' to connect to an already opened TAP interface\n"
     "                use 'fds=x:y:...:z' to connect to already opened multiqueue capable TAP interfaces\n"
@@ -2684,7 +2684,7 @@  DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "-netdev bridge,id=str[,br=bridge][,helper=helper]\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"
+    "                using the program 'helper (default=" DEFAULT_BUNDLE_BRIDGE_HELPER ")\n"
 #endif
 #ifdef __linux__
     "-netdev l2tpv3,id=str,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport]\n"