Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package slirp4netns for openSUSE:Factory checked in at 2024-05-01 14:55:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/slirp4netns (Old) and /work/SRC/openSUSE:Factory/.slirp4netns.new.1880 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "slirp4netns" Wed May 1 14:55:24 2024 rev:17 rq:1170783 version:1.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/slirp4netns/slirp4netns.changes 2024-02-15 20:58:58.896965085 +0100 +++ /work/SRC/openSUSE:Factory/.slirp4netns.new.1880/slirp4netns.changes 2024-05-01 14:55:32.303918955 +0200 @@ -1,0 +2,8 @@ +Fri Apr 26 12:21:24 UTC 2024 - Dan Äermák <dcer...@suse.com> + +- New upstream release 1.3.0 + + * Support new `--netns-type=tapfd` (#340, thanks to @helmutg) + * Do not leak socket in case of success (#339, thanks to @jnovy) + +------------------------------------------------------------------- Old: ---- slirp4netns-1.2.3.tar.xz New: ---- slirp4netns-1.3.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ slirp4netns.spec ++++++ --- /var/tmp/diff_new_pack.eY0pX1/_old 2024-05-01 14:55:33.407959012 +0200 +++ /var/tmp/diff_new_pack.eY0pX1/_new 2024-05-01 14:55:33.407959012 +0200 @@ -17,7 +17,7 @@ Name: slirp4netns -Version: 1.2.3 +Version: 1.3.0 Release: 0 Summary: User-mode networking for unprivileged network namespaces License: BSD-2-Clause AND GPL-2.0-only AND MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.eY0pX1/_old 2024-05-01 14:55:33.443960319 +0200 +++ /var/tmp/diff_new_pack.eY0pX1/_new 2024-05-01 14:55:33.447960464 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/rootless-containers/slirp4netns.git</param> <param name="scm">git</param> <param name="filename">slirp4netns</param> - <param name="revision">v1.2.3</param> + <param name="revision">v1.3.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> </service> ++++++ slirp4netns-1.2.3.tar.xz -> slirp4netns-1.3.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slirp4netns-1.2.3/.github/workflows/release.yaml new/slirp4netns-1.3.0/.github/workflows/release.yaml --- old/slirp4netns-1.2.3/.github/workflows/release.yaml 2024-02-06 16:26:54.000000000 +0100 +++ new/slirp4netns-1.3.0/.github/workflows/release.yaml 2024-04-26 02:18:17.000000000 +0200 @@ -52,6 +52,7 @@ run: sha256sum /tmp/SHA256SUMS - name: "Prepare the release note" run: | + tag="${GITHUB_REF##*/}" shasha=$(sha256sum /tmp/SHA256SUMS | awk '{print $1}') libslirp_version=$(/tmp/artifact/slirp4netns-x86_64 -v | grep -oP '^libslirp: \K\S*') libseccomp_version=$(/tmp/artifact/slirp4netns-x86_64 -v | grep -oP '^libseccomp: \K\S*') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slirp4netns-1.2.3/configure.ac new/slirp4netns-1.3.0/configure.ac --- old/slirp4netns-1.2.3/configure.ac 2024-02-06 16:26:54.000000000 +0100 +++ new/slirp4netns-1.3.0/configure.ac 2024-04-26 02:18:17.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([slirp4netns], [1.2.3], [https://github.com/rootless-containers/slirp4netns/issues]) +AC_INIT([slirp4netns], [1.3.0], [https://github.com/rootless-containers/slirp4netns/issues]) AC_CONFIG_SRCDIR([main.c]) AC_CONFIG_HEADERS([config.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slirp4netns-1.2.3/main.c new/slirp4netns-1.3.0/main.c --- old/slirp4netns-1.2.3/main.c 2024-02-06 16:26:54.000000000 +0100 +++ new/slirp4netns-1.3.0/main.c 2024-04-26 02:18:17.000000000 +0200 @@ -225,6 +225,7 @@ perror("set route"); goto fail; } + close(sockfd); return 0; fail: close(sockfd); @@ -355,11 +356,11 @@ return fd; } -static int parent(int sock, int ready_fd, int exit_fd, const char *api_socket, +static int parent(int tapfd, int ready_fd, int exit_fd, const char *api_socket, struct slirp4netns_config *cfg, pid_t target_pid) { char str[INET6_ADDRSTRLEN]; - int rc, tapfd; + int rc; struct in_addr vdhcp_end = { #define NB_BOOTP_CLIENTS 16 /* NB_BOOTP_CLIENTS is hard-coded to 16 in libslirp: @@ -367,11 +368,6 @@ .s_addr = htonl(ntohl(cfg->vdhcp_start.s_addr) + NB_BOOTP_CLIENTS - 1), #undef NB_BOOTP_CLIENTS }; - if ((tapfd = recvfd(sock)) < 0) { - return tapfd; - } - fprintf(stderr, "received tapfd=%d\n", tapfd); - close(sock); printf("Starting slirp\n"); printf("* MTU: %d\n", cfg->mtu); printf("* Network: %s\n", @@ -442,7 +438,7 @@ static void usage(const char *argv0) { - printf("Usage: %s [OPTION]... PID|PATH [TAPNAME]\n", argv0); + printf("Usage: %s [OPTION]... PID|PATH|FD [TAPNAME]\n", argv0); printf("User-mode networking for unprivileged network namespaces.\n\n"); printf("-c, --configure bring up the interface\n"); printf("-e, --exit-fd=FD specify the FD for terminating " @@ -461,8 +457,8 @@ printf("--disable-host-loopback prohibit connecting to 127.0.0.1:* on the " "host namespace\n"); /* v0.4.0 */ - printf("--netns-type=TYPE specify network namespace type ([path|pid], " - "default=%s)\n", + printf("--netns-type=TYPE specify network namespace type " + "([path|pid|tapfd], default=%s)\n", DEFAULT_NETNS_TYPE); printf("--userns-path=PATH specify user namespace path\n"); printf( @@ -532,6 +528,7 @@ char *macaddress; // --macaddress char *target_type; // --target-type char *bess_socket; // argv[1] (When --target-type="bess") + int tapfd; // argv[1] (When --netns-type="tapfd") }; static void options_init(struct options *options) @@ -539,6 +536,7 @@ memset(options, 0, sizeof(*options)); options->exit_fd = options->ready_fd = -1; options->mtu = DEFAULT_MTU; + options->tapfd = -1; } static void options_destroy(struct options *options) @@ -828,13 +826,9 @@ fprintf(stderr, "--target-type must be either \"netns\" or \"bess\"\n"); goto error; } - if (argc - optind < 2) { + if (argc - optind < 1) { goto error; } - if (argc - optind > 2) { - // not an error, for preventing potential compatibility issue - printf("WARNING: too many arguments\n"); - } if (!options->netns_type || strcmp(options->netns_type, DEFAULT_NETNS_TYPE) == 0) { errno = 0; @@ -843,6 +837,14 @@ fprintf(stderr, "PID must be a positive integer\n"); goto error; } + } else if (options->netns_type && + strcmp(options->netns_type, "tapfd") == 0) { + errno = 0; + options->tapfd = strtol(argv[optind], &strtol_e, 10); + if (errno || *strtol_e != '\0' || options->tapfd < 0) { + fprintf(stderr, "TAPFD must a file descriptor\n"); + goto error; + } } else { options->netns_path = strdup(argv[optind]); if (access(options->netns_path, F_OK) == -1) { @@ -850,7 +852,21 @@ goto error; } } - options->tapname = strdup(argv[optind + 1]); + if (options->tapfd >= 0) { + if (argc - optind > 1) { + // not an error, for preventing potential compatibility issue + printf("WARNING: too many arguments\n"); + } + } else { + if (argc - optind < 2) { + goto error; + } + if (argc - optind > 2) { + // not an error, for preventing potential compatibility issue + printf("WARNING: too many arguments\n"); + } + options->tapname = strdup(argv[optind + 1]); + } return; error: usage(argv[0]); @@ -1114,7 +1130,7 @@ int main(int argc, char *const argv[]) { int sv[2]; - pid_t child_pid; + pid_t child_pid = -1; struct options options; struct slirp4netns_config slirp4netns_config; int exit_status = 0; @@ -1129,11 +1145,12 @@ exit_status = EXIT_FAILURE; goto finish; } - if ((child_pid = fork()) < 0) { - perror("fork"); - exit_status = EXIT_FAILURE; - goto finish; - } + if (options.tapfd < 0) + if ((child_pid = fork()) < 0) { + perror("fork"); + exit_status = EXIT_FAILURE; + goto finish; + } if (child_pid == 0) { int ret; if (options.target_type != NULL && @@ -1149,28 +1166,40 @@ goto finish; } } else { - int ret, child_wstatus, child_status; - do - ret = waitpid(child_pid, &child_wstatus, 0); - while (ret < 0 && errno == EINTR); - if (ret < 0) { - perror("waitpid"); - exit_status = EXIT_FAILURE; - goto finish; - } - if (!WIFEXITED(child_wstatus)) { - fprintf(stderr, "child failed(wstatus=%d, !WIFEXITED)\n", - child_wstatus); - exit_status = EXIT_FAILURE; - goto finish; - } - child_status = WEXITSTATUS(child_wstatus); - if (child_status != 0) { - fprintf(stderr, "child failed(%d)\n", child_status); - exit_status = child_status; - goto finish; + int tapfd; + if (options.tapfd >= 0) { + tapfd = options.tapfd; + } else { + int ret, child_wstatus, child_status; + do + ret = waitpid(child_pid, &child_wstatus, 0); + while (ret < 0 && errno == EINTR); + if (ret < 0) { + perror("waitpid"); + exit_status = EXIT_FAILURE; + goto finish; + } + if (!WIFEXITED(child_wstatus)) { + fprintf(stderr, "child failed(wstatus=%d, !WIFEXITED)\n", + child_wstatus); + exit_status = EXIT_FAILURE; + goto finish; + } + child_status = WEXITSTATUS(child_wstatus); + if (child_status != 0) { + fprintf(stderr, "child failed(%d)\n", child_status); + exit_status = child_status; + goto finish; + } + if ((tapfd = recvfd(sv[0])) < 0) { + fprintf(stderr, "failed to receive tapfd from child\n"); + exit_status = EXIT_FAILURE; + goto finish; + } + fprintf(stderr, "received tapfd=%d\n", tapfd); + close(sv[0]); } - if (parent(sv[0], options.ready_fd, options.exit_fd, options.api_socket, + if (parent(tapfd, options.ready_fd, options.exit_fd, options.api_socket, &slirp4netns_config, options.target_pid) < 0) { fprintf(stderr, "parent failed\n"); exit_status = EXIT_FAILURE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slirp4netns-1.2.3/slirp4netns.1 new/slirp4netns-1.3.0/slirp4netns.1 --- old/slirp4netns-1.2.3/slirp4netns.1 2024-02-06 16:26:54.000000000 +0100 +++ new/slirp4netns-1.3.0/slirp4netns.1 2024-04-26 02:18:17.000000000 +0200 @@ -8,7 +8,7 @@ .SH SYNOPSIS .PP -slirp4netns [OPTION]... PID|PATH [TAPNAME] +slirp4netns [OPTION]... PID|PATH|FD [TAPNAME] .SH DESCRIPTION @@ -84,7 +84,10 @@ .PP \fB\fC\-\-netns\-type=TYPE\fR (since v0.4.0) -specify network namespace type ([path|pid], default=pid) +specify network namespace type ([path|pid|tapfd], default=pid) + +If the namespace type is tapfd, the first positional argument is expected to be an inherited file descriptor that corresponds to a \fB\fC/dev/net/tun\fR connection. +This conflicts with \fB\fC\-\-configure\fR and a \fB\fcTAPNAME\fR is ignored. .PP \fB\fC\-\-userns\-path=PATH\fR (since v0.4.0)