Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jan 2002 06:00:10 -0800 (PST)
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/33747: bug in rt socket
Message-ID:  <200201111400.g0BE0A743616@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/33747; it has been noted by GNATS.

From: Ruslan Ermilov <ru@FreeBSD.org>
To: Jan Oravec <wsx@wsx6.net>
Cc: bug-followup@FreeBSD.org, net@FreeBSD.org
Subject: Re: kern/33747: bug in rt socket
Date: Fri, 11 Jan 2002 15:52:00 +0200

 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-bugs" in the body of the message




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