<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/net/ipv6/ip6_fib.c, branch v3.17.8</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>ipv6: remove rt6i_genid</title>
<updated>2014-09-30T18:00:48+00:00</updated>
<author>
<name>Hannes Frederic Sowa</name>
<email>hannes@stressinduktion.org</email>
</author>
<published>2014-09-27T22:46:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=705f1c869d577c8055736dd02501f26a2507dd5b'/>
<id>705f1c869d577c8055736dd02501f26a2507dd5b</id>
<content type='text'>
Eric Dumazet noticed that all no-nonexthop or no-gateway routes which
are already marked DST_HOST (e.g. input routes routes) will always be
invalidated during sk_dst_check. Thus per-socket dst caching absolutely
had no effect and early demuxing had no effect.

Thus this patch removes rt6i_genid: fn_sernum already gets modified during
add operations, so we only must ensure we mutate fn_sernum during ipv6
address remove operations. This is a fairly cost extensive operations,
but address removal should not happen that often. Also our mtu update
functions do the same and we heard no complains so far. xfrm policy
changes also cause a call into fib6_flush_trees. Also plug a hole in
rt6_info (no cacheline changes).

I verified via tracing that this change has effect.

Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: YOSHIFUJI Hideaki &lt;hideaki@yoshifuji.org&gt;
Cc: Vlad Yasevich &lt;vyasevich@gmail.com&gt;
Cc: Nicolas Dichtel &lt;nicolas.dichtel@6wind.com&gt;
Cc: Martin Lau &lt;kafai@fb.com&gt;
Signed-off-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Eric Dumazet noticed that all no-nonexthop or no-gateway routes which
are already marked DST_HOST (e.g. input routes routes) will always be
invalidated during sk_dst_check. Thus per-socket dst caching absolutely
had no effect and early demuxing had no effect.

Thus this patch removes rt6i_genid: fn_sernum already gets modified during
add operations, so we only must ensure we mutate fn_sernum during ipv6
address remove operations. This is a fairly cost extensive operations,
but address removal should not happen that often. Also our mtu update
functions do the same and we heard no complains so far. xfrm policy
changes also cause a call into fib6_flush_trees. Also plug a hole in
rt6_info (no cacheline changes).

I verified via tracing that this change has effect.

Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: YOSHIFUJI Hideaki &lt;hideaki@yoshifuji.org&gt;
Cc: Vlad Yasevich &lt;vyasevich@gmail.com&gt;
Cc: Nicolas Dichtel &lt;nicolas.dichtel@6wind.com&gt;
Cc: Martin Lau &lt;kafai@fb.com&gt;
Signed-off-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: ipv6: fib: don't sleep inside atomic lock</title>
<updated>2014-08-22T17:54:49+00:00</updated>
<author>
<name>Benjamin Block</name>
<email>bebl@mageta.org</email>
</author>
<published>2014-08-21T17:37:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=793c3b4000a1ef611ae7e5c89bd2a9c6b776cb5e'/>
<id>793c3b4000a1ef611ae7e5c89bd2a9c6b776cb5e</id>
<content type='text'>
The function fib6_commit_metrics() allocates a piece of memory in mode
GFP_KERNEL while holding an atomic lock from higher up in the stack, in
the function __ip6_ins_rt(). This produces the following BUG:

