Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2007 18:36:39 -0400 (EDT)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Bruce M Simpson <bms@incunabulum.net>
Cc:        Poul-Henning Kamp <phk@phk.freebsd.dk>, Ian FREISLICH <ianf@clue.co.za>, current@freebsd.org
Subject:   Re: Multicast problems [PATCH]
Message-ID:  <Pine.GSO.4.64.0706191823040.1099@sea.ntplx.net>
In-Reply-To: <4678529A.3080308@incunabulum.net>
References:  <E1I0E3b-0000kk-Ky@clue.co.za> <46765CB9.9020105@incunabulum.net> <Pine.GSO.4.64.0706180833080.23884@sea.ntplx.net> <4676C30E.7040300@incunabulum.net> <Pine.GSO.4.64.0706181344060.24865@sea.ntplx.net> <4676C952.5000607@incunabulum.net> <4676D168.3050502@incunabulum.net> <4678529A.3080308@incunabulum.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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