aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ngctl
diff options
context:
space:
mode:
authorArchie Cobbs <archie@FreeBSD.org>1999-10-27 22:17:18 +0000
committerArchie Cobbs <archie@FreeBSD.org>1999-10-27 22:17:18 +0000
commit0d6985e2c191824083c838ca7107d9d5555f56f4 (patch)
treeaf16742e0fea4939917cf29be23df6bc9d0eae7e /usr.sbin/ngctl
parent142ebf4ad614fb783570f779964724d34b25e41e (diff)
Notes
Diffstat (limited to 'usr.sbin/ngctl')
-rw-r--r--usr.sbin/ngctl/main.c11
-rw-r--r--usr.sbin/ngctl/ngctl.86
-rw-r--r--usr.sbin/ngctl/ngctl.h2
3 files changed, 18 insertions, 1 deletions
diff --git a/usr.sbin/ngctl/main.c b/usr.sbin/ngctl/main.c
index 9a54cc7c649d..f6d68b9e0922 100644
--- a/usr.sbin/ngctl/main.c
+++ b/usr.sbin/ngctl/main.c
@@ -42,6 +42,7 @@
#define PROMPT "+ "
#define MAX_ARGS 512
#define WHITESPACE " \t\r\n\v\f"
+#define NG_SOCKET_KLD "ng_socket.ko"
/* Internal functions */
static int ReadFile(FILE *fp);
@@ -134,8 +135,16 @@ main(int ac, char *av[])
av += optind;
/* Create a new socket node */
- if (NgMkSockNode(name, &csock, &dsock) < 0)
+ if (NgMkSockNode(name, &csock, &dsock) < 0) {
+ if (errno == EPROTONOSUPPORT) {
+ if (kldload(NG_SOCKET_KLD) < 0)
+ err(EX_OSERR, "can't load %s", NG_SOCKET_KLD);
+ if (NgMkSockNode(name, &csock, &dsock) >= 0)
+ goto gotNode;
+ }
err(EX_OSERR, "can't create node");
+ }
+gotNode:
/* Do commands as requested */
if (ac == 0) {
diff --git a/usr.sbin/ngctl/ngctl.8 b/usr.sbin/ngctl/ngctl.8
index ee4f3bed4f59..8537d7655fef 100644
--- a/usr.sbin/ngctl/ngctl.8
+++ b/usr.sbin/ngctl/ngctl.8
@@ -60,6 +60,12 @@ will enter interactive mode. Otherwise
.Nm ngctl
will execute the supplied command(s) and exit immediately.
.Pp
+If the
+.Dv ng_socket.ko
+module is not installed in the kernel,
+.Nm ngctl
+will attempt to install it.
+.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl f Ar nodeinfo
diff --git a/usr.sbin/ngctl/ngctl.h b/usr.sbin/ngctl/ngctl.h
index 64ba3db2d913..817c6e82bea4 100644
--- a/usr.sbin/ngctl/ngctl.h
+++ b/usr.sbin/ngctl/ngctl.h
@@ -38,9 +38,11 @@
*/
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/select.h>
+#include <sys/linker.h>
#include <stdio.h>
#include <stdlib.h>