Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 2009 08:21:56 -0800
From:      "Peter Steele" <psteele@maxiscale.com>
To:        "Pieter de Goeje" <pieter@degoeje.nl>, <freebsd-questions@freebsd.org>
Subject:   RE: Do UDP broadcasts work in FreeBSD?
Message-ID:  <2ACA3DE8F9758A48B8BE2C7A847F91F2479F8A@polaris.maxiscale.com>
In-Reply-To: <200901081010.45049.pieter@degoeje.nl>
References:  <2ACA3DE8F9758A48B8BE2C7A847F91F2479DF3@polaris.maxiscale.com> <200901081010.45049.pieter@degoeje.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
>Did you enable SO_BROADCAST and IP_ONESBCAST on the socket? I remember
needing=20
>this on FreeBSD but not on Linux.

Yes we did, but...

>I know UDP broadcasting works fine, but is=20
>somewhat more involved:
>
>addr.sin_family =3D AF_INET;
>addr.sin_addr.s_addr =3D inet_addr("130.89.191.255");
>addr.sin_port =3D htons(UDP_PORT_ET);

You are using a subnet broadcast here. We are dealing with systems that
do not have IPs assigned, and as a result we have to send our broadcasts
to 255.255.255.255. This works fine on other operating systems but for
some reason the implementation is different on FreeBSD. It appears that
the only way this kind of broadcast can be sent on FreeBSD is using raw
sockets. This is how the FreeBSD DHCP client/server is written, so we're
taking that approach as well...





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2ACA3DE8F9758A48B8BE2C7A847F91F2479F8A>