From patchwork Thu Mar 22 17:01:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Merzlyakov X-Patchwork-Id: 889479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RUSUPLCN"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="T/wC+Lsb"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406XyD01P4z9s1P for ; Fri, 23 Mar 2018 04:01:39 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Sg1hD26aaW6AGkRuaBm0ZzNedG2r2s2v8x5NV8FM/NU=; b=RUSUPLCNK7z6FG eKxXCg8iFJOCEuPRpjB6fvL5hF3sTlDzGZQ1NZ4zaQlRDU1w34J8pSFfIjA5Pq/5KX800bZSFkoXB 83Pq1/G2VKzmlq3U6+Y3Vw+WUVFecuW2GYJFLu7ZSmo4ifASl43Gq7qbw39R6AaVD/5jIPlLlu27D ZNch61WKKVYwkuxsmUa1TaDMDjcuCnvjlxZ9w5g6fU3dDWbil/9I3GH4nuuzXTTXCCmA9Myd7owMA Z251qSD15zoUgua6q3eDNBGZWpLTJzV/KIjQXyNYlrkRgjfIeXJDqZPj/mkSjE9V21wUsAYnQylhc BwHLx2KDFwBwhBOkL50Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ez3al-00047e-Ie; Thu, 22 Mar 2018 17:01:31 +0000 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ez3aV-0003n5-Q0 for lede-dev@lists.infradead.org; Thu, 22 Mar 2018 17:01:25 +0000 Received: by mail-pl0-x242.google.com with SMTP id p9-v6so5695833pls.2 for ; Thu, 22 Mar 2018 10:01:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rWvWk1d0PPp6bJZaio2eGQy1ZtpJ/QAO61IAbY25FSM=; b=T/wC+LsbdHOTzit6qKtRG1/bPj3rEy3vfM2rtg/FzoxARp0Qxltr1T9Cu8ALwnnrBP ZKhW9FDzznjaI80+D4TKsCoP0JYNWxL86ygSPgZMqJdagMjGZMQe6nS0hUJvZFfJU6dd fS0vwXgxoA0KNPW32p5+vTMIkyKkVyNU/W7PsB/euqSpnvx17rV+kif3ehKMK2H/rRrk Vc2YZwOZa4Kj9vTCdumBNfDFqaXQ0nX0TMCES4DFgzFf1R/KcGFevJ4oh8k3Vntv4jIc Wq6PuQw0y/+IC9Rursbaccgp9ZX+fpJCqHYY1ABiFJ807aHhN/L+cZG0YfxAmJHSZl4Z hoig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rWvWk1d0PPp6bJZaio2eGQy1ZtpJ/QAO61IAbY25FSM=; b=eioRZjISm1g8I/dy6oDOg8CZYAplUdADDpvtjJSdCHjSeRhHUtvX3y/jRJPbn6g+/b CiNWjUp5nEAudT9sQ6rCrpJbiuw0S5D46VbEeyXaRgkH9rHYQperqQXhyNFDq4VDHQZR ItdIDWWj8jsJJcMO7A5eDwrRz1RwDeNpei0qWnWOfMMFdedKZ0hDjWBn0zMeI+W8SbAQ YgUaTW2TTpJG0EnodKkp5vP0U0CnXtP4eUkKpN6mK8PeOdBGX0xpivuasuJYB9m0NH+s ZBdvbjql5NECY9dv5yNdkLnbcAun6TC1k5hb6c3e62igBvUR4eJR+tD6UMDQd+1J4tOc Z75Q== X-Gm-Message-State: AElRT7HC57uC9XvwLfqCvUByOWbPJqqMp/P/0oe+wKTCFdW+hHOFso+/ qxRXPUQDzT/W62e36ofsTmGm2/mq X-Google-Smtp-Source: AG47ELuTw4KlX4Fby+f9MXEGfLACm0q3DVNNREluq7afYG+UG/QAGWo9w5QuEdlV7KC08k8iavnhGQ== X-Received: by 2002:a17:902:2805:: with SMTP id e5-v6mr17961185plb.89.1521738064697; Thu, 22 Mar 2018 10:01:04 -0700 (PDT) Received: from well.corp.ubnt.com ([2a02:16d8:105:4000:1d8d:bb15:157e:da21]) by smtp.gmail.com with ESMTPSA id p86sm15190859pfi.55.2018.03.22.10.01.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 10:01:03 -0700 (PDT) From: Pavel Merzlyakov To: lede-dev@lists.infradead.org Date: Thu, 22 Mar 2018 19:01:23 +0200 Message-Id: <20180322170123.22269-3-pavel.merzlyakov@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180322170123.22269-1-pavel.merzlyakov@gmail.com> References: <20180322170123.22269-1-pavel.merzlyakov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180322_100116_680853_5BD7FEAA X-CRM114-Status: GOOD ( 13.44 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c01:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (pavel.merzlyakov[at]gmail.com) 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH 2/2] procd: Copy missing attr/cfg to new instance X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pavel Merzlyakov MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In case when we (async) stop instance and then start it again while it not actually killed, we just update config of old instance without remake (del and new) so we should update/move all attr/cfg of instance Signed-off-by: Pavel Merzlyakov --- service/instance.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/service/instance.c b/service/instance.c index 5a14f82..ab949df 100644 --- a/service/instance.c +++ b/service/instance.c @@ -593,18 +593,35 @@ instance_config_changed(struct service_instance *in, struct service_instance *in if (!in->valid) return true; + if (!blob_attr_equal(in->trigger, in_new->trigger)) + return true; + if (!blob_attr_equal(in->command, in_new->command)) return true; if (!blobmsg_list_equal(&in->env, &in_new->env)) return true; + if (!blobmsg_list_equal(&in->data, &in_new->data)) + return true; + if (!blobmsg_list_equal(&in->netdev, &in_new->netdev)) return true; if (!blobmsg_list_equal(&in->file, &in_new->file)) return true; + if (in->name && in_new->name) + if (strcmp(in->name, in_new->name)) + return true; + if (in->name && !in_new->name) + return true; + if (!in->name && in_new->name) + return true; + + if (in->trace != in_new->trace) + return true; + if (in->nice != in_new->nice) return true; @@ -617,13 +634,13 @@ instance_config_changed(struct service_instance *in, struct service_instance *in if (in->pidfile && in_new->pidfile) if (strcmp(in->pidfile, in_new->pidfile)) return true; - if (in->pidfile && !in_new->pidfile) return true; - if (!in->pidfile && in_new->pidfile) return true; + if (in->respawn != in_new->respawn) + return true; if (in->respawn_retry != in_new->respawn_retry) return true; if (in->respawn_threshold != in_new->respawn_threshold) @@ -640,6 +657,26 @@ instance_config_changed(struct service_instance *in, struct service_instance *in if (!blobmsg_list_equal(&in->errors, &in_new->errors)) return true; + if (in->has_jail != in_new->has_jail) + return true; + + if (in->reload_signal != in_new->reload_signal) + return true; + + if (in->no_new_privs != in_new->no_new_privs) + return true; + + if (in->term_timeout != in_new->term_timeout) + return true; + + if (in->seccomp && in_new->seccomp) + if (strcmp(in->seccomp, in_new->seccomp)) + return true; + if (in->seccomp && !in_new->seccomp) + return true; + if (!in->seccomp && in_new->seccomp) + return true; + return false; } @@ -951,6 +988,14 @@ instance_config_move(struct service_instance *in, struct service_instance *in_sr in->name = in_src->name; in->trace = in_src->trace; in->node.avl.key = in_src->node.avl.key; + in->nice = in_src->nice; + in->uid = in_src->uid; + in->gid = in_src->gid; + in->has_jail = in_src->has_jail; + in->reload_signal = in_src->reload_signal; + in->no_new_privs = in_src->no_new_privs; + in->term_timeout = in_src->term_timeout; + in->seccomp = in_src->seccomp; free(in->config); in->config = in_src->config;