From nobody Wed Feb 15 21:45:19 2023 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PHBSy40Mqz3rNj3 for ; Wed, 15 Feb 2023 21:45:22 +0000 (UTC) (envelope-from johnl@iecc.com) Received: from gal.iecc.com (gal.iecc.com [IPv6:2001:470:1f07:1126:0:43:6f73:7461]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "gal.iecc.com", Issuer "Let's Encrypt Authority X3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PHBSy1R93z3P7v for ; Wed, 15 Feb 2023 21:45:22 +0000 (UTC) (envelope-from johnl@iecc.com) Authentication-Results: mx1.freebsd.org; none Received: (qmail 4507 invoked from network); 15 Feb 2023 21:45:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=iecc.com; h=date:message-id:from:to:cc:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:cleverness; s=1199.63ed5271.k2302; bh=AjAsBW63NdS0Zd3NUwQK1qjGLN82ERSviNY/s5L5NjI=; b=pQFQEX/8Scm12HV3ngWen5aIZJemKL9B/gTUjDFUi3sLGQE3Gi7hMqvXb83nNm4CgD5K0qhlvszVpQ6/ttDbh05aaMzE4oJlUBoE+UfBe4PbC6kPZFmHKGfhdyhWMUtBjJyRH+w2spysnMyd6CZy4JD938vVym0f1LHVvXj+Lw8fJpeVxByxcU6eYS59fMVyKLVyibSosRY8m39D3zWO3aYLPRV3bny1my1ou8JYKRL7Spo7voinLFoM7lQGGUhVTRG5wzgEuxHAPyfCM6igqOfWxiHa+NtAnSwL0za2S7gIgfgLHMQZzbfdCWXY/ZEiuzgO83JIA9Gu9ypdmwZ87g== Received: from ary.qy ([IPv6:2001:470:1f07:1126::78:696d:6170]) by imap.iecc.com ([IPv6:2001:470:1f07:1126::78:696d:6170]) with ESMTPS (TLS1.3 ECDHE-RSA AES-256-GCM AEAD) via TCP6; 15 Feb 2023 21:45:20 -0000 Received: by ary.qy (Postfix, from userid 501) id C9CC199766DF; Wed, 15 Feb 2023 16:45:19 -0500 (EST) Date: 15 Feb 2023 16:45:19 -0500 Message-Id: <20230215214519.C9CC199766DF@ary.qy> From: "John Levine" To: freebsd-questions@freebsd.org Cc: possessor.assizer305@aceecat.org Subject: Re: Source IP selection In-Reply-To: <20230215174535.jlxuis3xwhxee3bq@beesty.loosely.org> Organization: Taughannock Networks X-Headerized: yes Cleverness: minimal List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org Mime-Version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8bit X-Rspamd-Queue-Id: 4PHBSy1R93z3P7v X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N It appears that Ian Zimmerman said: >Hello, >how is the source IP address selected for an unbound socket, if there >are multiple addresses (ie. aliases) configured on the outgoing >interface? I am interested in particular in the UDP case, ie. >the sendto() syscall. >This is almost the question at the following link but ... not about >THAT kernel but FreeBSD. > >https://stackoverflow.com/questions/63955841/how-does-tcp-ip-select-a-source-ip-address Same answer, use bind() if you want to bind to a specific address. R's, John