Message ID | 20210421072936.35565-1-christian.storm@siemens.com |
---|---|
State | Accepted |
Headers | show |
Series | remote handler: Make socket directory run-time configurable | expand |
Hi Stefano, any thoughts on this patch being included the 2021.04 release? Kind regards, Christian > From: Dominik Tacke <dominik.tacke@siemens.com> > > Make the remote handler's socket directory run-time configurable > using the $TMPDIR environment variable's value with /tmp as fallback. > > Signed-off-by: Dominik Tacke <dominik.tacke@siemens.com> > Signed-off-by: Christian Storm <christian.storm@siemens.com> > --- > Kconfig | 7 ------- > doc/source/handlers.rst | 9 ++++++--- > handlers/remote_handler.c | 4 ++-- > 3 files changed, 8 insertions(+), 12 deletions(-) > > diff --git a/Kconfig b/Kconfig > index 75f9eaa..8ae5b29 100644 > --- a/Kconfig > +++ b/Kconfig > @@ -191,13 +191,6 @@ config SOCKET_PROGRESS_PATH > help > Path to the socket progress information is sent to. > > -config SOCKET_REMOTE_HANDLER_DIRECTORY > - string "SWUpdate remote handler socket directory" > - default "/tmp/" > - help > - Directory where sockets to remote handler processes > - are expected to be found. > - > config SOCKET_NOTIFIER_DIRECTORY > string "SWUpdate notifier socket directory" > depends on HAVE_FREEBSD > diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst > index 84dffd6..fa11887 100644 > --- a/doc/source/handlers.rst > +++ b/doc/source/handlers.rst > @@ -436,9 +436,12 @@ a possible setup using a remote handler could be: > ) > > > -The connection is instantiated using the socket "/tmp/test_remote". If > -connect() fails, the remote handler signals that the update is not successful. > -Each Zeromq Message from SWUpdate is a multi-part message split into two frames: > +The connection is instantiated using the socket ``test_remote`` (according > +to the "data" field's value) in the directory pointed to by the environment > +variable ``TMPDIR`` with ``/tmp`` as fall-back if ``TMPDIR`` is not set. > +If ``connect()`` fails, the remote handler signals that the update is not > +successful. Each zeromq message from SWUpdate is a multi-part message split > +into two frames: > > - first frame contains a string with a command. > - second frame contains data and can be of 0 bytes. > diff --git a/handlers/remote_handler.c b/handlers/remote_handler.c > index 2e2a517..8558d88 100644 > --- a/handlers/remote_handler.c > +++ b/handlers/remote_handler.c > @@ -159,7 +159,7 @@ static int install_remote_image(struct img_type *img, > struct RHmsg RHmessage; > char bufcmd[80]; > > - len = strlen(img->type_data) + strlen(CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY) + strlen("ipc://") + 4; > + len = strlen(img->type_data) + strlen(get_tmpdir()) + strlen("ipc://") + 4; > > /* > * Allocate maximum string > @@ -169,7 +169,7 @@ static int install_remote_image(struct img_type *img, > ERROR("Not enough memory"); > return -ENOMEM; > } > - snprintf(connect_string, len, "ipc://%s%s", CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY, > + snprintf(connect_string, len, "ipc://%s%s", get_tmpdir(), > img->type_data); > > ret = zmq_connect(request, connect_string); > -- > 2.31.1 >
On 29.04.21 14:09, Christian Storm wrote: > Hi Stefano, > > any thoughts on this patch being included the 2021.04 release? > It was already merged: https://github.com/sbabic/swupdate/commit/706424b699f0d1a7a3a4050c108c56f210378378 Regards, Stefano > Kind regards, > Christian > > > >> From: Dominik Tacke <dominik.tacke@siemens.com> >> >> Make the remote handler's socket directory run-time configurable >> using the $TMPDIR environment variable's value with /tmp as fallback. >> >> Signed-off-by: Dominik Tacke <dominik.tacke@siemens.com> >> Signed-off-by: Christian Storm <christian.storm@siemens.com> >> --- >> Kconfig | 7 ------- >> doc/source/handlers.rst | 9 ++++++--- >> handlers/remote_handler.c | 4 ++-- >> 3 files changed, 8 insertions(+), 12 deletions(-) >> >> diff --git a/Kconfig b/Kconfig >> index 75f9eaa..8ae5b29 100644 >> --- a/Kconfig >> +++ b/Kconfig >> @@ -191,13 +191,6 @@ config SOCKET_PROGRESS_PATH >> help >> Path to the socket progress information is sent to. >> >> -config SOCKET_REMOTE_HANDLER_DIRECTORY >> - string "SWUpdate remote handler socket directory" >> - default "/tmp/" >> - help >> - Directory where sockets to remote handler processes >> - are expected to be found. >> - >> config SOCKET_NOTIFIER_DIRECTORY >> string "SWUpdate notifier socket directory" >> depends on HAVE_FREEBSD >> diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst >> index 84dffd6..fa11887 100644 >> --- a/doc/source/handlers.rst >> +++ b/doc/source/handlers.rst >> @@ -436,9 +436,12 @@ a possible setup using a remote handler could be: >> ) >> >> >> -The connection is instantiated using the socket "/tmp/test_remote". If >> -connect() fails, the remote handler signals that the update is not successful. >> -Each Zeromq Message from SWUpdate is a multi-part message split into two frames: >> +The connection is instantiated using the socket ``test_remote`` (according >> +to the "data" field's value) in the directory pointed to by the environment >> +variable ``TMPDIR`` with ``/tmp`` as fall-back if ``TMPDIR`` is not set. >> +If ``connect()`` fails, the remote handler signals that the update is not >> +successful. Each zeromq message from SWUpdate is a multi-part message split >> +into two frames: >> >> - first frame contains a string with a command. >> - second frame contains data and can be of 0 bytes. >> diff --git a/handlers/remote_handler.c b/handlers/remote_handler.c >> index 2e2a517..8558d88 100644 >> --- a/handlers/remote_handler.c >> +++ b/handlers/remote_handler.c >> @@ -159,7 +159,7 @@ static int install_remote_image(struct img_type *img, >> struct RHmsg RHmessage; >> char bufcmd[80]; >> >> - len = strlen(img->type_data) + strlen(CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY) + strlen("ipc://") + 4; >> + len = strlen(img->type_data) + strlen(get_tmpdir()) + strlen("ipc://") + 4; >> >> /* >> * Allocate maximum string >> @@ -169,7 +169,7 @@ static int install_remote_image(struct img_type *img, >> ERROR("Not enough memory"); >> return -ENOMEM; >> } >> - snprintf(connect_string, len, "ipc://%s%s", CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY, >> + snprintf(connect_string, len, "ipc://%s%s", get_tmpdir(), >> img->type_data); >> >> ret = zmq_connect(request, connect_string); >> -- >> 2.31.1 >> > >
On 29.04.21 14:09, Christian Storm wrote: > Hi Stefano, > > any thoughts on this patch being included the 2021.04 release? > It was already merged: https://github.com/sbabic/swupdate/commit/706424b699f0d1a7a3a4050c108c56f210378378 Regards, Stefano > Kind regards, > Christian > > > >> From: Dominik Tacke <dominik.tacke@siemens.com> >> >> Make the remote handler's socket directory run-time configurable >> using the $TMPDIR environment variable's value with /tmp as fallback. >> >> Signed-off-by: Dominik Tacke <dominik.tacke@siemens.com> >> Signed-off-by: Christian Storm <christian.storm@siemens.com> >> --- >> Kconfig | 7 ------- >> doc/source/handlers.rst | 9 ++++++--- >> handlers/remote_handler.c | 4 ++-- >> 3 files changed, 8 insertions(+), 12 deletions(-) >> >> diff --git a/Kconfig b/Kconfig >> index 75f9eaa..8ae5b29 100644 >> --- a/Kconfig >> +++ b/Kconfig >> @@ -191,13 +191,6 @@ config SOCKET_PROGRESS_PATH >> help >> Path to the socket progress information is sent to. >> >> -config SOCKET_REMOTE_HANDLER_DIRECTORY >> - string "SWUpdate remote handler socket directory" >> - default "/tmp/" >> - help >> - Directory where sockets to remote handler processes >> - are expected to be found. >> - >> config SOCKET_NOTIFIER_DIRECTORY >> string "SWUpdate notifier socket directory" >> depends on HAVE_FREEBSD >> diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst >> index 84dffd6..fa11887 100644 >> --- a/doc/source/handlers.rst >> +++ b/doc/source/handlers.rst >> @@ -436,9 +436,12 @@ a possible setup using a remote handler could be: >> ) >> >> >> -The connection is instantiated using the socket "/tmp/test_remote". If >> -connect() fails, the remote handler signals that the update is not successful. >> -Each Zeromq Message from SWUpdate is a multi-part message split into two frames: >> +The connection is instantiated using the socket ``test_remote`` (according >> +to the "data" field's value) in the directory pointed to by the environment >> +variable ``TMPDIR`` with ``/tmp`` as fall-back if ``TMPDIR`` is not set. >> +If ``connect()`` fails, the remote handler signals that the update is not >> +successful. Each zeromq message from SWUpdate is a multi-part message split >> +into two frames: >> >> - first frame contains a string with a command. >> - second frame contains data and can be of 0 bytes. >> diff --git a/handlers/remote_handler.c b/handlers/remote_handler.c >> index 2e2a517..8558d88 100644 >> --- a/handlers/remote_handler.c >> +++ b/handlers/remote_handler.c >> @@ -159,7 +159,7 @@ static int install_remote_image(struct img_type *img, >> struct RHmsg RHmessage; >> char bufcmd[80]; >> >> - len = strlen(img->type_data) + strlen(CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY) + strlen("ipc://") + 4; >> + len = strlen(img->type_data) + strlen(get_tmpdir()) + strlen("ipc://") + 4; >> >> /* >> * Allocate maximum string >> @@ -169,7 +169,7 @@ static int install_remote_image(struct img_type *img, >> ERROR("Not enough memory"); >> return -ENOMEM; >> } >> - snprintf(connect_string, len, "ipc://%s%s", CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY, >> + snprintf(connect_string, len, "ipc://%s%s", get_tmpdir(), >> img->type_data); >> >> ret = zmq_connect(request, connect_string); >> -- >> 2.31.1 >> > >
Hi Stefano, > > any thoughts on this patch being included the 2021.04 release? > > > > It was already merged: > [...] Ah, sorry for the noise, I was looking for a discussion on this patch on this list rather than its merge state in the master branch.. Many thanks! Kind regards, Christian
diff --git a/Kconfig b/Kconfig index 75f9eaa..8ae5b29 100644 --- a/Kconfig +++ b/Kconfig @@ -191,13 +191,6 @@ config SOCKET_PROGRESS_PATH help Path to the socket progress information is sent to. -config SOCKET_REMOTE_HANDLER_DIRECTORY - string "SWUpdate remote handler socket directory" - default "/tmp/" - help - Directory where sockets to remote handler processes - are expected to be found. - config SOCKET_NOTIFIER_DIRECTORY string "SWUpdate notifier socket directory" depends on HAVE_FREEBSD diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst index 84dffd6..fa11887 100644 --- a/doc/source/handlers.rst +++ b/doc/source/handlers.rst @@ -436,9 +436,12 @@ a possible setup using a remote handler could be: ) -The connection is instantiated using the socket "/tmp/test_remote". If -connect() fails, the remote handler signals that the update is not successful. -Each Zeromq Message from SWUpdate is a multi-part message split into two frames: +The connection is instantiated using the socket ``test_remote`` (according +to the "data" field's value) in the directory pointed to by the environment +variable ``TMPDIR`` with ``/tmp`` as fall-back if ``TMPDIR`` is not set. +If ``connect()`` fails, the remote handler signals that the update is not +successful. Each zeromq message from SWUpdate is a multi-part message split +into two frames: - first frame contains a string with a command. - second frame contains data and can be of 0 bytes. diff --git a/handlers/remote_handler.c b/handlers/remote_handler.c index 2e2a517..8558d88 100644 --- a/handlers/remote_handler.c +++ b/handlers/remote_handler.c @@ -159,7 +159,7 @@ static int install_remote_image(struct img_type *img, struct RHmsg RHmessage; char bufcmd[80]; - len = strlen(img->type_data) + strlen(CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY) + strlen("ipc://") + 4; + len = strlen(img->type_data) + strlen(get_tmpdir()) + strlen("ipc://") + 4; /* * Allocate maximum string @@ -169,7 +169,7 @@ static int install_remote_image(struct img_type *img, ERROR("Not enough memory"); return -ENOMEM; } - snprintf(connect_string, len, "ipc://%s%s", CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY, + snprintf(connect_string, len, "ipc://%s%s", get_tmpdir(), img->type_data); ret = zmq_connect(request, connect_string);