From patchwork Tue Nov 23 02:04:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Angelo Daros de Luca X-Patchwork-Id: 1558334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=AC5UrLat; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=WfynW1SS; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) 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=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HynbG32Jtz9sRK for ; Tue, 23 Nov 2021 13:07:38 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Qe+hHTgHQ7/zbARFXA5yWa4TQDICaxLdX+n1KaIw+Ms=; b=AC5UrLat2h+HxO G0lCbCRGvvroV+R5aOactG/Wvlt2B4PzvlEdDolbSLlERDdRKbdyT3rgpqEacv162SVkTTrwFQBH1 uLiPs1CUJ7OhpO8srgXBIF5jwkVZPGAOCST4KmTkdEjXn32c+Us9fVSLR+pTE5/m4ag8fPu0Z16b3 XLmEqLlC3TNprLwsdUKf5vyYF75ysLoY97ZObOfGjgN5m6uv31Ns2yfKKYKuzUanUxzg0Qesfe5Wp LOgGoK9W8mL59SOzAhJ0yRMGVi22/C2R8sf9dmBWwSq50+ixk+wBDY80cJL39SQ8fEiW4DKVYJklq il0WIfU71Ta41bBEltjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpLBa-000d6p-KP; Tue, 23 Nov 2021 02:05:30 +0000 Received: from mail-vk1-xa2b.google.com ([2607:f8b0:4864:20::a2b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpLBA-000cuo-8u for openwrt-devel@lists.openwrt.org; Tue, 23 Nov 2021 02:05:05 +0000 Received: by mail-vk1-xa2b.google.com with SMTP id f7so11475214vkf.10 for ; Mon, 22 Nov 2021 18:05:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oiLltFbFl7HbPK7B7QCFSL9WRHMRI46zTIRS0kHfkG0=; b=WfynW1SSDAaZ/suBiGsyZYmeF4tt1g6wYQtez2ZD+fjljfkDIhMeqWqMT63kNLVT66 bNwH6nKbviPCfzqLPb7CuLmu0nVlahsGBBwFhSj5r85F9uxcuIpNWkc2lzFZ9KsiwjD5 TUA2EczesSGmXKdoGpnmZCrMsEYB+FNtCvcLj8+7DuBVWqI57YVeyWG9TiB1Zm9vxMUd YtJWsN8DFtCRcoEU4BqPM59rkjR5wZF+3nahyrUoGXBP0GULVFW6Xfc43oBixuTpAg11 NIuO/4VsbNmNWjMYl20WbsG8yngxVNTtX21DudrkR+LIhRjZ16zj7k72TQ8bDtnXJCFt D29Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oiLltFbFl7HbPK7B7QCFSL9WRHMRI46zTIRS0kHfkG0=; b=eiWi+IVNE+8b0hDSerf9sQRenxldCJwl0cfVwNtad+zODeTEbkSMTeduT37HtAoV56 Dg1wSK52dGqN/908gGLaEqC0xygopNuwVV0a+/GqrSh3nGHSZtNYcM9eEASZzUGIfclP XYo6Jpg3bnpRJsTak78pmx8pUfmzzBFeeOIpcHlTyEY4OedoGu9RofKn4PwVwPREEjMj W6LMe8koFQg6OGjtGtagjKhIKgHdgiE+0z1Iz3JnyJ8WGGVZen24DqINZkz3dY83+1BC 1RBnMzl+cIoZKaXRuZa1dyfMqCa8e9736NCo5pZ1DO16jI4dkZwH5RIhONgsS34Hd3/l RzLQ== X-Gm-Message-State: AOAM531MAxeqNfROELO2Y5jOJCP2kX7+Z11q3abI7WvjPasKAdAEevVm if1p+pywo5SGs4Keycn1T5s3U/nQig8= X-Google-Smtp-Source: ABdhPJw6gMNnwubX/NXwPsU1GLfwZPZzPA2anzdO89X0zdQVHVX8uycZzliZjpxVhN4UcTr0lzW2jw== X-Received: by 2002:a05:6122:886:: with SMTP id 6mr948738vkf.7.1637633102584; Mon, 22 Nov 2021 18:05:02 -0800 (PST) Received: from tresc043793.tre-sc.gov.br (187-049-235-234.floripa.net.br. [187.49.235.234]) by smtp.gmail.com with ESMTPSA id bk3sm5433901vkb.33.2021.11.22.18.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 18:05:02 -0800 (PST) From: luizluca@gmail.com To: openwrt-devel@lists.openwrt.org Cc: nbd@nbd.name, Luiz Angelo Daros de Luca Subject: [PATCH 2/2] interface-ip: copy more info for target host route Date: Mon, 22 Nov 2021 23:04:52 -0300 Message-Id: <20211123020452.25669-2-luizluca@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211123020452.25669-1-luizluca@gmail.com> References: <20211123020452.25669-1-luizluca@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211122_180504_375479_BF8B5563 X-CRM114-Status: GOOD ( 10.16 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Luiz Angelo Daros de Luca interface_ip_add_target_route was adding a host route without copying other confs like type, source, online). The result was that this: unreachable 192.168.0.9 metric 123 Content analysis details: (-0.2 points, 5.0 required) 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:a2b 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 [luizluca[at]gmail.com] -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 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Luiz Angelo Daros de Luca interface_ip_add_target_route was adding a host route without copying other confs like type, source, online). The result was that this: unreachable 192.168.0.9 metric 123 was being converted to: 192.168.0.9 dev lo scope link metric 123 valid_until is still not copied but I'm not sure if it is needed as this route might get updated when the source route is refreshed/expired. Signed-off-by: Luiz Angelo Daros de Luca --- interface-ip.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface-ip.c b/interface-ip.c index 7b63ef9..6fdbf18 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -300,12 +300,17 @@ interface_ip_add_target_route(union if_addr *addr, bool v6, struct interface *if return NULL; route->flags = v6 ? DEVADDR_INET6 : DEVADDR_INET4; + route->flags |= r->next & (DEVROUTE_MTU | DEVROUTE_METRIC | + DEVROUTE_TYPE | DEVROUTE_ONLINK | DEVROUTE_TABLE); route->mask = v6 ? 128 : 32; memcpy(&route->addr, addr, addrsize); memcpy(&route->nexthop, &r_next->nexthop, sizeof(route->nexthop)); route->mtu = r_next->mtu; route->metric = r_next->metric; route->table = r_next->table; + route->type = r_next->type; + memcpy(&route->source, &r_next->source, addrsize); + route->sourcemask = r_next->sourcemask; route->iface = iface; vlist_add(&iface->host_routes, &route->node, route);