netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Extend netlink error codes
@ 2004-09-10 22:51 Thomas Graf
  2004-09-10 23:07 ` David S. Miller
  2004-09-11 15:58 ` Andi Kleen
  0 siblings, 2 replies; 16+ messages in thread
From: Thomas Graf @ 2004-09-10 22:51 UTC (permalink / raw)
  To: netdev

The current situation with error codes sent back to a netlink
application is unsatisfactory. Most often, the application
receives EINVAL but has no idea what was wrong.

Here is my plan:

Introduce some macros:

#define NLERR_MAJ_MASK (0x7FFF0000U)
#define NLERR_MIN_MASK (0x0000FFFFU)
#define NLERR_MAJ(e) ((abs(e) & NLERR_MAJ_MASK) >> 16)
#define NLERR_MIN(e) (abs(e) & NLERR_MIN_MASK)
#define NLERR_MAKE(err, nle) ((((nle) << 16) & NLERR_MAJ_MASK)
		| ((err) & NLERR_MIN_MASK))

Specify netlink specific error codes, e.g.:

#define NLE_SUCCESS     0
#define NLE_NOQDISC     1
#define NLE_NOTCLASFUL  2
...

Predefined error messages could be provided by libnetlink
via nl_strerror().

Replace vague error return calls with something like:

return -NLERR_MAKE(EINVAL, NLE_NOQDISC);

Once in netlink_ack, split the combined error message again,
fill the existing errno into nlerrmsg.error and provide the
netlink specific error code in a newly introduced TLV. This
way, no binaries or old applications would break, but
applications can support it and provide more meanigful error
message with almost no effort.

Comments?

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-09-14  2:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-10 22:51 [RFC] Extend netlink error codes Thomas Graf
2004-09-10 23:07 ` David S. Miller
2004-09-11  1:38   ` jamal
2004-09-11 15:49     ` Thomas Graf
2004-09-11 15:58 ` Andi Kleen
2004-09-11 16:24   ` Thomas Graf
2004-09-11 16:50     ` Andi Kleen
2004-09-11 17:57       ` Thomas Graf
2004-09-11 18:48     ` Sam Leffler
2004-09-11 21:10       ` jamal
2004-09-13 20:36         ` Thomas Graf
2004-09-13 23:28           ` David S. Miller
2004-09-14  2:00           ` jamal
2004-09-12 23:37     ` David S. Miller
2004-09-13  6:26       ` Andi Kleen
2004-09-13 19:33         ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).