From patchwork Thu Aug 31 14:07:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 808260 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4010:c07::23a; helo=mail-lf0-x23a.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbrvrudgqkgqedosk3eq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="A6qgUrxj"; dkim-atps=neutral Received: from mail-lf0-x23a.google.com (mail-lf0-x23a.google.com [IPv6:2a00:1450:4010:c07::23a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xjkmC54h4z9sD9 for ; Fri, 1 Sep 2017 00:10:18 +1000 (AEST) Received: by mail-lf0-x23a.google.com with SMTP id p195sf508224lfd.17 for ; Thu, 31 Aug 2017 07:10:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1504188614; cv=pass; d=google.com; s=arc-20160816; b=XvJyJnDwG1P4mAv5loHEYPDzPAQNZlDOF/AY4OpooeGVVWKeQODRqeBvosaV4D5B7L zrMY1Om1esm5IGp6SmibStohfRp4KwtWmC7qE+PqE4JUZiHQngk8x6SzXgUU3AFRmlFW BmYsJ2vkegT4cNAiV2tsoGeWe/9WysSyY1EHWEFFTylpBupMep3At+r17cucSgE8HMya zMe3vzFauFyDN7HpwwdtxDh8UYuUyHaEaCzPFvBSR9C3mKb3sTLtRYBGCLKl6PtvAQMV AHeyJljV3E0JmPmihw+H67vVrzrU4NhuWIZ6JT/jZLdhWTP9iXD7aOgMdbDiiQGLYS3q EUUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:user-agent :content-transfer-encoding:content-disposition:mime-version :mail-followup-to:message-id:subject:to:from:date :arc-authentication-results:arc-message-signature:sender :dkim-signature:arc-authentication-results; bh=TkC3lahq92OWAKKa+rpPUTUNnogNt74a/NxbOdXk73w=; b=A70vOsuDefmteSGgm2ADWuZblK75JmRhYHdCBHsM0GIh8j4T1o4NyO89Aq5kcN6vDQ vje5SbKUhy+W7qRH1q1RkL+MU4/yj9slmAMltj6l0peYZ1Ldv28bFiBIxdUeGeNZldDm 9tJxIGTGnwVwbb1yMQ+P913xg13e8i2e8Lix4wb7/l+u0VcVNcEDmbQU9Zenf13QQhmF ZgEVBy542N2miFtsDnJqv08UIzC6DQIEzTZ7F/vk1z+a1BWGPFJ3VNiZjMI9bGB+2e8m dckz1wCfZGz9RvRf4kUOQmKSI3PHYTjjV/Cz/Qo74xShNJErOfE+AP2YZq97eE5Cqwx7 e5CA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition:content-transfer-encoding :user-agent:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=TkC3lahq92OWAKKa+rpPUTUNnogNt74a/NxbOdXk73w=; b=A6qgUrxjEEmJlUK2Grn+gdfP3FZc/+yG3rE+9k+aiJo6UGrB5dxqTZOLbn2YOw+xFr ytyvd9uwV/N8oAem6hRIkQOqShkLjdfNo0b0aYmrIaxlHhCQg/LF/nSxZzznVWJ36ryK M2QQjdLCF+SpYjq0lTGbw0zS1X9AZE3ouF0viFbU1wMaB1bJw1F2CIu+faEnu/qyOMsH avKU2SiftS53P8kZchT7pMrWmrZO9Nn9BDi1UU1i5txjGIP8tZd6efeUIyqHLeMTumxU k8TcMjSz/5nFQOA2tIZmuTjhEE79HR+vGvP61P5kBRMc8WyQYEm86AmuEDr9UH9DAJcd DTcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:subject:message-id :mail-followup-to:mime-version:content-disposition :content-transfer-encoding:user-agent:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=TkC3lahq92OWAKKa+rpPUTUNnogNt74a/NxbOdXk73w=; b=Od92YQYor9zXMYRg1iKuqoYiSVyM8D0qavtj2Rci/Nxz7Ba5gR/Ozb52alHOC0r/og f4WaKBa1XyEPJTPEfKaht+sfrejaqhbl41yJ5n+nQ9deb8ranpMBygEPd1+H6ywhkA+m bgtYOqj13JoJEF5lbJKTUdt/r3MTC/aqPBOB5s3qXouKxPhw5QdYpYUXuvLy7gtaL9Vn tFOvfgyN2b3c2IdVAen02J1oufoOyDHv0PxVNje5jbtTQbemW7hL5s3gYKJDqq8MzXzN j8umNGs5mMpWLNAlmZy281wOv15IQ106dpaguVtWfwDfXbR1VLqkg3a0VKPxOCCOkX1V GPkw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AHPjjUhNsGaOPd47Tym5kQvVJWC8/0wclyVwFxovgwcrRbZhrylkVcGr P6Mf80Fvx/MVSQ== X-Google-Smtp-Source: ADKCNb60dPpj5jV0r2BpxipYWN75d0DGV0nTKVttRVAnaN7PpiN3IJM4abKgMDSUl7bpF88FKjhE/g== X-Received: by 10.25.141.147 with SMTP id p141mr8718lfd.27.1504188614770; Thu, 31 Aug 2017 07:10:14 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 10.46.21.10 with SMTP id s10ls640052ljd.51.gmail; Thu, 31 Aug 2017 07:10:14 -0700 (PDT) X-Received: by 10.25.22.34 with SMTP id m34mr466213lfi.8.1504188614204; Thu, 31 Aug 2017 07:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504188614; cv=none; d=google.com; s=arc-20160816; b=sUZXvrRAeYV5nErlnzRpjeBeIu+Yat3ox66sv+NooJ7JqrS76qex3A201WlWBBJUl/ 3MXZhfs6w5yG0H/z6dgTEMKvegomak3fwPL1aiNtbuMcre/u6WdlHnnJxF91a3z1pauX umpqlN7lcT117fxDeG7JAHxjy2stW6a0AyH9sSmlPYXtdTQ/WDzVrJQeK2kgGNfBPYZI vlg5S+r0E6ZWLoSHKgpFkfcIRaDkHTG3if2AVxpOHfWEF2Lds9UGCi4ylj4Bjwl5PKLJ o7O+u3oQ74e86tPrVHWZSI65Pxt6R436K5qyRlnDVtQx4v6FOhEYzCg/V2rSwRyGED92 1iMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-transfer-encoding:content-disposition :mime-version:mail-followup-to:message-id:subject:to:from:date :arc-authentication-results; bh=5UqWmO2eCWp+Ckt5tTwUQnp6BelSnILj6flrpLtiMR4=; b=wZGK9s7hETR5gmnhuSv6sc/REGaI6ZvD7rxDIXya/ILz6QKoLRAjFHlppQi8nhD8kJ q27vY9ZHZGC6gwEQWXA6siNVj8rrph7OsgGzr7w2ISZVy5p0lofE0rwlI2IJJIMYloUd NOxmk4cCIYxwP7RTpGVE8gJQk7mY4q9GRMShoTS0YimG1yWwiffCbTcwHG7zi6VswVbL NAt+Y+pHqZh9nSYaPm0Bv4OLSjpJmOcJd6WIS9KUJZH7vNVitEkDyVjsuRGdDbRHNRvW Rid4gR4NeZQs2Iq7y2gXt1OL7LXqsxnIX+op58HO2Pf2VZDIO9TSsuTqVZIa6vg1ucet d0fQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id p65si233298wmg.1.2017.08.31.07.10.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Aug 2017 07:10:14 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) client-ip=192.35.17.14; Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id v7VEADb2023301 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 31 Aug 2017 16:10:13 +0200 Received: from localhost ([139.25.69.251]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTPS id v7VEAD8s029029 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 31 Aug 2017 16:10:13 +0200 Date: Thu, 31 Aug 2017 16:07:59 +0200 From: Christian Storm To: swupdate@googlegroups.com Subject: [swupdate] Make socket paths and TMPDIR configurable? Message-ID: <20170831140759.436kek42e27kqebj@MD1KR9XC.ww002.siemens.net> Mail-Followup-To: swupdate@googlegroups.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/20170113 (1.7.2) X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Hi, I'd like to see the various socket locations be configurable so that I can put them into different directories and, e.g., give progress clients access to the progress IPC socket only but not to, say, the control IPC socket, including the ability to "see" the control socket at all. Currently, they're all residing in /tmp/, hard-coded. As a quick hack, consider something along the lines of the following: ``` ``` This, however, breaks progress clients if they're compiled out-of-tree without a proper include/generated/autoconf.h defining, e.g., CONFIG_SOCKET_CTRL_PATH. Hence, progress clients should get a command line parameter -s /path/to/socket specifying the path to the progress IPC socket (and a "sane" default as fallback which is the current hard-coded location in /tmp). The same is true for the other sockets. Carrying things further, TMPDIR as defined in include/util.h:115 and used in various locations may also be split according to the concern at hand so that not all temporary files regardless of their concern reside in /tmp. What do you think about this? As a side note, what do you think about including systemd's socket-based activation as an optional feature? Then, if a process wants to talk to the control IPC socket created by systemd, systemd spawns SWUpdate and hands over the socket to SWUpdate... Kind regards, Christian --- a/Kconfig +++ b/Kconfig @@ -110,6 +110,25 @@ config SW_VERSIONS_FILE but in some cases it can be required to do it. Having a check, the risky-component is not always updated. +config SOCKET_CTRL_PATH + string "SWUpdate control socket path" + default "/tmp/sockinstctrl" + help + Path to SWUpdate's IPC socket. + +config SOCKET_PROGRESS_PATH + string "SWUpdate progress socket path" + default "/tmp/swupdateprog" + 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. + --- a/handlers/remote_handler.c +++ b/handlers/remote_handler.c @@ -167,7 +167,7 @@ static int install_remote_image(struct img_type *img, struct RHmsg RHmessage; char bufcmd[80]; - len = strlen(img->type_data) + strlen(TMPDIR) + strlen("ipc://") + 4; + len = strlen(img->type_data) + strlen(CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY) + strlen("ipc://") + 4; /* * Allocate maximum string @@ -177,7 +177,7 @@ static int install_remote_image(struct img_type *img, ERROR("Not enough memory"); return -ENOMEM; } - snprintf(connect_string, len, "ipc://%s%s", TMPDIR, + snprintf(connect_string, len, "ipc://%s%s", CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY, img->type_data); ret = zmq_connect(request, connect_string); --- a/include/network_ipc.h +++ b/include/network_ipc.h @@ -24,7 +24,7 @@ #include "swupdate_status.h" #define IPC_MAGIC 0x14052001 -#define SOCKET_CTRL_PATH "/tmp/sockinstctrl" +#define SOCKET_CTRL_PATH CONFIG_SOCKET_CTRL_PATH typedef enum { REQ_INSTALL, --- a/include/progress.h +++ b/include/progress.h @@ -24,7 +24,7 @@ #include -#define SOCKET_PROGRESS_PATH "/tmp/swupdateprog" +#define SOCKET_PROGRESS_PATH CONFIG_SOCKET_PROGRESS_PATH /* * Message sent via socket