From owner-freebsd-net Wed Jan 8 12:28:30 2003 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 847BA37B401 for ; Wed, 8 Jan 2003 12:28:28 -0800 (PST) Received: from mel-rto4.wanadoo.fr (smtp-out-4.wanadoo.fr [193.252.19.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8259D43EE6 for ; Wed, 8 Jan 2003 12:28:27 -0800 (PST) (envelope-from vjardin@wanadoo.fr) Received: from mel-rta7.wanadoo.fr (193.252.19.61) by mel-rto4.wanadoo.fr (6.7.015) id 3E0C33FD0067FD80 for net@freebsd.org; Wed, 8 Jan 2003 21:28:26 +0100 Received: from there (217.128.206.18) by mel-rta7.wanadoo.fr (6.7.015) id 3E075B1B006C7811 for net@freebsd.org; Wed, 8 Jan 2003 21:28:26 +0100 Message-ID: <3E075B1B006C7811@mel-rta7.wanadoo.fr> (added by postmaster@wanadoo.fr) Content-Type: text/plain; charset="iso-8859-15" From: Vincent Jardin To: net@freebsd.org Subject: rt_refcnt and rtentry protection ?? Date: Wed, 8 Jan 2003 21:47:40 +0100 X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 /* * Lookup or enter a new address in arptab. */ static struct llinfo_arp * arplookup(addr, create, proxy) u_long addr; int create, proxy; { register struct rtentry *rt; static struct sockaddr_inarp sin = {sizeof(sin), AF_INET }; const char *why = 0; sin.sin_addr.s_addr = addr; sin.sin_other = proxy ? SIN_PROXY : 0; rt = rtalloc1((struct sockaddr *)&sin, create, 0UL); if (rt == 0) return (0); rt->rt_refcnt--; if (rt->rt_flags & RTF_GATEWAY) /* XXX How can we be sure that rt won't be freeed by any other kernel thread now ?? XXX */ why = "host is not on local network"; else if ((rt->rt_flags & RTF_LLINFO) == 0) why = "could not allocate llinfo"; else if (rt->rt_gateway->sa_family != AF_LINK) why = "gateway route is not ours"; if (why && create) { log(LOG_DEBUG, "arplookup %s failed: %s\n", inet_ntoa(sin.sin_addr), why); return 0; } else if (why) { return 0; } return ((struct llinfo_arp *)rt->rt_llinfo); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message