Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
754f80fb
Commit
754f80fb
authored
Oct 16, 2003
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Catch buggy net drivers changing getstats op after registry.
parent
c700a9de
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
include/linux/netdevice.h
include/linux/netdevice.h
+1
-0
net/core/dev.c
net/core/dev.c
+29
-0
net/core/net-sysfs.c
net/core/net-sysfs.c
+1
-0
No files found.
include/linux/netdevice.h
View file @
754f80fb
...
...
@@ -469,6 +469,7 @@ struct net_device
/* class/net/name entry */
struct
class_device
class_dev
;
struct
net_device_stats
*
(
*
last_stats
)(
struct
net_device
*
);
};
#define SET_MODULE_OWNER(dev) do { } while (0)
...
...
net/core/dev.c
View file @
754f80fb
...
...
@@ -713,6 +713,19 @@ static int default_rebuild_header(struct sk_buff *skb)
return
1
;
}
/*
* Some old buggy device drivers change get_stats after registering
* the device. Try and trap them here.
* This can be elimnated when all devices are known fixed.
*/
static
inline
int
get_stats_changed
(
struct
net_device
*
dev
)
{
int
changed
=
dev
->
last_stats
!=
dev
->
get_stats
;
dev
->
last_stats
=
dev
->
get_stats
;
return
changed
;
}
/**
* dev_open - prepare an interface for use.
* @dev: device to open
...
...
@@ -736,6 +749,14 @@ int dev_open(struct net_device *dev)
if
(
dev
->
flags
&
IFF_UP
)
return
0
;
/*
* Check for broken device drivers.
*/
if
(
get_stats_changed
(
dev
)
&&
net_ratelimit
())
{
printk
(
KERN_ERR
"%s: driver changed get_stats after register
\n
"
,
dev
->
name
);
}
/*
* Is it even present?
*/
...
...
@@ -753,6 +774,14 @@ int dev_open(struct net_device *dev)
}
/*
* Check for more broken device drivers.
*/
if
(
get_stats_changed
(
dev
)
&&
net_ratelimit
())
{
printk
(
KERN_ERR
"%s: driver changed get_stats in open
\n
"
,
dev
->
name
);
}
/*
* If it went open OK then:
*/
...
...
net/core/net-sysfs.c
View file @
754f80fb
...
...
@@ -419,6 +419,7 @@ int netdev_register_sysfs(struct net_device *net)
}
net
->
last_stats
=
net
->
get_stats
;
if
(
net
->
get_stats
&&
(
ret
=
sysfs_create_group
(
&
class_dev
->
kobj
,
&
netstat_group
)))
goto
out_unreg
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment