Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jul 2012 09:43:32 +0100 (BST)
From:      William Waites <wwaites@tardis.ed.ac.uk>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/170104: error setting source interface in net/mcast-tools, net/mrouted
Message-ID:  <20120724084332.2C4B35E58@gallows.inf.ed.ac.uk>
Resent-Message-ID: <201207240850.q6O8o3iq084359@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         170104
>Category:       ports
>Synopsis:       error setting source interface in net/mcast-tools, net/mrouted
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 24 08:50:03 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     William Waites
>Release:        FreeBSD 8.2-RELEASE amd64
>Organization:
University of Stirling
>Environment:
System: FreeBSD gallows.inf.ed.ac.uk 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64


>Description:
	Some of the older multicast utilities, such as mcastread and
	mcastsend from net/mcast-tools as well as the net/mrouted DVMRP
	routing daemon seem to use what must be an old convention for
	determining the source address to use. From mcastread.c,

		ifindex = if_nametoindex(ifname);

		...

		/* XXX uses "0.0.0.0/8 for interface index" API */ 
		a.s_addr = htonl(ifindex);
		if (setsockopt(so, IPPROTO_IP, IP_MULTICAST_IF,   
		    &a, sizeof(a)) < 0) {
			emsg = "setsockopt(IP_MULTICAST_IF)";
			if (vflag)
				warn("%s", emsg);
			close(so);
			so = -1;
			continue;
		}

	the comment suggests what is happening here. Nevertheless,
	the value that is placed in a.s_addr should be an IP address
	that is configured on the system. Done this way it always
	fails.
     
>How-To-Repeat:

	# mcastread -v -4 vr0 234.194.35.194 6666
	mcastread: trying 234.194.35.194
	mcastread: setsockopt(IP_MULTICAST_IF): Can't assign requested address
	mcastread: can't allocate socket

	Changing the a.s_addr assignment, for example hardcoding
	to the result of inet_addr("192.0.2.1") makes the program
	work.

>Fix:

	All the affected programs need fixed, because they tend to
	use the device directly on the command line or in the configuration
	file, either their command-line syntax needs changed or some
	calls to getifaddrs(3) to determine a suitable address need to
	be made, and the results used in this setsockopt call. 

	No patch as of yet...

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

>Release-Note:
>Audit-Trail:
>Unformatted:



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