Date: Sat, 12 Apr 2008 12:27:01 -0400 From: tmm <tmm@fastmail.fm> To: freebsd-net@freebsd.org Subject: Howto send a limited broadcast? Message-ID: <4800E2D5.20107@fastmail.fm>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4800E2D5.20107>