From owner-freebsd-net@FreeBSD.ORG Tue Dec 23 05:50:18 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EF981065673; Tue, 23 Dec 2008 05:50:18 +0000 (UTC) (envelope-from ianf@clue.co.za) Received: from inbound01.jnb1.gp-online.net (inbound01.jnb1.gp-online.net [41.161.16.135]) by mx1.freebsd.org (Postfix) with ESMTP id CB8B88FC30; Tue, 23 Dec 2008 05:50:17 +0000 (UTC) (envelope-from ianf@clue.co.za) Received: from [41.241.101.159] (helo=clue.co.za) by inbound01.jnb1.gp-online.net with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1LF09n-0001Jz-1D; Tue, 23 Dec 2008 07:50:15 +0200 Received: from localhost ([127.0.0.1] helo=clue.co.za) by clue.co.za with esmtp (Exim 4.69 (FreeBSD)) (envelope-from ) id 1LF09h-0004XQ-O2; Tue, 23 Dec 2008 07:50:09 +0200 To: Sergey Matveychuk From: Ian FREISLICH In-Reply-To: <494FAFAC.90802@FreeBSD.org> References: <494FAFAC.90802@FreeBSD.org> X-Attribution: BOFH Date: Tue, 23 Dec 2008 07:50:09 +0200 Message-Id: Cc: Gerald Pfeifer , Vladimir Grebenschikov , Kip Macy , Qing Li , freebsd-current@freebsd.org, freebsd-net@freebsd.org Subject: Re: HEADSUP: arp-v2 has been committed X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2008 05:50:18 -0000 Sergey Matveychuk wrote: > Ian FREISLICH wrote: > > --- lib/sockopt.c.orig 2007-08-21 18:32:56.000000000 +0200 > > +++ lib/sockopt.c 2008-08-13 09:07:20.000000000 +0200 > > @@ -231,6 +231,7 @@ > > else > > mreqn.imr_address = if_addr; > > > > + mreqn.imr_address = if_addr; > > ret = setsockopt(sock, IPPROTO_IP, optname, > > (void *)&mreqn, sizeof(mreqn)); > > if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) && (errno == EADDRIN USE)) > > > > I don't catch your idea here. Can you explain it please? I can't quite remember exactly why imr_ifindex doesn't work, but on my hosts which have several hundred interfaces and my OSPF sessions are never on the interface that has the default route, until I explicitly set the imr_address, the kernel always chooses the interface which has the default route. I know the resultant code looks ugly. I've just never had the time to relook the problem. Does this look better? --- sockopt.c.orig 2008-12-23 07:00:24.000000000 +0200 +++ sockopt.c 2008-12-23 07:41:28.000000000 +0200 @@ -227,9 +227,11 @@ if (mcast_addr) mreqn.imr_multiaddr.s_addr = mcast_addr; +#if OSVERSION > 700001 if (ifindex) mreqn.imr_ifindex = ifindex; else +#endif mreqn.imr_address = if_addr; ret = setsockopt(sock, IPPROTO_IP, optname, Ian -- Ian Freislich