Re: Multicast problems [PATCH]

From: Daniel Eischen <deischen_at_freebsd.org>
Date: Tue, 19 Jun 2007 18:36:39 -0400 (EDT)
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
Received on Tue Jun 19 2007 - 20:36:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:12 UTC