&gt; BUG: sleeping function called from invalid context at mm/slub.c:1250
&gt; in_atomic(): 1, irqs_disabled(): 0, pid: 2909, name: dhcpcd
&gt; 2 locks held by dhcpcd/2909:
&gt;  #0:  (rtnl_mutex){+.+.+.}, at: [&lt;ffffffff81978e67&gt;] rtnl_lock+0x17/0x20
&gt;  #1:  (&amp;tb-&gt;tb6_lock){++--+.}, at: [&lt;ffffffff81a6951a&gt;] ip6_route_add+0x65a/0x800
&gt; CPU: 1 PID: 2909 Comm: dhcpcd Not tainted 3.17.0-rc1 #1
&gt; Hardware name: ASUS All Series/Q87T, BIOS 0216 10/16/2013
&gt;  0000000000000008 ffff8800c8f13858 ffffffff81af135a 0000000000000000
&gt;  ffff880212202430 ffff8800c8f13878 ffffffff810f8d3a ffff880212202c98
&gt;  0000000000000010 ffff8800c8f138c8 ffffffff8121ad0e 0000000000000001
&gt; Call Trace:
&gt;  [&lt;ffffffff81af135a&gt;] dump_stack+0x4e/0x68
&gt;  [&lt;ffffffff810f8d3a&gt;] __might_sleep+0x10a/0x120
&gt;  [&lt;ffffffff8121ad0e&gt;] kmem_cache_alloc_trace+0x4e/0x190
&gt;  [&lt;ffffffff81a6bcd6&gt;] ? fib6_commit_metrics+0x66/0x110
&gt;  [&lt;ffffffff81a6bcd6&gt;] fib6_commit_metrics+0x66/0x110
&gt;  [&lt;ffffffff81a6cbf3&gt;] fib6_add+0x883/0xa80
&gt;  [&lt;ffffffff81a6951a&gt;] ? ip6_route_add+0x65a/0x800
&gt;  [&lt;ffffffff81a69535&gt;] ip6_route_add+0x675/0x800
&gt;  [&lt;ffffffff81a68f2a&gt;] ? ip6_route_add+0x6a/0x800
&gt;  [&lt;ffffffff81a6990c&gt;] inet6_rtm_newroute+0x5c/0x80
&gt;  [&lt;ffffffff8197cf01&gt;] rtnetlink_rcv_msg+0x211/0x260
&gt;  [&lt;ffffffff81978e67&gt;] ? rtnl_lock+0x17/0x20
&gt;  [&lt;ffffffff81119708&gt;] ? lock_release_holdtime+0x28/0x180
&gt;  [&lt;ffffffff81978e67&gt;] ? rtnl_lock+0x17/0x20
&gt;  [&lt;ffffffff8197ccf0&gt;] ? __rtnl_unlock+0x20/0x20
&gt;  [&lt;ffffffff819a989e&gt;] netlink_rcv_skb+0x6e/0xd0
&gt;  [&lt;ffffffff81978ee5&gt;] rtnetlink_rcv+0x25/0x40
&gt;  [&lt;ffffffff819a8e59&gt;] netlink_unicast+0xd9/0x180
&gt;  [&lt;ffffffff819a9600&gt;] netlink_sendmsg+0x700/0x770
&gt;  [&lt;ffffffff81103735&gt;] ? local_clock+0x25/0x30
&gt;  [&lt;ffffffff8194e83c&gt;] sock_sendmsg+0x6c/0x90
&gt;  [&lt;ffffffff811f98e3&gt;] ? might_fault+0xa3/0xb0
&gt;  [&lt;ffffffff8195ca6d&gt;] ? verify_iovec+0x7d/0xf0
&gt;  [&lt;ffffffff8194ec3e&gt;] ___sys_sendmsg+0x37e/0x3b0
&gt;  [&lt;ffffffff8111ef15&gt;] ? trace_hardirqs_on_caller+0x185/0x220
&gt;  [&lt;ffffffff81af979e&gt;] ? mutex_unlock+0xe/0x10
&gt;  [&lt;ffffffff819a55ec&gt;] ? netlink_insert+0xbc/0xe0
&gt;  [&lt;ffffffff819a65e5&gt;] ? netlink_autobind.isra.30+0x125/0x150
&gt;  [&lt;ffffffff819a6520&gt;] ? netlink_autobind.isra.30+0x60/0x150
&gt;  [&lt;ffffffff819a84f9&gt;] ? netlink_bind+0x159/0x230
&gt;  [&lt;ffffffff811f989a&gt;] ? might_fault+0x5a/0xb0
&gt;  [&lt;ffffffff8194f25e&gt;] ? SYSC_bind+0x7e/0xd0
&gt;  [&lt;ffffffff8194f8cd&gt;] __sys_sendmsg+0x4d/0x80
&gt;  [&lt;ffffffff8194f912&gt;] SyS_sendmsg+0x12/0x20
&gt;  [&lt;ffffffff81afc692&gt;] system_call_fastpath+0x16/0x1b

Fixing this by replacing the mode GFP_KERNEL with GFP_ATOMIC.

Signed-off-by: Benjamin Block &lt;bebl@mageta.org&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The function fib6_commit_metrics() allocates a piece of memory in mode
GFP_KERNEL while holding an atomic lock from higher up in the stack, in
the function __ip6_ins_rt(). This produces the following BUG:

