diff options
-rw-r--r-- | share/man/man4/ng_eiface.4 | 6 | ||||
-rw-r--r-- | sys/netgraph/ng_eiface.c | 17 | ||||
-rw-r--r-- | sys/netgraph/ng_eiface.h | 7 |
3 files changed, 13 insertions, 17 deletions
diff --git a/share/man/man4/ng_eiface.4 b/share/man/man4/ng_eiface.4 index 2bcca3c..6699153 100644 --- a/share/man/man4/ng_eiface.4 +++ b/share/man/man4/ng_eiface.4 @@ -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 diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index 54f9135..6f15714 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -58,6 +58,13 @@ 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, "set", &ng_parse_enaddr_type, @@ -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: { diff --git a/sys/netgraph/ng_eiface.h b/sys/netgraph/ng_eiface.h index 2ff313c..db07a55 100644 --- a/sys/netgraph/ng_eiface.h +++ b/sys/netgraph/ng_eiface.h @@ -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_ */ |