Projet

Général

Profil

Télécharger (1,74 ko) Statistiques
| Branche: | Révision:

univnautes-tools / patches / stable / 10 / ng_ether_attach_command.diff @ 4ab3b90b

1
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
2
index a5fcb14..8227292 100644
3
--- a/sys/netgraph/ng_base.c
4
+++ b/sys/netgraph/ng_base.c
5
@@ -64,6 +64,10 @@
6
 #include <sys/unistd.h>
7
 #include <machine/cpu.h>
8
 
9
+#include <sys/socket.h>
10
+#include <net/if.h>
11
+#include <net/if_var.h>
12
+
13
 #include <net/netisr.h>
14
 #include <net/vnet.h>
15
 
16
@@ -240,6 +244,8 @@ int	ng_path_parse(char *addr, char **node, char **path, char **hook);
17
 void	ng_rmnode(node_p node, hook_p dummy1, void *dummy2, int dummy3);
18
 void	ng_unname(node_p node);
19
 
20
+extern void    (*ng_ether_attach_p)(struct ifnet *ifp);
21
+
22
 /* Our own netgraph malloc type */
23
 MALLOC_DEFINE(M_NETGRAPH, "netgraph", "netgraph structures and ctrl messages");
24
 MALLOC_DEFINE(M_NETGRAPH_MSG, "netgraph_msg", "netgraph name storage");
25
@@ -574,6 +580,13 @@ static const struct ng_cmdlist ng_generic_cmds[] = {
26
 	  &ng_parse_ng_mesg_type,
27
 	  &ng_parse_ng_mesg_type
28
 	},
29
+	{
30
+          NGM_GENERIC_COOKIE,
31
+          NGM_ETHER_ATTACH,
32
+          "attach",
33
+          &ng_parse_string_type,
34
+          NULL
35
+        },
36
 	{ 0 }
37
 };
38
 
39
@@ -2908,6 +2921,17 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook)
40
 		break;
41
 	    }
42
 
43
+	case NGM_ETHER_ATTACH:
44
+		{
45
+			struct ifnet *ifp;
46
+			ifp = ifunit((char *)msg->data);
47
+			if (ifp && ng_ether_attach_p != NULL) {
48
+				ng_ether_attach_p(ifp);
49
+			}
50
+				
51
+			break;
52
+                }
53
+
54
 	case NGM_TEXT_CONFIG:
55
 	case NGM_TEXT_STATUS:
56
 		/*
57
diff --git a/sys/netgraph/ng_message.h b/sys/netgraph/ng_message.h
58
index da531f0..d17ce46 100644
59
--- a/sys/netgraph/ng_message.h
60
+++ b/sys/netgraph/ng_message.h
61
@@ -138,6 +138,7 @@ enum {
62
 	NGM_ASCII2BINARY= (13|NGM_READONLY|NGM_HASREPLY),
63
 	/* (optional) Get/set text config. */
64
 	NGM_TEXT_CONFIG	= 14,
65
+	NGM_ETHER_ATTACH = 15,
66
 };
67
 
68
 /*
(38-38/67)