tmp_suning_uos_patched/net
Tom Gundersen 685343fc3b net: add name_assign_type netdev attribute
Based on a patch by David Herrmann.

The name_assign_type attribute gives hints where the interface name of a
given net-device comes from. These values are currently defined:
  NET_NAME_ENUM:
    The ifname is provided by the kernel with an enumerated
    suffix, typically based on order of discovery. Names may
    be reused and unpredictable.
  NET_NAME_PREDICTABLE:
    The ifname has been assigned by the kernel in a predictable way
    that is guaranteed to avoid reuse and always be the same for a
    given device. Examples include statically created devices like
    the loopback device and names deduced from hardware properties
    (including being given explicitly by the firmware). Names
    depending on the order of discovery, or in any other way on the
    existence of other devices, must not be marked as PREDICTABLE.
  NET_NAME_USER:
    The ifname was provided by user-space during net-device setup.
  NET_NAME_RENAMED:
    The net-device has been renamed from userspace. Once this type is set,
    it cannot change again.
  NET_NAME_UNKNOWN:
    This is an internal placeholder to indicate that we yet haven't yet
    categorized the name. It will not be exposed to userspace, rather
    -EINVAL is returned.

The aim of these patches is to improve user-space renaming of interfaces. As
a general rule, userspace must rename interfaces to guarantee that names stay
the same every time a given piece of hardware appears (at boot, or when
attaching it). However, there are several situations where userspace should
not perform the renaming, and that depends on both the policy of the local
admin, but crucially also on the nature of the current interface name.

If an interface was created in repsonse to a userspace request, and userspace
already provided a name, we most probably want to leave that name alone. The
main instance of this is wifi-P2P devices created over nl80211, which currently
have a long-standing bug where they are getting renamed by udev. We label such
names NET_NAME_USER.

If an interface, unbeknown to us, has already been renamed from userspace, we
most probably want to leave also that alone. This will typically happen when
third-party plugins (for instance to udev, but the interface is generic so could
be from anywhere) renames the interface without informing udev about it. A
typical situation is when you switch root from an installer or an initrd to the
real system and the new instance of udev does not know what happened before
the switch. These types of problems have caused repeated issues in the past. To
solve this, once an interface has been renamed, its name is labelled
NET_NAME_RENAMED.

In many cases, the kernel is actually able to name interfaces in such a
way that there is no need for userspace to rename them. This is the case when
the enumeration order of devices, or in fact any other (non-parent) device on
the system, can not influence the name of the interface. Examples include
statically created devices, or any naming schemes based on hardware properties
of the interface. In this case the admin may prefer to use the kernel-provided
names, and to make that possible we label such names NET_NAME_PREDICTABLE.
We want the kernel to have tho possibilty of performing predictable interface
naming itself (and exposing to userspace that it has), as the information
necessary for a proper naming scheme for a certain class of devices may not
be exposed to userspace.

The case where renaming is almost certainly desired, is when the kernel has
given the interface a name using global device enumeration based on order of
discovery (ethX, wlanY, etc). These naming schemes are labelled NET_NAME_ENUM.

Lastly, a fallback is left as NET_NAME_UNKNOWN, to indicate that a driver has
not yet been ported. This is mostly useful as a transitionary measure, allowing
us to label the various naming schemes bit by bit.

v8: minor documentation fixes
v9: move comment to the right commit

Signed-off-by: Tom Gundersen <teg@jklm.no>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-07-15 16:12:01 -07:00
..
9p
802
8021q vlan: Pass SIOC[SG]HWTSTAMP ioctls to real device 2014-07-07 16:57:26 -07:00
appletalk appletalk: fix a coccinella warning in net/appletalk/ddp.c 2014-07-08 14:32:17 -07:00
atm
ax25
batman-adv batman-adv: Use kasprintf 2014-07-07 17:00:31 -07:00
bluetooth Bluetooth: Don't send ERTM configuration option when disabled 2014-07-09 13:53:36 +03:00
bridge bridge: netlink dump interface at par with brctl 2014-07-10 12:37:33 -07:00
caif net/caif/caif_socket.c: remove unnecessary null test before debugfs_remove_recursive 2014-07-02 17:05:29 -07:00
can
ceph
core net: add name_assign_type netdev attribute 2014-07-15 16:12:01 -07:00
dcb
dccp inet: move ipv6only in sock_common 2014-07-01 23:46:21 -07:00
decnet
dns_resolver
dsa net/dsa/dsa.c: remove unnecessary null test before kfree 2014-06-25 16:15:16 -07:00
ethernet
hsr net/hsr: Remove left-over never-true conditional code. 2014-07-11 15:04:40 -07:00
ieee802154 6lowpan: mac802154: fix coding style issues 2014-07-07 20:55:22 -07:00
ipv4 udp: Move udp_tunnel_segment into udp_offload.c 2014-07-14 16:12:15 -07:00
ipv6 ipv6: Use BUG_ON 2014-07-11 15:06:38 -07:00
ipx
irda trivial: net/irda/irlmp.c: Fix closing brace followed by if 2014-06-23 15:04:33 -07:00
iucv
key
l2tp l2tp: Call udp_sock_create 2014-07-14 16:12:15 -07:00
lapb
llc
mac80211 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless 2014-07-10 17:00:24 -04:00
mac802154 mac802154: at86rf230: add hw flags and merge ops 2014-07-07 21:29:24 -07:00
mpls
netfilter netfilter: nf_nat: fix oops on netns removal 2014-06-16 13:58:54 +02:00
netlabel
netlink netlink: Fix do_one_broadcast() prototype. 2014-07-07 20:52:49 -07:00
netrom
nfc
openvswitch vxlan: Call udp_flow_src_port 2014-07-07 21:14:21 -07:00
packet
phonet
rds
rfkill
rose
rxrpc
sched net: fix some typos in comment 2014-07-01 14:20:32 -07:00
sctp net: sctp: Inline the functions from command.c 2014-07-08 14:38:48 -07:00
sunrpc NFSv4: test SECINFO RPC_AUTH_GSS pseudoflavors for support 2014-06-24 18:46:58 -04:00
tipc tipc: fix a memleak when sending data 2014-07-08 16:10:01 -07:00
unix
vmw_vsock
wimax
wireless Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless 2014-07-10 17:00:24 -04:00
x25
xfrm
compat.c
Kconfig
Makefile
nonet.c
socket.c
sysctl_net.c