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

    Pravin B Shelar
     

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 know

    To 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

    Johannes Berg
     

10 May, 2011

1 commit


04 Feb, 2011

1 commit


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

    Johannes Berg
     

02 Jun, 2010

1 commit


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

    Eric Dumazet
     

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

    Johannes Berg
     

22 May, 2009

1 commit


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

    Thomas Graf
     

19 Jul, 2007

1 commit


08 Jun, 2007

1 commit


03 Dec, 2006

4 commits


01 Oct, 2006

1 commit


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 function

    libnl 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

    Thomas Graf
     
  • 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

    Thomas Graf
     

15 Jul, 2006

1 commit


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

    Per Liden
     

04 Jan, 2006

1 commit


10 Nov, 2005

1 commit

  • The generic netlink family builds on top of netlink and provides
    simplifies access for the less demanding netlink users. It solves
    the problem of protocol numbers running out by introducing a so
    called controller taking care of id management and name resolving.

    Generic netlink modules register themself after filling out their
    id card (struct genl_family), after successful registration the
    modules are able to register callbacks to command numbers by
    filling out a struct genl_ops and calling genl_register_op(). The
    registered callbacks are invoked with attributes parsed making
    life of simple modules a lot easier.

    Although generic netlink modules can request static identifiers,
    it is recommended to use GENL_ID_GENERATE and to let the controller
    assign a unique identifier to the module. Userspace applications
    will then ask the controller and lookup the idenfier by the module
    name.

    Due to the current multicast implementation of netlink, the number
    of generic netlink modules is restricted to 1024 to avoid wasting
    memory for the per socket multiacst subscription bitmask.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf