From owner-svn-src-head@freebsd.org Thu Mar 14 22:31:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 828F415314DC; Thu, 14 Mar 2019 22:31:13 +0000 (UTC) (envelope-from glebius@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 20CF570A26; Thu, 14 Mar 2019 22:31:13 +0000 (UTC) (envelope-from glebius@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 0D56AF79; Thu, 14 Mar 2019 22:31:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2EMVCNU063110; Thu, 14 Mar 2019 22:31:12 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2EMVCwW063109; Thu, 14 Mar 2019 22:31:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201903142231.x2EMVCwW063109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 14 Mar 2019 22:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345164 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 345164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 20CF570A26 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] 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: Thu, 14 Mar 2019 22:31:13 -0000 Author: glebius Date: Thu Mar 14 22:31:12 2019 New Revision: 345164 URL: https://svnweb.freebsd.org/changeset/base/345164 Log: Reduce argument list to ipfw_divert(), as args holds the rule ref and the direction. While here make 'tee' a bool. Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_pfil.c Thu Mar 14 22:30:05 2019 (r345163) +++ head/sys/netpfil/ipfw/ip_fw_pfil.c Thu Mar 14 22:31:12 2019 (r345164) @@ -85,7 +85,7 @@ VNET_DEFINE_STATIC(int, fwlink_enable) = 0; int ipfw_chg_hook(SYSCTL_HANDLER_ARGS); /* Forward declarations. */ -static int ipfw_divert(struct mbuf **, bool, struct ipfw_rule_ref *, int); +static int ipfw_divert(struct mbuf **, struct ip_fw_args *, bool); #ifdef SYSCTL_NODE @@ -281,8 +281,7 @@ again: break; } MPASS(args.flags & IPFW_ARGS_REF); - (void )ipfw_divert(m0, dir == DIR_IN, &args.rule, - (ipfw == IP_FW_TEE) ? 1 : 0); + (void )ipfw_divert(m0, &args, ipfw == IP_FW_TEE); /* continue processing for the original packet (tee). */ if (*m0) goto again; @@ -441,8 +440,7 @@ again: /* do the divert, return 1 on error 0 on success */ static int -ipfw_divert(struct mbuf **m0, bool incoming, struct ipfw_rule_ref *rule, - int tee) +ipfw_divert(struct mbuf **m0, struct ip_fw_args *args, bool tee) { /* * ipfw_chk() has already tagged the packet with the divert tag. @@ -454,7 +452,7 @@ ipfw_divert(struct mbuf **m0, bool incoming, struct ip struct m_tag *tag; /* Cloning needed for tee? */ - if (tee == 0) { + if (tee == false) { clone = *m0; /* use the original mbuf */ *m0 = NULL; } else { @@ -474,7 +472,7 @@ ipfw_divert(struct mbuf **m0, bool incoming, struct ip * Note that we now have the 'reass' ipfw option so if we care * we can do it before a 'tee'. */ - if (!tee) switch (ip->ip_v) { + if (tee == false) switch (ip->ip_v) { case IPVERSION: if (ntohs(ip->ip_off) & (IP_MF | IP_OFFMASK)) { int hlen; @@ -523,11 +521,11 @@ ipfw_divert(struct mbuf **m0, bool incoming, struct ip FREE_PKT(clone); return 1; } - *((struct ipfw_rule_ref *)(tag+1)) = *rule; + *((struct ipfw_rule_ref *)(tag+1)) = args->rule; m_tag_prepend(clone, tag); /* Do the dirty job... */ - ip_divert_ptr(clone, incoming); + ip_divert_ptr(clone, args->flags & IPFW_ARGS_IN); return 0; }