Date: Wed, 27 Apr 2016 15:28:25 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298702 - head/sys/netpfil/ipfw Message-ID: <201604271528.u3RFSP6J082267@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604271528.u3RFSP6J082267>