kern/63864: [patch] new control message for ng_iface(4) - getifindex
Gleb Smirnoff
glebius at cell.sick.ru
Sat Mar 6 17:40:17 PST 2004
>Number: 63864
>Category: kern
>Synopsis: [patch] new control message for ng_iface(4) - getifindex
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Mar 06 17:40:17 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Gleb Smirnoff
>Release: FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD morannon.bestcom.ru 5.2-CURRENT FreeBSD 5.2-CURRENT #3: Mon Mar 1 21:49:20 MSK 2004 glebius at morannon.bestcom.ru:/usr/obj/usr/src/sys/MORANNON i386
>Description:
Add support for message NGM_IFACE_GET_IFINDEX, which returns index number of the
interface, node corresponds to.
>How-To-Repeat:
>Fix:
The patch is trivial, code is same as in ng_ether(4), which already has
support for this message.
--- ng_iface.h.orig Sun Mar 7 04:13:43 2004
+++ ng_iface.h Sun Mar 7 04:14:35 2004
@@ -69,6 +69,7 @@
NGM_IFACE_GET_IFNAME = 1, /* returns struct ng_iface_ifname */
NGM_IFACE_POINT2POINT,
NGM_IFACE_BROADCAST,
+ NGM_IFACE_GET_IFINDEX
};
struct ng_iface_ifname {
--- ng_iface.c.orig Sun Mar 7 04:12:32 2004
+++ ng_iface.c Sun Mar 7 04:16:14 2004
@@ -186,6 +186,13 @@
NULL,
&ng_cisco_ipaddr_type
},
+ {
+ NGM_IFACE_COOKIE,
+ NGM_IFACE_GET_IFINDEX,
+ "getifindex",
+ NULL,
+ &ng_parse_int32_type
+ },
{ 0 }
};
@@ -666,6 +673,15 @@
}
break;
}
+
+ case NGM_IFACE_GET_IFINDEX:
+ NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT);
+ if (resp == NULL) {
+ error = ENOMEM;
+ break;
+ }
+ *((u_int32_t *)resp->data) = priv->ifp->if_index;
+ break;
default:
error = EINVAL;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list