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
This commit is contained in:
parent
863c16cbbd
commit
30f8ed2140
@ -151,20 +151,14 @@ eaction_findbykidx(struct ip_fw_chain *ch, uint16_t idx)
|
||||
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,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -2236,7 +2236,10 @@ create_objects_compat(struct ip_fw_chain *ch, ipfw_insn *cmd,
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user