From patchwork Thu Aug 11 13:53:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 658227 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 (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s98dX0VK0z9sdn for ; Thu, 11 Aug 2016 23:54:24 +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=KO5DGI/p; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 6FB09B91BD3; Thu, 11 Aug 2016 15:54:06 +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, 11 Aug 2016 15:54:06 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 716A1B91B8D for ; Thu, 11 Aug 2016 15:53:59 +0200 (CEST) X-policyd-weight: using cached result; rate:hard: -7 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 11 Aug 2016 15:53:59 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id i5so1548271wmg.2 for ; Thu, 11 Aug 2016 06:53:59 -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:in-reply-to:references; bh=RzGEJrUy2/CjvGPtuw6tcNvInneodbytM9s/DT2ci14=; b=KO5DGI/pu6FssoCSfMlj6cwSCKI5idAp606mjyXb+APlBqowSImx2syRkc3x9Xzt+A iw1udxZ1w/dFEgCsl5mcHXzR0nxuPK4ukzITVPDjISrnnjYMPyt0qLzZZCS5QZc4U618 CHPJTRnz+rmdbGJ2OO6cC/nKiEaKVCCAA99oNFiCseMooUhPfn2uwup5ksBKLEcbrNsu Pd99mryiP3wwuYfS8s9OR/ZdtixsgUDF0ADOrF5no20yHL5FMZ/GMs4d1tssppqABy9L WXv/00gezvEGod3h06VvqxqpN3imycBGIwzXC3u0jzQoFz1skehidSrMWqGhpV+Cl5g1 qP0Q== 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:in-reply-to :references; bh=RzGEJrUy2/CjvGPtuw6tcNvInneodbytM9s/DT2ci14=; b=T3RYjRNK5MQZRNtyK/o2GN91JI2m5RFu8cZbT+xadAU1A4RQm5dTriJ6EuiAkotGnq R5G8jY7a05JI4Rptv2Y7JiCvauIf/YE3lWiUAv2U5MZvIkgnign8aDxTq7v4b1lLzUFs 7It8T9L5MGidb7ZrAQa5XJquzKPKdWi/AnGnBJ82SlxkUiFUN/B/5Aip+4nmxRYky0tx gpuPlDG7quXQDRmYtmqJARzeLODIonxmcr8xVlgOJDlAHTon7VVaqiRhl0baUG4cABh5 eMjAaqhO7jpDe2RWZDSW8G1KW+tfIxOdnFZFKAEk2MoxfTWHSEkQOjAFqozy2UpOvSBz wDeg== X-Gm-Message-State: AEkoousROjMWt4vyW58VdVk28mUPBF1xsKODrbfgjsv31u2Fy5sXNBoHpwD3IGGV1yUgmQ== X-Received: by 10.195.12.77 with SMTP id eo13mr9945607wjd.142.1470923638842; Thu, 11 Aug 2016 06:53:58 -0700 (PDT) Received: from cplx43.eu.thmulti.com ([141.11.62.7]) by smtp.gmail.com with ESMTPSA id 207sm238901wmb.7.2016.08.11.06.53.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Aug 2016 06:53:58 -0700 (PDT) From: Hans Dedecker To: openwrt-devel@lists.openwrt.org, lede-dev@lists.infradead.org Date: Thu, 11 Aug 2016 15:53:26 +0200 Message-Id: <1470923609-24767-2-git-send-email-dedeckeh@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470923609-24767-1-git-send-email-dedeckeh@gmail.com> References: <1470923609-24767-1-git-send-email-dedeckeh@gmail.com> Subject: [OpenWrt-Devel] [PATCH v2 2/5 netifd] 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's available for other other netifd modules Signed-off-by: Hans Dedecker --- Changes in v2: -PROTO_FLAG_NO_TASK assigned value 0x80 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 4391cdd..998a44c 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 8f50fdc..26a54bd 100644 --- a/proto.h +++ b/proto.h @@ -39,6 +39,7 @@ enum { PROTO_FLAG_FORCE_LINK_DEFAULT = (1 << 4), PROTO_FLAG_LASTERROR = (1 << 5), PROTO_FLAG_TEARDOWN_ON_L3_LINK_DOWN = (1 << 6), + PROTO_FLAG_NO_TASK = (1 << 7), }; struct interface_proto_state {