From a62ed181db9ba7d85d057365d5331dd35026247f Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Fri, 7 Oct 2022 04:01:56 +0200 Subject: conf, tap: Add option to quit once the client closes the connection This is practical to avoid explicit lifecycle management in users, e.g. libvirtd, and is trivial to implement. Signed-off-by: Stefano Brivio Reviewed-by: David Gibson --- tap.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tap.c') diff --git a/tap.c b/tap.c index bdcc161..78de42c 100644 --- a/tap.c +++ b/tap.c @@ -1011,5 +1011,10 @@ void tap_handler(struct ctx *c, int fd, uint32_t events, return; reinit: + if (c->one_off) { + info("Client closed connection, exiting"); + exit(EXIT_SUCCESS); + } + tap_sock_init(c); } -- cgit v1.2.3