diff options
author | ru <ru@FreeBSD.org> | 2004-03-07 23:00:44 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2004-03-07 23:00:44 +0000 |
commit | bf23ea37e6288cf0227dab4c910f8cde345cd140 (patch) | |
tree | a8def910e7ab0c280b72a24183328b78ed465d00 /sys/netgraph/ng_iface.c | |
parent | 41b17057eff98a603cc4f9dea224f7081ca9fbb4 (diff) | |
download | FreeBSD-src-bf23ea37e6288cf0227dab4c910f8cde345cd140.zip FreeBSD-src-bf23ea37e6288cf0227dab4c910f8cde345cd140.tar.gz |
Implemented the "getifindex" control message.
PR: kern/63864
Submitted by: Gleb Smirnoff
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; |