22 Nov, 2013
2 commits
-
Fix another really stupid bug - I introduced genl_set_err()
precisely to be able to adjust the group and reject invalid
ones, but then forgot to do so.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
Unfortunately, I introduced a tremendously stupid bug into
genlmsg_multicast() when doing all those multicast group
changes: it adjusts the group number, but then passes it
to genlmsg_multicast_netns() which does that again.Somehow, my tests failed to catch this, so add a warning
into genlmsg_multicast_netns() and remove the offending
group ID adjustment.Also add a warning to the similar code in other functions
so people who misuse them are more loudly warned.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller
20 Nov, 2013
6 commits
-
Register generic netlink multicast groups as an array with
the family and give them contiguous group IDs. Then instead
of passing the global group ID to the various functions that
send messages, pass the ID relative to the family - for most
families that's just 0 because the only have one group.This avoids the list_head and ID in each group, adding a new
field for the mcast group ID offset to the family.At the same time, this allows us to prevent abusing groups
again like the quota and dropmon code did, since we can now
check that a family only uses a group it owns.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
This doesn't really change anything, but prepares for the
next patch that will change the APIs to pass the group ID
within the family, rather than the global group ID.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
Add a static inline to generic netlink to wrap netlink_set_err()
to make it easier to use here - use it in openvswitch (the only
generic netlink user of netlink_set_err()).Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
There's no reason to have the family pointer there since it
can just be passed internally where needed, so remove it.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
There are no users of this API remaining, and we'll soon
change group registration to be static (like ops are now)Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
As suggested by David Miller, make genl_register_family_with_ops()
a macro and pass only the array, evaluating ARRAY_SIZE() in the
macro, this is a little safer.The openvswitch has some indirection, assing ops/n_ops directly in
that code. This might ultimately just assign the pointers in the
family initializations, saving the struct genl_family_and_ops and
code (once mcast groups are handled differently.)Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller
16 Nov, 2013
1 commit
-
Now that the ops assignment is just two variables rather than a
long list iteration etc., there's no reason to separately export
__genl_register_family() and __genl_register_family_with_ops().Unify the two functions into __genl_register_family() and make
genl_register_family_with_ops() call it after assigning the ops.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller
15 Nov, 2013
4 commits
-
To save some space in the struct on 32-bit systems,
make the flags a u8 (only 4 bits are used) and also
move them to the end of the struct.This has no impact on 64-bit systems as alignment of
the struct in an array uses up the space anyway.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
Allow making the ops array const by not modifying the ops
flags on registration but rather only when ops are sent
out in the family information.No users are updated yet except for the pre_doit/post_doit
calls in wireless (the only ones that exist now.)Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
Instead of using a linked list, use an array. This reduces
the data size needed by the users of genetlink, for example
in wireless (net/wireless/nl80211.c) on 64-bit it frees up
over 1K of data space.Remove the attempted sending of CTRL_CMD_NEWOPS ctrl event
since genl_ctrl_event(CTRL_CMD_NEWOPS, ...) only returns
-EINVAL anyway, therefore no such event could ever be sent.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller -
genl_register_ops() is still needed for internal registration,
but is no longer available to users of the API.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller
21 Sep, 2013
1 commit
-
There are a mix of function prototypes with and without extern
in the kernel sources. Standardize on not using extern for
function prototypes.Function prototypes don't need to be written with extern.
extern is assumed by the compiler. Its use is as unnecessary as
using auto to declare automatic/local variables in a block.Signed-off-by: Joe Perches
Signed-off-by: David S. Miller
29 Aug, 2013
1 commit
-
netlink dump operations take module as parameter to hold
reference for entire netlink dump duration.
Currently it holds ref only on genl module which is not correct
when we use ops registered to genl from another module.
Following patch adds module pointer to genl_ops so that netlink
can hold ref count on it.CC: Jesse Gross
CC: Johannes Berg
Signed-off-by: Pravin B Shelar
Signed-off-by: David S. Miller
25 Apr, 2013
1 commit
-
All genl callbacks are serialized by genl-mutex. This can become
bottleneck in multi threaded case.
Following patch adds an parameter to genl_family so that a
particular family can get concurrent netlink callback without
genl_lock held.
New rw-sem is used to protect genl callback from genl family unregister.
in case of parallel_ops genl-family read-lock is taken for callbacks and
write lock is taken for register or unregistration for any family.
In case of locked genl family semaphore and gel-mutex is locked for
any openration.Signed-off-by: Pravin B Shelar
Signed-off-by: David S. Miller
11 Sep, 2012
1 commit
-
It is a frequent mistake to confuse the netlink port identifier with a
process identifier. Try to reduce this confusion by renaming fields
that hold port identifiers portid instead of pid.I have carefully avoided changing the structures exported to
userspace to avoid changing the userspace API.I have successfully built an allyesconfig kernel with this change.
Signed-off-by: "Eric W. Biederman"
Acked-by: Stephen Hemminger
Signed-off-by: David S. Miller
29 Jun, 2012
1 commit
-
Using NLMSG_GOODSIZE results in multiple pages being used as
nlmsg_new() will automatically add the size of the netlink
header to the payload thus exceeding the page limit.NLMSG_DEFAULT_SIZE takes this into account.
Signed-off-by: Thomas Graf
Cc: Jiri Pirko
Cc: Dmitry Eremin-Solenikov
Cc: Sergey Lapin
Cc: Johannes Berg
Cc: Lauro Ramos Venancio
Cc: Aloisio Almeida Jr
Cc: Samuel Ortiz
Reviewed-by: Jiri Pirko
Signed-off-by: David S. Miller
31 Jan, 2012
1 commit
-
text data bss dec hex filename
8455963 532732 1810804 10799499 a4c98b vmlinux.o.before
8448899 532732 1810804 10792435 a4adf3 vmlinux.oThis change also removes commented-out copy of __nlmsg_put
which was last touched in 2005 with "Enable once all users
have been converted" comment on top.Changes in v2: rediffed against net-next.
Signed-off-by: Denys Vlasenko
Signed-off-by: David S. Miller
04 Dec, 2011
1 commit
-
Open vSwitch uses Generic Netlink interface for communication
between userspace and kernel module. genl_notify() is used
for sending notification back to userspace.genl_notify() is analogous to rtnl_notify() but uses genl_sock
instead of rtnl.Signed-off-by: Pravin B Shelar
Signed-off-by: Jesse Gross
23 Jun, 2011
1 commit
-
Consider the following situation:
* a dump that would show 8 entries, four in the first
round, and four in the second
* between the first and second rounds, 6 entries are
removed
* now the second round will not show any entry, and
even if there is a sequence/generation counter the
application will not knowTo solve this problem, add a new flag NLM_F_DUMP_INTR
to the netlink header that indicates the dump wasn't
consistent, this flag can also be set on the MSG_DONE
message that terminates the dump, and as such above
situation can be detected.To achieve this, add a sequence counter to the netlink
callback struct. Of course, netlink code still needs
to use this new functionality. The correct way to do
that is to always set cb->seq when a dumpit callback
is invoked and call nl_dump_check_consistent() for
each new message. The core code will also call this
function for the final MSG_DONE message.To make it usable with generic netlink, a new function
genlmsg_nlhdr() is needed to obtain the netlink header
from the genetlink user header.Signed-off-by: Johannes Berg
Acked-by: David S. Miller
Signed-off-by: John W. Linville
10 May, 2011
1 commit
-
- kenrel -> kernel
- whetehr -> whether
- ttt -> tt
- sss -> ssSigned-off-by: Justin P. Mattock
Signed-off-by: Jiri Kosina
04 Feb, 2011
1 commit
-
nlmsg_cancel can accept NULL as its second argument, so for similarity,
this patch extends genlmsg_cancel to be able to accept a NULL second
argument as well.Signed-off-by: Julia Lawall
Signed-off-by: David S. Miller
06 Oct, 2010
1 commit
-
Each family may have some amount of boilerplate
locking code that applies to most, or even all,
commands.This allows a family to handle such things in
a more generic way, by allowing it to
a) include private flags in each operation
b) specify a pre_doit hook that is called,
before an operation's doit() callback and
may return an error directly,
c) specify a post_doit hook that can undo
locking or similar things done by pre_doit,
and finally
d) include two private pointers in each info
struct passed between all these operations
including doit(). (It's two because I'll
need two in nl80211 -- can be extended.)Signed-off-by: Johannes Berg
Acked-by: David S. Miller
Signed-off-by: John W. Linville
02 Jun, 2010
1 commit
-
Use read_pnet() and write_pnet() to reduce number of ifdef CONFIG_NET_NS
Signed-off-by: Eric Dumazet
Signed-off-by: David S. Miller
04 Nov, 2009
1 commit
-
This cleanup patch puts struct/union/enum opening braces,
in first line to ease grep games.struct something
{becomes :
struct something {
Signed-off-by: Eric Dumazet
Signed-off-by: David S. Miller
13 Jul, 2009
1 commit
-
This makes generic netlink network namespace aware. No
generic netlink families except for the controller family
are made namespace aware, they need to be checked one by
one and then set the family->netnsok member to true.A new function genlmsg_multicast_netns() is introduced to
allow sending a multicast message in a given namespace,
for example when it applies to an object that lives in
that namespace, a new function genlmsg_multicast_allns()
to send a message to all network namespaces (for objects
that do not have an associated netns).The function genlmsg_multicast() is changed to multicast
the message in just init_net, which is currently correct
for all generic netlink families since they only work in
init_net right now. Some will later want to work in all
net namespaces because they do not care about the netns
at all -- those will have to be converted to use one of
the new functions genlmsg_multicast_allns() or
genlmsg_multicast_netns() whenever they are made netns
aware in some way.After this patch families can easily decide whether or
not they should be available in all net namespaces. Many
genl families us it for objects not related to networking
and should therefore be available in all namespaces, but
that will have to be done on a per family basis.Note that this doesn't touch on the checkpoint/restart
problem where network namespaces could be used, genl
families and multicast groups are numbered globally and
I see no easy way of changing that, especially since it
must be possible to multicast to all network namespaces
for those families that do not care about netns.Signed-off-by: Johannes Berg
Signed-off-by: David S. Miller
22 May, 2009
1 commit
-
This introduces genl_register_family_with_ops() that registers a genetlink
family along with operations from a table. This is used to kill copy'n'paste
occurrences in following patches.Signed-off-by: Michał Mirosław
Signed-off-by: David S. Miller
04 Jun, 2008
1 commit
-
Make nlmsg_trim(), nlmsg_cancel(), genlmsg_cancel(), and
nla_nest_cancel() void functions.Return -EMSGSIZE instead of -1 if the provided message buffer is not
big enough.Signed-off-by: Thomas Graf
Signed-off-by: David S. Miller
19 Jul, 2007
1 commit
-
Introduce API to dynamically register and unregister multicast groups.
Signed-off-by: Johannes Berg
Acked-by: Patrick McHardy
Acked-by: Jamal Hadi Salim
Signed-off-by: David S. Miller
08 Jun, 2007
1 commit
-
Signed-off-by: Patrick McHardy
Signed-off-by: David S. Miller
03 Dec, 2006
4 commits
-
Remove assumption that generic netlink commands cannot have dump
completion callbacks.Signed-off-by: Jamal Hadi Salim
Signed-off-by: David S. Miller -
By modyfing genlmsg_put() to take a genl_family and by adding
genlmsg_put_reply() the process of constructing the netlink
and generic netlink headers is simplified.Signed-off-by: Thomas Graf
Acked-by: Paul Moore
Signed-off-by: David S. Miller -
A generic netlink user has no interest in knowing how to
address the source of the original request.Signed-off-by: Thomas Graf
Acked-by: Paul Moore
Signed-off-by: David S. Miller -
Signed-off-by: Thomas Graf
Acked-by: Paul Moore
Signed-off-by: David S. Miller
01 Oct, 2006
1 commit
-
Add two utility helper functions genlmsg_msg_size() and genlmsg_total_size().
These functions are derived from their netlink counterparts.Signed-off-by: Balbir Singh
Cc: Jamal Hadi
Cc: Shailabh Nagar
Cc: Thomas Graf
Cc: "David S. Miller"
Cc: Jay Lan
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
23 Sep, 2006
2 commits
-
Additionaly exports the following information when providing
the list of registered generic netlink families:
- protocol version
- header size
- maximum number of attributes
- list of available operations including
- id
- flags
- avaiability of policy and doit/dumpit functionlibnl HEAD provides a utility to read this new information:
0x0010 nlctrl version 1
hdrsize 0 maxattr 6
op GETFAMILY (0x03) [POLICY,DOIT,DUMPIT]
0x0011 NLBL_MGMT version 1
hdrsize 0 maxattr 0
op unknown (0x02) [DOIT]
op unknown (0x03) [DOIT]
....Signed-off-by: Thomas Graf
Signed-off-by: David S. Miller -
Adds nlmsg_notify() implementing proper notification logic. The
message is multicasted to all listeners in the group. The
applications the requests orignates from can request a unicast
back report in which case said socket will be excluded from the
multicast to avoid duplicated notifications.nlmsg_multicast() is extended to take allocation flags to
allow notification in atomic contexts.Signed-off-by: Thomas Graf
Signed-off-by: David S. Miller
15 Jul, 2006
1 commit
-
Two utilities for simplifying usage of NETLINK_GENERIC interface.
Signed-off-by: Balbir Singh
Signed-off-by: Shailabh Nagar
Cc: Jes Sorensen
Cc: Peter Chubb
Cc: Erich Focht
Cc: Levent Serinol
Cc: Jay Lan
Cc: "David S. Miller"
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
14 Jan, 2006
1 commit
-
Increasing the module ref count at registration will block the module from
ever being unloaded. In fact, genetlink should not care about the owner at
all. This patch removes the owner field from the struct registered with
genetlink.Signed-off-by: Per Liden
Signed-off-by: Jamal Hadi Salim
Signed-off-by: David S. Miller