From patchwork Mon Apr 1 08:34:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 1072476 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=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.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="TofwGxIy"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="M1K+aLiQ"; 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 44XlyL3hT5z9sQt for ; Mon, 1 Apr 2019 19:34:50 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5l42En9P65SxOJO5cn7zAUGs3p18pmsIHsFB/51upzE=; b=TofwGxIynFh8WW gBwpxzAdNS+3uZLbQ0VjCGVwpYmgqkOOpxQdYdeT2ls/T+2wVfzmvwWkoLiUC0tC6pmctq2YS6PIs I7vRIOg6pFxc7vHEmu8RkgQZJfDqmO0PXjRAIvyHMXKCaPYu5j3gR7+oiK7TbGwKJMYBui+LSJ6pH U1j2oKvPiCEZb/47fs5KPS+3tz4dN30qCJc0gCLv9mm6CvcItmUUfEs/F6o6TXlF444h5+mZDAANN ye8YTjUKMmz/Wx6HukIcOSIYIj5dVQ2AMgssvsozsdV14u8DLThQIih5dCLXlhRN/C2cQ6zEVn5gX AXJt93z2xxPf55iTNTkw==; 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 1hAsOo-0007YW-Q8; Mon, 01 Apr 2019 08:34:34 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAsOl-0007Xy-N9 for openwrt-devel@lists.openwrt.org; Mon, 01 Apr 2019 08:34:33 +0000 Received: by mail-wr1-x444.google.com with SMTP id k11so10799161wro.5 for ; Mon, 01 Apr 2019 01:34:31 -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:mime-version :content-transfer-encoding; bh=eFbk0Ovuls8xwzkx+2Xa5rCCUkm7tjyrqH92NEM4Pis=; b=M1K+aLiQlFux2g6b57hgSC/LRQzOOWbrihFMoWsDyM+ydWRJExhSWKVwY+UhSChf2+ ddDCPBzkLtWCYaEca5d4dlKYhkoTECzgotZ7+INY9QVua9B/MawaomzyXgY5ZrCmTzk8 Un8sQzwWbXlRRPOS5cnEgEFitp5R9YWP4lq/38zXnlBAwmQrkxPe5reqYsDow/2LgyEX 0LTE4xWj3DoUNVTGMu5oZQprAovGoYP9IsB8/vdiaSQ8humy5dlzm3JxjEDZGsyxhhrq JDy2C2gfRKt36peb088BeHtbuxDU5wchUscfDmtyTw6B4Sm6KfCMflx2aAQ5c+ONc9fL Hzbw== 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:mime-version :content-transfer-encoding; bh=eFbk0Ovuls8xwzkx+2Xa5rCCUkm7tjyrqH92NEM4Pis=; b=exwOawv7lj+QrHzU74tEcDo8ec/BzJOGKScFo7v6kKmTgGMIoF/VTcIFdFgH617ffy 7nGlhHPNa+LvSVhB/F8a6yTfNI3u/eB52jINJN3kXVgUKf26W9NnBxhPp4SnUrSXlBU8 EDqPRrTWFq8yMuih7TNYo37xyf1YBj0+d7EIAky0e4FD/LRG7vrgHKrR6bu0LQa+foVA 0kGLgesv2FZFnPMm65lRQWTK2q0wvJw1tVW1bYzp5Aaclpo5ntiaGflJbtNYzuNkz1+0 K7Gstkp8uaArZnpTB3lpg4r8CcqZ4M3eIjZCMwD37mTvmc97rCdYbsJZRsg2FtF2mi6K L1Hg== X-Gm-Message-State: APjAAAVaM8JiwwUMwiTv9k5hIXsQ462ZP7qJgnTsI7RoG8ymEEpVNQB7 0/6yB8hN/l8g+doG7+P1y4ht/Vw0 X-Google-Smtp-Source: APXvYqxh80TqeXrLk8i/JQEsIQTZmOfWVPEWTIO83d3LT61TmZAxE6L5dyYs9F5l+E1GW3x2KzcpJw== X-Received: by 2002:adf:f1ce:: with SMTP id z14mr23508803wro.152.1554107669845; Mon, 01 Apr 2019 01:34:29 -0700 (PDT) Received: from cplx43.eu.thmulti.com (14.125.146.82.ipv4.evonet.be. [82.146.125.14]) by smtp.gmail.com with ESMTPSA id a9sm9545268wmb.30.2019.04.01.01.34.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Apr 2019 01:34:29 -0700 (PDT) From: Hans Dedecker To: openwrt-devel@lists.openwrt.org, nbd@nbd.name Date: Mon, 1 Apr 2019 10:34:26 +0200 Message-Id: <20190401083427.6783-1-dedeckeh@gmail.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_013431_779605_39D4075D X-CRM114-Status: GOOD ( 11.50 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 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 (dedeckeh[at]gmail.com) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 Subject: [OpenWrt-Devel] [PATCH 1/2 netifd] interface: set interface in TEARDOWN state when checking link state X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans dedecker Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Hans dedecker When launching PROTO_CMD_TEARDOWN in interface_check_state() the interface was set in IFS_DOWN state. In case an interface is now brought into IFS_SETUP state in __interface_set_up() it will launch PROTO_CMD_SETUP trying to bring the proto shell handler in S_SETUP state which will fail as the proto shell handler is still in the S_TEARDOWN state. Fix this by setting the interface in IFS_TEARDOWN state when the PROTO_CMD_TEARDOWN event is launched which will prevent the interface being brought into IFS_SETUP state as long as it's not in the IFS_DOWN state. Signed-off-by: Hans Dedecker --- interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface.c b/interface.c index b8c4ae2..fd7a826 100644 --- a/interface.c +++ b/interface.c @@ -342,11 +342,11 @@ interface_check_state(struct interface *iface) case IFS_UP: case IFS_SETUP: if (!iface->enabled || !link_state) { - interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, false); + iface->state = IFS_TEARDOWN; if (iface->dynamic) __set_config_state(iface, IFC_REMOVE); - mark_interface_down(iface); + interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, false); } break; case IFS_DOWN: From patchwork Mon Apr 1 08:34:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 1072477 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=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.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="DTQEeEHA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nLle0Cg0"; 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 44XlyR6pHgz9sQt for ; Mon, 1 Apr 2019 19:34:55 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version: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=1Svez1CeK3vBaCcM+KM7yAOHpaBBET/xo+6vllB9zBc=; b=DTQEeEHAxfs+lQ lmg+J3yFZcjSWIWkQl/VEXnYCPZ4inFaU264CJXpBkhh3rKwXhNsW5GJ8cA/fQABQGjtJ1lKEA5zQ Zb9NIZdX4yjCjCFUbHPgBdQBsQfKPqR7W4+aFjvLVAjrJYoVZGRo2ZGi1evfjAQblNl+5DIgSz6QV 1OrEwb2nt8+6bcAMZt2r/0+lGM1mxxC6dGFtjHqma7qQpD9iFz++/1JZ3h/LmnAOX8zUfRHtmpUnO EIuyTEIv+rrDvg16MuPGbVQFz5Zp0m5RIjUf0rx0OE9K9gC3YMVgoC148+utlGSl+rc7JnfWwgn+c J5ZFKRScwUis3uljVBCg==; 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 1hAsOw-0007jK-Ky; Mon, 01 Apr 2019 08:34:42 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAsOn-0007YC-CZ for openwrt-devel@lists.openwrt.org; Mon, 01 Apr 2019 08:34:34 +0000 Received: by mail-wr1-x444.google.com with SMTP id y7so10752405wrn.11 for ; Mon, 01 Apr 2019 01:34:33 -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 :mime-version:content-transfer-encoding; bh=GxPomTPpNcQ2swXI+k6fKkrhHhTWRqcn1WCUndr1PeY=; b=nLle0Cg0pU/taNq7U71KDbsRk8+APzML+lCPQbZKJFp9JfJF1LwYNV6XtAndom60bA d15WahEicXpccF4C/+vCUAzI2fzms1XelYeuQHn3yuBYpUJk60nMswPIZBsLCIPk+G5F F+/ptOsGIysO9sVNmNi4u9gVFVmB+wt0CM/npWSEJa5gjsvEzjYx9LzJWVC/QY5FfyOK eGGm7ihyf6D0e0d/rIGAHq6g7Uh5FjI6LhPZ+5G/xtDUeV/jpIG8dv36fbor6gxPTawA S48+e1x+4PPQPm6Q5ZeFKfZ9VDXBIQG5hxIcQNBLtv+dFh83dGlZ7YYJQMRXLTKLV+t1 xkew== 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:mime-version:content-transfer-encoding; bh=GxPomTPpNcQ2swXI+k6fKkrhHhTWRqcn1WCUndr1PeY=; b=V8N2urpcR8bL3Lu7YwpYMqwFO/Syv6QlP7sl+AsUMNU4CJPuvDExq7dAFAYdd4w/CJ kLhOREGeFLh7HKSrdyKRwJrDXw/NyMqChLfUE16WNMO6sZIDLvHVhpHOmCXs9SwxP7GJ BrRiVfttP/7vP19E9LtY2sD7tLRoHM+3eE9ACILtZ/wd/HHoOwnea8yBtWXf63Ntvq/z IWoGW5ffoxoHUiDp3o1lko4bDml5tcCbU7x6jxcSmQXXJ76AzXcAqvKc6usL3Tmj6iaZ 8Fj/HQcYFFKYmos1a13yhO/wNgIQqGJG0HpN+KSRjs5zeV2JHjbxFBbsjlVoZtSDJxl9 dsNQ== X-Gm-Message-State: APjAAAX8vnpsVwe1sesjWlJ+Kl+KveRDQTmxCSTUiuQ9Pun7TwyC0FN/ ubBBwiFmoiueqDOQK+p9g0zO7Geu X-Google-Smtp-Source: APXvYqyDbo8igWPw8ZUy10J+l5t/W/hRmtwF2GslVsvYaxN+PzYlhvY5vekRycPtrZDGFbyrgkHdDA== X-Received: by 2002:adf:ef0c:: with SMTP id e12mr39519515wro.170.1554107671927; Mon, 01 Apr 2019 01:34:31 -0700 (PDT) Received: from cplx43.eu.thmulti.com (14.125.146.82.ipv4.evonet.be. [82.146.125.14]) by smtp.gmail.com with ESMTPSA id a9sm9545268wmb.30.2019.04.01.01.34.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Apr 2019 01:34:31 -0700 (PDT) From: Hans Dedecker To: openwrt-devel@lists.openwrt.org, nbd@nbd.name Date: Mon, 1 Apr 2019 10:34:27 +0200 Message-Id: <20190401083427.6783-2-dedeckeh@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190401083427.6783-1-dedeckeh@gmail.com> References: <20190401083427.6783-1-dedeckeh@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_013433_423789_5F03FEA3 X-CRM114-Status: UNSURE ( 8.75 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 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 (dedeckeh[at]gmail.com) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 Subject: [OpenWrt-Devel] [PATCH 2/2 netifd] proto-shell: return error in case setup fails X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans Dedecker Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org In case PROTO_CMD_SETUP cannot be handled due to an invalid state; return -1 so the calling functions are aware the PROTO_CMD_SETUP has failed. Signed-off-by: Hans Dedecker --- proto-shell.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/proto-shell.c b/proto-shell.c index 9653f4c..fd9cad4 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -184,8 +184,6 @@ proto_shell_handler(struct interface_proto_state *proto, case S_SETUP_ABORT: case S_TEARDOWN: case S_SETUP: - return 0; - default: return -1; }