On 7 November 2010 06:16, dv <d...@pseudoterminal.org> wrote:

>  ifconfig tells me that multicast is enabled for eth1, but not for lo. With
> purinrecv, I always get the same result, which is pasted below.
>

Can you try the attached test program, pumpkin.c.  It iterates a million
times looking for eth1 with multicast flag set.


>  One interesting thing is the first line - it always appears, does it mean
> anything? :)
>

It means "pudding", as in http://i.imgur.com/nJWjJ.jpg


> Oh, and one other thing I've noticed is that sometimes it takes up to a
> second for connect() to finish. Most of the time its done nearly instantly,
> though.
>

Would need some profiling as anything touching the networking stack or
filing system has potential to randomly block, common causes a normally NSS
lookups.

I would suggest try using the interface IP address instead of the adapter
name for a test run.

-- 
Steve-o
/* Verify multicast interface flag on enumeration.
 */

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <ifaddrs.h>
#include <net/if.h>

#define TEST_ITERATION_COUNT	1000 * 1000

int one_iteration (const char* ifname)
{
	struct ifaddrs *ifaddr, *ifa;
	int interface_matches = 0;
	int status = EXIT_SUCCESS;

	if (-1 == getifaddrs (&ifaddr)) {
		perror ("getifaddrs");
		return EXIT_FAILURE;
	}

	for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
		if (NULL == ifa->ifa_addr)
			continue;
		switch (ifa->ifa_addr->sa_family) {
/* ignore raw entries on Linux */
#ifdef AF_PACKET
		case AF_PACKET:
			continue;
#endif
		case AF_INET:
			break;
		default:
			continue;
		}
		if (0 != strcmp (ifname, ifa->ifa_name))
			continue;
		if ((ifa->ifa_flags & IFF_LOOPBACK) || !(ifa->ifa_flags & IFF_MULTICAST)) {
			printf ("ifa_flags %d.\n", ifa->ifa_flags);
			status = EXIT_FAILURE;
			continue;
		}
		if (interface_matches++) {
			puts ("duplicate matching interface.");
			status = EXIT_FAILURE;
			break;
		}
	}

	if (0 == interface_matches) {
		puts ("no matching interface found.");
		status = EXIT_FAILURE;
	}

	freeifaddrs (ifaddr);
	return status;
}

int main (void)
{
	const char ifname[] = "eth1";
	int i;

	for (i = TEST_ITERATION_COUNT; i; i--)
		assert (EXIT_SUCCESS == one_iteration (ifname));
	return EXIT_SUCCESS;
}
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to