diff mbox

[iproute2] ip monitor: Changed 'Unknown message' format to be more informative

Message ID 1410891830-4556-1-git-send-email-vadim4j@gmail.com
State Changes Requested, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Vadym Kochan Sept. 16, 2014, 6:23 p.m. UTC
In case if unknown message was handled then it will be displayed as:

    Unknown message: type=0x00000044(68) flags=0x00000000(0) len=0x0000004c(76)

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 ip/ipmonitor.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Stephen Hemminger Sept. 28, 2014, 11:15 p.m. UTC | #1
On Tue, 16 Sep 2014 21:23:50 +0300
Vadim Kochan <vadim4j@gmail.com> wrote:

> In case if unknown message was handled then it will be displayed as:
> 
>     Unknown message: type=0x00000044(68) flags=0x00000000(0) len=0x0000004c(76)
> 
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> ---
>  ip/ipmonitor.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
> index 70f2a7a..838934d 100644
> --- a/ip/ipmonitor.c
> +++ b/ip/ipmonitor.c
> @@ -135,8 +135,10 @@ static int accept_msg(const struct sockaddr_nl *who,
>  		return 0;
>  	if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
>  	    n->nlmsg_type != NLMSG_DONE) {
> -		fprintf(fp, "Unknown message: %08x %08x %08x\n",
> -			n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
> +		fprintf(fp, "Unknown message: type=0x%08x(%d) flags=0x%08x(%d)"
> +			"len=0x%08x(%d)\n", n->nlmsg_type, n->nlmsg_type,
> +		       	n->nlmsg_flags, n->nlmsg_flags, n->nlmsg_len,
> +		       	n->nlmsg_len);
>  	}
>  	return 0;
>  }

Patch is formatted improperly, it should be indented only with tabs.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 70f2a7a..838934d 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -135,8 +135,10 @@  static int accept_msg(const struct sockaddr_nl *who,
 		return 0;
 	if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
 	    n->nlmsg_type != NLMSG_DONE) {
-		fprintf(fp, "Unknown message: %08x %08x %08x\n",
-			n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
+		fprintf(fp, "Unknown message: type=0x%08x(%d) flags=0x%08x(%d)"
+			"len=0x%08x(%d)\n", n->nlmsg_type, n->nlmsg_type,
+		       	n->nlmsg_flags, n->nlmsg_flags, n->nlmsg_len,
+		       	n->nlmsg_len);
 	}
 	return 0;
 }