From owner-svn-src-head@FreeBSD.ORG Thu Oct 15 06:26:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97A9C1065696; Thu, 15 Oct 2009 06:26:22 +0000 (UTC) (envelope-from tomelite82@gmail.com) Received: from mail-vw0-f180.google.com (mail-vw0-f180.google.com [209.85.212.180]) by mx1.freebsd.org (Postfix) with ESMTP id 0CB108FC1C; Thu, 15 Oct 2009 06:26:21 +0000 (UTC) Received: by vws10 with SMTP id 10so296200vws.7 for ; Wed, 14 Oct 2009 23:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=DJeB/AeF4VQdK0xqLmgS2qbfqiOPeEFkDBiOIMPZcUU=; b=ZSceYBSWxV+3ORS4pshSyfDG5RKslVm7LfuvOxT8B7vJst2mdJ+Faw/9t24yyrPmP3 mr9F8UPAGy5ODDsP6i3RVeG/+u0zoiQvx/zr8ScNfwkHItc7K/qukzuzgFFVd8UInFmb V09zbCJIc8C57v374W7B69e/Dsf0Pa7jONvnk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=mXAicA8aWWckf3YPuSB6uwd46jsg0XUQb3lK6mTBcLDCbnznVuT6o6nifJPui1vR59 vnycyT9/f3LKaFofOzYPTM7TrR5WrnFskVceKbvqZaDfwsh33LBl9UXIi/U6iFZ1qMW5 yI6wSQxZ/y38415mu3dAPhE3AFbAN+9ITegag= MIME-Version: 1.0 Sender: tomelite82@gmail.com Received: by 10.220.114.211 with SMTP id f19mr14409846vcq.1.1255587981174; Wed, 14 Oct 2009 23:26:21 -0700 (PDT) In-Reply-To: <200910150612.n9F6C4vH061396@svn.freebsd.org> References: <200910150612.n9F6C4vH061396@svn.freebsd.org> Date: Wed, 14 Oct 2009 23:26:21 -0700 X-Google-Sender-Auth: cbbb9daef1da1feb Message-ID: <9ace436c0910142326t69ddfe9ex26fa2c99849483aa@mail.gmail.com> From: Qing Li To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r198111 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 06:26:22 -0000 Forgot to mention the return code was incorrect. The function was returning EHOSTUNEACH when it should be returning EHOSTDOWN. This is also fixed by this patch. -- Qing On Wed, Oct 14, 2009 at 11:12 PM, Qing Li wrote: > Author: qingli > Date: Thu Oct 15 06:12:04 2009 > New Revision: 198111 > URL: http://svn.freebsd.org/changeset/base/198111 > > Log: > =A0This patch fixes the following issues in the ARP operation: > > =A01. There is a regression issue in the ARP code. The incomplete > =A0 =A0 ARP entry was timing out too quickly (1 second timeout), as > =A0 =A0 such, a new entry is created each time arpresolve() is called. > =A0 =A0 Therefore the maximum attempts made is always 1. Consequently > =A0 =A0 the error code returned to the application is always 0. > =A02. Set the expiration of each incomplete entry to a 20-second > =A0 =A0 lifetime. > =A03. Return "incomplete" entries to the application. > > =A0Reviewed by: =A0kmacy > =A0MFC after: =A0 =A03 days > > Modified: > =A0head/sys/netinet/if_ether.c > =A0head/sys/netinet/in.c > > Modified: head/sys/netinet/if_ether.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/if_ether.c Thu Oct 15 06:02:37 2009 =A0 =A0 =A0 =A0(= r198110) > +++ head/sys/netinet/if_ether.c Thu Oct 15 06:12:04 2009 =A0 =A0 =A0 =A0(= r198111) > @@ -88,11 +88,14 @@ VNET_DEFINE(int, useloopback) =3D 1; =A0/* us > =A0/* timer values */ > =A0static VNET_DEFINE(int, arpt_keep) =3D (20*60); =A0/* once resolved, g= ood for 20 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 * minutes */ > +static VNET_DEFINE(int, arpt_down) =3D 20; =A0 =A0 =A0/* keep incomplete= entries for > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0* 20 seconds */ > =A0static VNET_DEFINE(int, arp_maxtries) =3D 5; > =A0static VNET_DEFINE(int, arp_proxyall); > =A0static VNET_DEFINE(struct arpstat, arpstat); =A0/* ARP statistics, see= if_arp.h */ > > =A0#define =A0 =A0 =A0 =A0V_arpt_keep =A0 =A0 =A0 =A0 =A0 =A0 VNET(arpt_k= eep) > +#define =A0 =A0 =A0 =A0V_arpt_down =A0 =A0 =A0 =A0 =A0 =A0 VNET(arpt_dow= n) > =A0#define =A0 =A0 =A0 =A0V_arp_maxtries =A0 =A0 =A0 =A0 =A0VNET(arp_maxt= ries) > =A0#define =A0 =A0 =A0 =A0V_arp_proxyall =A0 =A0 =A0 =A0 =A0VNET(arp_prox= yall) > =A0#define =A0 =A0 =A0 =A0V_arpstat =A0 =A0 =A0 =A0 =A0 =A0 =A0 VNET(arps= tat) > @@ -309,7 +312,7 @@ retry: > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0if ((la->la_flags & LLE_VALID) && > - =A0 =A0 =A0 =A0 =A0 ((la->la_flags & LLE_STATIC) || la->la_expire > tim= e_uptime)) { > + =A0 =A0 =A0 =A0 =A0 ((la->la_flags & LLE_STATIC) || la->la_expire > tim= e_second)) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bcopy(&la->ll_addr, desten, ifp->if_addrle= n); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * If entry has an expiry time and it is a= pproaching, > @@ -317,7 +320,7 @@ retry: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * arpt_down interval. > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!(la->la_flags & LLE_STATIC) && > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 time_uptime + la->la_preempt > la->= la_expire) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 time_second + la->la_preempt > la->= la_expire) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0arprequest(ifp, NULL, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&SIN(dst)->sin_add= r, IF_LLADDR(ifp)); > > @@ -337,7 +340,7 @@ retry: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto done; > =A0 =A0 =A0 =A0} > > - =A0 =A0 =A0 renew =3D (la->la_asked =3D=3D 0 || la->la_expire !=3D time= _uptime); > + =A0 =A0 =A0 renew =3D (la->la_asked =3D=3D 0 || la->la_expire !=3D time= _second); > =A0 =A0 =A0 =A0if ((renew || m !=3D NULL) && (flags & LLE_EXCLUSIVE) =3D= =3D 0) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0flags |=3D LLE_EXCLUSIVE; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0LLE_RUNLOCK(la); > @@ -370,12 +373,12 @@ retry: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0error =3D EWOULDBLOCK; =A0 =A0/* First req= uest. */ > =A0 =A0 =A0 =A0else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0error =3D > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (rt0->rt_flags & RTF_GATEWAY) ? EHO= STDOWN : EHOSTUNREACH; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (rt0->rt_flags & RTF_GATEWA= Y) ? EHOSTUNREACH : EHOSTDOWN; > > =A0 =A0 =A0 =A0if (renew) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0LLE_ADDREF(la); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 la->la_expire =3D time_uptime; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 callout_reset(&la->la_timer, hz, arptimer, = la); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 la->la_expire =3D time_second; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 callout_reset(&la->la_timer, hz * V_arpt_do= wn, arptimer, la); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0la->la_asked++; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0LLE_WUNLOCK(la); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0arprequest(ifp, NULL, &SIN(dst)->sin_addr, > @@ -687,7 +690,7 @@ match: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0EVENTHANDLER_INVOKE(arp_update_event, la); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!(la->la_flags & LLE_STATIC)) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 la->la_expire =3D time_upti= me + V_arpt_keep; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 la->la_expire =3D time_seco= nd + V_arpt_keep; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0callout_reset(&la->la_time= r, hz * V_arpt_keep, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0arptimer, la); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > > Modified: head/sys/netinet/in.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/in.c =A0 =A0 =A0 Thu Oct 15 06:02:37 2009 =A0 =A0 = =A0 =A0(r198110) > +++ head/sys/netinet/in.c =A0 =A0 =A0 Thu Oct 15 06:12:04 2009 =A0 =A0 = =A0 =A0(r198111) > @@ -1440,7 +1440,7 @@ in_lltable_dump(struct lltable *llt, str > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct sockaddr_dl *sdl; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* skip deleted entries */ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((lle->la_flags & (LLE_D= ELETED|LLE_VALID)) !=3D LLE_VALID) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((lle->la_flags & LLE_DE= LETED) =3D=3D LLE_DELETED) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0continue; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Skip if jailed and not = a valid IP of the prison. */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (prison_if(wr->td->td_u= cred, L3_ADDR(lle)) !=3D 0) > @@ -1472,10 +1472,15 @@ in_lltable_dump(struct lltable *llt, str > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sdl =3D &arpc.sdl; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sdl->sdl_family =3D AF_LIN= K; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sdl->sdl_len =3D sizeof(*s= dl); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sdl->sdl_alen =3D ifp->if_a= ddrlen; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sdl->sdl_index =3D ifp->if= _index; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0sdl->sdl_type =3D ifp->if_= type; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bcopy(&lle->ll_addr, LLADDR= (sdl), ifp->if_addrlen); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((lle->la_flags & LLE_VA= LID) =3D=3D LLE_VALID) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sdl->sdl_al= en =3D ifp->if_addrlen; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bcopy(&lle-= >ll_addr, LLADDR(sdl), ifp->if_addrlen); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sdl->sdl_al= en =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bzero(LLADD= R(sdl), ifp->if_addrlen); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0arpc.rtm.rtm_rmx.rmx_expir= e =3D > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0lle->la_flags & LL= E_STATIC ? 0 : lle->la_expire; >