diff options
Diffstat (limited to 'sys/netgraph/ng_iface.c')
-rw-r--r-- | sys/netgraph/ng_iface.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index 430e0e6..38845fc 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -186,6 +186,13 @@ static const struct ng_cmdlist ng_iface_cmds[] = { NULL, &ng_cisco_ipaddr_type }, + { + NGM_IFACE_COOKIE, + NGM_IFACE_GET_IFINDEX, + "getifindex", + NULL, + &ng_parse_uint32_type + }, { 0 } }; @@ -667,6 +674,15 @@ ng_iface_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } + case NGM_IFACE_GET_IFINDEX: + NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_NOWAIT); + if (resp == NULL) { + error = ENOMEM; + break; + } + *((uint32_t *)resp->data) = priv->ifp->if_index; + break; + default: error = EINVAL; break; |