From owner-freebsd-isp Sat Jun 30 11:38:36 2001 Delivered-To: freebsd-isp@freebsd.org Received: from softweyr.com (softweyr.com [208.247.99.111]) by hub.freebsd.org (Postfix) with ESMTP id 79F7737B710; Sat, 30 Jun 2001 11:03:58 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from localhost.softweyr.com ([127.0.0.1] helo=softweyr.com ident=c39f7bcab758238b869b8ffa170e8727) by softweyr.com with esmtp (Exim 3.16 #1) id 15GOdH-00008m-00; Sat, 30 Jun 2001 11:34:11 -0600 Message-ID: <3B3E0D93.79738728@softweyr.com> Date: Sat, 30 Jun 2001 11:34:11 -0600 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Igor Podlesny Cc: freebsd-hackers@FreeBSD.ORG, freebsd-isp@freebsd.org Subject: Re: Flight of the rat, living wreck..... References: <754836544.20010630185133@morning.ru> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Igor Podlesny wrote: > > /* > > * Macro for finding the interface (ifnet structure) corresponding to one > > * of our IP addresses. > > */ > > #define INADDR_TO_IFP(addr, ifp) \ > > /* struct in_addr addr; */ \ > > /* struct ifnet *ifp; */ \ > > { \ > > register struct in_ifaddr *ia; \ > > \ > > for (ia = in_ifaddrhead.tqh_first; \ > > // so here we start looking through the queue > > > ia != NULL > > // sanity (I'd have written just (ia)) > > > && ((ia->ia_ifp->if_flags & IFF_POINTOPOINT)? \ > > // hm. special case if the interface is PTP > > > IA_DSTSIN(ia):IA_SIN(ia))->sin_addr.s_addr != (addr).s_addr; \ > > // so it is like: if it is PTP, then we using DST address in comparison > // with addr.s_addr > > // it is the time I started to ask myself why it is so? why we're (ok, > // they're) checking for remote ip-address if the head comment > // says: > // * Macro for finding the interface (ifnet structure) corresponding to one > // * of our IP addresses. > // ^^^ > // ^^^ With point-to-point connections, the address at the opposite end of the connection is always used in the route table. When the interface is created as a point-to-point interface, a route is automatically entered from the local address to the opposite address. The "corresponding" in the comment at the beginning of the macro is interpreted rather loosely. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message