--- ng_ipfw.c.orig 2023-07-14 13:47:28.448235000 +0700 +++ ng_ipfw.c 2023-11-14 06:31:25.825326000 +0700 @@ -71,7 +71,7 @@ static ng_findhook_t ng_ipfw_findhook; static ng_rcvdata_t ng_ipfw_rcvdata; static ng_disconnect_t ng_ipfw_disconnect; -static hook_p ng_ipfw_findhook1(node_p, u_int16_t ); +static hook_p ng_ipfw_findhook1(node_p, u_int32_t ); static int ng_ipfw_input(struct mbuf **, struct ip_fw_args *, bool); /* We have only one node */ @@ -96,7 +96,7 @@ MODULE_DEPEND(ng_ipfw, ipfw, 3, 3, 3); /* Information we store for each hook */ struct ng_ipfw_hook_priv { hook_p hook; - u_int16_t rulenum; + u_int32_t cookie; }; typedef struct ng_ipfw_hook_priv *hpriv_p; @@ -154,7 +154,7 @@ static int ng_ipfw_newhook(node_p node, hook_p hook, const char *name) { hpriv_p hpriv; - u_int16_t rulenum; + u_int32_t cookie; const char *cp; char *endptr; @@ -168,7 +168,7 @@ ng_ipfw_newhook(node_p node, hook_p hook, const char * return (EINVAL); /* Convert it to integer */ - rulenum = (u_int16_t)strtol(name, &endptr, 10); + cookie = (u_int32_t)strtoul(name, &endptr, 10); if (*endptr != '\0') return (EINVAL); @@ -178,7 +178,7 @@ ng_ipfw_newhook(node_p node, hook_p hook, const char * return (ENOMEM); hpriv->hook = hook; - hpriv->rulenum = rulenum; + hpriv->cookie = cookie; NG_HOOK_SET_PRIVATE(hook, hpriv); @@ -200,10 +200,10 @@ ng_ipfw_connect(hook_p hook) static hook_p ng_ipfw_findhook(node_p node, const char *name) { - u_int16_t n; /* numeric representation of hook */ + u_int32_t n; /* numeric representation of hook */ char *endptr; - n = (u_int16_t)strtol(name, &endptr, 10); + n = (u_int32_t)strtoul(name, &endptr, 10); if (*endptr != '\0') return NULL; return ng_ipfw_findhook1(node, n); @@ -211,14 +211,14 @@ ng_ipfw_findhook(node_p node, const char *name) /* Look up hook by rule number */ static hook_p -ng_ipfw_findhook1(node_p node, u_int16_t rulenum) +ng_ipfw_findhook1(node_p node, u_int32_t cookie) { hook_p hook; hpriv_p hpriv; LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { hpriv = NG_HOOK_PRIVATE(hook); - if (NG_HOOK_IS_VALID(hook) && (hpriv->rulenum == rulenum)) + if (NG_HOOK_IS_VALID(hook) && (hpriv->cookie == cookie)) return (hook); }