From owner-freebsd-questions Tue Aug 27 5:27:36 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EE01837B400 for ; Tue, 27 Aug 2002 05:27:32 -0700 (PDT) Received: from gw.smarts-gsm.ru (gw.smarts-gsm.ru [194.190.8.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 22A5443E4A for ; Tue, 27 Aug 2002 05:27:30 -0700 (PDT) (envelope-from vss@gw.smarts-gsm.ru) Received: (from vss@localhost) by gw.smarts-gsm.ru (8.11.3/8.11.0-vlm) id g7RCROX80197 for freebsd-questions@freebsd.org.AVP; Tue, 27 Aug 2002 16:27:24 +0400 (MSD) (envelope-from vss@gw.smarts-gsm.ru) X-Authentication-Warning: ns.smarts-gsm.ru: vss set sender to vss@gw.smarts-gsm.ru using -f Received: (from vss@localhost) by gw.smarts-gsm.ru (8.11.3/8.11.0-vlm) id g7RCRNK80079 for freebsd-questions@freebsd.org; Tue, 27 Aug 2002 16:27:23 +0400 (MSD) (envelope-from vss@gw.smarts-gsm.ru) Date: Tue, 27 Aug 2002 16:27:23 +0400 From: Vlad Skvortsov To: freebsd-questions@freebsd.org Subject: INADDR_ANY and assigning source address of outgoing packets Message-ID: <20020827162723.W96508@smarts-gsm.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [please CC: me] Hi ! This question is related to my previous posting. I've digged into that problem and half-solved it. My solution is not complete due to some unconfigurable tools I use that cannot be told to bind() to specified address before establishing connection. I think that in heterogenous complex environments it would be a good help to administator if there would be a way of establishing some kind of map/table for source address selection if a socket is unbound. For example, in my case this would eliminate all hacks and tricks. I would just add several entries: 192.168.0.0/16 -> 192.168.0.103 10.0.0.0/8 -> 192.168.0.103 default -> 193.125.154.4 (taking in mind that the single rl0 interface has both 192.168.0.103 and 193.125.154.4 configured). The schema would work something like this. If socket is not bound and connect() is called, then we should use the mapping table shown above to select source address (of course sanity checks are to be implemented to see if all addresses in that map table do exist). If there is no default entry in map table, then use original method of assigning address based on interfaces configuration. Any thoughts ? I think I would be able to try to implement that if this is considered okay. -- Vlad Skvortsov, vss@smarts-gsm.ru, vss@high.net.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message