netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] sched, bpf: let stack handle !IFF_UP devs on bpf_clone_redirect
@ 2015-09-23 20:20 Daniel Borkmann
  2015-09-23 20:55 ` Alexei Starovoitov
  2015-09-23 21:26 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Borkmann @ 2015-09-23 20:20 UTC (permalink / raw)
  To: davem; +Cc: ast, netdev, Daniel Borkmann

Similarly as already the case in bpf_redirect()/skb_do_redirect()
pair, let the stack deal with devs that are !IFF_UP.

dev_forward_skb() as well as dev_queue_xmit() will free the skb
and increment drop counter internally in such cases, so we can
spare the condition in bpf_clone_redirect().

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
 net/core/filter.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index da3f3d9..96bd962 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -1404,9 +1404,6 @@ static u64 bpf_clone_redirect(u64 r1, u64 ifindex, u64 flags, u64 r4, u64 r5)
 	if (unlikely(!dev))
 		return -EINVAL;
 
-	if (unlikely(!(dev->flags & IFF_UP)))
-		return -EINVAL;
-
 	skb2 = skb_clone(skb, GFP_ATOMIC);
 	if (unlikely(!skb2))
 		return -ENOMEM;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] sched, bpf: let stack handle !IFF_UP devs on bpf_clone_redirect
  2015-09-23 20:20 [PATCH net-next] sched, bpf: let stack handle !IFF_UP devs on bpf_clone_redirect Daniel Borkmann
@ 2015-09-23 20:55 ` Alexei Starovoitov
  2015-09-23 21:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2015-09-23 20:55 UTC (permalink / raw)
  To: Daniel Borkmann, davem; +Cc: netdev

On 9/23/15 1:20 PM, Daniel Borkmann wrote:
> Similarly as already the case in bpf_redirect()/skb_do_redirect()
> pair, let the stack deal with devs that are !IFF_UP.
>
> dev_forward_skb() as well as dev_queue_xmit() will free the skb
> and increment drop counter internally in such cases, so we can
> spare the condition in bpf_clone_redirect().
>
> Signed-off-by: Daniel Borkmann<daniel@iogearbox.net>

thanks. was about to send the same fix.
Acked-by: Alexei Starovoitov <ast@plumgrid.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] sched, bpf: let stack handle !IFF_UP devs on bpf_clone_redirect
  2015-09-23 20:20 [PATCH net-next] sched, bpf: let stack handle !IFF_UP devs on bpf_clone_redirect Daniel Borkmann
  2015-09-23 20:55 ` Alexei Starovoitov
@ 2015-09-23 21:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-09-23 21:26 UTC (permalink / raw)
  To: daniel; +Cc: ast, netdev

From: Daniel Borkmann <daniel@iogearbox.net>
Date: Wed, 23 Sep 2015 22:20:15 +0200

> Similarly as already the case in bpf_redirect()/skb_do_redirect()
> pair, let the stack deal with devs that are !IFF_UP.
> 
> dev_forward_skb() as well as dev_queue_xmit() will free the skb
> and increment drop counter internally in such cases, so we can
> spare the condition in bpf_clone_redirect().
> 
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

Applied, thanks Daniel.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-23 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-23 20:20 [PATCH net-next] sched, bpf: let stack handle !IFF_UP devs on bpf_clone_redirect Daniel Borkmann
2015-09-23 20:55 ` Alexei Starovoitov
2015-09-23 21:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).