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
Kirill Smelkov
linux
Commits
7c624149
Commit
7c624149
authored
Jul 05, 2004
by
Herbert Xu
Committed by
David S. Miller
Jul 05, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NETLINK]: Check connect address.
parent
f8f1f469
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
include/linux/netlink.h
include/linux/netlink.h
+5
-0
net/netlink/af_netlink.c
net/netlink/af_netlink.c
+5
-1
No files found.
include/linux/netlink.h
View file @
7c624149
...
...
@@ -91,6 +91,11 @@ struct nlmsgerr
#define NET_MAJOR 36
/* Major 36 is reserved for networking */
enum
{
NETLINK_UNCONNECTED
=
0
,
NETLINK_CONNECTED
,
};
#ifdef __KERNEL__
#include <linux/capability.h>
...
...
net/netlink/af_netlink.c
View file @
7c624149
...
...
@@ -365,6 +365,7 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,
struct
sockaddr_nl
*
nladdr
=
(
struct
sockaddr_nl
*
)
addr
;
if
(
addr
->
sa_family
==
AF_UNSPEC
)
{
sk
->
sk_state
=
NETLINK_UNCONNECTED
;
nlk
->
dst_pid
=
0
;
nlk
->
dst_groups
=
0
;
return
0
;
...
...
@@ -380,6 +381,7 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,
err
=
netlink_autobind
(
sock
);
if
(
err
==
0
)
{
sk
->
sk_state
=
NETLINK_CONNECTED
;
nlk
->
dst_pid
=
nladdr
->
nl_pid
;
nlk
->
dst_groups
=
nladdr
->
nl_groups
;
}
...
...
@@ -427,7 +429,9 @@ struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
/* Don't bother queuing skb if kernel socket has no input function */
nlk
=
nlk_sk
(
sock
);
if
(
nlk
->
pid
==
0
&&
!
nlk
->
data_ready
)
{
if
((
nlk
->
pid
==
0
&&
!
nlk
->
data_ready
)
||
(
sock
->
sk_state
==
NETLINK_CONNECTED
&&
nlk
->
dst_pid
!=
nlk_sk
(
ssk
)
->
pid
))
{
sock_put
(
sock
);
return
ERR_PTR
(
-
ECONNREFUSED
);
}
...
...
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