From owner-svn-src-head@freebsd.org Sun Apr 19 17:01:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0BB127B27C; Sun, 19 Apr 2020 17:01:19 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 494x1W0cs7z4bJm; Sun, 19 Apr 2020 17:01:18 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C0EB1081; Sun, 19 Apr 2020 17:01:18 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03JH1IwB002893; Sun, 19 Apr 2020 17:01:18 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03JH1IqC002892; Sun, 19 Apr 2020 17:01:18 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202004191701.03JH1IqC002892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 19 Apr 2020 17:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360101 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 360101 X-SVN-Commit-Repository: base 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.29 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: Sun, 19 Apr 2020 17:01:19 -0000 Author: cy Date: Sun Apr 19 17:01:17 2020 New Revision: 360101 URL: https://svnweb.freebsd.org/changeset/base/360101 Log: Convert ipfilter to the new routing KPI. Reviewed by: melifaro (previous version) Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun Apr 19 17:01:14 2020 (r360100) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun Apr 19 17:01:17 2020 (r360101) @@ -49,6 +49,7 @@ static const char rcsid[] = "@(#)$Id$"; #include #include #include +#include #include #include #include @@ -698,7 +699,7 @@ ipf_fastroute(m0, mpp, fin, fdp) int len, off, error = 0, hlen, code; struct ifnet *ifp, *sifp; struct sockaddr_in dst; - struct nhop4_extended nh4; + struct nhop_object *nh; u_long fibnum = 0; u_short ip_off; frdest_t node; @@ -773,7 +774,9 @@ ipf_fastroute(m0, mpp, fin, fdp) dst.sin_addr = fdp->fd_ip; fibnum = M_GETFIB(m0); - if (fib4_lookup_nh_ext(fibnum, dst.sin_addr, NHR_REF, 0, &nh4) != 0) { + NET_EPOCH_ASSERT(); + nh = fib4_lookup(fibnum, dst.sin_addr, 0, NHR_NONE, 0); + if (nh == NULL) { if (in_localaddr(ip->ip_dst)) error = EHOSTUNREACH; else @@ -782,9 +785,9 @@ ipf_fastroute(m0, mpp, fin, fdp) } if (ifp == NULL) - ifp = nh4.nh_ifp; - if (nh4.nh_flags & NHF_GATEWAY) - dst.sin_addr = nh4.nh_addr; + ifp = nh->nh_ifp; + if (nh->nh_flags & NHF_GATEWAY) + dst.sin_addr = nh->gw4_sa.sin_addr; /* * For input packets which are being "fastrouted", they won't @@ -944,11 +947,13 @@ int ipf_verifysrc(fin) fr_info_t *fin; { - struct nhop4_basic nh4; + struct nhop_object *nh; - if (fib4_lookup_nh_basic(0, fin->fin_src, 0, 0, &nh4) != 0) + NET_EPOCH_ASSERT(); + nh = fib4_lookup(RT_DEFAULT_FIB, fin->fin_src, 0, NHR_NONE, 0); + if (nh == NULL) return (0); - return (fin->fin_ifp == nh4.nh_ifp); + return (fin->fin_ifp == nh->nh_ifp); }