Netdev List
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: steffen.klassert@secunet.com, davem@davemloft.net,
	netdev@vger.kernel.org
Subject: Re: [PATCH ipsec v2] vti[6]: fix packet tx through bpf_redirect() in XinY cases
Date: Tue, 4 Feb 2020 12:46:04 +0100	[thread overview]
Message-ID: <20200204114604.GA59185@bistromath.localdomain> (raw)
In-Reply-To: <20200204105248.28729-1-nicolas.dichtel@6wind.com>

Hi,

2020-02-04, 11:52:48 +0100, Nicolas Dichtel wrote:
> I forgot the 4in6/6in4 cases in my previous patch. Let's fix them.
> 
> Fixes: 95224166a903 ("vti[6]: fix packet tx through bpf_redirect()")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> 
> v1 -> v2:
>  - fix compilation when IPv6 is disabled
> 
>  net/ipv4/ip_vti.c  | 38 ++++++++++++++++++++++++++++++--------
>  net/ipv6/ip6_vti.c | 32 +++++++++++++++++++++++++-------
>  2 files changed, 55 insertions(+), 15 deletions(-)
> 
> diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
> index 37cddd18f282..1b4e6f298648 100644
> --- a/net/ipv4/ip_vti.c
> +++ b/net/ipv4/ip_vti.c
> @@ -187,17 +187,39 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
>  	int mtu;
>  
>  	if (!dst) {
> -		struct rtable *rt;
> -
> -		fl->u.ip4.flowi4_oif = dev->ifindex;
> -		fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
> -		rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
> -		if (IS_ERR(rt)) {
> +		switch (skb->protocol) {
> +		case htons(ETH_P_IP): {
> +			struct rtable *rt;
> +
> +			fl->u.ip4.flowi4_oif = dev->ifindex;
> +			fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
> +			rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
> +			if (IS_ERR(rt)) {
> +				dev->stats.tx_carrier_errors++;
> +				goto tx_error_icmp;
> +			}
> +			dst = &rt->dst;
> +			skb_dst_set(skb, dst);
> +			break;
> +		}
> +#if IS_ENABLED(CONFIG_IPV6)
> +		case htons(ETH_P_IPV6):
> +			fl->u.ip6.flowi6_oif = dev->ifindex;
> +			fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
> +			dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);

I don't think that works with CONFIG_IPV6=m and CONFIG_NET_IPVTI=y:

ld: net/ipv4/ip_vti.o: in function `ip6_route_output':
/home/sab/linux/net/./include/net/ip6_route.h:98: undefined reference to `ip6_route_output_flags'

You probably have to do like ipvlan did in commit 7f897db37b76
("ipvlan: fix building with modular IPV6").

-- 
Sabrina


  reply	other threads:[~2020-02-04 11:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 16:46 [PATCH ipsec] vti[6]: fix packet tx through bpf_redirect() in XinY cases Nicolas Dichtel
2020-02-04  7:56 ` kbuild test robot
2020-02-04 10:52   ` [PATCH ipsec v2] " Nicolas Dichtel
2020-02-04 11:46     ` Sabrina Dubroca [this message]
2020-02-04 13:10       ` Nicolas Dichtel
2020-02-04 16:00       ` [PATCH ipsec v3] " Nicolas Dichtel
2020-02-07  9:42         ` Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200204114604.GA59185@bistromath.localdomain \
    --to=sd@queasysnail.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox