Go to file
Alexander Mikhalitsyn 459ce6e3d7 ip route: ignore ENOENT during save if RT_TABLE_MAIN is being dumped
We started to use in-kernel filtering feature which allows to get only
needed tables (see iproute_dump_filter()). From the kernel side it's
implemented in net/ipv4/fib_frontend.c (inet_dump_fib), net/ipv6/ip6_fib.c
(inet6_dump_fib). The problem here is that behaviour of "ip route save"
was changed after
c7e6371bc ("ip route: Add protocol, table id and device to dump request").
If filters are used, then kernel returns ENOENT error if requested table
is absent, but in newly created net namespace even RT_TABLE_MAIN table
doesn't exist. It is really allocated, for instance, after issuing
"ip l set lo up".

Reproducer is fairly simple:
$ unshare -n ip route save > dump
Error: ipv4: FIB table does not exist.
Dump terminated

Expected result here is to get empty dump file (as it was before this
change).

v2: reworked, so, now it takes into account NLMSGERR_ATTR_MSG
(see nl_dump_ext_ack_done() function). We want to suppress error messages
in stderr about absent FIB table from kernel too.

v3: reworked to make code clearer. Introduced rtnl_suppressed_errors(),
rtnl_suppress_error() helpers. User may suppress up to 3 errors (may be
easily extended by changing SUPPRESS_ERRORS_INIT macro).

v4: reworked, rtnl_dump_filter_errhndlr() was introduced. Thanks
to Stephen Hemminger for comments and suggestions

v5: space fixes, commit message reformat, empty initializers

Fixes: c7e6371bc ("ip route: Add protocol, table id and device to dump request")
Cc: David Ahern <dsahern@gmail.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Andrei Vagin <avagin@gmail.com>
Cc: Alexander Mikhalitsyn <alexander@mihalicyn.com>
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2021-07-07 07:32:56 -07:00
bash-completion devlink: add support for port params get/set 2021-02-11 09:21:24 -07:00
bridge bridge: vlan: dump port only if there are any vlans 2021-04-26 02:32:46 +00:00
dcb dcb: fix memory leak 2021-05-06 14:48:02 +00:00
devlink Merge branch 'main' into next 2021-07-01 14:29:42 +00:00
doc/actions doc: remove trailing whitespace 2018-12-19 12:02:38 -08:00
etc/iproute2 Add Open/R to rt_protos 2021-03-30 03:04:09 +00:00
examples/bpf examples/bpf: add bpf examples with BTF defined maps 2020-11-24 22:14:08 -07:00
genl genl: ctrl: print op -> policy idx mapping 2020-10-11 20:10:09 -06:00
include ip route: ignore ENOENT during save if RT_TABLE_MAIN is being dumped 2021-07-07 07:32:56 -07:00
ip ip route: ignore ENOENT during save if RT_TABLE_MAIN is being dumped 2021-07-07 07:32:56 -07:00
lib ip route: ignore ENOENT during save if RT_TABLE_MAIN is being dumped 2021-07-07 07:32:56 -07:00
man Merge branch 'main' into next 2021-07-01 14:29:42 +00:00
misc Merge git://git.kernel.org/pub/scm/network/iproute2/iproute2-next 2021-02-23 23:03:42 -08:00
netem doc: remove trailing whitespace 2018-12-19 12:02:38 -08:00
rdma rdma: Add copy-on-fork to get sys command 2021-05-03 14:43:13 +00:00
schema bridge: add json schema for bridge fdb show 2016-07-20 12:02:02 -07:00
tc tc: pedit: add decrement operation 2021-06-26 04:45:19 +00:00
testsuite testsuite: Add mpls packet matching tests for tc flower 2020-12-16 04:14:26 +00:00
tipc tipc: bail out if key is abnormally long 2021-05-09 22:08:47 +00:00
vdpa vdpa: add .gitignore 2021-02-23 23:12:14 -08:00
.clang-format clang-format: add configuration file 2019-01-17 13:38:23 -08:00
.gitignore Remove leftovers from removed Latex documentation 2018-02-13 16:43:19 -08:00
.mailmap mailmap: map David's mail address 2019-05-15 09:50:42 -07:00
COPYING Update address of FSF in license 2008-03-08 13:31:03 -08:00
Makefile config.mk: Rerun configure when it is newer than config.mk 2021-05-17 02:13:56 +00:00
README README: remove doc instructions 2021-03-20 09:29:02 -07:00
README.devel README: update location of git repositories, remove broken info link 2018-02-13 16:42:51 -08:00
configure configure: convert LIBBPF environment variables to command-line options 2021-06-03 03:25:59 +00:00

README

This is a set of utilities for Linux networking.

Information:
    https://wiki.linuxfoundation.org/networking/iproute2

Download:
    http://www.kernel.org/pub/linux/utils/net/iproute2/

Stable version repository:
    git://git.kernel.org/pub/scm/network/iproute2/iproute2.git

Development repository:
    git://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git

How to compile this.
--------------------
1. libdbm

arpd needs to have the berkeleydb development libraries. For Debian
users this is the package with a name like libdbX.X-dev.
DBM_INCLUDE points to the directory with db_185.h which
is the include file used by arpd to get to the old format Berkeley
database routines.  Often this is in the db-devel package.

2. make

The makefile will automatically build a config.mk file which
contains definitions of libraries that may or may not be available
on the system such as: ATM, ELF, MNL, and SELINUX.

3. include/uapi

This package includes matching sanitized kernel headers because
the build environment may not have up to date versions. See Makefile
if you have special requirements and need to point at different
kernel include files.

Stephen Hemminger
stephen@networkplumber.org

Alexey Kuznetsov
kuznet@ms2.inr.ac.ru