On 03.09.25 08:37, Jason Wang wrote:
On Sun, Aug 24, 2025 at 12:03 AM Vladimir Sementsov-Ogievskiy
<[email protected]> wrote:

Add helper that covers logic for initializing fds, given from monitor
or helper.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
---
  net/tap.c | 90 ++++++++++++++++++++++---------------------------------
  1 file changed, 36 insertions(+), 54 deletions(-)

diff --git a/net/tap.c b/net/tap.c
index 27642c45a9..8cea6ed87b 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -627,13 +627,40 @@ static bool set_fd_nonblocking(int fd, const char *note, 
Error **errp)
      return ok;
  }

+static int net_tap_fd_init_external(const Netdev *netdev, NetClientState *peer,
+                                    const char *model, const char *name,
+                                    const char *vhostfdname,
+                                    int *pvnet_hdr, int fd, Error **errp)

Is net_tap_fd_init_mon() better?


The function is shared between "monitor" case and "helper" case.

I just didn't look what "helper" actually do, and decided that fd comes from 
somewhere...

Now looking at code, I see that for helper we do fork(), and exec() the helper 
in child process, and then read
the fd in parent from preliminary created socket pair.

So I still think that "external" works good: either we get fd from monitor, or from third 
"helper" program.

--
Best regards,
Vladimir

Reply via email to