From patchwork Wed Oct 21 03:08:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1385306 X-Patchwork-Delegate: yszhou4tech@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.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; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=j7YuwpK7; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=mGJFeh2j; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CGFr220vYz9sTR for ; Wed, 21 Oct 2020 14:10:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8Y80qXIGc8+Sre0i8R4RIBiFoQaQNKcS6sWP9lELeWA=; b=j7YuwpK7QVQ9D/8iGlqYG09zy OADcadOnKLfkCx7Fqy7bnzz5wAx1owa/tYRusB9LGdRUQ583YNf6Q6rbzjSeSR1FAXLeC8RkCUEE3 NvAwHAplCfHrASq4IFqAVmEyfhNkpVgXcpsrJUjyxmkcRE9AVI0MFSLyZ/ofHSE4jwJ7dBTtSZkqa b1aSRXKSCksD5MjX6565jARHVLWEYOtVxA3DKq3/ZtkmIr3Lb8HFqUF4M/yW7Xwleu8Fiq/68SIGy GQOwfu1iWP+b0rT/e07hmA+Bujr9kue8YMSpc+0OXcq/kg9XeZh2MR0vHxJ3Sx7PyUqlBlrGhi0li X2fqd3Rcw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kV4Ug-0006mw-0O; Wed, 21 Oct 2020 03:08:54 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kV4Ud-0006lT-1t for openwrt-devel@lists.openwrt.org; Wed, 21 Oct 2020 03:08:51 +0000 Received: by mail-pj1-x1044.google.com with SMTP id gv6so390813pjb.4 for ; Tue, 20 Oct 2020 20:08:50 -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=Qt8IIeRmzS6rmmgvBUtUJk9RmJpjmGBKglEHBp5qw6k=; b=mGJFeh2jpfq1zXQzgyJ54u9wUUDEV96YLNcJK+B7i59pC0HIyYZ7ZZudgHllG7r/8i o0o/3/O398/q9+IdCxvL/XCbHd0Hz1X+cTfolYCxIg47lE6UW6D2zs4UVAPXEhQxHsQZ earKYUc4UsxFxNMrrWGOQs/xyX7NCWmIMOzX3guK/K0xTSgCIqO3wkl5knrFosNYStbO 8E1Lsenod5C0oXW8SURk9o/1IAuPjtNr5BOwENnWcUq6p3YstfV6Jb4uNQTmng5haoVz JOmToxORfR0xWl/HNMzQXvJj8OEsKIJeA9PcfstC+j3fxN+L+F7ClgAuM7vWGSArAply Jfog== 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=Qt8IIeRmzS6rmmgvBUtUJk9RmJpjmGBKglEHBp5qw6k=; b=apLOIZ0QA4hJ/PXVKMN6J2ypB6mfLUlMtYZfQRlSOzIabajihFNTRLlUCeUxy6MNtj uGfJmpMDZNpWQximpu1hDIXzRBJMVVIQviB81pJYSVr/6oY2/qC2VDjWF72oHI5HbtT/ 5Y5/4vAV3U82r4n4FP6Xv8RXe+kYlzZ0urE4rmrQTkjO77jMrBm57D79h4TxV4oqj3CL qEjT07YL5vQ1tPrX9Jbh8bcYBTKLGiEcFbuBd4+BqB5gFNAvVqpUYat69UBaM82p+75S bKULWVMvwsRSuN2Xj9Yhz282FXiiEOb5K7FTPmZZkjgxGBsYPIuReAvJdaX4ayjXZunT mXcA== X-Gm-Message-State: AOAM530XAvfJ91a+dCqO3A088Q3nU33zfs1eNlXR4zSn6xsMePSMMjMi DhBap7/iDLvmPmy/3cbJTT4= X-Google-Smtp-Source: ABdhPJyLNhQYUrTlGrDvnZQo96tSIqNZ0lLgECjt8HXmbT6NFcbPl8SVcCj9XuJMtRvpn1cbGjKw0g== X-Received: by 2002:a17:902:ab89:b029:d5:b297:2cc1 with SMTP id f9-20020a170902ab89b02900d5b2972cc1mr1361533plr.7.1603249729114; Tue, 20 Oct 2020 20:08:49 -0700 (PDT) Received: from titan.office.yunion.io ([103.119.177.162]) by smtp.gmail.com with ESMTPSA id f7sm376393pfd.111.2020.10.20.20.08.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2020 20:08:48 -0700 (PDT) From: Yousong Zhou To: Felix Fietkau , Hans Dedecker Subject: [PATCH netifd 3/4] device_addr: record address index as in the blob Date: Wed, 21 Oct 2020 11:08:24 +0800 Message-Id: <20201021030825.93626-4-yszhou4tech@gmail.com> In-Reply-To: <20201021030825.93626-1-yszhou4tech@gmail.com> References: <20201021030825.93626-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201020_230851_187579_461956A7 X-CRM114-Status: GOOD ( 11.57 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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 [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [yszhou4tech[at]gmail.com] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Yousong Zhou Acked-by: Hans Dedecker --- interface-ip.h | 1 + proto.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/interface-ip.h b/interface-ip.h index 5ab9299..b17ad94 100644 --- a/interface-ip.h +++ b/interface-ip.h @@ -127,6 +127,7 @@ struct device_addr { struct vlist_node node; bool enabled; bool failed; + int index; unsigned int policy_table; struct device_route subnet; diff --git a/proto.c b/proto.c index d80cae0..f7d27aa 100644 --- a/proto.c +++ b/proto.c @@ -172,6 +172,7 @@ parse_static_address_option(struct interface *iface, struct blob_attr *attr, interface_add_error(iface, "proto", "INVALID_ADDRESS", &str, 1); return -1; } + addr->index = n_addr; n_addr++; vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags); } @@ -272,6 +273,7 @@ parse_address_list(struct interface *iface, struct blob_attr *attr, bool v6, if (!addr) return -1; + addr->index = n_addr; n_addr++; vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags); }