diff options
author | brooks <brooks@FreeBSD.org> | 2003-10-31 18:32:15 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2003-10-31 18:32:15 +0000 |
commit | f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda (patch) | |
tree | 4d9e6671d486576767506230a4240131526fea49 /sys/netgraph/ng_gif.c | |
parent | be546fdee455a96afdefee10d0bdba8547399f5b (diff) | |
download | FreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.zip FreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.tar.gz |
Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.
This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.
Approved By: re (in principle)
Reviewed By: njl, imp
Tested On: i386, amd64, sparc64
Obtained From: NetBSD (if_xname)
Diffstat (limited to 'sys/netgraph/ng_gif.c')
-rw-r--r-- | sys/netgraph/ng_gif.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/netgraph/ng_gif.c b/sys/netgraph/ng_gif.c index 2d99959..794378b 100644 --- a/sys/netgraph/ng_gif.c +++ b/sys/netgraph/ng_gif.c @@ -227,16 +227,14 @@ ng_gif_input2(node_p node, struct mbuf **mp, int af) static void ng_gif_attach(struct ifnet *ifp) { - char name[IFNAMSIZ + 1]; priv_p priv; node_p node; /* Create node */ KASSERT(!IFP2NG(ifp), ("%s: node already exists?", __func__)); - snprintf(name, sizeof(name), "%s%d", ifp->if_name, ifp->if_unit); if (ng_make_node_common(&ng_gif_typestruct, &node) != 0) { log(LOG_ERR, "%s: can't %s for %s\n", - __func__, "create node", name); + __func__, "create node", ifp->if_xname); return; } @@ -244,7 +242,7 @@ ng_gif_attach(struct ifnet *ifp) MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); if (priv == NULL) { log(LOG_ERR, "%s: can't %s for %s\n", - __func__, "allocate memory", name); + __func__, "allocate memory", ifp->if_xname); NG_NODE_UNREF(node); return; } @@ -253,9 +251,9 @@ ng_gif_attach(struct ifnet *ifp) IFP2NG(ifp) = node; /* Try to give the node the same name as the interface */ - if (ng_name_node(node, name) != 0) { + if (ng_name_node(node, ifp->if_xname) != 0) { log(LOG_WARNING, "%s: can't name node %s\n", - __func__, name); + __func__, ifp->if_xname); } } @@ -410,8 +408,7 @@ ng_gif_rcvmsg(node_p node, item_p item, hook_p lasthook) error = ENOMEM; break; } - snprintf(resp->data, IFNAMSIZ + 1, - "%s%d", priv->ifp->if_name, priv->ifp->if_unit); + strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ + 1); break; case NGM_GIF_GET_IFINDEX: NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); |