2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-09-01 17:40:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-07-12 19:33:09 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-02 19:15:33 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-06 22:52:32 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-25 13:00:33 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-04-16 00:41:16 -07:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
2010-02-14 01:01:10 +00:00
|
|
|
|
2007-09-17 11:56:21 -07:00
|
|
|
|
2008-04-16 00:40:46 -07:00
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2014-01-29 16:43:31 +09:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2016-12-24 11:46:01 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-04-12 18:48:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2008-04-12 18:48:58 -07:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-12 18:48:58 -07:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2017-09-04 11:36:08 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2014-11-19 14:44:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-16 15:05:06 +02:00
|
|
|
|
|
|
|
|
|
2015-04-24 14:50:36 +02:00
|
|
|
|
2014-11-19 14:44:40 +02:00
|
|
|
|
|
|
|
|
|
2014-12-16 15:05:06 +02:00
|
|
|
|
2012-07-20 09:23:23 +00:00
|
|
|
|
|
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-12 11:41:29 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-23 03:59:13 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2013-12-05 20:42:58 -08:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2012-11-25 22:07:40 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
|
|
|
|
|
2012-11-25 22:07:40 +00:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tun: Add ability to create tun device with given index
Tun devices cannot be created with ifidex user wants, but it's
required by checkpoint-restore project.
Long time ago such ability was implemented for rtnl_ops-based
interface for creating links (9c7dafbf net: Allow to create links
with given ifindex), but the only API for creating and managing
tuntap devices is ioctl-based and is evolving with adding new ones
(cde8b15f tuntap: add ioctl to attach or detach a file form tuntap
device).
Following that trend, here's how a new ioctl that sets the ifindex
for device, that _will_ be created by TUNSETIFF ioctl looks like.
So those who want a tuntap device with the ifindex N, should open
the tun device, call ioctl(fd, TUNSETIFINDEX, &N), then call TUNSETIFF.
If the index N is busy, then the register_netdev will find this out
and the ioctl would be failed with -EBUSY.
If setifindex is not called, then it will be generated as before.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:31:38 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2012-11-25 22:07:40 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2008-04-12 18:48:58 -07:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
|
|
|
|
|
2008-04-12 18:48:58 -07:00
|
|
|
|
|
|
|
|
|
2011-11-15 15:29:55 +00:00
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2017-07-03 06:35:32 -07:00
|
|
|
|
2010-03-17 17:45:01 +02:00
|
|
|
|
2016-02-26 10:45:40 +01:00
|
|
|
|
2010-03-17 17:45:01 +02:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-12 18:48:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
2013-01-14 07:12:19 +00:00
|
|
|
|
2013-01-23 03:59:13 +00:00
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2008-04-12 18:48:58 -07:00
|
|
|
|
|
|
|
|
|
2015-04-24 14:50:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-24 14:24:38 +02:00
|
|
|
|
|
|
|
|
|
2015-04-24 14:26:24 +02:00
|
|
|
|
2015-04-24 14:50:36 +02:00
|
|
|
|
2015-04-24 14:24:38 +02:00
|
|
|
|
|
|
|
|
|
2014-10-23 22:59:31 +03:00
|
|
|
|
|
|
|
|
|
2015-04-24 14:24:38 +02:00
|
|
|
|
2014-10-23 22:59:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-24 14:24:38 +02:00
|
|
|
|
2014-10-23 22:59:31 +03:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 17:06:00 -08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-21 07:17:21 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-23 03:59:13 +00:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-21 07:17:21 +00:00
|
|
|
|
2013-01-23 03:59:13 +00:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 17:06:00 -08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 17:06:00 -08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 17:06:00 -08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 17:06:00 -08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 17:06:00 -08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 17:06:00 -08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-12 19:22:57 +00:00
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
2013-01-23 03:59:13 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
net: rfs: add hash collision detection
Receive Flow Steering is a nice solution but suffers from
hash collisions when a mix of connected and unconnected traffic
is received on the host, when flow hash table is populated.
Also, clearing flow in inet_release() makes RFS not very good
for short lived flows, as many packets can follow close().
(FIN , ACK packets, ...)
This patch extends the information stored into global hash table
to not only include cpu number, but upper part of the hash value.
I use a 32bit value, and dynamically split it in two parts.
For host with less than 64 possible cpus, this gives 6 bits for the
cpu number, and 26 (32-6) bits for the upper part of the hash.
Since hash bucket selection use low order bits of the hash, we have
a full hash match, if /proc/sys/net/core/rps_sock_flow_entries is big
enough.
If the hash found in flow table does not match, we fallback to RPS (if
it is enabled for the rxqueue).
This means that a packet for an non connected flow can avoid the
IPI through a unrelated/victim CPU.
This also means we no longer have to clear the table at socket
close time, and this helps short lived flows performance.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-02-06 12:59:01 -08:00
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2013-12-05 20:42:58 -08:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-10 16:18:26 +08:00
|
|
|
|
2014-02-16 15:55:20 +01:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-05 16:44:57 +08:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2017-06-06 14:09:49 +08:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
|
|
|
|
|
2014-01-02 13:24:28 +08:00
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-18 21:34:11 +00:00
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-18 21:34:11 +00:00
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-18 11:00:27 +08:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-09-05 17:53:59 +08:00
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
2013-09-05 17:53:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-15 11:37:29 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:32 +00:00
|
|
|
|
|
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:32 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2014-03-24 00:02:32 +05:30
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2013-09-05 17:53:59 +08:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2013-01-11 16:59:34 +00:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2013-01-11 16:59:34 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
2013-01-28 00:38:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2013-01-28 00:38:02 +00:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2013-01-28 00:38:02 +00:00
|
|
|
|
2018-01-15 11:37:29 -08:00
|
|
|
|
2015-05-08 21:07:08 -05:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:32 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2016-05-19 13:36:51 +08:00
|
|
|
|
2014-05-16 15:11:48 -07:00
|
|
|
|
2014-03-24 00:02:32 +05:30
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2016-05-19 13:36:51 +08:00
|
|
|
|
2014-05-16 15:11:48 -07:00
|
|
|
|
2014-03-24 00:02:32 +05:30
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:32 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2013-09-05 17:53:59 +08:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2018-01-15 11:37:29 -08:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
2013-09-05 17:53:59 +08:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2018-01-15 11:37:29 -08:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:34 +00:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2013-01-11 16:59:34 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
tun: Allow to skip filter on attach
There's a small problem with sk-filters on tun devices. Consider
an application doing this sequence of steps:
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
ioctl(fd, TUNATTACHFILTER, &my_filter);
ioctl(fd, TUNSETPERSIST, 1);
close(fd);
At that point the tun0 will remain in the system and will keep in
mind that there should be a socket filter at address '&my_filter'.
If after that we do
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
we most likely receive the -EFAULT error, since tun_attach() would
try to connect the filter back. But (!) if we provide a filter at
address &my_filter, then tun0 will be created and the "new" filter
would be attached, but application may not know about that.
This may create certain problems to anyone using tun-s, but it's
critical problem for c/r -- if we meet a persistent tun device
with a filter in mind, we will not be able to attach to it to dump
its state (flags, owner, address, vnethdr size, etc.).
The proposal is to allow to attach to tun device (with TUNSETIFF)
w/o attaching the filter to the tun-file's socket. After this
attach app may e.g clean the device by dropping the filter, it
doesn't want to have one, or (in case of c/r) get information
about the device with tun ioctls.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:32:21 +04:00
|
|
|
|
2009-01-20 10:57:48 +00:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
2009-01-20 11:02:28 +00:00
|
|
|
|
2009-01-20 10:57:48 +00:00
|
|
|
|
2013-01-14 07:12:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 11:02:28 +00:00
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2009-01-20 11:02:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:02:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2013-12-05 20:42:58 -08:00
|
|
|
|
tun: Allow to skip filter on attach
There's a small problem with sk-filters on tun devices. Consider
an application doing this sequence of steps:
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
ioctl(fd, TUNATTACHFILTER, &my_filter);
ioctl(fd, TUNSETPERSIST, 1);
close(fd);
At that point the tun0 will remain in the system and will keep in
mind that there should be a socket filter at address '&my_filter'.
If after that we do
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
we most likely receive the -EFAULT error, since tun_attach() would
try to connect the filter back. But (!) if we provide a filter at
address &my_filter, then tun0 will be created and the "new" filter
would be attached, but application may not know about that.
This may create certain problems to anyone using tun-s, but it's
critical problem for c/r -- if we meet a persistent tun device
with a filter in mind, we will not be able to attach to it to dump
its state (flags, owner, address, vnethdr size, etc.).
The proposal is to allow to attach to tun device (with TUNSETIFF)
w/o attaching the filter to the tun-file's socket. After this
attach app may e.g clean the device by dropping the filter, it
doesn't want to have one, or (in case of c/r) get information
about the device with tun ioctls.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:32:21 +04:00
|
|
|
|
2016-04-05 17:10:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2016-05-19 13:36:51 +08:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 10:57:48 +00:00
|
|
|
|
2009-01-20 11:02:28 +00:00
|
|
|
|
|
|
|
|
|
2009-01-20 10:57:48 +00:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2009-01-20 11:07:17 +00:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 11:07:17 +00:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-20 08:54:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-08 17:49:17 -08:00
|
|
|
|
|
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2009-02-08 17:49:17 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-20 09:00:34 +02:00
|
|
|
|
2009-02-08 17:49:17 -08:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2009-02-08 17:49:17 -08:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-20 09:00:34 +02:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drivers/net: Convert compare_ether_addr to ether_addr_equal
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.
Done via cocci script:
$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-09 17:17:46 +00:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2006-09-13 14:30:00 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-20 11:07:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2009-01-20 11:07:17 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-13 00:00:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2017-03-13 00:00:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-31 19:50:51 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2014-01-22 03:03:23 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2014-01-22 03:03:23 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-01-22 03:03:23 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2016-04-25 23:13:42 -04:00
|
|
|
|
|
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-06 14:09:49 +08:00
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-25 23:13:42 -04:00
|
|
|
|
2013-12-22 18:54:32 +08:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2010-02-14 01:01:10 +00:00
|
|
|
|
|
|
|
|
|
sock: enable MSG_ZEROCOPY
Prepare the datapath for refcounted ubuf_info. Clone ubuf_info with
skb_zerocopy_clone() wherever needed due to skb split, merge, resize
or clone.
Split skb_orphan_frags into two variants. The split, merge, .. paths
support reference counted zerocopy buffers, so do not do a deep copy.
Add skb_orphan_frags_rx for paths that may loop packets to receive
sockets. That is not allowed, as it may cause unbounded latency.
Deep copy all zerocopy copy buffers, ref-counted or not, in this path.
The exact locations to modify were chosen by exhaustively searching
through all code that might modify skb_frag references and/or the
the SKBTX_DEV_ZEROCOPY tx_flags bit.
The changes err on the safe side, in two ways.
(1) legacy ubuf_info paths virtio and tap are not modified. They keep
a 1:1 ubuf_info to sk_buff relationship. Calls to skb_orphan_frags
still call skb_copy_ubufs and thus copy frags in this case.
(2) not all copies deep in the stack are addressed yet. skb_shift,
skb_split and skb_try_coalesce can be refined to avoid copying.
These are not in the hot path and this patch is hairy enough as
is, so that is left for future refinement.
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-03 16:29:41 -04:00
|
|
|
|
2013-09-05 17:54:00 +08:00
|
|
|
|
|
|
|
|
|
2016-08-23 18:22:33 -04:00
|
|
|
|
2013-07-19 19:40:10 +02:00
|
|
|
|
tun: orphan an skb on tx
The following situation was observed in the field:
tap1 sends packets, tap2 does not consume them, as a result
tap1 can not be closed. This happens because
tun/tap devices can hang on to skbs undefinitely.
As noted by Herbert, possible solutions include a timeout followed by a
copy/change of ownership of the skb, or always copying/changing
ownership if we're going into a hostile device.
This patch implements the second approach.
Note: one issue still remaining is that since skbs
keep reference to tun socket and tun socket has a
reference to tun device, we won't flush backlog,
instead simply waiting for all skbs to get transmitted.
At least this is not user-triggerable, and
this was not reported in practice, my assumption is
other devices besides tap complete an skb
within finite time after it has been queued.
A possible solution for the second issue
would not to have socket reference the device,
instead, implement dev->destructor for tun, and
wait for all skbs to complete there, but this
needs some thought, probably too risky for 2.6.34.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Yan Vugenfirer <yvugenfi@redhat.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-04-13 04:59:44 +00:00
|
|
|
|
2013-09-05 17:54:00 +08:00
|
|
|
|
|
|
|
|
|
tun: orphan an skb on tx
The following situation was observed in the field:
tap1 sends packets, tap2 does not consume them, as a result
tap1 can not be closed. This happens because
tun/tap devices can hang on to skbs undefinitely.
As noted by Herbert, possible solutions include a timeout followed by a
copy/change of ownership of the skb, or always copying/changing
ownership if we're going into a hostile device.
This patch implements the second approach.
Note: one issue still remaining is that since skbs
keep reference to tun socket and tun socket has a
reference to tun device, we won't flush backlog,
instead simply waiting for all skbs to get transmitted.
At least this is not user-triggerable, and
this was not reported in practice, my assumption is
other devices besides tap complete an skb
within finite time after it has been queued.
A possible solution for the second issue
would not to have socket reference the device,
instead, implement dev->destructor for tun, and
wait for all skbs to complete there, but this
needs some thought, probably too risky for 2.6.34.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Yan Vugenfirer <yvugenfi@redhat.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-04-13 04:59:44 +00:00
|
|
|
|
|
|
|
|
|
2013-03-06 11:02:37 +00:00
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2014-05-16 15:11:48 -07:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
|
|
|
|
|
2009-06-23 06:03:08 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2012-11-01 09:16:32 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2014-11-18 13:20:41 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-11-15 15:29:55 +00:00
|
|
|
|
|
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-15 05:25:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-05 20:42:58 -08:00
|
|
|
|
2011-06-15 05:25:01 +00:00
|
|
|
|
2013-12-05 20:42:58 -08:00
|
|
|
|
2011-06-15 05:25:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-26 10:45:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-06 19:12:52 -08:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-19 22:10:37 -08:00
|
|
|
|
2009-01-20 11:07:17 +00:00
|
|
|
|
2008-11-19 22:10:37 -08:00
|
|
|
|
|
|
|
|
|
2008-11-20 20:14:53 -08:00
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2011-06-15 05:25:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-26 10:45:40 +01:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2008-11-19 22:10:37 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 11:07:17 +00:00
|
|
|
|
2008-11-19 22:10:37 -08:00
|
|
|
|
|
|
|
|
|
2008-11-20 20:14:53 -08:00
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2011-08-16 06:29:01 +00:00
|
|
|
|
2008-11-19 22:10:37 -08:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2011-06-15 05:25:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-31 15:03:27 +09:00
|
|
|
|
2016-02-26 10:45:40 +01:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2008-11-19 22:10:37 -08:00
|
|
|
|
|
|
|
|
|
2013-06-11 17:01:08 +04:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
net: use core MTU range checking in core net infra
geneve:
- Merge __geneve_change_mtu back into geneve_change_mtu, set max_mtu
- This one isn't quite as straight-forward as others, could use some
closer inspection and testing
macvlan:
- set min/max_mtu
tun:
- set min/max_mtu, remove tun_net_change_mtu
vxlan:
- Merge __vxlan_change_mtu back into vxlan_change_mtu
- Set max_mtu to IP_MAX_MTU and retain dynamic MTU range checks in
change_mtu function
- This one is also not as straight-forward and could use closer inspection
and testing from vxlan folks
bridge:
- set max_mtu of IP_MAX_MTU and retain dynamic MTU range checks in
change_mtu function
openvswitch:
- set min/max_mtu, remove internal_dev_change_mtu
- note: max_mtu wasn't checked previously, it's been set to 65535, which
is the largest possible size supported
sch_teql:
- set min/max_mtu (note: max_mtu previously unchecked, used max of 65535)
macsec:
- min_mtu = 0, max_mtu = 65535
macvlan:
- min_mtu = 0, max_mtu = 65535
ntb_netdev:
- min_mtu = 0, max_mtu = 65535
veth:
- min_mtu = 68, max_mtu = 65535
8021q:
- min_mtu = 0, max_mtu = 65535
CC: netdev@vger.kernel.org
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Hannes Frederic Sowa <hannes@stressinduktion.org>
CC: Tom Herbert <tom@herbertland.com>
CC: Daniel Borkmann <daniel@iogearbox.net>
CC: Alexander Duyck <alexander.h.duyck@intel.com>
CC: Paolo Abeni <pabeni@redhat.com>
CC: Jiri Benc <jbenc@redhat.com>
CC: WANG Cong <xiyou.wangcong@gmail.com>
CC: Roopa Prabhu <roopa@cumulusnetworks.com>
CC: Pravin B Shelar <pshelar@ovn.org>
CC: Sabrina Dubroca <sd@queasysnail.net>
CC: Patrick McHardy <kaber@trash.net>
CC: Stephen Hemminger <stephen@networkplumber.org>
CC: Pravin Shelar <pshelar@nicira.com>
CC: Maxim Krasnyansky <maxk@qti.qualcomm.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-20 13:55:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2008-11-19 22:10:37 -08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2008-12-29 18:23:28 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2011-07-26 06:05:38 +00:00
|
|
|
|
2012-12-10 15:16:00 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-02-15 06:45:39 +00:00
|
|
|
|
2007-04-26 01:00:55 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
net: use core MTU range checking in core net infra
geneve:
- Merge __geneve_change_mtu back into geneve_change_mtu, set max_mtu
- This one isn't quite as straight-forward as others, could use some
closer inspection and testing
macvlan:
- set min/max_mtu
tun:
- set min/max_mtu, remove tun_net_change_mtu
vxlan:
- Merge __vxlan_change_mtu back into vxlan_change_mtu
- Set max_mtu to IP_MAX_MTU and retain dynamic MTU range checks in
change_mtu function
- This one is also not as straight-forward and could use closer inspection
and testing from vxlan folks
bridge:
- set max_mtu of IP_MAX_MTU and retain dynamic MTU range checks in
change_mtu function
openvswitch:
- set min/max_mtu, remove internal_dev_change_mtu
- note: max_mtu wasn't checked previously, it's been set to 65535, which
is the largest possible size supported
sch_teql:
- set min/max_mtu (note: max_mtu previously unchecked, used max of 65535)
macsec:
- min_mtu = 0, max_mtu = 65535
macvlan:
- min_mtu = 0, max_mtu = 65535
ntb_netdev:
- min_mtu = 0, max_mtu = 65535
veth:
- min_mtu = 68, max_mtu = 65535
8021q:
- min_mtu = 0, max_mtu = 65535
CC: netdev@vger.kernel.org
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Hannes Frederic Sowa <hannes@stressinduktion.org>
CC: Tom Herbert <tom@herbertland.com>
CC: Daniel Borkmann <daniel@iogearbox.net>
CC: Alexander Duyck <alexander.h.duyck@intel.com>
CC: Paolo Abeni <pabeni@redhat.com>
CC: Jiri Benc <jbenc@redhat.com>
CC: WANG Cong <xiyou.wangcong@gmail.com>
CC: Roopa Prabhu <roopa@cumulusnetworks.com>
CC: Pravin B Shelar <pshelar@ovn.org>
CC: Sabrina Dubroca <sd@queasysnail.net>
CC: Patrick McHardy <kaber@trash.net>
CC: Stephen Hemminger <stephen@networkplumber.org>
CC: Pravin Shelar <pshelar@nicira.com>
CC: Maxim Krasnyansky <maxk@qti.qualcomm.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-20 13:55:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2009-01-20 11:03:21 +00:00
|
|
|
|
|
|
|
|
|
2009-07-05 19:48:35 +00:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2009-01-20 10:59:05 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2009-07-05 19:48:35 +00:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-05-16 15:11:48 -07:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-03-13 00:00:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:07:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-15 15:15:10 -07:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2011-06-08 14:33:08 +00:00
|
|
|
|
|
|
|
|
|
2008-08-15 15:15:10 -07:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2008-08-15 15:15:10 -07:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2008-08-15 15:15:10 -07:00
|
|
|
|
|
|
|
|
|
2009-04-14 02:09:43 -07:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2008-08-15 15:15:10 -07:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2013-08-08 14:38:47 -07:00
|
|
|
|
2008-08-15 15:15:10 -07:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2008-08-15 15:15:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
2008-08-15 15:15:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2017-09-04 11:36:09 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2017-08-16 22:14:33 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2017-09-04 11:36:08 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2017-09-04 11:36:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2017-10-27 11:05:44 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-04 11:36:08 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-04 11:36:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-04 11:36:09 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2017-09-04 11:36:09 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2018-02-24 11:32:25 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
2017-09-04 11:36:09 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-04 11:36:08 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-24 11:32:26 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
2017-11-19 19:31:04 +08:00
|
|
|
|
2018-02-24 11:32:25 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-24 11:32:25 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-04 11:36:08 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-19 19:31:04 +08:00
|
|
|
|
2018-02-24 11:32:25 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-24 11:32:25 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-24 11:32:25 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2014-06-19 15:36:49 -04:00
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-02-01 00:45:17 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-06-19 15:36:49 -04:00
|
|
|
|
2016-02-26 10:45:40 +01:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2013-11-13 14:00:39 +08:00
|
|
|
|
2012-07-20 09:23:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-12 19:22:57 +00:00
|
|
|
|
2017-09-04 11:36:09 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-12-16 08:57:37 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2013-08-15 15:52:57 +03:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-08-15 15:52:57 +03:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2016-11-01 22:09:04 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2017-02-03 18:20:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
2017-02-03 18:20:48 -05:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
2016-11-01 22:09:04 -04:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
|
|
|
|
|
2009-06-08 00:20:01 -07:00
|
|
|
|
2014-10-23 22:59:31 +03:00
|
|
|
|
|
|
|
|
|
2009-06-08 00:20:01 -07:00
|
|
|
|
2014-10-23 22:59:31 +03:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
2017-02-03 18:20:48 -05:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2011-06-08 14:33:07 +00:00
|
|
|
|
2009-04-14 02:09:43 -07:00
|
|
|
|
2014-10-23 22:59:31 +03:00
|
|
|
|
2008-04-12 18:49:30 -07:00
|
|
|
|
|
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2013-11-13 14:00:39 +08:00
|
|
|
|
|
|
|
|
|
2013-07-18 10:55:15 +08:00
|
|
|
|
2014-06-19 15:36:49 -04:00
|
|
|
|
|
|
|
|
|
2013-07-18 10:55:15 +08:00
|
|
|
|
|
|
|
|
|
2012-07-20 09:23:23 +00:00
|
|
|
|
|
|
|
|
|
2014-10-23 22:59:31 +03:00
|
|
|
|
2013-11-13 14:00:39 +08:00
|
|
|
|
|
|
|
|
|
2013-07-10 13:43:27 +08:00
|
|
|
|
2014-06-19 15:36:49 -04:00
|
|
|
|
|
|
|
|
|
2013-07-18 10:55:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2017-09-04 11:36:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-20 09:23:23 +00:00
|
|
|
|
2017-08-11 19:41:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-11 18:49:13 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2016-11-18 15:40:38 -08:00
|
|
|
|
2016-06-14 00:00:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
|
|
|
|
|
tun: bail out from tun_get_user() if the skb is empty
KMSAN (https://github.com/google/kmsan) reported accessing uninitialized
skb->data[0] in the case the skb is empty (i.e. skb->len is 0):
================================================
BUG: KMSAN: use of uninitialized memory in tun_get_user+0x19ba/0x3770
CPU: 0 PID: 3051 Comm: probe Not tainted 4.13.0+ #3140
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
...
__msan_warning_32+0x66/0xb0 mm/kmsan/kmsan_instr.c:477
tun_get_user+0x19ba/0x3770 drivers/net/tun.c:1301
tun_chr_write_iter+0x19f/0x300 drivers/net/tun.c:1365
call_write_iter ./include/linux/fs.h:1743
new_sync_write fs/read_write.c:457
__vfs_write+0x6c3/0x7f0 fs/read_write.c:470
vfs_write+0x3e4/0x770 fs/read_write.c:518
SYSC_write+0x12f/0x2b0 fs/read_write.c:565
SyS_write+0x55/0x80 fs/read_write.c:557
do_syscall_64+0x242/0x330 arch/x86/entry/common.c:284
entry_SYSCALL64_slow_path+0x25/0x25 arch/x86/entry/entry_64.S:245
...
origin:
...
kmsan_poison_shadow+0x6e/0xc0 mm/kmsan/kmsan.c:211
slab_alloc_node mm/slub.c:2732
__kmalloc_node_track_caller+0x351/0x370 mm/slub.c:4351
__kmalloc_reserve net/core/skbuff.c:138
__alloc_skb+0x26a/0x810 net/core/skbuff.c:231
alloc_skb ./include/linux/skbuff.h:903
alloc_skb_with_frags+0x1d7/0xc80 net/core/skbuff.c:4756
sock_alloc_send_pskb+0xabf/0xfe0 net/core/sock.c:2037
tun_alloc_skb drivers/net/tun.c:1144
tun_get_user+0x9a8/0x3770 drivers/net/tun.c:1274
tun_chr_write_iter+0x19f/0x300 drivers/net/tun.c:1365
call_write_iter ./include/linux/fs.h:1743
new_sync_write fs/read_write.c:457
__vfs_write+0x6c3/0x7f0 fs/read_write.c:470
vfs_write+0x3e4/0x770 fs/read_write.c:518
SYSC_write+0x12f/0x2b0 fs/read_write.c:565
SyS_write+0x55/0x80 fs/read_write.c:557
do_syscall_64+0x242/0x330 arch/x86/entry/common.c:284
return_from_SYSCALL_64+0x0/0x6a arch/x86/entry/entry_64.S:245
================================================
Make sure tun_get_user() doesn't touch skb->data[0] unless there is
actual data.
C reproducer below:
==========================
// autogenerated by syzkaller (http://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <fcntl.h>
#include <linux/if_tun.h>
#include <netinet/ip.h>
#include <net/if.h>
#include <string.h>
#include <sys/ioctl.h>
int main()
{
int sock = socket(PF_INET, SOCK_STREAM, IPPROTO_IP);
int tun_fd = open("/dev/net/tun", O_RDWR);
struct ifreq req;
memset(&req, 0, sizeof(struct ifreq));
strcpy((char*)&req.ifr_name, "gre0");
req.ifr_flags = IFF_UP | IFF_MULTICAST;
ioctl(tun_fd, TUNSETIFF, &req);
ioctl(sock, SIOCSIFFLAGS, "gre0");
write(tun_fd, "hi", 0);
return 0;
}
==========================
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-09-28 11:32:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-06-17 21:10:33 -07:00
|
|
|
|
|
|
|
|
|
tun: bail out from tun_get_user() if the skb is empty
KMSAN (https://github.com/google/kmsan) reported accessing uninitialized
skb->data[0] in the case the skb is empty (i.e. skb->len is 0):
================================================
BUG: KMSAN: use of uninitialized memory in tun_get_user+0x19ba/0x3770
CPU: 0 PID: 3051 Comm: probe Not tainted 4.13.0+ #3140
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
...
__msan_warning_32+0x66/0xb0 mm/kmsan/kmsan_instr.c:477
tun_get_user+0x19ba/0x3770 drivers/net/tun.c:1301
tun_chr_write_iter+0x19f/0x300 drivers/net/tun.c:1365
call_write_iter ./include/linux/fs.h:1743
new_sync_write fs/read_write.c:457
__vfs_write+0x6c3/0x7f0 fs/read_write.c:470
vfs_write+0x3e4/0x770 fs/read_write.c:518
SYSC_write+0x12f/0x2b0 fs/read_write.c:565
SyS_write+0x55/0x80 fs/read_write.c:557
do_syscall_64+0x242/0x330 arch/x86/entry/common.c:284
entry_SYSCALL64_slow_path+0x25/0x25 arch/x86/entry/entry_64.S:245
...
origin:
...
kmsan_poison_shadow+0x6e/0xc0 mm/kmsan/kmsan.c:211
slab_alloc_node mm/slub.c:2732
__kmalloc_node_track_caller+0x351/0x370 mm/slub.c:4351
__kmalloc_reserve net/core/skbuff.c:138
__alloc_skb+0x26a/0x810 net/core/skbuff.c:231
alloc_skb ./include/linux/skbuff.h:903
alloc_skb_with_frags+0x1d7/0xc80 net/core/skbuff.c:4756
sock_alloc_send_pskb+0xabf/0xfe0 net/core/sock.c:2037
tun_alloc_skb drivers/net/tun.c:1144
tun_get_user+0x9a8/0x3770 drivers/net/tun.c:1274
tun_chr_write_iter+0x19f/0x300 drivers/net/tun.c:1365
call_write_iter ./include/linux/fs.h:1743
new_sync_write fs/read_write.c:457
__vfs_write+0x6c3/0x7f0 fs/read_write.c:470
vfs_write+0x3e4/0x770 fs/read_write.c:518
SYSC_write+0x12f/0x2b0 fs/read_write.c:565
SyS_write+0x55/0x80 fs/read_write.c:557
do_syscall_64+0x242/0x330 arch/x86/entry/common.c:284
return_from_SYSCALL_64+0x0/0x6a arch/x86/entry/entry_64.S:245
================================================
Make sure tun_get_user() doesn't touch skb->data[0] unless there is
actual data.
C reproducer below:
==========================
// autogenerated by syzkaller (http://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <fcntl.h>
#include <linux/if_tun.h>
#include <netinet/ip.h>
#include <net/if.h>
#include <string.h>
#include <sys/ioctl.h>
int main()
{
int sock = socket(PF_INET, SOCK_STREAM, IPPROTO_IP);
int tun_fd = open("/dev/net/tun", O_RDWR);
struct ifreq req;
memset(&req, 0, sizeof(struct ifreq));
strcpy((char*)&req.ifr_name, "gre0");
req.ifr_flags = IFF_UP | IFF_MULTICAST;
ioctl(tun_fd, TUNSETIFF, &req);
ioctl(sock, SIOCSIFFLAGS, "gre0");
write(tun_fd, "hi", 0);
return 0;
}
==========================
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-09-28 11:32:37 +02:00
|
|
|
|
2008-06-17 21:10:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2008-06-17 21:10:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-03-19 15:30:44 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-04-25 17:40:23 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2011-06-03 11:51:20 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-07-20 09:23:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-11 09:27:41 +00:00
|
|
|
|
2016-11-30 13:17:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-20 09:23:23 +00:00
|
|
|
|
|
|
|
|
|
2015-02-03 16:36:16 -05:00
|
|
|
|
2013-03-26 23:11:22 +00:00
|
|
|
|
2013-03-25 20:19:56 +00:00
|
|
|
|
2017-09-04 11:36:09 +08:00
|
|
|
|
2017-08-11 19:41:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-06 14:09:49 +08:00
|
|
|
|
2016-12-01 10:34:40 +01:00
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
2016-12-01 10:34:40 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2016-12-01 10:34:40 +01:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-01-28 01:05:19 +00:00
|
|
|
|
2012-07-20 09:23:23 +00:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-06-19 15:36:49 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2009-02-14 20:46:39 -08:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-08 14:33:08 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2011-06-08 14:33:08 +00:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2014-11-13 16:54:14 +08:00
|
|
|
|
2014-11-03 04:30:13 +08:00
|
|
|
|
2014-11-03 04:30:14 +08:00
|
|
|
|
2014-11-03 04:30:13 +08:00
|
|
|
|
2015-01-13 17:13:44 +01:00
|
|
|
|
2014-11-03 04:30:13 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2017-02-03 18:20:48 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-03 04:30:14 +08:00
|
|
|
|
2016-11-18 15:40:40 -08:00
|
|
|
|
2016-06-08 16:09:20 +03:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
|
|
|
|
|
2016-11-18 15:40:38 -08:00
|
|
|
|
2017-01-20 14:32:42 +08:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
2016-06-08 16:09:20 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
2014-11-13 16:54:14 +08:00
|
|
|
|
|
|
|
|
|
2008-07-03 03:48:02 -07:00
|
|
|
|
|
|
|
|
|
2014-11-03 04:30:13 +08:00
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2013-07-25 13:00:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-07-25 13:00:33 +08:00
|
|
|
|
2015-01-13 17:13:44 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-07-25 13:00:33 +08:00
|
|
|
|
|
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
|
|
|
|
|
2013-07-25 13:00:33 +08:00
|
|
|
|
|
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
|
|
|
|
|
2013-07-25 13:00:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2013-07-25 13:00:33 +08:00
|
|
|
|
|
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-04 13:53:38 +08:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-04 13:53:38 +08:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-04 13:53:38 +08:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-04 13:53:38 +08:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-04 13:53:38 +08:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2014-11-07 13:52:07 -05:00
|
|
|
|
2017-05-17 12:14:43 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-07 13:52:07 -05:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-11-25 22:07:41 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-12-01 05:10:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-07 13:52:07 -05:00
|
|
|
|
2017-12-01 05:10:37 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-05-17 12:14:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-07 21:22:23 +08:00
|
|
|
|
2014-11-07 13:52:07 -05:00
|
|
|
|
2014-12-01 16:53:15 +08:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2014-12-01 16:53:15 +08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-07 13:52:07 -05:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-07 13:52:07 -05:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-17 12:14:43 +08:00
|
|
|
|
2013-12-10 22:05:45 -05:00
|
|
|
|
2013-12-06 14:16:51 +08:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
2013-01-14 07:12:19 +00:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
net: Fix inconsistent teardown and release of private netdev state.
Network devices can allocate reasources and private memory using
netdev_ops->ndo_init(). However, the release of these resources
can occur in one of two different places.
Either netdev_ops->ndo_uninit() or netdev->destructor().
The decision of which operation frees the resources depends upon
whether it is necessary for all netdev refs to be released before it
is safe to perform the freeing.
netdev_ops->ndo_uninit() presumably can occur right after the
NETDEV_UNREGISTER notifier completes and the unicast and multicast
address lists are flushed.
netdev->destructor(), on the other hand, does not run until the
netdev references all go away.
Further complicating the situation is that netdev->destructor()
almost universally does also a free_netdev().
This creates a problem for the logic in register_netdevice().
Because all callers of register_netdevice() manage the freeing
of the netdev, and invoke free_netdev(dev) if register_netdevice()
fails.
If netdev_ops->ndo_init() succeeds, but something else fails inside
of register_netdevice(), it does call ndo_ops->ndo_uninit(). But
it is not able to invoke netdev->destructor().
This is because netdev->destructor() will do a free_netdev() and
then the caller of register_netdevice() will do the same.
However, this means that the resources that would normally be released
by netdev->destructor() will not be.
Over the years drivers have added local hacks to deal with this, by
invoking their destructor parts by hand when register_netdevice()
fails.
Many drivers do not try to deal with this, and instead we have leaks.
Let's close this hole by formalizing the distinction between what
private things need to be freed up by netdev->destructor() and whether
the driver needs unregister_netdevice() to perform the free_netdev().
netdev->priv_destructor() performs all actions to free up the private
resources that used to be freed by netdev->destructor(), except for
free_netdev().
netdev->needs_free_netdev is a boolean that indicates whether
free_netdev() should be done at the end of unregister_netdevice().
Now, register_netdevice() can sanely release all resources after
ndo_ops->ndo_init() succeeds, by invoking both ndo_ops->ndo_uninit()
and netdev->priv_destructor().
And at the end of unregister_netdevice(), we invoke
netdev->priv_destructor() and optionally call free_netdev().
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-05-08 12:52:56 -04:00
|
|
|
|
|
|
|
|
|
2016-04-08 13:26:48 +08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-25 23:56:01 +02:00
|
|
|
|
|
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2010-04-29 11:01:49 +00:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-29 20:03:10 -08:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
2010-04-29 11:01:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
2009-06-03 21:45:55 -07:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
2015-03-02 15:37:48 +08:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-19 15:36:49 -04:00
|
|
|
|
2014-11-24 10:42:55 -05:00
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
2015-03-02 15:37:48 +08:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2017-12-01 05:10:37 -05:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2017-12-01 05:10:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2013-07-19 19:40:10 +02:00
|
|
|
|
2013-04-24 21:59:23 +00:00
|
|
|
|
2017-12-01 05:10:37 -05:00
|
|
|
|
2013-04-24 21:59:23 +00:00
|
|
|
|
2013-07-19 19:40:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-01 05:10:37 -05:00
|
|
|
|
2014-12-25 23:05:03 -08:00
|
|
|
|
2013-12-10 22:05:45 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-24 21:59:23 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
2017-12-01 05:10:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
2009-05-09 22:54:21 -07:00
|
|
|
|
|
|
|
|
|
2014-11-19 14:44:40 +02:00
|
|
|
|
2009-05-09 22:54:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-05-09 22:54:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-05-09 22:54:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-04 14:37:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-16 00:41:16 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 10:56:20 +00:00
|
|
|
|
|
|
|
|
|
2009-04-27 03:23:54 -07:00
|
|
|
|
|
|
|
|
|
2009-01-20 10:56:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-28 18:32:11 +00:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2013-05-28 18:32:11 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
2009-08-28 18:12:43 -04:00
|
|
|
|
2013-01-14 07:12:19 +00:00
|
|
|
|
2009-08-28 18:12:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tun: Allow to skip filter on attach
There's a small problem with sk-filters on tun devices. Consider
an application doing this sequence of steps:
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
ioctl(fd, TUNATTACHFILTER, &my_filter);
ioctl(fd, TUNSETPERSIST, 1);
close(fd);
At that point the tun0 will remain in the system and will keep in
mind that there should be a socket filter at address '&my_filter'.
If after that we do
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
we most likely receive the -EFAULT error, since tun_attach() would
try to connect the filter back. But (!) if we provide a filter at
address &my_filter, then tun0 will be created and the "new" filter
would be attached, but application may not know about that.
This may create certain problems to anyone using tun-s, but it's
critical problem for c/r -- if we meet a persistent tun device
with a filter in mind, we will not be able to attach to it to dump
its state (flags, owner, address, vnethdr size, etc.).
The proposal is to allow to attach to tun device (with TUNSETIFF)
w/o attaching the filter to the tun-file's socket. After this
attach app may e.g clean the device by dropping the filter, it
doesn't want to have one, or (in case of c/r) get information
about the device with tun ioctls.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:32:21 +04:00
|
|
|
|
2009-01-20 10:57:48 +00:00
|
|
|
|
|
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2013-04-22 20:40:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-23 03:59:12 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-11-18 21:34:11 +00:00
|
|
|
|
2006-06-22 16:07:52 -07:00
|
|
|
|
2009-08-28 18:12:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-06-22 16:07:52 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2009-09-16 21:36:13 +00:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
net: set name_assign_type in alloc_netdev()
Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
all users to pass NET_NAME_UNKNOWN.
Coccinelle patch:
@@
expression sizeof_priv, name, setup, txqs, rxqs, count;
@@
(
-alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
+alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
|
-alloc_netdev_mq(sizeof_priv, name, setup, count)
+alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
|
-alloc_netdev(sizeof_priv, name, setup)
+alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
)
v9: move comments here from the wrong commit
Signed-off-by: Tom Gundersen <teg@jklm.no>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-07-14 16:37:24 +02:00
|
|
|
|
|
|
|
|
|
2013-01-23 03:59:12 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-10-13 11:58:53 -07:00
|
|
|
|
2017-10-25 11:50:50 -07:00
|
|
|
|
2017-10-13 11:58:53 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-04-16 00:41:53 -07:00
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
tun: Add ability to create tun device with given index
Tun devices cannot be created with ifidex user wants, but it's
required by checkpoint-restore project.
Long time ago such ability was implemented for rtnl_ops-based
interface for creating links (9c7dafbf net: Allow to create links
with given ifindex), but the only API for creating and managing
tuntap devices is ioctl-based and is evolving with adding new ones
(cde8b15f tuntap: add ioctl to attach or detach a file form tuntap
device).
Following that trend, here's how a new ioctl that sets the ifindex
for device, that _will_ be created by TUNSETIFF ioctl looks like.
So those who want a tuntap device with the ifindex N, should open
the tun device, call ioctl(fd, TUNSETIFINDEX, &N), then call TUNSETIFF.
If the index N is busy, then the register_netdev will find this out
and the ioctl would be failed with -EBUSY.
If setifindex is not called, then it will be generated as before.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:31:38 +04:00
|
|
|
|
2015-02-04 14:37:34 +01:00
|
|
|
|
2008-11-19 22:10:37 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2010-03-17 17:45:01 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2016-02-26 10:45:40 +01:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
|
|
|
|
|
2013-01-14 07:12:19 +00:00
|
|
|
|
|
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
2009-08-28 18:12:43 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-06-11 17:01:08 +04:00
|
|
|
|
2012-10-31 19:46:02 +00:00
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2013-07-25 13:00:33 +08:00
|
|
|
|
|
|
|
|
|
2016-04-14 18:39:39 +02:00
|
|
|
|
2014-02-18 21:20:09 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
tun: Allow to skip filter on attach
There's a small problem with sk-filters on tun devices. Consider
an application doing this sequence of steps:
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
ioctl(fd, TUNATTACHFILTER, &my_filter);
ioctl(fd, TUNSETPERSIST, 1);
close(fd);
At that point the tun0 will remain in the system and will keep in
mind that there should be a socket filter at address '&my_filter'.
If after that we do
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
we most likely receive the -EFAULT error, since tun_attach() would
try to connect the filter back. But (!) if we provide a filter at
address &my_filter, then tun0 will be created and the "new" filter
would be attached, but application may not know about that.
This may create certain problems to anyone using tun-s, but it's
critical problem for c/r -- if we meet a persistent tun device
with a filter in mind, we will not be able to attach to it to dump
its state (flags, owner, address, vnethdr size, etc.).
The proposal is to allow to attach to tun device (with TUNSETIFF)
w/o attaching the filter to the tun-file's socket. After this
attach app may e.g clean the device by dropping the filter, it
doesn't want to have one, or (in case of c/r) get information
about the device with tun ioctls.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:32:21 +04:00
|
|
|
|
2012-12-02 17:19:45 +00:00
|
|
|
|
2013-09-11 18:09:48 +08:00
|
|
|
|
2012-12-02 17:19:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2013-09-11 18:09:48 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2013-01-28 00:38:02 +00:00
|
|
|
|
|
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-19 14:44:40 +02:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2008-07-10 16:59:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2008-07-10 16:59:11 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-09-11 18:09:48 +08:00
|
|
|
|
|
|
|
|
|
2017-08-18 13:39:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-09-11 18:09:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-13 10:52:20 +02:00
|
|
|
|
|
|
|
|
|
2013-09-11 18:09:48 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-23 03:58:10 +00:00
|
|
|
|
2009-08-06 14:22:44 +00:00
|
|
|
|
2008-08-15 15:09:56 -07:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2008-08-15 15:09:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-05-09 22:54:21 -07:00
|
|
|
|
2008-08-15 15:09:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-03 03:46:16 -07:00
|
|
|
|
|
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2008-07-03 03:46:16 -07:00
|
|
|
|
2011-11-15 15:29:55 +00:00
|
|
|
|
2008-07-03 03:46:16 -07:00
|
|
|
|
|
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2008-07-03 03:46:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
net: accept UFO datagrams from tuntap and packet
[ Upstream commit 0c19f846d582af919db66a5914a0189f9f92c936 ]
Tuntap and similar devices can inject GSO packets. Accept type
VIRTIO_NET_HDR_GSO_UDP, even though not generating UFO natively.
Processes are expected to use feature negotiation such as TUNSETOFFLOAD
to detect supported offload types and refrain from injecting other
packets. This process breaks down with live migration: guest kernels
do not renegotiate flags, so destination hosts need to expose all
features that the source host does.
Partially revert the UFO removal from 182e0b6b5846~1..d9d30adf5677.
This patch introduces nearly(*) no new code to simplify verification.
It brings back verbatim tuntap UFO negotiation, VIRTIO_NET_HDR_GSO_UDP
insertion and software UFO segmentation.
It does not reinstate protocol stack support, hardware offload
(NETIF_F_UFO), SKB_GSO_UDP tunneling in SKB_GSO_SOFTWARE or reception
of VIRTIO_NET_HDR_GSO_UDP packets in tuntap.
To support SKB_GSO_UDP reappearing in the stack, also reinstate
logic in act_csum and openvswitch. Achieve equivalence with v4.13 HEAD
by squashing in commit 939912216fa8 ("net: skb_needs_check() removes
CHECKSUM_UNNECESSARY check for tx.") and reverting commit 8d63bee643f1
("net: avoid skb_warn_bad_offload false positives on UFO").
(*) To avoid having to bring back skb_shinfo(skb)->ip6_frag_id,
ipv6_proxy_select_ident is changed to return a __be32 and this is
assigned directly to the frag_hdr. Also, SKB_GSO_UDP is inserted
at the end of the enum to minimize code churn.
Tested
Booted a v4.13 guest kernel with QEMU. On a host kernel before this
patch `ethtool -k eth0` shows UFO disabled. After the patch, it is
enabled, same as on a v4.13 host kernel.
A UFO packet sent from the guest appears on the tap device:
host:
nc -l -p -u 8000 &
tcpdump -n -i tap0
guest:
dd if=/dev/zero of=payload.txt bs=1 count=2000
nc -u 192.16.1.1 8000 < payload.txt
Direct tap to tap transmission of VIRTIO_NET_HDR_GSO_UDP succeeds,
packets arriving fragmented:
./with_tap_pair.sh ./tap_send_ufo tap0 tap1
(from https://github.com/wdebruij/kerneltools/tree/master/tests)
Changes
v1 -> v2
- simplified set_offload change (review comment)
- documented test procedure
Link: http://lkml.kernel.org/r/<CAF=yD-LuUeDuL9YWPJD9ykOZ0QCjNeznPDr6whqZ9NGMNF12Mw@mail.gmail.com>
Fixes: fb652fdfe837 ("macvlan/macvtap: Remove NETIF_F_UFO advertisement.")
Reported-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-21 10:22:25 -05:00
|
|
|
|
|
|
|
|
|
2008-07-03 03:46:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2017-03-16 22:44:10 +03:00
|
|
|
|
|
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2008-07-03 03:46:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:32 +00:00
|
|
|
|
2016-04-05 17:10:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:32 +00:00
|
|
|
|
2016-04-05 17:10:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 16:59:32 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2013-01-14 07:12:19 +00:00
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
2013-01-14 07:12:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tun: Allow to skip filter on attach
There's a small problem with sk-filters on tun devices. Consider
an application doing this sequence of steps:
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
ioctl(fd, TUNATTACHFILTER, &my_filter);
ioctl(fd, TUNSETPERSIST, 1);
close(fd);
At that point the tun0 will remain in the system and will keep in
mind that there should be a socket filter at address '&my_filter'.
If after that we do
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
we most likely receive the -EFAULT error, since tun_attach() would
try to connect the filter back. But (!) if we provide a filter at
address &my_filter, then tun0 will be created and the "new" filter
would be attached, but application may not know about that.
This may create certain problems to anyone using tun-s, but it's
critical problem for c/r -- if we meet a persistent tun device
with a filter in mind, we will not be able to attach to it to dump
its state (flags, owner, address, vnethdr size, etc.).
The proposal is to allow to attach to tun device (with TUNSETIFF)
w/o attaching the filter to the tun-file's socket. After this
attach app may e.g clean the device by dropping the filter, it
doesn't want to have one, or (in case of c/r) get information
about the device with tun ioctls.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:32:21 +04:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2013-01-11 16:59:32 +00:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
|
|
|
|
|
2013-01-14 07:12:19 +00:00
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-06 22:52:32 -08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-20 11:01:48 +00:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
|
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2010-03-17 17:45:01 +02:00
|
|
|
|
tun: Add ability to create tun device with given index
Tun devices cannot be created with ifidex user wants, but it's
required by checkpoint-restore project.
Long time ago such ability was implemented for rtnl_ops-based
interface for creating links (9c7dafbf net: Allow to create links
with given ifindex), but the only API for creating and managing
tuntap devices is ioctl-based and is evolving with adding new ones
(cde8b15f tuntap: add ioctl to attach or detach a file form tuntap
device).
Following that trend, here's how a new ioctl that sets the ifindex
for device, that _will_ be created by TUNSETIFF ioctl looks like.
So those who want a tuntap device with the ifindex N, should open
the tun device, call ioctl(fd, TUNSETIFINDEX, &N), then call TUNSETIFF.
If the index N is busy, then the register_netdev will find this out
and the ioctl would be failed with -EBUSY.
If setifindex is not called, then it will be generated as before.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:31:38 +04:00
|
|
|
|
2014-12-16 15:05:06 +02:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2016-10-27 09:05:22 +08:00
|
|
|
|
2009-11-06 22:52:32 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-07-30 14:52:48 -07:00
|
|
|
|
2012-07-29 19:45:14 +00:00
|
|
|
|
2012-07-30 14:52:48 -07:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 14:44:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2012-10-31 19:46:01 +00:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2009-08-06 14:22:44 +00:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:01:48 +00:00
|
|
|
|
2016-10-25 22:26:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-05-08 21:07:08 -05:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-08-06 14:22:44 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-11-06 22:52:32 -08:00
|
|
|
|
2009-08-06 14:22:44 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
tun: Add ability to create tun device with given index
Tun devices cannot be created with ifidex user wants, but it's
required by checkpoint-restore project.
Long time ago such ability was implemented for rtnl_ops-based
interface for creating links (9c7dafbf net: Allow to create links
with given ifindex), but the only API for creating and managing
tuntap devices is ioctl-based and is evolving with adding new ones
(cde8b15f tuntap: add ioctl to attach or detach a file form tuntap
device).
Following that trend, here's how a new ioctl that sets the ifindex
for device, that _will_ be created by TUNSETIFF ioctl looks like.
So those who want a tuntap device with the ifindex N, should open
the tun device, call ioctl(fd, TUNSETIFINDEX, &N), then call TUNSETIFF.
If the index N is busy, then the register_netdev will find this out
and the ioctl would be failed with -EBUSY.
If setifindex is not called, then it will be generated as before.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:31:38 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-08-06 14:22:44 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-08-06 14:22:44 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-10-31 19:45:56 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-08-15 15:09:56 -07:00
|
|
|
|
2012-11-23 03:58:10 +00:00
|
|
|
|
2008-08-15 15:09:56 -07:00
|
|
|
|
2013-08-21 14:32:00 +04:00
|
|
|
|
|
|
|
|
|
tun: Allow to skip filter on attach
There's a small problem with sk-filters on tun devices. Consider
an application doing this sequence of steps:
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
ioctl(fd, TUNATTACHFILTER, &my_filter);
ioctl(fd, TUNSETPERSIST, 1);
close(fd);
At that point the tun0 will remain in the system and will keep in
mind that there should be a socket filter at address '&my_filter'.
If after that we do
fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
we most likely receive the -EFAULT error, since tun_attach() would
try to connect the filter back. But (!) if we provide a filter at
address &my_filter, then tun0 will be created and the "new" filter
would be attached, but application may not know about that.
This may create certain problems to anyone using tun-s, but it's
critical problem for c/r -- if we meet a persistent tun device
with a filter in mind, we will not be able to attach to it to dump
its state (flags, owner, address, vnethdr size, etc.).
The proposal is to allow to attach to tun device (with TUNSETIFF)
w/o attaching the filter to the tun-file's socket. After this
attach app may e.g clean the device by dropping the filter, it
doesn't want to have one, or (in case of c/r) get information
about the device with tun ioctls.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:32:21 +04:00
|
|
|
|
|
|
|
|
|
2013-08-21 14:32:00 +04:00
|
|
|
|
2009-11-06 22:52:32 -08:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2008-08-15 15:09:56 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
|
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2013-01-11 16:59:34 +00:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:56 +00:00
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2007-07-02 22:50:25 -07:00
|
|
|
|
|
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:56 +00:00
|
|
|
|
2012-02-07 16:48:55 -08:00
|
|
|
|
2007-07-02 22:50:25 -07:00
|
|
|
|
|
|
|
|
|
2005-09-01 17:40:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
|
|
|
|
|
2008-04-23 19:37:58 -07:00
|
|
|
|
2005-09-01 17:40:05 -07:00
|
|
|
|
|
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
|
|
|
|
|
2008-04-23 19:37:58 -07:00
|
|
|
|
2005-09-01 17:40:05 -07:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-09-01 17:40:05 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-03 03:46:16 -07:00
|
|
|
|
2011-04-19 06:13:10 +00:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2008-07-03 03:46:16 -07:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2008-07-16 12:45:34 -07:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
tree-wide: fix comment/printk typos
"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-11-01 15:38:34 -04:00
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
|
|
|
|
|
2009-11-06 22:52:32 -08:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2008-07-14 22:18:19 -07:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
|
|
|
|
|
2008-02-29 12:26:21 -08:00
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-10-30 18:50:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
2009-02-05 21:25:32 -08:00
|
|
|
|
|
|
|
|
|
2010-03-17 17:45:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-16 15:05:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-24 14:50:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-14 01:01:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2010-02-14 01:01:10 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2010-02-14 01:01:10 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2010-02-14 01:01:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2010-02-14 01:01:10 +00:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
|
|
|
|
|
2010-02-14 01:01:10 +00:00
|
|
|
|
|
|
|
|
|
2013-08-21 14:32:39 +04:00
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2013-08-21 14:32:39 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
2010-05-17 22:47:34 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-08-06 14:22:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2009-11-06 22:52:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2008-06-19 15:50:37 -06:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-08-22 11:27:32 -04:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2008-06-19 15:50:37 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-08 21:07:08 -05:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2009-10-14 01:19:46 -07:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2015-05-08 21:07:08 -05:00
|
|
|
|
2015-05-08 21:09:13 -05:00
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
|
|
|
|
|
2014-03-24 00:02:32 +05:30
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
tun: Add ability to create tun device with given index
Tun devices cannot be created with ifidex user wants, but it's
required by checkpoint-restore project.
Long time ago such ability was implemented for rtnl_ops-based
interface for creating links (9c7dafbf net: Allow to create links
with given ifindex), but the only API for creating and managing
tuntap devices is ioctl-based and is evolving with adding new ones
(cde8b15f tuntap: add ioctl to attach or detach a file form tuntap
device).
Following that trend, here's how a new ioctl that sets the ifindex
for device, that _will_ be created by TUNSETIFF ioctl looks like.
So those who want a tuntap device with the ifindex N, should open
the tun device, call ioctl(fd, TUNSETIFINDEX, &N), then call TUNSETIFF.
If the index N is busy, then the register_netdev will find this out
and the ioctl would be failed with -EBUSY.
If setifindex is not called, then it will be generated as before.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 14:31:38 +04:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
2014-05-16 15:11:48 -07:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2012-12-13 23:53:30 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2013-06-08 14:17:41 +08:00
|
|
|
|
|
|
|
|
|
2018-01-15 11:37:29 -08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 11:00:40 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-10-31 19:46:00 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-29 16:43:31 +09:00
|
|
|
|
2014-09-29 16:08:25 -07:00
|
|
|
|
2014-01-29 16:43:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-29 16:08:25 -07:00
|
|
|
|
2014-01-29 16:43:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-02-12 00:55:34 -08:00
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-07 13:52:07 -05:00
|
|
|
|
2014-06-19 15:36:49 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-11-06 22:52:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-01-29 16:43:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-18 23:01:12 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-11 22:03:50 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-03-11 22:03:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-15 14:59:53 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2011-11-15 14:59:53 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2014-11-19 15:17:31 +02:00
|
|
|
|
2011-11-15 14:59:53 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-13 14:30:00 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-27 13:53:43 +00:00
|
|
|
|
2013-07-19 19:40:10 +02:00
|
|
|
|
2017-01-18 15:02:03 +08:00
|
|
|
|
|
|
|
|
|
2017-03-11 22:03:50 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-15 10:29:16 -07:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-06 18:44:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-16 00:40:46 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
2008-04-16 00:40:46 -07:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
2008-04-16 00:40:46 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-04-16 00:40:46 -07:00
|
|
|
|
2011-03-02 07:18:10 +00:00
|
|
|
|
2008-04-16 00:40:46 -07:00
|
|
|
|
|
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
2017-07-20 02:41:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
2017-07-20 02:41:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-16 00:40:46 -07:00
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-13 13:24:59 -04:00
|
|
|
|
2009-01-21 16:02:16 -08:00
|
|
|
|
2016-06-30 14:45:36 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
2012-10-31 19:45:58 +00:00
|
|
|
|
|
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
2012-10-31 19:45:57 +00:00
|
|
|
|
2010-01-14 06:17:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-17 12:14:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
driver core: add devname module aliases to allow module on-demand auto-loading
This adds:
alias: devname:<name>
to some common kernel modules, which will allow the on-demand loading
of the kernel module when the device node is accessed.
Ideally all these modules would be compiled-in, but distros seems too
much in love with their modularization that we need to cover the common
cases with this new facility. It will allow us to remove a bunch of pretty
useless init scripts and modprobes from init scripts.
The static device node aliases will be carried in the module itself. The
program depmod will extract this information to a file in the module directory:
$ cat /lib/modules/2.6.34-00650-g537b60d-dirty/modules.devname
# Device nodes to trigger on-demand module loading.
microcode cpu/microcode c10:184
fuse fuse c10:229
ppp_generic ppp c108:0
tun net/tun c10:200
dm_mod mapper/control c10:235
Udev will pick up the depmod created file on startup and create all the
static device nodes which the kernel modules specify, so that these modules
get automatically loaded when the device node is accessed:
$ /sbin/udevd --debug
...
static_dev_create_from_modules: mknod '/dev/cpu/microcode' c10:184
static_dev_create_from_modules: mknod '/dev/fuse' c10:229
static_dev_create_from_modules: mknod '/dev/ppp' c108:0
static_dev_create_from_modules: mknod '/dev/net/tun' c10:200
static_dev_create_from_modules: mknod '/dev/mapper/control' c10:235
udev_rules_apply_static_dev_perms: chmod '/dev/net/tun' 0666
udev_rules_apply_static_dev_perms: chmod '/dev/fuse' 0666
A few device nodes are switched to statically allocated numbers, to allow
the static nodes to work. This might also useful for systems which still run
a plain static /dev, which is completely unsafe to use with any dynamic minor
numbers.
Note:
The devname aliases must be limited to the *common* and *single*instance*
device nodes, like the misc devices, and never be used for conceptually limited
systems like the loop devices, which should rather get fixed properly and get a
control node for losetup to talk to, instead of creating a random number of
device nodes in advance, regardless if they are ever used.
This facility is to hide the mess distros are creating with too modualized
kernels, and just to hide that these modules are not compiled-in, and not to
paper-over broken concepts. Thanks! :)
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Alasdair G Kergon <agk@redhat.com>
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: Ian Kent <raven@themaw.net>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 18:07:20 +02:00
|
|
|
|