mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-01 00:18:15 +01:00
Added ASCII version of the NGM_EIFACE_GET_IFNAME message, "getifname".
This commit is contained in:
parent
b26f9f6376
commit
c60878f0d2
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 9, 2004
|
||||
.Dd February 3, 2005
|
||||
.Dt NG_EIFACE 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -64,7 +64,7 @@ packets received by any real Ethernet interface.
|
||||
.Sh CONTROL MESSAGES
|
||||
This node type supports the generic control messages, plus the following:
|
||||
.Bl -tag -width indent
|
||||
.It Dv NGM_EIFACE_SET
|
||||
.It Dv NGM_EIFACE_SET Pq Li set
|
||||
Set link-level address of the interface.
|
||||
Requires
|
||||
.Vt "struct ether_addr"
|
||||
@ -76,7 +76,7 @@ version, called
|
||||
which requires as an argument an
|
||||
.Tn ASCII
|
||||
string consisting of 6 colon-separated hex digits.
|
||||
.It Dv NGM_EIFACE_GET_IFNAME
|
||||
.It Dv NGM_EIFACE_GET_IFNAME Pq Li getifname
|
||||
Return the name of the associated interface as a
|
||||
.Dv NUL Ns -terminated
|
||||
.Tn ASCII
|
||||
|
@ -56,6 +56,13 @@
|
||||
#include <net/if_arp.h>
|
||||
|
||||
static const struct ng_cmdlist ng_eiface_cmdlist[] = {
|
||||
{
|
||||
NGM_EIFACE_COOKIE,
|
||||
NGM_EIFACE_GET_IFNAME,
|
||||
"getifname",
|
||||
NULL,
|
||||
&ng_parse_string_type
|
||||
},
|
||||
{
|
||||
NGM_EIFACE_COOKIE,
|
||||
NGM_EIFACE_SET,
|
||||
@ -517,19 +524,13 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
||||
}
|
||||
|
||||
case NGM_EIFACE_GET_IFNAME:
|
||||
{
|
||||
struct ng_eiface_ifname *arg;
|
||||
|
||||
NG_MKRESPONSE(resp, msg, sizeof(*arg), M_NOWAIT);
|
||||
NG_MKRESPONSE(resp, msg, IFNAMSIZ + 1, M_NOWAIT);
|
||||
if (resp == NULL) {
|
||||
error = ENOMEM;
|
||||
break;
|
||||
}
|
||||
arg = (struct ng_eiface_ifname *)resp->data;
|
||||
strlcpy(arg->ngif_name, ifp->if_xname,
|
||||
sizeof(arg->ngif_name));
|
||||
strlcpy(resp->data, ifp->if_xname, IFNAMSIZ + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case NGM_EIFACE_GET_IFADDRS:
|
||||
{
|
||||
|
@ -40,7 +40,6 @@
|
||||
|
||||
/* Interface base name */
|
||||
#define NG_EIFACE_EIFACE_NAME "ngeth"
|
||||
#define NG_EIFACE_EIFACE_NAME_MAX 15
|
||||
|
||||
/* My hook names */
|
||||
#define NG_EIFACE_HOOK_ETHER "ether"
|
||||
@ -52,13 +51,9 @@
|
||||
|
||||
/* Netgraph commands */
|
||||
enum {
|
||||
NGM_EIFACE_GET_IFNAME = 1, /* returns struct ng_eiface_ifname */
|
||||
NGM_EIFACE_GET_IFNAME = 1, /* get the interface name */
|
||||
NGM_EIFACE_GET_IFADDRS, /* returns list of addresses */
|
||||
NGM_EIFACE_SET, /* set ethernet address */
|
||||
};
|
||||
|
||||
struct ng_eiface_ifname {
|
||||
char ngif_name[NG_EIFACE_EIFACE_NAME_MAX + 1];
|
||||
};
|
||||
|
||||
#endif /* _NETGRAPH_NG_EIFACE_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user