Multicast problems [PATCH]
Daniel Eischen
deischen at freebsd.org
Tue Jun 19 22:36:47 UTC 2007
On Tue, 19 Jun 2007, Bruce M Simpson wrote:
> Bruce M. Simpson wrote:
>>
>> Here is a patch which explicitly looks for an interface supporting
>> multicast, if no default route exists. The KASSERT should only be triggered
>> if the routing trie code is broken; it is still possible for the
>> last-resort interface lookup to fail if no loopback interface exists, if
>> none of the interfaces have IPv4 addresses, or if no interfaces in the
>> system support multicast.
>
> If this patch solves your problems without resorting to adding a 224/4 route
> then I shall commit it to -CURRENT. It is not relevant to RELENG_6. Please
> let me know...
My system's not up to date enough to test this. I do have a
test program, that if runs, should be good enough.
http://people.freebsd.org/~deischen/test_net.c
gcc -o test_net test_net.c -lpthread
machine1$ ./test_net -c -b 230.0.0.1
machine2$ ./test_net -b 230.0.0.1
Also, on a slightly different topic... I found while compiling
the above test program that socklen_t is uint32_t and that causes
a compile error (seen with -Wall). Solaris has:
ssize_t recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from, int *fromlen);
while we have:
ssize_t recvfrom(int s, void * restrict buf, size_t len, int flags,
struct sockaddr * restrict from, socklen_t * restrict fromlen);
POSIX states that:
o The <sys/socket.h> header shall define the type socklen_t,
which is an integer type of width of at least 32 bits; see
APPLICATION USAGE.
and goes on to state:
o The <sys/socket.h> header shall define the unsigned integer
type sa_family_t.
This seems to imply that our socklen_t should not be an unsigned
integer (uint32_t), but a signed integer. In APPLICATION USAGE,
POSIX states:
To forestall portability problems, it is recommended that
applications not use values larger than 23^1 -1 for the
socklen_t type.
I think we would be more portable if we defined socklen_t to be
int32_t.
--
DE
More information about the freebsd-current
mailing list