Re: HEADSUP: arp-v2 has been committed

From: Ian FREISLICH <ianf_at_clue.co.za>
Date: Tue, 23 Dec 2008 07:50:09 +0200
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
> > _at__at_ -231,6 +231,7 _at__at_
> >        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
_at__at_ -227,9 +227,11 _at__at_
       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
Received on Tue Dec 23 2008 - 04:50:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:39 UTC