Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Nov 2021 12:04:39 +0200
From:      Michael Pounov <misho@elwix.org>
To:        freebsd-net@freebsd.org
Cc:        hrs@FreeBSD.org
Subject:   rtadvctl unable to connect to different control socket of radvd
Message-ID:  <20211111120439.88ca9557ed37d10947d165fd@elwix.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart=_Thu__11_Nov_2021_12_04_39_+0200_XBoVkQsM/qOw3LaX
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

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


--Multipart=_Thu__11_Nov_2021_12_04_39_+0200_XBoVkQsM/qOw3LaX
Content-Type: text/x-diff;
 name="rtadvctl_ctrlsock.patch"
Content-Disposition: attachment;
 filename="rtadvctl_ctrlsock.patch"
Content-Transfer-Encoding: 7bit

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) {

--Multipart=_Thu__11_Nov_2021_12_04_39_+0200_XBoVkQsM/qOw3LaX--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20211111120439.88ca9557ed37d10947d165fd>