public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind•com>
To: davem@davemloft•net
Cc: netdev@vger•kernel.org,
	Nicolas Dichtel <nicolas.dichtel@6wind•com>,
	Thomas Graf <tgraf@suug•ch>
Subject: [PATCH net] diag: fix netlink API attributes
Date: Thu, 28 Nov 2013 14:57:19 +0100	[thread overview]
Message-ID: <1385647039-1547-1-git-send-email-nicolas.dichtel@6wind.com> (raw)

The first netlink attribute (value 0) must always be defined as none/unspec.
This is correctly done in inet_diag.h, but other diag interfaces are broken.

Libraries like libnl skip this kind of attributes, thus it's never reported to
the application.

CC: Thomas Graf <tgraf@suug•ch>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind•com>
---

Ok, I know that this patch change the API, but it's really painful to have such
broken API, is it really mandatory to live with this?
And the question is: how to avoid to have the same mistake in the next diag API?

 include/uapi/linux/netlink_diag.h | 1 +
 include/uapi/linux/packet_diag.h  | 1 +
 include/uapi/linux/unix_diag.h    | 1 +
 3 files changed, 3 insertions(+)

diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h
index 4e31db4eea41..d15d5c8f9d9c 100644
--- a/include/uapi/linux/netlink_diag.h
+++ b/include/uapi/linux/netlink_diag.h
@@ -33,6 +33,7 @@ struct netlink_diag_ring {
 };
 
 enum {
+	NETLINK_DIAG_NONE,
 	NETLINK_DIAG_MEMINFO,
 	NETLINK_DIAG_GROUPS,
 	NETLINK_DIAG_RX_RING,
diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h
index b2cc0cd9c4d9..e49fa94b3463 100644
--- a/include/uapi/linux/packet_diag.h
+++ b/include/uapi/linux/packet_diag.h
@@ -29,6 +29,7 @@ struct packet_diag_msg {
 };
 
 enum {
+	PACKET_DIAG_UNSPEC,
 	PACKET_DIAG_INFO,
 	PACKET_DIAG_MCLIST,
 	PACKET_DIAG_RX_RING,
diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h
index b9e2a6a7446f..b24e9626c704 100644
--- a/include/uapi/linux/unix_diag.h
+++ b/include/uapi/linux/unix_diag.h
@@ -31,6 +31,7 @@ struct unix_diag_msg {
 };
 
 enum {
+	UNIX_DIAG_NONE,
 	UNIX_DIAG_NAME,
 	UNIX_DIAG_VFS,
 	UNIX_DIAG_PEER,
-- 
1.8.4.1

             reply	other threads:[~2013-11-28 13:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28 13:57 Nicolas Dichtel [this message]
2013-11-28 16:38 ` [PATCH net] diag: fix netlink API attributes Thomas Graf
2013-11-28 17:31   ` [RFC PATCH v2] diag: warn about missing first netlink attribute Nicolas Dichtel
2013-11-28 21:36     ` David Miller
2013-11-28 22:09     ` Thomas Graf
2013-11-28 23:16       ` David Miller
2013-11-28 17:37   ` [PATCH net] diag: fix netlink API attributes Nicolas Dichtel
2013-11-28 22:19     ` Thomas Graf
2013-11-29  8:28       ` Nicolas Dichtel
2013-11-29  8:42         ` Thomas Graf

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=1385647039-1547-1-git-send-email-nicolas.dichtel@6wind.com \
    --to=nicolas.dichtel@6wind$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=tgraf@suug$(echo .)ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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