&gt; BUG: sleeping function called from invalid context at mm/slub.c:1250
&gt; in_atomic(): 1, irqs_disabled(): 0, pid: 2909, name: dhcpcd
&gt; 2 locks held by dhcpcd/2909:
&gt;  #0:  (rtnl_mutex){+.+.+.}, at: [&lt;ffffffff81978e67&gt;] rtnl_lock+0x17/0x20
&gt;  #1:  (&amp;tb-&gt;tb6_lock){++--+.}, at: [&lt;ffffffff81a6951a&gt;] ip6_route_add+0x65a/0x800
&gt; CPU: 1 PID: 2909 Comm: dhcpcd Not tainted 3.17.0-rc1 #1
&gt; Hardware name: ASUS All Series/Q87T, BIOS 0216 10/16/2013
&gt;  0000000000000008 ffff8800c8f13858 ffffffff81af135a 0000000000000000
&gt;  ffff880212202430 ffff8800c8f13878 ffffffff810f8d3a ffff880212202c98
&gt;  0000000000000010 ffff8800c8f138c8 ffffffff8121ad0e 0000000000000001
&gt; Call Trace:
&gt;  [&lt;ffffffff81af135a&gt;] dump_stack+0x4e/0x68
&gt;  [&lt;ffffffff810f8d3a&gt;] __might_sleep+0x10a/0x120
&gt;  [&lt;ffffffff8121ad0e&gt;] kmem_cache_alloc_trace+0x4e/0x190
&gt;  [&lt;ffffffff81a6bcd6&gt;] ? fib6_commit_metrics+0x66/0x110
&gt;  [&lt;ffffffff81a6bcd6&gt;] fib6_commit_metrics+0x66/0x110
&gt;  [&lt;ffffffff81a6cbf3&gt;] fib6_add+0x883/0xa80
&gt;  [&lt;ffffffff81a6951a&gt;] ? ip6_route_add+0x65a/0x800
&gt;  [&lt;ffffffff81a69535&gt;] ip6_route_add+0x675/0x800
&gt;  [&lt;ffffffff81a68f2a&gt;] ? ip6_route_add+0x6a/0x800
&gt;  [&lt;ffffffff81a6990c&gt;] inet6_rtm_newroute+0x5c/0x80
&gt;  [&lt;ffffffff8197cf01&gt;] rtnetlink_rcv_msg+0x211/0x260
&gt;  [&lt;ffffffff81978e67&gt;] ? rtnl_lock+0x17/0x20
&gt;  [&lt;ffffffff81119708&gt;] ? lock_release_holdtime+0x28/0x180
&gt;  [&lt;ffffffff81978e67&gt;] ? rtnl_lock+0x17/0x20
&gt;  [&lt;ffffffff8197ccf0&gt;] ? __rtnl_unlock+0x20/0x20
&gt;  [&lt;ffffffff819a989e&gt;] netlink_rcv_skb+0x6e/0xd0
&gt;  [&lt;ffffffff81978ee5&gt;] rtnetlink_rcv+0x25/0x40
&gt;  [&lt;ffffffff819a8e59&gt;] netlink_unicast+0xd9/0x180
&gt;  [&lt;ffffffff819a9600&gt;] netlink_sendmsg+0x700/0x770
&gt;  [&lt;ffffffff81103735&gt;] ? local_clock+0x25/0x30
&gt;  [&lt;ffffffff8194e83c&gt;] sock_sendmsg+0x6c/0x90
&gt;  [&lt;ffffffff811f98e3&gt;] ? might_fault+0xa3/0xb0
&gt;  [&lt;ffffffff8195ca6d&gt;] ? verify_iovec+0x7d/0xf0
&gt;  [&lt;ffffffff8194ec3e&gt;] ___sys_sendmsg+0x37e/0x3b0
&gt;  [&lt;ffffffff8111ef15&gt;] ? trace_hardirqs_on_caller+0x185/0x220
&gt;  [&lt;ffffffff81af979e&gt;] ? mutex_unlock+0xe/0x10
&gt;  [&lt;ffffffff819a55ec&gt;] ? netlink_insert+0xbc/0xe0
&gt;  [&lt;ffffffff819a65e5&gt;] ? netlink_autobind.isra.30+0x125/0x150
&gt;  [&lt;ffffffff819a6520&gt;] ? netlink_autobind.isra.30+0x60/0x150
&gt;  [&lt;ffffffff819a84f9&gt;] ? netlink_bind+0x159/0x230
&gt;  [&lt;ffffffff811f989a&gt;] ? might_fault+0x5a/0xb0
&gt;  [&lt;ffffffff8194f25e&gt;] ? SYSC_bind+0x7e/0xd0
&gt;  [&lt;ffffffff8194f8cd&gt;] __sys_sendmsg+0x4d/0x80
&gt;  [&lt;ffffffff8194f912&gt;] SyS_sendmsg+0x12/0x20
&gt;  [&lt;ffffffff81afc692&gt;] system_call_fastpath+0x16/0x1b

