* [PATCH ipsec] vti[6]: fix packet tx through bpf_redirect() in XinY cases
@ 2020-02-03 16:46 Nicolas Dichtel
2020-02-04 7:56 ` kbuild test robot
0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Dichtel @ 2020-02-03 16:46 UTC (permalink / raw)
To: steffen.klassert, davem; +Cc: netdev, Nicolas Dichtel
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>
---
net/ipv4/ip_vti.c | 36 ++++++++++++++++++++++++++++--------
net/ipv6/ip6_vti.c | 32 +++++++++++++++++++++++++-------
2 files changed, 53 insertions(+), 15 deletions(-)
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index 37cddd18f282..a86b60c4e995 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -187,17 +187,37 @@ 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;
+ }
+ 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);
+ if (dst->error) {
+ dst_release(dst);
+ dst = NULL;
+ dev->stats.tx_carrier_errors++;
+ goto tx_error_icmp;
+ }
+ skb_dst_set(skb, dst);
+ break;
+ default:
dev->stats.tx_carrier_errors++;
goto tx_error_icmp;
}
- dst = &rt->dst;
- skb_dst_set(skb, dst);
}
dst_hold(dst);
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 524006aa0d78..56e642efefff 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -450,15 +450,33 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
int mtu;
if (!dst) {
- 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);
- if (dst->error) {
- dst_release(dst);
- dst = NULL;
+ 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))
+ goto tx_err_link_failure;
+ dst = &rt->dst;
+ skb_dst_set(skb, dst);
+ break;
+ }
+ 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);
+ if (dst->error) {
+ dst_release(dst);
+ dst = NULL;
+ goto tx_err_link_failure;
+ }
+ skb_dst_set(skb, dst);
+ break;
+ default:
goto tx_err_link_failure;
}
- skb_dst_set(skb, dst);
}
dst_hold(dst);
--
2.24.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH ipsec] vti[6]: fix packet tx through bpf_redirect() in XinY cases
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
0 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2020-02-04 7:56 UTC (permalink / raw)
To: Nicolas Dichtel
Cc: kbuild-all, steffen.klassert, davem, netdev, Nicolas Dichtel
[-- Attachment #1: Type: text/plain, Size: 4662 bytes --]
Hi Nicolas,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on ipsec/master]
[also build test ERROR on v5.5 next-20200203]
[cannot apply to ipsec-next/master sparc-next/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Nicolas-Dichtel/vti-6-fix-packet-tx-through-bpf_redirect-in-XinY-cases/20200204-072439
base: https://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git master
config: x86_64-randconfig-s2-20200204 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.2-10+deb8u1) 4.9.2
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
net//ipv4/ip_vti.c: In function 'vti_xmit':
>> net//ipv4/ip_vti.c:208:4: error: implicit declaration of function 'ip6_route_output' [-Werror=implicit-function-declaration]
dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
^
>> net//ipv4/ip_vti.c:208:8: warning: assignment makes pointer from integer without a cast
dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
^
cc1: some warnings being treated as errors
vim +/ip6_route_output +208 net//ipv4/ip_vti.c
177
178 static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
179 struct flowi *fl)
180 {
181 struct ip_tunnel *tunnel = netdev_priv(dev);
182 struct ip_tunnel_parm *parms = &tunnel->parms;
183 struct dst_entry *dst = skb_dst(skb);
184 struct net_device *tdev; /* Device to other host */
185 int pkt_len = skb->len;
186 int err;
187 int mtu;
188
189 if (!dst) {
190 switch (skb->protocol) {
191 case htons(ETH_P_IP): {
192 struct rtable *rt;
193
194 fl->u.ip4.flowi4_oif = dev->ifindex;
195 fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
196 rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
197 if (IS_ERR(rt)) {
198 dev->stats.tx_carrier_errors++;
199 goto tx_error_icmp;
200 }
201 dst = &rt->dst;
202 skb_dst_set(skb, dst);
203 break;
204 }
205 case htons(ETH_P_IPV6):
206 fl->u.ip6.flowi6_oif = dev->ifindex;
207 fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
> 208 dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
209 if (dst->error) {
210 dst_release(dst);
211 dst = NULL;
212 dev->stats.tx_carrier_errors++;
213 goto tx_error_icmp;
214 }
215 skb_dst_set(skb, dst);
216 break;
217 default:
218 dev->stats.tx_carrier_errors++;
219 goto tx_error_icmp;
220 }
221 }
222
223 dst_hold(dst);
224 dst = xfrm_lookup(tunnel->net, dst, fl, NULL, 0);
225 if (IS_ERR(dst)) {
226 dev->stats.tx_carrier_errors++;
227 goto tx_error_icmp;
228 }
229
230 if (!vti_state_check(dst->xfrm, parms->iph.daddr, parms->iph.saddr)) {
231 dev->stats.tx_carrier_errors++;
232 dst_release(dst);
233 goto tx_error_icmp;
234 }
235
236 tdev = dst->dev;
237
238 if (tdev == dev) {
239 dst_release(dst);
240 dev->stats.collisions++;
241 goto tx_error;
242 }
243
244 mtu = dst_mtu(dst);
245 if (skb->len > mtu) {
246 skb_dst_update_pmtu_no_confirm(skb, mtu);
247 if (skb->protocol == htons(ETH_P_IP)) {
248 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
249 htonl(mtu));
250 } else {
251 if (mtu < IPV6_MIN_MTU)
252 mtu = IPV6_MIN_MTU;
253
254 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
255 }
256
257 dst_release(dst);
258 goto tx_error;
259 }
260
261 skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(dev)));
262 skb_dst_set(skb, dst);
263 skb->dev = skb_dst(skb)->dev;
264
265 err = dst_output(tunnel->net, skb->sk, skb);
266 if (net_xmit_eval(err) == 0)
267 err = pkt_len;
268 iptunnel_xmit_stats(dev, err);
269 return NETDEV_TX_OK;
270
271 tx_error_icmp:
272 dst_link_failure(skb);
273 tx_error:
274 dev->stats.tx_errors++;
275 kfree_skb(skb);
276 return NETDEV_TX_OK;
277 }
278
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30007 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH ipsec] vti[6]: fix packet tx through bpf_redirect() in XinY cases
@ 2020-02-04 7:56 ` kbuild test robot
0 siblings, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2020-02-04 7:56 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4805 bytes --]
Hi Nicolas,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on ipsec/master]
[also build test ERROR on v5.5 next-20200203]
[cannot apply to ipsec-next/master sparc-next/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Nicolas-Dichtel/vti-6-fix-packet-tx-through-bpf_redirect-in-XinY-cases/20200204-072439
base: https://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git master
config: x86_64-randconfig-s2-20200204 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.2-10+deb8u1) 4.9.2
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
net//ipv4/ip_vti.c: In function 'vti_xmit':
>> net//ipv4/ip_vti.c:208:4: error: implicit declaration of function 'ip6_route_output' [-Werror=implicit-function-declaration]
dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
^
>> net//ipv4/ip_vti.c:208:8: warning: assignment makes pointer from integer without a cast
dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
^
cc1: some warnings being treated as errors
vim +/ip6_route_output +208 net//ipv4/ip_vti.c
177
178 static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
179 struct flowi *fl)
180 {
181 struct ip_tunnel *tunnel = netdev_priv(dev);
182 struct ip_tunnel_parm *parms = &tunnel->parms;
183 struct dst_entry *dst = skb_dst(skb);
184 struct net_device *tdev; /* Device to other host */
185 int pkt_len = skb->len;
186 int err;
187 int mtu;
188
189 if (!dst) {
190 switch (skb->protocol) {
191 case htons(ETH_P_IP): {
192 struct rtable *rt;
193
194 fl->u.ip4.flowi4_oif = dev->ifindex;
195 fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
196 rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
197 if (IS_ERR(rt)) {
198 dev->stats.tx_carrier_errors++;
199 goto tx_error_icmp;
200 }
201 dst = &rt->dst;
202 skb_dst_set(skb, dst);
203 break;
204 }
205 case htons(ETH_P_IPV6):
206 fl->u.ip6.flowi6_oif = dev->ifindex;
207 fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
> 208 dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
209 if (dst->error) {
210 dst_release(dst);
211 dst = NULL;
212 dev->stats.tx_carrier_errors++;
213 goto tx_error_icmp;
214 }
215 skb_dst_set(skb, dst);
216 break;
217 default:
218 dev->stats.tx_carrier_errors++;
219 goto tx_error_icmp;
220 }
221 }
222
223 dst_hold(dst);
224 dst = xfrm_lookup(tunnel->net, dst, fl, NULL, 0);
225 if (IS_ERR(dst)) {
226 dev->stats.tx_carrier_errors++;
227 goto tx_error_icmp;
228 }
229
230 if (!vti_state_check(dst->xfrm, parms->iph.daddr, parms->iph.saddr)) {
231 dev->stats.tx_carrier_errors++;
232 dst_release(dst);
233 goto tx_error_icmp;
234 }
235
236 tdev = dst->dev;
237
238 if (tdev == dev) {
239 dst_release(dst);
240 dev->stats.collisions++;
241 goto tx_error;
242 }
243
244 mtu = dst_mtu(dst);
245 if (skb->len > mtu) {
246 skb_dst_update_pmtu_no_confirm(skb, mtu);
247 if (skb->protocol == htons(ETH_P_IP)) {
248 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
249 htonl(mtu));
250 } else {
251 if (mtu < IPV6_MIN_MTU)
252 mtu = IPV6_MIN_MTU;
253
254 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
255 }
256
257 dst_release(dst);
258 goto tx_error;
259 }
260
261 skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(dev)));
262 skb_dst_set(skb, dst);
263 skb->dev = skb_dst(skb)->dev;
264
265 err = dst_output(tunnel->net, skb->sk, skb);
266 if (net_xmit_eval(err) == 0)
267 err = pkt_len;
268 iptunnel_xmit_stats(dev, err);
269 return NETDEV_TX_OK;
270
271 tx_error_icmp:
272 dst_link_failure(skb);
273 tx_error:
274 dev->stats.tx_errors++;
275 kfree_skb(skb);
276 return NETDEV_TX_OK;
277 }
278
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30007 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH ipsec v2] vti[6]: fix packet tx through bpf_redirect() in XinY cases
2020-02-04 7:56 ` kbuild test robot
(?)
@ 2020-02-04 10:52 ` Nicolas Dichtel
2020-02-04 11:46 ` Sabrina Dubroca
-1 siblings, 1 reply; 8+ messages in thread
From: Nicolas Dichtel @ 2020-02-04 10:52 UTC (permalink / raw)
To: steffen.klassert, davem; +Cc: netdev, Nicolas Dichtel
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);
+ if (dst->error) {
+ dst_release(dst);
+ dst = NULL;
+ dev->stats.tx_carrier_errors++;
+ goto tx_error_icmp;
+ }
+ skb_dst_set(skb, dst);
+ break;
+#endif
+ default:
dev->stats.tx_carrier_errors++;
goto tx_error_icmp;
}
- dst = &rt->dst;
- skb_dst_set(skb, dst);
}
dst_hold(dst);
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 524006aa0d78..56e642efefff 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -450,15 +450,33 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
int mtu;
if (!dst) {
- 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);
- if (dst->error) {
- dst_release(dst);
- dst = NULL;
+ 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))
+ goto tx_err_link_failure;
+ dst = &rt->dst;
+ skb_dst_set(skb, dst);
+ break;
+ }
+ 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);
+ if (dst->error) {
+ dst_release(dst);
+ dst = NULL;
+ goto tx_err_link_failure;
+ }
+ skb_dst_set(skb, dst);
+ break;
+ default:
goto tx_err_link_failure;
}
- skb_dst_set(skb, dst);
}
dst_hold(dst);
--
2.24.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH ipsec v2] vti[6]: fix packet tx through bpf_redirect() in XinY cases
2020-02-04 10:52 ` [PATCH ipsec v2] " Nicolas Dichtel
@ 2020-02-04 11:46 ` Sabrina Dubroca
2020-02-04 13:10 ` Nicolas Dichtel
2020-02-04 16:00 ` [PATCH ipsec v3] " Nicolas Dichtel
0 siblings, 2 replies; 8+ messages in thread
From: Sabrina Dubroca @ 2020-02-04 11:46 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: steffen.klassert, davem, netdev
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH ipsec v2] vti[6]: fix packet tx through bpf_redirect() in XinY cases
2020-02-04 11:46 ` Sabrina Dubroca
@ 2020-02-04 13:10 ` Nicolas Dichtel
2020-02-04 16:00 ` [PATCH ipsec v3] " Nicolas Dichtel
1 sibling, 0 replies; 8+ messages in thread
From: Nicolas Dichtel @ 2020-02-04 13:10 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: steffen.klassert, davem, netdev
Le 04/02/2020 à 12:46, Sabrina Dubroca a écrit :
[snip]
>> +#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").
>
Thanks for pointing this out.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH ipsec v3] vti[6]: fix packet tx through bpf_redirect() in XinY cases
2020-02-04 11:46 ` Sabrina Dubroca
2020-02-04 13:10 ` Nicolas Dichtel
@ 2020-02-04 16:00 ` Nicolas Dichtel
2020-02-07 9:42 ` Steffen Klassert
1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Dichtel @ 2020-02-04 16:00 UTC (permalink / raw)
To: steffen.klassert, davem; +Cc: netdev, sd, Nicolas Dichtel
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>
---
v2 -> v3:
- fix compilation when IPv6 is compiled as a module
v1 -> v2:
- fix compilation when IPv6 is disabled
net/ipv4/Kconfig | 1 +
net/ipv4/ip_vti.c | 38 ++++++++++++++++++++++++++++++--------
net/ipv6/ip6_vti.c | 32 +++++++++++++++++++++++++-------
3 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index f96bd489b362..6490b845e17b 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -303,6 +303,7 @@ config SYN_COOKIES
config NET_IPVTI
tristate "Virtual (secure) IP: tunneling"
+ depends on IPV6 || IPV6=n
select INET_TUNNEL
select NET_IP_TUNNEL
select XFRM
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);
+ if (dst->error) {
+ dst_release(dst);
+ dst = NULL;
+ dev->stats.tx_carrier_errors++;
+ goto tx_error_icmp;
+ }
+ skb_dst_set(skb, dst);
+ break;
+#endif
+ default:
dev->stats.tx_carrier_errors++;
goto tx_error_icmp;
}
- dst = &rt->dst;
- skb_dst_set(skb, dst);
}
dst_hold(dst);
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 524006aa0d78..56e642efefff 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -450,15 +450,33 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
int mtu;
if (!dst) {
- 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);
- if (dst->error) {
- dst_release(dst);
- dst = NULL;
+ 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))
+ goto tx_err_link_failure;
+ dst = &rt->dst;
+ skb_dst_set(skb, dst);
+ break;
+ }
+ 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);
+ if (dst->error) {
+ dst_release(dst);
+ dst = NULL;
+ goto tx_err_link_failure;
+ }
+ skb_dst_set(skb, dst);
+ break;
+ default:
goto tx_err_link_failure;
}
- skb_dst_set(skb, dst);
}
dst_hold(dst);
--
2.24.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH ipsec v3] vti[6]: fix packet tx through bpf_redirect() in XinY cases
2020-02-04 16:00 ` [PATCH ipsec v3] " Nicolas Dichtel
@ 2020-02-07 9:42 ` Steffen Klassert
0 siblings, 0 replies; 8+ messages in thread
From: Steffen Klassert @ 2020-02-07 9:42 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: davem, netdev, sd
On Tue, Feb 04, 2020 at 05:00:27PM +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>
Applied, thanks a lot!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-02-07 9:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 7:56 ` kbuild test robot
2020-02-04 10:52 ` [PATCH ipsec v2] " Nicolas Dichtel
2020-02-04 11:46 ` Sabrina Dubroca
2020-02-04 13:10 ` Nicolas Dichtel
2020-02-04 16:00 ` [PATCH ipsec v3] " Nicolas Dichtel
2020-02-07 9:42 ` Steffen Klassert
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.