netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* genetlink misinterprets NEW as GET
@ 2011-01-04  2:14 Jan Engelhardt
  2011-01-06 13:48 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Engelhardt @ 2011-01-04  2:14 UTC (permalink / raw)
  To: Netfilter Developer Mailing List; +Cc: Linux Networking Developer Mailing List

Hey there,


I can't really say whether it's genetlink or netlink to blame,
but I noticed that a request with

	nlmsg_flags = NLM_F_CREATE | NLM_F_EXCL

to a genl-registered component can return -EOPNOTSUPP because it does 
not have a dumpit function defined in struct genl_ops. Make sense?
Not at first sight at least.
include/linux/netlink.h has this nice anecdote:

	/* Modifiers to GET request */
	#define NLM_F_ROOT      0x100
	#define NLM_F_MATCH     0x200
	#define NLM_F_ATOMIC    0x400
	#define NLM_F_DUMP      (NLM_F_ROOT|NLM_F_MATCH)
	
	/* Modifiers to NEW request */
	#define NLM_F_REPLACE   0x100
	#define NLM_F_EXCL      0x200
	#define NLM_F_CREATE    0x400
	#define NLM_F_APPEND    0x800

Except there is nothing that declares a particular Netlink message
as "GET" or "NEW". Subsequently, genetlink chokes:

	if (nlh->nlmsg_flags & NLM_F_DUMP)
		if (ops->dumpit == NULL)
			return -EOPNOTSUPP;

Because NLM_F_CREATE | NLM_F_EXCL == NLM_F_DUMP.
That, of course, is absolutely bogus.

[N.B.: I am also wondering whether
	(nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP
may have been desired, because NLM_F_DUMP is composed of two bits.]

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

end of thread, other threads:[~2011-01-10  0:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-04  2:14 genetlink misinterprets NEW as GET Jan Engelhardt
2011-01-06 13:48 ` Pablo Neira Ayuso
2011-01-06 14:25   ` Jan Engelhardt
2011-01-06 14:55     ` Pablo Neira Ayuso
2011-01-06 16:12       ` Jan Engelhardt
2011-01-06 17:23   ` Ben Pfaff
2011-01-07  1:31     ` Pablo Neira Ayuso
2011-01-07  9:38       ` Jan Engelhardt
2011-01-07 12:12         ` Pablo Neira Ayuso
2011-01-07 13:15       ` [patch] " Jan Engelhardt
2011-01-07 13:33         ` Pablo Neira Ayuso
2011-01-10  0:25           ` David 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).