Fixing this by replacing the mode GFP_KERNEL with GFP_ATOMIC.

Signed-off-by: Benjamin Block &lt;bebl@mageta.org&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2014-05-12T17:19:14+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2014-05-12T17:19:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5f013c9bc70214dcacd5fbed5a06c217d6ff9c59'/>
<id>5f013c9bc70214dcacd5fbed5a06c217d6ff9c59</id>
<content type='text'>
Conflicts:
	drivers/net/ethernet/altera/altera_sgdma.c
	net/netlink/af_netlink.c
	net/sched/cls_api.c
	net/sched/sch_api.c

The netlink conflict dealt with moving to netlink_capable() and
netlink_ns_capable() in the 'net' tree vs. supporting 'tc' operations
in non-init namespaces.  These were simple transformations from
netlink_capable to netlink_ns_capable.

The Altera driver conflict was simply code removal overlapping some
void pointer cast cleanups in net-next.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	drivers/net/ethernet/altera/altera_sgdma.c
	net/netlink/af_netlink.c
	net/sched/cls_api.c
	net/sched/sch_api.c

The netlink conflict dealt with moving to netlink_capable() and
netlink_ns_capable() in the 'net' tree vs. supporting 'tc' operations
in non-init namespaces.  These were simple transformations from
netlink_capable to netlink_ns_capable.

The Altera driver conflict was simply code removal overlapping some
void pointer cast cleanups in net-next.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv6: remove parameter rt from fib6_prune_clones()</title>
<updated>2014-05-12T05:06:42+00:00</updated>
<author>
<name>Duan Jiong</name>
<email>duanj.fnst@cn.fujitsu.com</email>
</author>
<published>2014-05-09T05:31:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=163cd4e817a4444e348ca577cb74c71d245f0c72'/>
<id>163cd4e817a4444e348ca577cb74c71d245f0c72</id>
<content type='text'>
the parameter rt will be assigned to c.arg in function fib6_clean_tree(),
but function fib6_prune_clone() doesn't use c.arg, so we can remove it
safely.

Signed-off-by: Duan Jiong &lt;duanj.fnst@cn.fujitsu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the parameter rt will be assigned to c.arg in function fib6_clean_tree(),
but function fib6_prune_clone() doesn't use c.arg, so we can remove it
safely.

Signed-off-by: Duan Jiong &lt;duanj.fnst@cn.fujitsu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv6: fib: fix fib dump restart</title>
<updated>2014-04-24T21:19:25+00:00</updated>
<author>
<name>Kumar Sundararajan</name>
<email>kumar@fb.com</email>
</author>
<published>2014-04-24T13:48:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1c2658545816088477e91860c3a645053719cb54'/>
<id>1c2658545816088477e91860c3a645053719cb54</id>
<content type='text'>
When the ipv6 fib changes during a table dump, the walk is
restarted and the number of nodes dumped are skipped. But the existing
code doesn't advance to the next node after a node is skipped. This can
cause the dump to loop or produce lots of duplicates when the fib
is modified during the dump.

This change advances the walk to the next node if the current node is
skipped after a restart.

Signed-off-by: Kumar Sundararajan &lt;kumar@fb.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the ipv6 fib changes during a table dump, the walk is
restarted and the number of nodes dumped are skipped. But the existing
code doesn't advance to the next node after a node is skipped. This can
cause the dump to loop or produce lots of duplicates when the fib
is modified during the dump.

This change advances the walk to the next node if the current node is
skipped after a restart.

Signed-off-by: Kumar Sundararajan &lt;kumar@fb.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv6: fix checkpatch errors of "foo*" and "foo * bar"</title>
<updated>2014-03-29T22:15:52+00:00</updated>
<author>
<name>Wang Yufen</name>
<email>wangyufen@huawei.com</email>
</author>
<published>2014-03-28T04:07:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=437de07ced703c2d171b43bd63cf47e0af09a241'/>
<id>437de07ced703c2d171b43bd63cf47e0af09a241</id>
<content type='text'>
ERROR: "(foo*)" should be "(foo *)"
ERROR: "foo * bar" should be "foo *bar"

