From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <sthemmin@microsoft.com>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 2/2] ipmonitor: decode DELNETCONF message
Date: Wed, 15 Aug 2018 14:29:42 -0700 [thread overview]
Message-ID: <20180815212942.25276-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20180815212942.25276-1-stephen@networkplumber.org>
From: Stephen Hemminger <sthemmin@microsoft.com>
When device is deleted DELNETCONF is sent, but ipmonitor
was unable to decode it.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
ip/ipmonitor.c | 1 +
ip/ipnetconf.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 5552d98ee9e5..a93b62cd6624 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -133,6 +133,7 @@ static int accept_msg(const struct sockaddr_nl *who,
return 0;
case RTM_NEWNETCONF:
+ case RTM_DELNETCONF:
print_headers(fp, "[NETCONF]", ctrl);
print_netconf(who, ctrl, n, arg);
return 0;
diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index 03f98ace9145..afce982ced37 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -66,7 +66,8 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
if (n->nlmsg_type == NLMSG_ERROR)
return -1;
- if (n->nlmsg_type != RTM_NEWNETCONF) {
+
+ if (n->nlmsg_type != RTM_NEWNETCONF && n->nlmsg_type != RTM_DELNETCONF) {
fprintf(stderr, "Not RTM_NEWNETCONF: %08x %08x %08x\n",
n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
@@ -91,6 +92,9 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
return 0;
open_json_object(NULL);
+ if (n->nlmsg_type == RTM_DELNETCONF)
+ print_bool(PRINT_ANY, "deleted", "Deleted ", true);
+
print_string(PRINT_ANY, "family",
"%s ", family_name(ncm->ncm_family));
--
2.18.0
prev parent reply other threads:[~2018-08-16 0:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-15 21:29 [PATCH iproute2 0/2] ip monitor fixes Stephen Hemminger
2018-08-15 21:29 ` [PATCH 1/2] ip: convert monitor to switch Stephen Hemminger
2018-08-15 21:29 ` Stephen Hemminger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180815212942.25276-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox