<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/include/net/ip_fib.h, branch v5.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.0</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-01-15T21:33:44Z</updated>
<entry>
<title>net: ipv4: Fix memory leak in network namespace dismantle</title>
<updated>2019-01-15T21:33:44Z</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@mellanox.com</email>
</author>
<published>2019-01-09T09:57:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f97f4dd8b3bb9d0993d2491e0f22024c68109184'/>
<id>urn:sha1:f97f4dd8b3bb9d0993d2491e0f22024c68109184</id>
<content type='text'>
IPv4 routing tables are flushed in two cases:

1. In response to events in the netdev and inetaddr notification chains
2. When a network namespace is being dismantled

In both cases only routes associated with a dead nexthop group are
flushed. However, a nexthop group will only be marked as dead in case it
is populated with actual nexthops using a nexthop device. This is not
the case when the route in question is an error route (e.g.,
'blackhole', 'unreachable').

Therefore, when a network namespace is being dismantled such routes are
not flushed and leaked [1].

To reproduce:
# ip netns add blue
# ip -n blue route add unreachable 192.0.2.0/24
# ip netns del blue

Fix this by not skipping error routes that are not marked with
RTNH_F_DEAD when flushing the routing tables.

To prevent the flushing of such routes in case #1, add a parameter to
fib_table_flush() that indicates if the table is flushed as part of
namespace dismantle or not.

Note that this problem does not exist in IPv6 since error routes are
associated with the loopback device.

[1]
unreferenced object 0xffff888066650338 (size 56):
  comm "ip", pid 1206, jiffies 4294786063 (age 26.235s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 b0 1c 62 61 80 88 ff ff  ..........ba....
    e8 8b a1 64 80 88 ff ff 00 07 00 08 fe 00 00 00  ...d............
  backtrace:
    [&lt;00000000856ed27d&gt;] inet_rtm_newroute+0x129/0x220
    [&lt;00000000fcdfc00a&gt;] rtnetlink_rcv_msg+0x397/0xa20
    [&lt;00000000cb85801a&gt;] netlink_rcv_skb+0x132/0x380
    [&lt;00000000ebc991d2&gt;] netlink_unicast+0x4c0/0x690
    [&lt;0000000014f62875&gt;] netlink_sendmsg+0x929/0xe10
    [&lt;00000000bac9d967&gt;] sock_sendmsg+0xc8/0x110
    [&lt;00000000223e6485&gt;] ___sys_sendmsg+0x77a/0x8f0
    [&lt;000000002e94f880&gt;] __sys_sendmsg+0xf7/0x250
    [&lt;00000000ccb1fa72&gt;] do_syscall_64+0x14d/0x610
    [&lt;00000000ffbe3dae&gt;] entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [&lt;000000003a8b605b&gt;] 0xffffffffffffffff
unreferenced object 0xffff888061621c88 (size 48):
  comm "ip", pid 1206, jiffies 4294786063 (age 26.235s)
  hex dump (first 32 bytes):
    6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    6b 6b 6b 6b 6b 6b 6b 6b d8 8e 26 5f 80 88 ff ff  kkkkkkkk..&amp;_....
  backtrace:
    [&lt;00000000733609e3&gt;] fib_table_insert+0x978/0x1500
    [&lt;00000000856ed27d&gt;] inet_rtm_newroute+0x129/0x220
    [&lt;00000000fcdfc00a&gt;] rtnetlink_rcv_msg+0x397/0xa20
    [&lt;00000000cb85801a&gt;] netlink_rcv_skb+0x132/0x380
    [&lt;00000000ebc991d2&gt;] netlink_unicast+0x4c0/0x690
    [&lt;0000000014f62875&gt;] netlink_sendmsg+0x929/0xe10
    [&lt;00000000bac9d967&gt;] sock_sendmsg+0xc8/0x110
    [&lt;00000000223e6485&gt;] ___sys_sendmsg+0x77a/0x8f0
    [&lt;000000002e94f880&gt;] __sys_sendmsg+0xf7/0x250
    [&lt;00000000ccb1fa72&gt;] do_syscall_64+0x14d/0x610
    [&lt;00000000ffbe3dae&gt;] entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [&lt;000000003a8b605b&gt;] 0xffffffffffffffff

Fixes: 8cced9eff1d4 ("[NETNS]: Enable routing configuration in non-initial namespace.")
Signed-off-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Reviewed-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Don't return invalid table id error when dumping all families</title>
<updated>2018-10-24T21:06:25Z</updated>
<author>
<name>David Ahern</name>
<email>dsahern@gmail.com</email>
</author>
<published>2018-10-24T19:59:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ae677bbb4441309e1827e60413de92363153dccb'/>
<id>urn:sha1:ae677bbb4441309e1827e60413de92363153dccb</id>
<content type='text'>
When doing a route dump across all address families, do not error out
if the table does not exist. This allows a route dump for AF_UNSPEC
with a table id that may only exist for some of the families.

Do return the table does not exist error if dumping routes for a
specific family and the table does not exist.

Signed-off-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Enable kernel side filtering of route dumps</title>
<updated>2018-10-16T07:14:07Z</updated>
<author>
<name>David Ahern</name>
<email>dsahern@gmail.com</email>
</author>
<published>2018-10-16T01:56:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=effe6792662495ad9c175bf0d9c53459a51fdbbd'/>
<id>urn:sha1:effe6792662495ad9c175bf0d9c53459a51fdbbd</id>
<content type='text'>
Update parsing of route dump request to enable kernel side filtering.
Allow filtering results by protocol (e.g., which routing daemon installed
the route), route type (e.g., unicast), table id and nexthop device. These
amount to the low hanging fruit, yet a huge improvement, for dumping
routes.

ip_valid_fib_dump_req is called with RTNL held, so __dev_get_by_index can
be used to look up the device index without taking a reference. From
there filter-&gt;dev is only used during dump loops with the lock still held.

Set NLM_F_DUMP_FILTERED in the answer_flags so the user knows the results
have been filtered should no entries be returned.

Signed-off-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/ipv4: Plumb support for filtering route dumps</title>
<updated>2018-10-16T07:13:12Z</updated>
<author>
<name>David Ahern</name>
<email>dsahern@gmail.com</email>
</author>
<published>2018-10-16T01:56:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=18a8021a7be3207686851208f91a2f105b2d4703'/>
<id>urn:sha1:18a8021a7be3207686851208f91a2f105b2d4703</id>
<content type='text'>
Implement kernel side filtering of routes by table id, egress device index,
protocol and route type. If the table id is given in the filter, lookup the
table and call fib_table_dump directly for it.

Signed-off-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Add struct for fib dump filter</title>
<updated>2018-10-16T07:13:12Z</updated>
<author>
<name>David Ahern</name>
<email>dsahern@gmail.com</email>
</author>
<published>2018-10-16T01:56:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4724676d551c0961659b1da3fb4b5928169fb184'/>
<id>urn:sha1:4724676d551c0961659b1da3fb4b5928169fb184</id>
<content type='text'>
Add struct fib_dump_filter for options on limiting which routes are
returned in a dump request. The current list is table id, protocol,
route type, rtm_flags and nexthop device index. struct net is needed
to lookup the net_device from the index.

Declare the filter for each route dump handler and plumb the new
arguments from dump handlers to ip_valid_fib_dump_req.

Signed-off-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2018-10-13T04:38:46Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2018-10-13T04:38:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d864991b220b7c62e81d21209e1fd978fd67352c'/>
<id>urn:sha1:d864991b220b7c62e81d21209e1fd978fd67352c</id>
<content type='text'>
Conflicts were easy to resolve using immediate context mostly,
except the cls_u32.c one where I simply too the entire HEAD
chunk.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: ipv4: update fnhe_pmtu when first hop's MTU changes</title>
<updated>2018-10-11T05:44:46Z</updated>
<author>
<name>Sabrina Dubroca</name>
<email>sd@queasysnail.net</email>
</author>
<published>2018-10-09T15:48:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=af7d6cce53694a88d6a1bb60c9a239a6a5144459'/>
<id>urn:sha1:af7d6cce53694a88d6a1bb60c9a239a6a5144459</id>
<content type='text'>
Since commit 5aad1de5ea2c ("ipv4: use separate genid for next hop
exceptions"), exceptions get deprecated separately from cached
routes. In particular, administrative changes don't clear PMTU anymore.

As Stefano described in commit e9fa1495d738 ("ipv6: Reflect MTU changes
on PMTU of exceptions for MTU-less routes"), the PMTU discovered before
the local MTU change can become stale:
 - if the local MTU is now lower than the PMTU, that PMTU is now
   incorrect
 - if the local MTU was the lowest value in the path, and is increased,
   we might discover a higher PMTU

Similarly to what commit e9fa1495d738 did for IPv6, update PMTU in those
cases.

If the exception was locked, the discovered PMTU was smaller than the
minimal accepted PMTU. In that case, if the new local MTU is smaller
than the current PMTU, let PMTU discovery figure out if locking of the
exception is still needed.

To do this, we need to know the old link MTU in the NETDEV_CHANGEMTU
notifier. By the time the notifier is called, dev-&gt;mtu has been
changed. This patch adds the old MTU as additional information in the
notifier structure, and a new call_netdevice_notifiers_u32() function.

Fixes: 5aad1de5ea2c ("ipv4: use separate genid for next hop exceptions")
Signed-off-by: Sabrina Dubroca &lt;sd@queasysnail.net&gt;
Reviewed-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rtnetlink: Update fib dumps for strict data checking</title>
<updated>2018-10-08T17:39:05Z</updated>
<author>
<name>David Ahern</name>
<email>dsahern@gmail.com</email>
</author>
<published>2018-10-08T03:16:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e8ba330ac0c55004e775eab53fa1e748e5d71bdb'/>
<id>urn:sha1:e8ba330ac0c55004e775eab53fa1e748e5d71bdb</id>
<content type='text'>
Add helper to check netlink message for route dumps. If the strict flag
is set the dump request is expected to have an rtmsg struct as the header.
All elements of the struct are expected to be 0 with the exception of
rtm_flags (which is used by both ipv4 and ipv6 dumps) and no attributes
can be appended. rtm_flags can only have RTM_F_CLONED and RTM_F_PREFIX
set.

Update inet_dump_fib, inet6_dump_fib, mpls_dump_routes, ipmr_rtm_dumproute,
and ip6mr_rtm_dumproute to call this helper if strict data checking is
enabled.

Signed-off-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/ipv4: Move device validation to helper</title>
<updated>2018-09-21T03:01:52Z</updated>
<author>
<name>David Ahern</name>
<email>dsahern@gmail.com</email>
</author>
<published>2018-09-20T20:50:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=78f2756c5fc0bf17560766dbc5aaa1e4a7ba66e4'/>
<id>urn:sha1:78f2756c5fc0bf17560766dbc5aaa1e4a7ba66e4</id>
<content type='text'>
Move the device matching check in __fib_validate_source to a helper and
export it for use by netfilter modules. Code move only; no functional
change intended.

Signed-off-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/ipv4: Add helper to return path MTU based on fib result</title>
<updated>2018-05-22T08:51:09Z</updated>
<author>
<name>David Ahern</name>
<email>dsahern@gmail.com</email>
</author>
<published>2018-05-21T16:08:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=50d889b1789458d1f7d7f40ff4f628b670047773'/>
<id>urn:sha1:50d889b1789458d1f7d7f40ff4f628b670047773</id>
<content type='text'>
Determine path MTU from a FIB lookup result. Logic is a distillation of
ip_dst_mtu_maybe_forward.

Signed-off-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
</feed>
