From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 829355A005E for ; Tue, 11 Oct 2022 13:59:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665489586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1eEtUZvzJuRIKzprB0Xxe565ritcoJ3qOMTbyc+pnP4=; b=WQ3XkLKoSruLgvwQb0eGVWM0j8pkzYiuHVuv3aRFMb4X1CTQvghTIT84zTrp2lUYE52yVC 88yqto9xyhmH9rwYjDsdkKef9Cks9z8SzeibNzMHEC9hGrS1ZpuU6kLqJpL4ex8iSZGaWB 7AIKtDBmQ0G+PnMASrvL+jwXqt6xb+g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-rufitEwTN-us-FbMPuAv1w-1; Tue, 11 Oct 2022 07:59:44 -0400 X-MC-Unique: rufitEwTN-us-FbMPuAv1w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51287101A528; Tue, 11 Oct 2022 11:59:44 +0000 (UTC) Received: from maya.cloud.tilaa.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09F191402BDC; Tue, 11 Oct 2022 11:59:43 +0000 (UTC) Date: Tue, 11 Oct 2022 13:59:38 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v3] conf, tcp, udp: Allow specification of interface to bind to Message-ID: <20221011135938.52903640@elisabeth> In-Reply-To: References: <20221010233220.1198263-1-sbrivio@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: BVL7I6LSQ36WUKNSSWBCCYJV2ZNUBPL3 X-Message-ID-Hash: BVL7I6LSQ36WUKNSSWBCCYJV2ZNUBPL3 X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: <> Archived-At: List-Archive: <> List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 11 Oct 2022 11:48:20 +1100 David Gibson wrote: > On Tue, Oct 11, 2022 at 01:32:20AM +0200, Stefano Brivio wrote: > > > [...] > > > > @@ -231,6 +231,14 @@ static int conf_ports(const struct ctx *c, char optname, const char *optarg, > > if (optname != 't' && optname != 'u') > > goto bad; > > > > + if ((ifname = strchr(buf, '%'))) { > > + if (spec - ifname >= IFNAMSIZ - 1) > > + goto bad; > > + > > + *ifname = 0; > > + ifname++; > > + } > > + > > if (inet_pton(AF_INET, buf, addr)) > > af = AF_INET; > > else if (inet_pton(AF_INET6, buf, addr)) > > @@ -278,9 +286,9 @@ static int conf_ports(const struct ctx *c, char optname, const char *optarg, > > bitmap_set(fwd->map, i); > > > > if (optname == 't') > > - tcp_sock_init(c, 0, af, addr, i); > > + tcp_sock_init(c, 0, af, addr, NULL, i); > > else if (optname == 'u') > > - udp_sock_init(c, 0, af, addr, i); > > + udp_sock_init(c, 0, af, addr, NULL, i); > > AFAICT nothing prevents specifying an interface with the exclude only > case, in which case shouldn't you also be passing ifname here? Right, good catch, I'll fix that. -- Stefano