aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorBrian Haley <brian.haley@hp.com>2012-11-26 00:21:08 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-26 17:22:14 -0500
commitc91f6df2db4972d3cc983e6988b9abf1ad02f5f9 (patch)
treecd29f1a068154e6136e54449ed7caa0b2f922318 /include/linux
parent513777b2435a4b2a551ef57a345d3e6f99ae1508 (diff)
sockopt: Change getsockopt() of SO_BINDTODEVICE to return an interface name
Instead of having the getsockopt() of SO_BINDTODEVICE return an index, which will then require another call like if_indextoname() to get the actual interface name, have it return the name directly. This also matches the existing man page description on socket(7) which mentions the argument being an interface name. If the value has not been set, zero is returned and optlen will be set to zero to indicate there is no interface name present. Added a seqlock to protect this code path, and dev_ifname(), from someone changing the device name via dev_change_name(). v2: Added seqlock protection while copying device name. v3: Fixed word wrap in patch. Signed-off-by: Brian Haley <brian.haley@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e46c830c88d8..e9929abeb932 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1567,6 +1567,8 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1567 1567
1568extern rwlock_t dev_base_lock; /* Device list lock */ 1568extern rwlock_t dev_base_lock; /* Device list lock */
1569 1569
1570extern seqlock_t devnet_rename_seq; /* Device rename lock */
1571
1570 1572
1571#define for_each_netdev(net, d) \ 1573#define for_each_netdev(net, d) \
1572 list_for_each_entry(d, &(net)->dev_base_head, dev_list) 1574 list_for_each_entry(d, &(net)->dev_base_head, dev_list)