patch-2.3.99-pre6 linux/net/core/dev.c
Next file: linux/net/core/neighbour.c
Previous file: linux/net/bridge/br.c
Back to the patch index
Back to the overall index
- Lines: 189
- Date:
Mon Apr 24 13:59:56 2000
- Orig file:
v2.3.99-pre5/linux/net/core/dev.c
- Orig date:
Tue Apr 11 15:09:26 2000
diff -u --recursive --new-file v2.3.99-pre5/linux/net/core/dev.c linux/net/core/dev.c
@@ -181,7 +181,7 @@
* dev_add_pack - add packet handler
* @pt: packet type declaration
*
- * Add a protocol handler to the networking stack. The passed packet_type
+ * Add a protocol handler to the networking stack. The passed &packet_type
* is linked into kernel lists and may not be freed until it has been
* removed from the kernel lists.
*/
@@ -217,7 +217,7 @@
* @pt: packet type declaration
*
* Remove a protocol handler that was previously added to the kernel
- * protocol handlers by dev_add_pack. The passed packet_type is removed
+ * protocol handlers by dev_add_pack(). The passed &packet_type is removed
* from the kernel lists and can be freed or reused once this function
* returns.
*/
@@ -260,9 +260,9 @@
* __dev_get_by_name - find a device by its name
* @name: name to find
*
- * Find an interface by name. Must be called under rtnl semaphore
- * or dev_base_lock. If the name is found a pointer to the device
- * is returned. If the name is not found then NULL is returned. The
+ * Find an interface by name. Must be called under RTNL semaphore
+ * or @dev_base_lock. If the name is found a pointer to the device
+ * is returned. If the name is not found then %NULL is returned. The
* reference counters are not incremented so the caller must be
* careful with locks.
*/
@@ -286,7 +286,7 @@
* Find an interface by name. This can be called from any
* context and does its own locking. The returned handle has
* the usage count incremented and the caller must use dev_put() to
- * release it when it is no longer needed. NULL is returned if no
+ * release it when it is no longer needed. %NULL is returned if no
* matching device is found.
*/
@@ -336,11 +336,11 @@
* __dev_get_by_index - find a device by its ifindex
* @ifindex: index of device
*
- * Search for an interface by index. Returns NULL if the device
+ * Search for an interface by index. Returns %NULL if the device
* is not found or a pointer to the device. The device has not
* had its reference counter increased so the caller must be careful
- * about locking. The caller must hold either the rtnl semaphore
- * or dev_base_lock.
+ * about locking. The caller must hold either the RTNL semaphore
+ * or @dev_base_lock.
*/
struct net_device * __dev_get_by_index(int ifindex)
@@ -440,15 +440,15 @@
* @name: name format string
* @err: error return pointer
*
- * Passed a format string - eg "lt%d" it will allocate a network device
- * and space for the name. NULL is returned if no memory is available.
+ * Passed a format string, eg. "lt%d", it will allocate a network device
+ * and space for the name. %NULL is returned if no memory is available.
* If the allocation succeeds then the name is assigned and the
- * device pointer returned. NULL is returned if the name allocation failed.
- * The cause of an error is returned as a negative errno code in the
- * variable err points to.
+ * device pointer returned. %NULL is returned if the name allocation
+ * failed. The cause of an error is returned as a negative errno code
+ * in the variable @err points to.
*
- * The claler must hold the dev_base or rtnl locks when doing this in order
- * to avoid duplicate name allocations.
+ * The caller must hold the @dev_base or RTNL locks when doing this in
+ * order to avoid duplicate name allocations.
*/
struct net_device *dev_alloc(const char *name, int *err)
@@ -520,9 +520,9 @@
* dev_open - prepare an interface for use.
* @dev: device to open
*
- * Takes a device from down to up state. The devices private open
+ * Takes a device from down to up state. The device's private open
* function is invoked and then the multicast lists are loaded. Finally
- * the device is moved into the up state and a NETDEV_UP message is
+ * the device is moved into the up state and a %NETDEV_UP message is
* sent to the netdev notifier chain.
*
* Calling this function on an active interface is a nop. On a failure
@@ -622,8 +622,8 @@
* @dev: device to shutdown
*
* This function moves an active device into down state. A
- * NETDEV_GOING_DOWN is sent to the netev notifier chain. The device
- * is then deactivated and finally a NETDEV_DOWN is sent to the notifier
+ * %NETDEV_GOING_DOWN is sent to the netdev notifier chain. The device
+ * is then deactivated and finally a %NETDEV_DOWN is sent to the notifier
* chain.
*/
@@ -695,9 +695,10 @@
* unregister_netdevice_notifier - unregister a network notifier block
* @nb: notifier
*
- * Unregister a notifier previously registered by register_netdevice_notifier
- * The notifier is unlinked into the kernel structures and may
- * then be reused. A negative errno code is returned on a failure.
+ * Unregister a notifier previously registered by
+ * register_netdevice_notifier(). The notifier is unlinked into the
+ * kernel structures and may then be reused. A negative errno code
+ * is returned on a failure.
*/
int unregister_netdevice_notifier(struct notifier_block *nb)
@@ -1079,7 +1080,7 @@
* @fn: function to call
*
* Make a function call that is atomic with respect to the protocol
- * layers
+ * layers.
*/
void net_call_rx_atomic(void (*fn)(void))
@@ -1426,10 +1427,11 @@
static int dev_proc_stats(char *buffer, char **start, off_t offset,
int length, int *eof, void *data)
{
- int i;
+ int i, lcpu;
int len=0;
- for (i=0; i<smp_num_cpus; i++) {
+ for (lcpu=0; lcpu<smp_num_cpus; lcpu++) {
+ i = cpu_logical_map(lcpu);
len += sprintf(buffer+len, "%08x %08x %08x %08x %08x %08x %08x %08x %08x\n",
netdev_rx_stat[i].total,
netdev_rx_stat[i].dropped,
@@ -1554,10 +1556,10 @@
* @slave: slave device
* @master: new master device
*
- * Changes the master device of the slave. Pass NULL to break the
+ * Changes the master device of the slave. Pass %NULL to break the
* bonding. The caller must hold the RTNL semaphore. On a failure
* a negative errno code is returned. On success the reference counts
- * are adjusted, RTM_NEWLINK is sent to the routing socket and the
+ * are adjusted, %RTM_NEWLINK is sent to the routing socket and the
* function returns zero.
*/
@@ -1629,7 +1631,7 @@
* Add or remove reception of all multicast frames to a device. While the
* count in the device remains above zero the interface remains listening
* to all interfaces. Once it hits zero the device reverts back to normal
- * filtering operation. A negative inc value is used to drop the counter
+ * filtering operation. A negative @inc value is used to drop the counter
* when releasing a resource needing all multicasts.
*/
@@ -2005,12 +2007,16 @@
return ret;
}
#ifdef WIRELESS_EXT
+ /* Take care of Wireless Extensions */
if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
- dev_load(ifr.ifr_name);
- if (IW_IS_SET(cmd)) {
- if (!suser())
+ /* If command is `set a parameter', or
+ * `get the encoding parameters', check if
+ * the user has the right to do it */
+ if (IW_IS_SET(cmd) || (cmd == SIOCGIWENCODE)) {
+ if(!capable(CAP_NET_ADMIN))
return -EPERM;
}
+ dev_load(ifr.ifr_name);
rtnl_lock();
ret = dev_ifsioc(&ifr, cmd);
rtnl_unlock();
@@ -2051,7 +2057,7 @@
* @dev: device to register
*
* Take a completed network device structure and add it to the kernel
- * interfaces. A NETDEV_REGISTER message is sent to the netdev notifier
+ * interfaces. A %NETDEV_REGISTER message is sent to the netdev notifier
* chain. 0 is returned on success. A negative errno code is returned
* on a failure to set up the device, or if the name is a duplicate.
*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)