Suggested-by: Sergei Shtylyov &lt;sergei.shtylyov@cogentembedded.com&gt;
Signed-off-by: Wang Yufen &lt;wangyufen@huawei.com&gt;
Acked-by: Sergei Shtylyov &lt;sergei.shtylyov@cogentembedded.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ERROR: "(foo*)" should be "(foo *)"
ERROR: "foo * bar" should be "foo *bar"

Suggested-by: Sergei Shtylyov &lt;sergei.shtylyov@cogentembedded.com&gt;
Signed-off-by: Wang Yufen &lt;wangyufen@huawei.com&gt;
Acked-by: Sergei Shtylyov &lt;sergei.shtylyov@cogentembedded.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv6: fix checkpatch errors of brace and trailing statements</title>
<updated>2014-03-29T22:15:52+00:00</updated>
<author>
<name>Wang Yufen</name>
<email>wangyufen@huawei.com</email>
</author>
<published>2014-03-28T04:07:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=49e253e399778f7b93deccc9fb5b834cc8de6c92'/>
<id>49e253e399778f7b93deccc9fb5b834cc8de6c92</id>
<content type='text'>
ERROR: open brace '{' following enum go on the same line
ERROR: open brace '{' following struct go on the same line
ERROR: trailing statements should be on next line

Signed-off-by: Wang Yufen &lt;wangyufen@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ERROR: open brace '{' following enum go on the same line
ERROR: open brace '{' following struct go on the same line
ERROR: trailing statements should be on next line

Signed-off-by: Wang Yufen &lt;wangyufen@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv6: fix checkpatch errors comments and space</title>
<updated>2014-03-29T22:15:52+00:00</updated>
<author>
<name>Wang Yufen</name>
<email>wangyufen@huawei.com</email>
</author>
<published>2014-03-28T04:07:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8db46f1d4c689bfbdde0a83e1ba73c820ab98b42'/>
<id>8db46f1d4c689bfbdde0a83e1ba73c820ab98b42</id>
<content type='text'>
WARNING: please, no space before tabs
WARNING: please, no spaces at the start of a line
ERROR: spaces required around that ':' (ctx:VxW)
ERROR: spaces required around that '&gt;' (ctx:VxV)
ERROR: spaces required around that '&gt;=' (ctx:VxV)

Signed-off-by: Wang Yufen &lt;wangyufen@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
WARNING: please, no space before tabs
WARNING: please, no spaces at the start of a line
ERROR: spaces required around that ':' (ctx:VxW)
ERROR: spaces required around that '&gt;' (ctx:VxV)
ERROR: spaces required around that '&gt;=' (ctx:VxV)

Signed-off-by: Wang Yufen &lt;wangyufen@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv6: do not overwrite inetpeer metrics prematurely</title>
<updated>2014-03-27T19:09:07+00:00</updated>
<author>
<name>Michal Kubeček</name>
<email>mkubecek@suse.cz</email>
</author>
<published>2014-03-27T12:04:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e5fd387ad5b30ca3971fbccb0735c843cdebf967'/>
<id>e5fd387ad5b30ca3971fbccb0735c843cdebf967</id>
<content type='text'>
If an IPv6 host route with metrics exists, an attempt to add a
new route for the same target with different metrics fails but
rewrites the metrics anyway:

12sp0:~ # ip route add fec0::1 dev eth0 rto_min 1000
12sp0:~ # ip -6 route show
fe80::/64 dev eth0  proto kernel  metric 256
fec0::1 dev eth0  metric 1024  rto_min lock 1s
12sp0:~ # ip route add fec0::1 dev eth0 rto_min 1500
RTNETLINK answers: File exists
12sp0:~ # ip -6 route show
fe80::/64 dev eth0  proto kernel  metric 256
fec0::1 dev eth0  metric 1024  rto_min lock 1.5s

This is caused by all IPv6 host routes using the metrics in
their inetpeer (or the shared default). This also holds for the
new route created in ip6_route_add() which shares the metrics
with the already existing route and thus ip6_route_add()
rewrites the metrics even if the new route ends up not being
used at all.

