From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH 01/18] slirp4netns: Look up pasta command, exit if not found
Date: Tue, 22 Feb 2022 02:34:17 +0100 [thread overview]
Message-ID: <20220222013434.4116044-2-sbrivio@redhat.com> (raw)
In-Reply-To: <20220222013434.4116044-1-sbrivio@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]
Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
slirp4netns.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/slirp4netns.sh b/slirp4netns.sh
index de74281..e6a6049 100755
--- a/slirp4netns.sh
+++ b/slirp4netns.sh
@@ -17,7 +17,10 @@
PASTA_PID="$(mktemp)"
PASTA_OPTS="-q --ipv4-only -a 10.0.2.0 -n 24 -g 10.0.2.2 -m 1500 --no-ndp --no-dhcpv6 --no-dhcp -P ${PASTA_PID}"
+PASTA="$(command -v ./pasta || command -v pasta || :)"
+
USAGE_RET=1
+NOTFOUND_RET=127
# add() - Add single option to $PASTA_OPTS
# $1: Option name, with or without argument
@@ -161,6 +164,8 @@ no_map_gw=0
EFD=0
RFD=0
+[ -z "${PASTA}" ] && echo "pasta command not found" && exit ${NOTFOUND_RET}
+
while getopts ce:r:m:6a:hv-: OPT 2>/dev/null; do
if [ "${OPT}" = "-" ]; then
OPT="${OPTARG%%[= ]*}"
@@ -198,7 +203,7 @@ if [ ${v6} -eq 1 ]; then
add "-a $(gen_addr6) -g fd00::2 -D fd00::3"
fi
-./pasta ${PASTA_OPTS} ${ns_spec} 2>/dev/null && \
+${PASTA} ${PASTA_OPTS} ${ns_spec} && \
[ ${RFD} -ne 0 ] && echo "1" >&${RFD}
trap "kill $(cat ${PASTA_PID}); rm ${PASTA_PID}" INT TERM
--
@@ -17,7 +17,10 @@
PASTA_PID="$(mktemp)"
PASTA_OPTS="-q --ipv4-only -a 10.0.2.0 -n 24 -g 10.0.2.2 -m 1500 --no-ndp --no-dhcpv6 --no-dhcp -P ${PASTA_PID}"
+PASTA="$(command -v ./pasta || command -v pasta || :)"
+
USAGE_RET=1
+NOTFOUND_RET=127
# add() - Add single option to $PASTA_OPTS
# $1: Option name, with or without argument
@@ -161,6 +164,8 @@ no_map_gw=0
EFD=0
RFD=0
+[ -z "${PASTA}" ] && echo "pasta command not found" && exit ${NOTFOUND_RET}
+
while getopts ce:r:m:6a:hv-: OPT 2>/dev/null; do
if [ "${OPT}" = "-" ]; then
OPT="${OPTARG%%[= ]*}"
@@ -198,7 +203,7 @@ if [ ${v6} -eq 1 ]; then
add "-a $(gen_addr6) -g fd00::2 -D fd00::3"
fi
-./pasta ${PASTA_OPTS} ${ns_spec} 2>/dev/null && \
+${PASTA} ${PASTA_OPTS} ${ns_spec} && \
[ ${RFD} -ne 0 ] && echo "1" >&${RFD}
trap "kill $(cat ${PASTA_PID}); rm ${PASTA_PID}" INT TERM
--
2.34.1
next prev parent reply other threads:[~2022-02-22 1:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 1:34 [PATCH 00/18] slirp4netns, sandboxing, Podman integration, assorted fixes Stefano Brivio
2022-02-22 1:34 ` Stefano Brivio [this message]
2022-02-22 1:34 ` [PATCH 02/18] slirp4netns: Add EXIT as condition for trap Stefano Brivio
2022-02-22 1:34 ` [PATCH 03/18] passt, pasta: Namespace-based sandboxing, defer seccomp policy application Stefano Brivio
2022-02-22 1:34 ` [PATCH 04/18] passt: Make process not dumpable after sandboxing Stefano Brivio
2022-02-22 1:34 ` [PATCH 05/18] Makefile, conf, passt: Drop passt4netns references, explicit argc check Stefano Brivio
2022-02-22 1:34 ` [PATCH 06/18] slirp4netns.sh: Implement API socket option for port forwarding Stefano Brivio
2022-02-22 1:34 ` [PATCH 07/18] conf: Don't print configuration on --quiet Stefano Brivio
2022-02-22 1:34 ` [PATCH 08/18] conf: Given IPv4 address and no netmask, assign RFC 790-style classes Stefano Brivio
2022-02-22 1:34 ` [PATCH 09/18] conf, udp: Introduce basic DNS forwarding Stefano Brivio
2022-02-22 1:34 ` [PATCH 10/18] udp: Allow loopback connections from host using configured unicast address Stefano Brivio
2022-02-22 1:34 ` [PATCH 11/18] tcp, udp: Receive batching doesn't pay off when writing single frames to tap Stefano Brivio
2022-02-22 1:34 ` [PATCH 12/18] pasta: By default, quit if filesystem-bound net namespace goes away Stefano Brivio
2022-02-22 1:34 ` [PATCH 13/18] test/distro/ubuntu: Use DEBIAN_FRONTEND=noninteractive for apt on 22.04 Stefano Brivio
2022-02-22 1:34 ` [PATCH 14/18] test/perf/passt_udp: Drop threshold for 256B test Stefano Brivio
2022-02-22 1:34 ` [PATCH 15/18] man page: Update REPORTING BUGS section Stefano Brivio
2022-02-22 1:34 ` [PATCH 16/18] README, hooks: Build HTML man page on push, add a link Stefano Brivio
2022-02-22 1:34 ` [PATCH 17/18] contrib: Add patch for Podman integration Stefano Brivio
2022-02-22 1:34 ` [PATCH 18/18] test: Add demo for Podman with pasta Stefano Brivio
2022-02-22 9:07 ` [PATCH 00/18] slirp4netns, sandboxing, Podman integration, assorted fixes Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220222013434.4116044-2-sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).