Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_tag.c
Show First 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | case NGM_TAG_COOKIE: | ||||
switch (msg->header.cmd) { | switch (msg->header.cmd) { | ||||
case NGM_TAG_SET_HOOKIN: | case NGM_TAG_SET_HOOKIN: | ||||
{ | { | ||||
struct ng_tag_hookin *const | struct ng_tag_hookin *const | ||||
hp = (struct ng_tag_hookin *)msg->data; | hp = (struct ng_tag_hookin *)msg->data; | ||||
hook_p hook; | hook_p hook; | ||||
/* Sanity check. */ | /* Sanity check. */ | ||||
if (msg->header.arglen < sizeof(*hp) | if (msg->header.arglen < sizeof(*hp) || | ||||
|| msg->header.arglen != | msg->header.arglen < NG_TAG_HOOKIN_SIZE(hp->tag_len)) | ||||
donner: Reformatted to more readability and conformance to style(9) | |||||
NG_TAG_HOOKIN_SIZE(hp->tag_len)) | |||||
ERROUT(EINVAL); | ERROUT(EINVAL); | ||||
/* Find hook. */ | /* Find hook. */ | ||||
if ((hook = ng_findhook(node, hp->thisHook)) == NULL) | if ((hook = ng_findhook(node, hp->thisHook)) == NULL) | ||||
ERROUT(ENOENT); | ERROUT(ENOENT); | ||||
/* Set new tag values. */ | /* Set new tag values. */ | ||||
if ((error = ng_tag_setdata_in(hook, hp)) != 0) | if ((error = ng_tag_setdata_in(hook, hp)) != 0) | ||||
ERROUT(error); | ERROUT(error); | ||||
break; | break; | ||||
} | } | ||||
case NGM_TAG_SET_HOOKOUT: | case NGM_TAG_SET_HOOKOUT: | ||||
{ | { | ||||
struct ng_tag_hookout *const | struct ng_tag_hookout *const | ||||
hp = (struct ng_tag_hookout *)msg->data; | hp = (struct ng_tag_hookout *)msg->data; | ||||
hook_p hook; | hook_p hook; | ||||
/* Sanity check. */ | /* Sanity check. */ | ||||
if (msg->header.arglen < sizeof(*hp) | if (msg->header.arglen < sizeof(*hp) || | ||||
|| msg->header.arglen != | msg->header.arglen < NG_TAG_HOOKOUT_SIZE(hp->tag_len)) | ||||
NG_TAG_HOOKOUT_SIZE(hp->tag_len)) | |||||
ERROUT(EINVAL); | ERROUT(EINVAL); | ||||
/* Find hook. */ | /* Find hook. */ | ||||
if ((hook = ng_findhook(node, hp->thisHook)) == NULL) | if ((hook = ng_findhook(node, hp->thisHook)) == NULL) | ||||
ERROUT(ENOENT); | ERROUT(ENOENT); | ||||
/* Set new tag values. */ | /* Set new tag values. */ | ||||
if ((error = ng_tag_setdata_out(hook, hp)) != 0) | if ((error = ng_tag_setdata_out(hook, hp)) != 0) | ||||
▲ Show 20 Lines • Show All 321 Lines • Show Last 20 Lines |
Reformatted to more readability and conformance to style(9)