From patchwork Thu Jul 14 08:14:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 648261 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (caladan.dune.hu [78.24.191.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rqpQt4jm6z9s9Z for ; Thu, 14 Jul 2016 18:15:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=rDQi3TQZ; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5C6A7B8078E; Thu, 14 Jul 2016 10:14:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Thu, 14 Jul 2016 10:14:52 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 1A2B0B80780 for ; Thu, 14 Jul 2016 10:14:50 +0200 (CEST) X-policyd-weight: using cached result; rate: -7 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 14 Jul 2016 10:14:49 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id q128so4142253wma.1 for ; Thu, 14 Jul 2016 01:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=f2i4Y7NqsAl7LcKV+CnLTq5I/fehzShV/DOjnl+gqF0=; b=rDQi3TQZgJn9c474mIsfU3XW04peoAb+DvMBneRYlTaTzg/4jv16Qir+/90e3aE1E3 C34wlYBUM1ymozqPsW6FHIDalSOD8c0m0CyU66w1im973na8H4TRrxY4A3h5h/GpM59P iBqUGRkMvOIpJVCZW9WjOypRR+7MLgq1vG8eqnH2S7Ki+CJ6WNWdruK9W5YJOVQdEhqu hh6fafNmJLmjh8nYOLQrWoe8gFR+Ihr1ukSskCHpgEsc9DCfL2erggc1OCluNIq2VyNx QgVw241LZyeaFdcUz5YO8V3gG+LPKJYnt69UKn4rs5nPC+y8y+4kusAAPP4AaNVe2hzv cXTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=f2i4Y7NqsAl7LcKV+CnLTq5I/fehzShV/DOjnl+gqF0=; b=gP9+3HT5z4I0sRpPwS0VkOQ4ULP+eiUT8TJ9eflfFltej5JEZ8GzOIirFWcn148spU 1FhLHhQI22dmFPtswIlDOVQVcXpryXKiyTh2kN8wuWHH0mZxHPhJK9s5LAyNIiFmkLu2 /OJtcxpNyPk3ppEWffYju70Ev6ZP/GS7ZZk2Laj6IMPUWurpOw43xuforCPsusgAzg8b 4gK0q+Zk5JDX6UZcRSf4GSqzZDFSeOB3tVtR2C6nFD2DbQ7Ea5EbRDzwdcn9xKy7iuse o09M9ag/51vYZNA0tLT0F0SXngT8ESMVsJb1oUHUwMwRm7EQMVLcSm7TLtkJhxOTpCqx TuxQ== X-Gm-Message-State: ALyK8tJCj2Zot6gVu5FHt0PPTb0bfwuEoZh3H3I20G4GNc/oqzPcVeKWU2vL0xnlI+4csQ== X-Received: by 10.28.16.193 with SMTP id 184mr15180119wmq.62.1468484089402; Thu, 14 Jul 2016 01:14:49 -0700 (PDT) Received: from cplx43.eu.thmulti.com ([141.11.62.7]) by smtp.gmail.com with ESMTPSA id ju2sm1164384wjc.14.2016.07.14.01.14.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jul 2016 01:14:48 -0700 (PDT) From: Hans Dedecker To: openwrt-devel@lists.openwrt.org, lede-dev@lists.infradead.org Date: Thu, 14 Jul 2016 10:14:13 +0200 Message-Id: <1468484055-27341-1-git-send-email-dedeckeh@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [OpenWrt-Devel] [PATCH netifd 1/3] proto-shell: Model config parameter "no-proto-task" as a proto flag X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans Dedecker , steven@midlink.org MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Export the config parameter "no-proto-task" as a proto flag so it can be checked by other netifd modules Signed-off-by: Hans Dedecker --- proto-shell.c | 6 +++--- proto.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/proto-shell.c b/proto-shell.c index 25dec00..1922024 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -44,7 +44,6 @@ struct proto_shell_handler { char *config_buf; char *script_name; bool init_available; - bool no_proto_task; struct uci_blob_param_list config; }; @@ -306,7 +305,7 @@ proto_shell_task_finish(struct proto_shell_state *state, if (state->renew_pending) proto_shell_handler(&state->proto, PROTO_CMD_RENEW, false); - else if (!state->handler->no_proto_task && + else if (!(state->handler->proto.flags & PROTO_FLAG_NO_TASK) && !state->proto_task.uloop.pending && state->sm == S_SETUP) proto_shell_handler(&state->proto, @@ -892,7 +891,8 @@ proto_shell_add_handler(const char *script, const char *name, json_object *obj) handler->proto.flags |= PROTO_FLAG_NODEV; tmp = json_get_field(obj, "no-proto-task", json_type_boolean); - handler->no_proto_task = tmp && json_object_get_boolean(tmp); + if (tmp && json_object_get_boolean(tmp)) + handler->proto.flags |= PROTO_FLAG_NO_TASK; tmp = json_get_field(obj, "available", json_type_boolean); if (tmp && json_object_get_boolean(tmp)) diff --git a/proto.h b/proto.h index 87dec4e..4c4d824 100644 --- a/proto.h +++ b/proto.h @@ -38,6 +38,7 @@ enum { PROTO_FLAG_RENEW_AVAILABLE = (1 << 3), PROTO_FLAG_FORCE_LINK_DEFAULT = (1 << 4), PROTO_FLAG_LASTERROR = (1 << 5), + PROTO_FLAG_NO_TASK = (1 << 6), }; struct interface_proto_state {