[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-net
Subject:    rtadvctl unable to connect to different control socket of radvd
From:       Michael Pounov <misho () elwix ! org>
Date:       2021-11-11 10:04:39
Message-ID: 20211111120439.88ca9557ed37d10947d165fd () elwix ! org
[Download RAW message or body]

Hi Hiroki Sato

I mention you because I believe that you are right person like author of rtadvctl tool.

I found issue with management of running rtadvd service instance.
When we choose to working with different control socket path instead default one.
rtadvctl lose any capability to operate with existing rtadvd instance, 
 because it have no any kind of option to change connection path of control socket

I made one patch to solve this problem with minimal disturbing of whole code.
If you thinking that is ok. You are feel free to take it

I am using same option -C <ctrl_sock> in rtadvctl as like in rtadvd


Br
-- 
Michael Pounov
ELWIX.ORG
CloudSigma AG


["rtadvctl_ctrlsock.patch" (text/x-diff)]

diff --git a/usr.sbin/rtadvctl/rtadvctl.c b/usr.sbin/rtadvctl/rtadvctl.c
index 8bbd7afb6dd..f191b25c174 100644
--- a/usr.sbin/rtadvctl/rtadvctl.c
+++ b/usr.sbin/rtadvctl/rtadvctl.c
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <sys/un.h>
 #include <sys/uio.h>
+#include <sys/param.h>
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <net/if_types.h>
@@ -155,9 +156,13 @@ main(int argc, char *argv[])
 	int ch;
 	int (*action)(int, char **) = NULL;
 	int error;
+	char ctrlsock_name[MAXPATHLEN] = _PATH_CTRL_SOCK;
 
-	while ((ch = getopt(argc, argv, "Dv")) != -1) {
+	while ((ch = getopt(argc, argv, "DvC:")) != -1) {
 		switch (ch) {
+		case 'C':
+			strlcpy(ctrlsock_name, optarg, sizeof ctrlsock_name);
+			break;
 		case 'D':
 			vflag = LOG_DEBUG;
 			break;
@@ -174,6 +179,8 @@ main(int argc, char *argv[])
 	if (argc == 0)
 		usage();
 
+	ctrlsock.si_name = ctrlsock_name;
+
 	for (i = 0; (size_t)i < sizeof(dtable)/sizeof(dtable[0]); i++) {
 		if (dtable[i].dt_comm == NULL ||
 		    strcmp(dtable[i].dt_comm, argv[0]) == 0) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic