From owner-freebsd-net@FreeBSD.ORG Sat Apr 12 16:42:44 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B2A3106564A for ; Sat, 12 Apr 2008 16:42:44 +0000 (UTC) (envelope-from tmm@fastmail.fm) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id CE1018FC16 for ; Sat, 12 Apr 2008 16:42:43 +0000 (UTC) (envelope-from tmm@fastmail.fm) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 62FEBECC07 for ; Sat, 12 Apr 2008 12:27:10 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Sat, 12 Apr 2008 12:27:10 -0400 X-Sasl-enc: w/v+prkZYslqAj91EbjM0oOHwtd8xYpje7ONjACb1+oo 1208017630 Received: from [192.168.11.4] (bas4-toronto46-1279334009.dsl.bell.ca [76.65.22.121]) by mail.messagingengine.com (Postfix) with ESMTPSA id F2331D5E2 for ; Sat, 12 Apr 2008 12:27:09 -0400 (EDT) Message-ID: <4800E2D5.20107@fastmail.fm> Date: Sat, 12 Apr 2008 12:27:01 -0400 From: tmm User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Subject: Howto send a limited broadcast? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2008 16:42:44 -0000 Hi. I'm using the FreeBSD network stack (on top of the eCos embedded OS), and I want to send a limited broadcast (a broadcast with destination IP of 255.255.255.255). Normally (I believe) the stack will only send a broadcast like this if there is no subnet mask set on the interface, or an all zeros mask (this is how bootp/dhcp work). Once I set a normal subnet mask, the stack will change my broadcasts into subnet broadcasts, eg. 192.168.0.255. In my situation the interface is active, so I can't just remove the netmask - I must find another way to send the limited broadcast. When the interface gets setup with IP and netmask it creates a default broadcast address. If I override this and set it to 255.255.255.255 (using SIOCSIFBRDADDR), then it will try to send my limited broadcast as is, rather then changing it into a subnet braodcast. Unforunately this fails, because there is no route available that matches this destination. Okay, so just add a route? But when I try to add a route that would match 255.255.255.255 it gets rejected – it is not valid for the interface as currently configured. The next step – which I would rather avoid - is modify the ip code. If the SO_DONTROUTE/IP_ROUTETOIF flag is set then you only need a route in order to pick an interface, not for any actual routing. So, I could add some code to manually pick an interface (even though none really match my destination address). But I’d rather avoid changing the code. So, can anyone suggest how I can send a limited broadcast (on an interface that has been initalized with an IP and a subnet)? Thanks for any suggestions. Tom.