]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ip: add NLM_F_ECHO support
authorHangbin Liu <liuhangbin@gmail.com>
Fri, 16 Sep 2022 03:34:28 +0000 (11:34 +0800)
committerDavid Ahern <dsahern@kernel.org>
Thu, 22 Sep 2022 23:12:33 +0000 (16:12 -0700)
commitb264b4c6568c78a09475f1d6663e10e19d05abb4
tree61a12efd5fc51b0cc6a1944fd434363dbb760690
parent04a6b456bf7441b7d71b3f71428da82881486a0d
ip: add NLM_F_ECHO support

When user space configures the kernel with netlink messages, it can set the
NLM_F_ECHO flag to request the kernel to send the applied configuration back
to the caller. This allows user space to retrieve configuration information
that are filled by the kernel (either because these parameters can only be
set by the kernel or because user space let the kernel choose a default
value).

NLM_F_ACK is also supplied incase the kernel doesn't support NLM_F_ECHO
and we will wait for the reply forever. Just like the update in
iplink.c, which I plan to post a patch to kernel later.

A new parameter -echo is added when user want to get feedback from kernel.
e.g.

  # ip -echo addr add 192.168.0.1/24 dev eth1
  3: eth1    inet 192.168.0.1/24 scope global eth1
         valid_lft forever preferred_lft forever
  # ip -j -p -echo addr del 192.168.0.1/24 dev eth1
  [ {
          "deleted": true,
          "index": 3,
          "dev": "eth1",
          "family": "inet",
          "local": "192.168.0.1",
          "prefixlen": 24,
          "scope": "global",
          "label": "eth1",
          "valid_life_time": 4294967295,
          "preferred_life_time": 4294967295
      } ]

Suggested-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
include/utils.h
ip/ip.c
ip/ipaddress.c
ip/iplink.c
ip/ipnexthop.c
ip/iproute.c
ip/iprule.c
man/man8/ip.8