Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp302311ybc; Tue, 19 Nov 2019 01:28:20 -0800 (PST) X-Google-Smtp-Source: APXvYqz2Gtlpyy+WLZtu8ltRWuofaORpL9DDIOWZd2OPyQ0miMLIT7iyaplHivY3rYgoRSOq0q9c X-Received: by 2002:a17:906:5959:: with SMTP id g25mr33157461ejr.248.1574155690750; Tue, 19 Nov 2019 01:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574155690; cv=none; d=google.com; s=arc-20160816; b=T6F1EQZBvBfbRCTB0MFU+uMgmEZ9lZrfuKuJMeYZtvovXGp77ZKDMqJQr7RemN1+JS uwFx5fcztb/967wmypGoK8fDyCLZoJtSrngBLA+EDt7bs/FeI3pQ4lZTGQ27Q4imfuRw Qbj8YD/DmMk5qBH9xbRuwEqF82guwOkG4FK3blad7DKRxd0UdXRWF2JnXql39oGGqubC uDQfx4+FTtR9/BtBe2Azyy9HgJcAK5JCclYUBT7FgOxYBuSPUap5ymtzmrweQh+byRO0 M0cm79mYoMjcU/ltnfo3x08XwtIH29bh2IohHaOh2okYIBoqjxoVZx/AANwu80WoikWj gVfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=EaDBGaUrTCyGilB8DhkN1F/kJnvQ8bUshlfDqjHoxzk=; b=KzKnjC5yRvEMX/Zj+H/vv8dgKh8FmBtW5Lulzfs5Z9ZO3fjDuqm2ATLw21AUwj6s3k 02zE7NyTOdxgy6sW3dkJ/qZfy/DzSG+VkzHeuIzaZvWFTtFjYoQ9/94Wy5m4V6T7KXQG oT5eY7rqSG+VkqicVyJJuSrojjO4YDJhFHohqCzAl/5kvvqG1JaFLXi4BdIwl5Teedkh p2Q9ogwVL5AL2iE4vMRVIr6+Tve+v4/BkEz0NtLRzNdvxtASmtLiC0FOMKbrQUul1XbQ RFUswI6C6VIZ+Fun5H36dGMgAcXPM1xhKa9QQSacBqjHY4ziQ9+JmJtOPLVtdZ/yYD1p EcpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=ikbsjyFh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si13167165eju.50.2019.11.19.01.27.46; Tue, 19 Nov 2019 01:28:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=ikbsjyFh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726939AbfKSJ0K (ORCPT + 99 others); Tue, 19 Nov 2019 04:26:10 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45389 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725904AbfKSJ0K (ORCPT ); Tue, 19 Nov 2019 04:26:10 -0500 Received: by mail-lj1-f195.google.com with SMTP id n21so22430195ljg.12 for ; Tue, 19 Nov 2019 01:26:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=EaDBGaUrTCyGilB8DhkN1F/kJnvQ8bUshlfDqjHoxzk=; b=ikbsjyFhsTnrhXVyUK14RaUtYzx0tqRfpB9YUHH//6RbExWy1uHu91Bw1ZqhWuYbEu J39r/tOknfZ3t8x8kShgq6SCikWU4DYb7MMMWoysNVhfxTMkRSwbTzcPvhMD4p8sgjAU 4QjeCxbJ16VrHpovL5nIUKdXL9z22ioGdACH8vuzEQZROcVKDeT1ubAEzquTuG95sM2A dQCjEhbvewCWNLPG1cGfqrZ0tgg/uwcrzxR+vXipT65+wKK/fp/j6aSUv+FahTBJgOLG e3S4cGKWcfCPPuk+115tGtCk7iM7aynce+d36C6WeC1EWFqlTNcwmG/e0hO5Gj5du2CC xLrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=EaDBGaUrTCyGilB8DhkN1F/kJnvQ8bUshlfDqjHoxzk=; b=FdG1/5beJ7seMfLSSlxY0CvWP4Tu9kKTKeEeWosavmFNzug3Jh+a12LJCfznVmLa1Z R/vGqSJYl3hY4CC1fgrtV5wdpbuRSA7ybV5v48zCp/WO++VxiFP6tLLGTw+3fMFQdzrK 12CzjiWkWIjDpXTqKjt6448OdIxpQ96UDB5US7AP9a0paWOMR9y03uL75kGL/SFjqSAr cmUi/boB1eJPSMH0wSv+seO2w/Tfqrt7cOylTYc9C5LjVzz/cwESghZJzTaPECARavDW Sk6gWq4SZ2KbiihYhicLwx5iyxz6MdEDDlrsq5xK9wKtwydlupO/IGAnJHWCmrpte0JP btBw== X-Gm-Message-State: APjAAAXnHFIB+CccFuXN/mlrGqDZms6XXLEuFKxHL3K/9jaAJsbuz42J N9TyiS+6U5nxFTuO5B5qOtey+j8TM52A9A== X-Received: by 2002:a05:651c:1053:: with SMTP id x19mr2976201ljm.39.1574155567470; Tue, 19 Nov 2019 01:26:07 -0800 (PST) Received: from ?IPv6:2a00:1fa0:21a:5b37:6d7b:a689:ba65:5cea? ([2a00:1fa0:21a:5b37:6d7b:a689:ba65:5cea]) by smtp.gmail.com with ESMTPSA id u2sm10244727ljg.34.2019.11.19.01.26.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 01:26:06 -0800 (PST) Subject: Re: [net-next] seg6: allow local packet processing for SRv6 End.DT6 behavior To: Andrea Mayer , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , David Lebrun , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191118182026.2634-1-andrea.mayer@uniroma2.it> From: Sergei Shtylyov Message-ID: <703510f1-22af-aca1-b066-d2c38fe572b1@cogentembedded.com> Date: Tue, 19 Nov 2019 12:25:16 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191118182026.2634-1-andrea.mayer@uniroma2.it> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18.11.2019 21:20, Andrea Mayer wrote: > End.DT6 behavior makes use of seg6_lookup_nexthop() function which drops > all packets that are destined to be locally processed. However, DT* should > be able to delivery decapsulated packets that are destined to local Deliver? > addresses. Function seg6_lookup_nexthop() is also used by DX6, so in order > to maintain compatibility I created another routing helper function which > is called seg6_lookup_any_nexthop(). This function is able to take into > account both packets that have to be processed locally and the ones that > are destined to be forwarded directly to another machine. Hence, > seg6_lookup_any_nexthop() is used in DT6 rather than seg6_lookup_nexthop() > to allow local delivery. > > Signed-off-by: Andrea Mayer > --- > net/ipv6/seg6_local.c | 22 ++++++++++++++++++---- > 1 file changed, 18 insertions(+), 4 deletions(-) > > diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c > index e70567446f28..43f3c9f1b4c1 100644 > --- a/net/ipv6/seg6_local.c > +++ b/net/ipv6/seg6_local.c > @@ -149,8 +149,9 @@ static void advance_nextseg(struct ipv6_sr_hdr *srh, struct in6_addr *daddr) > *daddr = *addr; > } > > -int seg6_lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr, > - u32 tbl_id) > +static int > +seg6_lookup_any_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr, > + u32 tbl_id, int local_delivery) > { > struct net *net = dev_net(skb->dev); > struct ipv6hdr *hdr = ipv6_hdr(skb); [...] > @@ -199,6 +207,12 @@ int seg6_lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr, > return dst->error; > } > > +inline int seg6_lookup_nexthop(struct sk_buff *skb, > + struct in6_addr *nhaddr, u32 tbl_id) > +{ > + return seg6_lookup_any_nexthop(skb, nhaddr, tbl_id, false); The last parameter to that function is of type *int*, not 'bool'. Be consistent please... > @@ -396,7 +410,7 @@ static int input_action_end_dt6(struct sk_buff *skb, > > skb_set_transport_header(skb, sizeof(struct ipv6hdr)); > > - seg6_lookup_nexthop(skb, NULL, slwt->table); > + seg6_lookup_any_nexthop(skb, NULL, slwt->table, true); Same here, just declare the last parameter as 'bool'. [...] MBR, Sergei