From owner-freebsd-net Fri Jan 11 5:53:25 2002 Delivered-To: freebsd-net@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 1769737B4D3; Fri, 11 Jan 2002 05:53:03 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g0BDq0C54304; Fri, 11 Jan 2002 15:52:00 +0200 (EET) (envelope-from ru) Date: Fri, 11 Jan 2002 15:52:00 +0200 From: Ruslan Ermilov To: Jan Oravec Cc: bug-followup@FreeBSD.org, net@FreeBSD.org Subject: Re: kern/33747: bug in rt socket Message-ID: <20020111155200.B49408@sunbay.com> References: <200201100103.g0A13Mw46469@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200201100103.g0A13Mw46469@freefall.freebsd.org> User-Agent: Mutt/1.3.23i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, Jan 09, 2002 at 05:03:22PM -0800, Jan Oravec wrote: > > there is a bug in rt socket in kernel, file net/rtsock.c: > > function rt_ifmsg contains: > ifm->ifm_addrs = 0; > > we should set RTA_IFP attribute instead and send interface name, > because information that some interface has been created without > name of interface is unusable. > I wouldn't call it a bug, but rather a design issue. In BSD, rt_ifmsg() doesn't set any sockaddrs, and this is documented in Stevens' TCP/IP Illustrated Vol. 2 on the bottom of page 627. What made you think we SHOULD supply IFP to this message? Usually, daemons remember interface index (see natd(8) for a working example), and on receipt of an RTM_IFINFO message with a matching ifm_index, some actions take place. > openbsd haven't this bug > I've looked into the latest revisions of rtsock.c in OpenBSD, NetBSD and BSD/OS; they all do not seem to set any sockaddrs in "info" before calling rt_msg1(), and all set ifm_addrs = 0. Are you sure you're not looking at some locally modified OpenBSD sources? > >Fix: > ifm->ifm_addrs = RTA_IFP; > and some other code to send name of interface... > The fix is rather trivial but I don't think we should commit it, for the reasons specified above. Index: rtsock.c =================================================================== RCS file: /home/ncvs/src/sys/net/rtsock.c,v retrieving revision 1.63 diff -u -p -r1.63 rtsock.c --- rtsock.c 2001/12/19 16:05:27 1.63 +++ rtsock.c 2002/01/11 13:51:29 @@ -747,6 +747,7 @@ rt_ifmsg(ifp) if (route_cb.any_count == 0) return; bzero((caddr_t)&info, sizeof(info)); + ifpaddr = TAILQ_FIRST(&ifp->if_addrhead)->ifa_addr; m = rt_msg1(RTM_IFINFO, &info); if (m == 0) return; @@ -754,7 +755,7 @@ rt_ifmsg(ifp) ifm->ifm_index = ifp->if_index; ifm->ifm_flags = (u_short)ifp->if_flags; ifm->ifm_data = ifp->if_data; - ifm->ifm_addrs = 0; + ifm->ifm_addrs = info.rti_addrs; route_proto.sp_protocol = 0; raw_input(m, &route_proto, &route_src, &route_dst); } Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message