From owner-svn-src-head@freebsd.org Mon Aug 31 05:03:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB55C9C661E; Mon, 31 Aug 2015 05:03:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A25C5192A; Mon, 31 Aug 2015 05:03:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7V53bJN046589; Mon, 31 Aug 2015 05:03:37 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7V53aWQ046586; Mon, 31 Aug 2015 05:03:36 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201508310503.t7V53aWQ046586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 31 Aug 2015 05:03:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287318 - in head/sys: net netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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: Mon, 31 Aug 2015 05:03:37 -0000 Author: melifaro Date: Mon Aug 31 05:03:36 2015 New Revision: 287318 URL: https://svnweb.freebsd.org/changeset/base/287318 Log: Simplify lla_rt_output()/nd6_add_ifa_lle() by setting lle state in alloc handler, based on flags. Modified: head/sys/net/if_llatbl.c head/sys/netinet6/in6.c head/sys/netinet6/nd6.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sun Aug 30 23:58:53 2015 (r287317) +++ head/sys/net/if_llatbl.c Mon Aug 31 05:03:36 2015 (r287318) @@ -592,7 +592,10 @@ lla_rt_output(struct rt_msghdr *rtm, str switch (rtm->rtm_type) { case RTM_ADD: /* Add static LLE */ - lle = lltable_alloc_entry(llt, 0, dst); + laflags = 0; + if (rtm->rtm_rmx.rmx_expire == 0) + laflags = LLE_STATIC; + lle = lltable_alloc_entry(llt, laflags, dst); if (lle == NULL) return (ENOMEM); @@ -600,22 +603,8 @@ lla_rt_output(struct rt_msghdr *rtm, str if ((rtm->rtm_flags & RTF_ANNOUNCE)) lle->la_flags |= LLE_PUB; lle->la_flags |= LLE_VALID; -#ifdef INET6 - /* - * ND6 - */ - if (dst->sa_family == AF_INET6) - lle->ln_state = ND6_LLINFO_REACHABLE; -#endif - /* - * NB: arp and ndp always set (RTF_STATIC | RTF_HOST) - */ + lle->la_expire = rtm->rtm_rmx.rmx_expire; - if (rtm->rtm_rmx.rmx_expire == 0) { - lle->la_flags |= LLE_STATIC; - lle->la_expire = 0; - } else - lle->la_expire = rtm->rtm_rmx.rmx_expire; laflags = lle->la_flags; /* Try to link new entry */ Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sun Aug 30 23:58:53 2015 (r287317) +++ head/sys/netinet6/in6.c Mon Aug 31 05:03:36 2015 (r287318) @@ -2264,6 +2264,9 @@ in6_lltable_alloc(struct lltable *llt, u lle->la_flags |= (LLE_VALID | LLE_STATIC); } + if ((lle->la_flags & LLE_STATIC) != 0) + lle->ln_state = ND6_LLINFO_REACHABLE; + return (lle); } Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sun Aug 30 23:58:53 2015 (r287317) +++ head/sys/netinet6/nd6.c Mon Aug 31 05:03:36 2015 (r287318) @@ -2275,9 +2275,6 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia) if (ln == NULL) return (ENOBUFS); - ln->la_expire = 0; /* for IPv6 this means permanent */ - ln->ln_state = ND6_LLINFO_REACHABLE; - IF_AFDATA_WLOCK(ifp); LLE_WLOCK(ln); /* Unlink any entry if exists */