Another problem is that old metrics in inetpeer can reappear
unexpectedly for a new route, e.g.

12sp0:~ # ip route add fec0::1 dev eth0 rto_min 1000
12sp0:~ # ip route del fec0::1
12sp0:~ # ip route add fec0::1 dev eth0
12sp0:~ # ip route change fec0::1 dev eth0 hoplimit 10
12sp0:~ # ip -6 route show
fe80::/64 dev eth0  proto kernel  metric 256
fec0::1 dev eth0  metric 1024  hoplimit 10 rto_min lock 1s

Resolve the first problem by moving the setting of metrics down
into fib6_add_rt2node() to the point we are sure we are
inserting the new route into the tree. Second problem is
addressed by introducing new flag DST_METRICS_FORCE_OVERWRITE
which is set for a new host route in ip6_route_add() and makes
ipv6_cow_metrics() always overwrite the metrics in inetpeer
(even if they are not "new"); it is reset after that.

v5: use a flag in _metrics member rather than one in flags

v4: fix a typo making a condition always true (thanks to Hannes
Frederic Sowa)

v3: rewritten based on David Miller's idea to move setting the
metrics (and allocation in non-host case) down to the point we
already know the route is to be inserted. Also rebased to
net-next as it is quite late in the cycle.

Signed-off-by: Michal Kubecek &lt;mkubecek@suse.cz&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If an IPv6 host route with metrics exists, an attempt to add a
new route for the same target with different metrics fails but
rewrites the metrics anyway:

12sp0:~ # ip route add fec0::1 dev eth0 rto_min 1000
12sp0:~ # ip -6 route show
fe80::/64 dev eth0  proto kernel  metric 256
fec0::1 dev eth0  metric 1024  rto_min lock 1s
12sp0:~ # ip route add fec0::1 dev eth0 rto_min 1500
RTNETLINK answers: File exists
12sp0:~ # ip -6 route show
fe80::/64 dev eth0  proto kernel  metric 256
fec0::1 dev eth0  metric 1024  rto_min lock 1.5s

This is caused by all IPv6 host routes using the metrics in
their inetpeer (or the shared default). This also holds for the
new route created in ip6_route_add() which shares the metrics
with the already existing route and thus ip6_route_add()
rewrites the metrics even if the new route ends up not being
used at all.

Another problem is that old metrics in inetpeer can reappear
unexpectedly for a new route, e.g.

12sp0:~ # ip route add fec0::1 dev eth0 rto_min 1000
12sp0:~ # ip route del fec0::1
12sp0:~ # ip route add fec0::1 dev eth0
12sp0:~ # ip route change fec0::1 dev eth0 hoplimit 10
12sp0:~ # ip -6 route show
fe80::/64 dev eth0  proto kernel  metric 256
fec0::1 dev eth0  metric 1024  hoplimit 10 rto_min lock 1s

Resolve the first problem by moving the setting of metrics down
into fib6_add_rt2node() to the point we are sure we are
inserting the new route into the tree. Second problem is
addressed by introducing new flag DST_METRICS_FORCE_OVERWRITE
which is set for a new host route in ip6_route_add() and makes
ipv6_cow_metrics() always overwrite the metrics in inetpeer
(even if they are not "new"); it is reset after that.

v5: use a flag in _metrics member rather than one in flags

v4: fix a typo making a condition always true (thanks to Hannes
Frederic Sowa)

v3: rewritten based on David Miller's idea to move setting the
metrics (and allocation in non-host case) down to the point we
already know the route is to be inserted. Also rebased to
net-next as it is quite late in the cycle.

Signed-off-by: Michal Kubecek &lt;mkubecek@suse.cz&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv6: remove prune parameter for fib6_clean_all</title>
<updated>2014-01-02T08:30:35+00:00</updated>
<author>
<name>Li RongQing</name>
<email>roy.qing.li@gmail.com</email>
</author>
<published>2013-12-27T08:32:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0c3584d58913a72a6b28a976f7c0bfd2afb65237'/>
<id>0c3584d58913a72a6b28a976f7c0bfd2afb65237</id>
<content type='text'>
since the prune parameter for fib6_clean_all always is 0, remove it.

Signed-off-by: Li RongQing &lt;roy.qing.li@gmail.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
since the prune parameter for fib6_clean_all always is 0, remove it.

Signed-off-by: Li RongQing &lt;roy.qing.li@gmail.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
