From owner-svn-src-head@freebsd.org Wed Apr 27 15:28:27 2016 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 12D56B1EDC7; Wed, 27 Apr 2016 15:28:27 +0000 (UTC) (envelope-from ae@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 mx1.freebsd.org (Postfix) with ESMTPS id C06E41AD5; Wed, 27 Apr 2016 15:28:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RFSPZE082269; Wed, 27 Apr 2016 15:28:25 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RFSP6J082267; Wed, 27 Apr 2016 15:28:25 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201604271528.u3RFSP6J082267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 27 Apr 2016 15:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298702 - head/sys/netpfil/ipfw 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.21 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: Wed, 27 Apr 2016 15:28:27 -0000 Author: ae Date: Wed Apr 27 15:28:25 2016 New Revision: 298702 URL: https://svnweb.freebsd.org/changeset/base/298702 Log: Make create_object callback optional and return EOPNOTSUPP when it isn't defined. Remove eaction_create_compat() and use designated initializers to initialize eaction_opcodes structure. Obtained from: Yandex LLC Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_eaction.c Wed Apr 27 15:27:23 2016 (r298701) +++ head/sys/netpfil/ipfw/ip_fw_eaction.c Wed Apr 27 15:28:25 2016 (r298702) @@ -151,20 +151,14 @@ eaction_findbykidx(struct ip_fw_chain *c return (ipfw_objhash_lookup_kidx(CHAIN_TO_SRV(ch), idx)); } -static int -eaction_create_compat(struct ip_fw_chain *ch, struct tid_info *ti, - uint16_t *pkidx) -{ - - return (EOPNOTSUPP); -} - static struct opcode_obj_rewrite eaction_opcodes[] = { { - O_EXTERNAL_ACTION, IPFW_TLV_EACTION, - eaction_classify, eaction_update, - eaction_findbyname, eaction_findbykidx, - eaction_create_compat + .opcode = O_EXTERNAL_ACTION, + .etlv = IPFW_TLV_EACTION, + .classifier = eaction_classify, + .update = eaction_update, + .find_byname = eaction_findbyname, + .find_bykidx = eaction_findbykidx, }, }; Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Apr 27 15:27:23 2016 (r298701) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Apr 27 15:28:25 2016 (r298702) @@ -2236,7 +2236,10 @@ create_objects_compat(struct ip_fw_chain KASSERT(rw != NULL, ("Unable to find handler for op %d", (cmd + p->off)->opcode)); - error = rw->create_object(ch, ti, &kidx); + if (rw->create_object == NULL) + error = EOPNOTSUPP; + else + error = rw->create_object(ch, ti, &kidx); if (error == 0) { p->kidx = kidx; continue;