Skip to content
  1. Mar 08, 2018
  2. Mar 07, 2018
  3. Mar 06, 2018
  4. Mar 05, 2018
    • David S. Miller's avatar
      Merge branch 'convert-pernet_operations-part4' · 229952d1
      David S. Miller authored
      
      
      Kirill Tkhai says:
      
      ====================
      Converting pernet_operations (part #4)
      
      this series continues to review and to convert pernet_operations
      to make them possible to be executed in parallel for several
      net namespaces in the same time. The patches touch mostly netfilter,
      also there are small number of changes in other places.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      229952d1
    • Kirill Tkhai's avatar
      net: Convert proto_gre_net_ops · c29babb7
      Kirill Tkhai authored
      
      
      These pernet_operations register and unregister sysctl.
      nf_conntrack_l4proto_gre4->init_net is simple memory
      initializer. Also, exit method removes gre keymap_list,
      which is per-net. This looks safe to be executed
      in parallel with other pernet_operations.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c29babb7
    • Kirill Tkhai's avatar
      net: Convert ctnetlink_net_ops · b04a3d09
      Kirill Tkhai authored
      
      
      These pernet_operations register and unregister
      two conntrack notifiers, and they seem to be safe
      to be executed in parallel.
      
      General/not related to async pernet_operations JFI:
      ctnetlink_net_exit_batch() actions are grouped in batch,
      and this could look like there is synchronize_rcu()
      is forgotten. But there is synchronize_rcu() on module
      exit patch (in ctnetlink_exit()), so this batch may
      be reworked as simple .exit method.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b04a3d09
    • Kirill Tkhai's avatar
      net: Convert nf_conntrack_net_ops · 467d14b3
      Kirill Tkhai authored
      
      
      These pernet_operations register and unregister sysctl and /proc
      entries. Exit batch method also waits till all per-net conntracks
      are dead. Thus, they are safe to be marked as async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      467d14b3
    • Kirill Tkhai's avatar
      net: Convert ip_set_net_ops · a5a179b6
      Kirill Tkhai authored
      
      
      These pernet_operations initialize and destroy
      net_generic(net, ip_set_net_id)-related data.
      Since ip_set is under CONFIG_IP_SET, it's easy
      to watch drivers, which depend on this config.
      All of them are in net/netfilter/ipset directory,
      except of net/netfilter/xt_set.c. There are no
      more drivers, which use ip_set, and all of
      the above don't register another pernet_operations.
      Also, there are is no indirect users, as header
      file include/linux/netfilter/ipset/ip_set.h does
      not define indirect users by something like this:
      
      	#ifdef CONFIG_IP_SET
      	extern func(void);
      	#else
      	static inline func(void);
      	#endif
      
      So, there are no more pernet operations, dereferencing
      net_generic(net, ip_set_net_id).
      
      ip_set_net_ops are OK to be executed in parallel
      for several net, so we mark them as async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a5a179b6
    • Kirill Tkhai's avatar
      net: Convert fou_net_ops · 6c6c566e
      Kirill Tkhai authored
      
      
      These pernet_operations initialize and destroy
      pernet net_generic(net, fou_net_id) list.
      The rest of net_generic(net, fou_net_id) accesses
      may happen after netlink message, and in-tree
      pernet_operations do not send FOU_GENL_NAME messages.
      So, these pernet_operations are safe to be marked
      as async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6c6c566e
    • Kirill Tkhai's avatar
      net: Convert dccp_v6_ops · 16b0c0c4
      Kirill Tkhai authored
      
      
      These pernet_operations looks similar to dccp_v4_ops,
      and they are also safe to be marked as async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      16b0c0c4
    • Kirill Tkhai's avatar
      net: Convert dccp_v4_ops · 5368bd72
      Kirill Tkhai authored
      
      
      These pernet_operations create and destroy net::dccp::v4_ctl_sk.
      It looks like another pernet_operations don't want to send
      dccp packets to dying or creating net. Batch method similar
      to ipv4/ipv6 sockets and it has to be safe to be executed
      in parallel with anything else. So, we mark them as async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5368bd72
    • Kirill Tkhai's avatar
      net: Convert cangw_pernet_ops · 111da7ad
      Kirill Tkhai authored
      
      
      These pernet_operations have a deal with cgw_list,
      and the rest of accesses are made under rtnl_lock().
      The only exception is cgw_dump_jobs(), which is
      accessed under rcu_read_lock(). cgw_dump_jobs() is
      called on netlink request, and it does not seem,
      foreign pernet_operations want to send a net such
      the messages. So, we mark them as async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      111da7ad
    • Kirill Tkhai's avatar
      net: Convert caif_net_ops · d2174724
      Kirill Tkhai authored
      
      
      Init method just allocates memory for new cfg, and
      assigns net_generic(net, caif_net_id). Despite there is
      synchronize_rcu() on error path in cfcnfg_create(),
      in real this function does not use global lists,
      so it looks like this synchronize_rcu() is some legacy
      inheritance. Exit method removes caif devices under
      rtnl_lock().
      
      There could be a problem, if someone from foreign net
      pernet_operations dereference caif_net_id of this net.
      It's dereferenced in get_cfcnfg() and caif_device_list().
      
      get_cfcnfg() is used from netdevice notifiers, where
      they are called under rtnl_lock(). The notifiers can't
      be called from foreign nets pernet_operations. Also,
      it's used from caif_disconnect_client() and from
      caif_connect_client(). The both of the functions work
      with caif socket, and there is the only possibility
      to have a socket, when the net is dead. This may happen
      only of the socket was created as kern using sk_alloc().
      Grep by PF_CAIF shows we do not create kern caif sockets,
      so get_cfcnfg() is safe.
      
      caif_device_list() is used in netdevice notifiers and exit
      method under rtnl lock. Also, from caif_get() used in
      the netdev notifiers and in caif_flow_cb(). The last item
      is skb destructor. Since there are no kernel caif sockets
      nobody can send net a packet in parallel with init/exit,
      so this is also safe.
      
      So, these pernet_operations are safe to be async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d2174724
    • Kirill Tkhai's avatar
      net: Convert arp_tables_net_ops and ip6_tables_net_ops · c60a246c
      Kirill Tkhai authored
      
      
      These pernet_operations call xt_proto_init() and xt_proto_fini(),
      which just register and unregister /proc entries.
      They are safe to be marked as async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c60a246c
    • Kirill Tkhai's avatar
      net: Convert log pernet_operations · 38220345
      Kirill Tkhai authored
      
      
      These pernet_operations use nf_log_set() and nf_log_unset()
      in their methods:
      
      	nf_log_bridge_net_ops
      	nf_log_arp_net_ops
      	nf_log_ipv4_net_ops
      	nf_log_ipv6_net_ops
      	nf_log_netdev_net_ops
      
      Nobody can send such a packet to a net before it's became
      registered, nobody can send a packet after all netdevices
      are unregistered. So, these pernet_operations are able
      to be marked as async.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      38220345
    • Kirill Tkhai's avatar
      net: Convert broute_net_ops, frame_filter_net_ops and frame_nat_net_ops · ec012f3b
      Kirill Tkhai authored
      
      
      These pernet_operations use ebt_register_table() and
      ebt_unregister_table() to act on the tables, which
      are used as argument in ebt_do_table(), called from
      ebtables hooks.
      
      Since there are no net-related bridge packets in-flight,
      when the init and exit methods are called, these
      pernet_operations are safe to be executed in parallel
      with any other.
      
      Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ec012f3b
    • David Ahern's avatar
      selftests: forwarding: Add suppport to create veth interfaces · 190f887c
      David Ahern authored
      
      
      For tests using veth interfaces, the test infrastructure can create
      the netdevs if they do not exist. Arguably this is a preferred approach
      since the tests require p$N and p$(N+1) to be pairs.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      190f887c
    • Samuel Mendoza-Jonas's avatar
      net/ncsi: Add generic netlink family · 955dc68c
      Samuel Mendoza-Jonas authored
      
      
      Add a generic netlink family for NCSI. This supports three commands;
      NCSI_CMD_PKG_INFO which returns information on packages and their
      associated channels, NCSI_CMD_SET_INTERFACE which allows a specific
      package or package/channel combination to be set as the preferred
      choice, and NCSI_CMD_CLEAR_INTERFACE which clears any preferred setting.
      
      Signed-off-by: default avatarSamuel Mendoza-Jonas <sam@mendozajonas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      955dc68c