From 530e648b95fdb42c666debc134332ddfcab6ee87 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sun, 9 Nov 2014 15:44:56 +0100 Subject: [PATCH] tools: apply ng_ether_attach_command.diff --- sys/netgraph/ng_base.c | 24 ++++++++++++++++++++++++ sys/netgraph/ng_message.h | 1 + 2 files changed, 25 insertions(+) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index a5fcb143275..8227292d251 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -64,6 +64,10 @@ #include #include +#include +#include +#include + #include #include @@ -240,6 +244,8 @@ int ng_path_parse(char *addr, char **node, char **path, char **hook); void ng_rmnode(node_p node, hook_p dummy1, void *dummy2, int dummy3); void ng_unname(node_p node); +extern void (*ng_ether_attach_p)(struct ifnet *ifp); + /* Our own netgraph malloc type */ MALLOC_DEFINE(M_NETGRAPH, "netgraph", "netgraph structures and ctrl messages"); MALLOC_DEFINE(M_NETGRAPH_MSG, "netgraph_msg", "netgraph name storage"); @@ -574,6 +580,13 @@ static const struct ng_cmdlist ng_generic_cmds[] = { &ng_parse_ng_mesg_type, &ng_parse_ng_mesg_type }, + { + NGM_GENERIC_COOKIE, + NGM_ETHER_ATTACH, + "attach", + &ng_parse_string_type, + NULL + }, { 0 } }; @@ -2908,6 +2921,17 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) break; } + case NGM_ETHER_ATTACH: + { + struct ifnet *ifp; + ifp = ifunit((char *)msg->data); + if (ifp && ng_ether_attach_p != NULL) { + ng_ether_attach_p(ifp); + } + + break; + } + case NGM_TEXT_CONFIG: case NGM_TEXT_STATUS: /* diff --git a/sys/netgraph/ng_message.h b/sys/netgraph/ng_message.h index da531f0e786..d17ce463850 100644 --- a/sys/netgraph/ng_message.h +++ b/sys/netgraph/ng_message.h @@ -138,6 +138,7 @@ enum { NGM_ASCII2BINARY= (13|NGM_READONLY|NGM_HASREPLY), /* (optional) Get/set text config. */ NGM_TEXT_CONFIG = 14, + NGM_ETHER_ATTACH = 15, }; /*