[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200204114604.GA59185@bistromath.localdomain>
Date: Tue, 4 Feb 2020 12:46:04 +0100
From: Sabrina Dubroca <sd@...asysnail.net>
To: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc: steffen.klassert@...unet.com, davem@...emloft.net,
netdev@...r.kernel.org
Subject: Re: [PATCH ipsec v2] vti[6]: fix packet tx through bpf_redirect() in
XinY cases
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@...nd.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
Powered by blists - more mailing lists