On 2/17/07, Bruce M. Simpson <[EMAIL PROTECTED]> wrote:
Jouke Witteveen wrote:
>
> So my apologies for suggesting it doesn't work at all; it seems that
> the application I'm trying to get to work (wpa_supplicant for wired
> interfaces) just doesn't _send_ its packets the right way.
That's a big relief! I added an item to the Wiki for someone to write a
regression test.
>
> Things aren't perfect though. In if.c the if_findmulti function is
> broken (always returns NULL). I presume just comparing the
> *LLADDR((sockaddr *)sa) data on both sockets is a better check, though
> my knowledge on these things is limited.
I think I see a possible problem, though the code looks as though it is
behaving as expected.
I am looking at RELENG_6 if.c. I think sa_equal() may be to blame.

sa_equal() performs a binary comparison on all of sa_data up to sa_len.
Looking at struct sockaddr_dl, this might not be the right thing at all
in that situation... though I need another pair of eyes to look. Can
anyone shed light on this? An AF_INET and AF_INET6 address can be
completely specified and compared with sa_equal(). An AF_LINK address
looks as though sa_equal() may return irrational results.
>
> As for netstat, I do not really know what is keeping it from showing
> the Multicast addresses. Again: my knowledge on this matter is
> limited. All I can think of is that getifmaddrs is forgetting
> something (perhaps the lack of a group membership). Maybe you can take
> a look at it (I believe you wrote it).

I wrote the libc getifmaddrs() function and integrated it into netstat
-g; Harti Brandt wrote the NET_RT_IFMALIST support. getifmaddrs()
*should* return sockaddr_dl as well as sockaddr_in and all the others.

netstat skips over AF_LINK addresses. Try this patch to reveal them. It
doesn't seem to show the IPv4 link layer memberships underneath, which
is interesting...
>
> As I am still learning how best to contribute to a project as big as
> FreeBSD and I do not think I am skilled enough yet in C I refrain from
> writing a patch. I am eager to see one though, be it only out of
> curiosity to know what would be considered a proper fix.
Give it a try anyway!  I like to think we have strong healthy egos round
here.

Regards,
BMS


Thanks for that enormous stimulation; it really gave me some
confidence. I have (before I saw your ethermcast.diff patch) been
trying some things too and found that the patch attached did the job
for me. As for now I haven't found any glitches yet as a result of
this change. I notice however that you have probably foreseen quite
some situations with your patch, since it looks far more complex than
mine. However I'm pleased to see I managed to get something done
myself.

As for the netstat patch: it works like a shine! Very nicely done (ie: thanks).

I will now try to make the wired driver of wpa_supplicant work in
FreeBSD (it still isn't able to send/receive packages properly), as
that is what started this whole bug-hunt of mine.

Thanks again for your help and motivation.

Regards,
- Jouke
--- if.c.orig	Wed Feb 15 04:37:15 2006
+++ if.c	Thu Feb 22 09:12:11 2007
@@ -1838,11 +1838,17 @@
 if_findmulti(struct ifnet *ifp, struct sockaddr *sa)
 {
 	struct ifmultiaddr *ifma;
+	caddr_t data = LLADDR((struct sockaddr_dl *)sa);
 
 	IF_ADDR_LOCK_ASSERT(ifp);
 
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-		if (sa_equal(ifma->ifma_addr, sa))
+		/*
+		 * In multicasting we are only interested in the address value
+		 * obtained with LLADDR().
+		 */
+		if (bcmp(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), data,
+		    ETHER_ADDR_LEN) == 0)
 			break;
 	}
 
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to