Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Dec 2008 07:50:09 +0200
From:      Ian FREISLICH <ianf@clue.co.za>
To:        Sergey Matveychuk <sem@FreeBSD.org>
Cc:        Gerald Pfeifer <gerald@pfeifer.com>, Vladimir Grebenschikov <vova@fbsd.ru>, Kip Macy <kip.macy@gmail.com>, Qing Li <qingli@freebsd.org>, freebsd-current@freebsd.org, freebsd-net@freebsd.org
Subject:   Re: HEADSUP: arp-v2 has been committed 
Message-ID:  <E1LF09h-0004XQ-O2@clue.co.za>
In-Reply-To: <494FAFAC.90802@FreeBSD.org> 
References:  <494FAFAC.90802@FreeBSD.org>  <E1LEfm2-000BPk-Rs@clue.co.za> 

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1LF09h-0004XQ-O2>