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
9acee33f
Commit
9acee33f
authored
Jun 24, 2002
by
James Morris
Committed by
David S. Miller
Jun 24, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NETLINK: Add unicast release notifier.
parent
0dd307f5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
0 deletions
+31
-0
include/linux/netlink.h
include/linux/netlink.h
+8
-0
include/linux/notifier.h
include/linux/notifier.h
+2
-0
net/netlink/af_netlink.c
net/netlink/af_netlink.c
+19
-0
net/netsyms.c
net/netsyms.c
+2
-0
No files found.
include/linux/netlink.h
View file @
9acee33f
...
...
@@ -110,6 +110,8 @@ extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int
extern
void
netlink_broadcast
(
struct
sock
*
ssk
,
struct
sk_buff
*
skb
,
__u32
pid
,
__u32
group
,
int
allocation
);
extern
void
netlink_set_err
(
struct
sock
*
ssk
,
__u32
pid
,
__u32
group
,
int
code
);
extern
int
netlink_register_notifier
(
struct
notifier_block
*
nb
);
extern
int
netlink_unregister_notifier
(
struct
notifier_block
*
nb
);
/*
* skb should fit one page. This choice is good for headerless malloc.
...
...
@@ -129,6 +131,12 @@ struct netlink_callback
long
args
[
4
];
};
struct
netlink_notify
{
int
pid
;
int
protocol
;
};
static
__inline__
struct
nlmsghdr
*
__nlmsg_put
(
struct
sk_buff
*
skb
,
u32
pid
,
u32
seq
,
int
type
,
int
len
)
{
...
...
include/linux/notifier.h
View file @
9acee33f
...
...
@@ -58,5 +58,7 @@ extern int notifier_call_chain(struct notifier_block **n, unsigned long val, voi
#define SYS_HALT 0x0002
/* Notify of system halt */
#define SYS_POWER_OFF 0x0003
/* Notify of system power off */
#define NETLINK_URELEASE 0x0001
/* Unicast netlink socket released */
#endif
/* __KERNEL__ */
#endif
/* _LINUX_NOTIFIER_H */
net/netlink/af_netlink.c
View file @
9acee33f
...
...
@@ -41,6 +41,7 @@
#include <linux/rtnetlink.h>
#include <linux/proc_fs.h>
#include <linux/smp_lock.h>
#include <linux/notifier.h>
#include <net/sock.h>
#include <net/scm.h>
...
...
@@ -81,6 +82,8 @@ atomic_t netlink_sock_nr;
static
rwlock_t
nl_table_lock
=
RW_LOCK_UNLOCKED
;
static
atomic_t
nl_table_users
=
ATOMIC_INIT
(
0
);
static
struct
notifier_block
*
netlink_chain
;
static
void
netlink_sock_destruct
(
struct
sock
*
sk
)
{
skb_queue_purge
(
&
sk
->
receive_queue
);
...
...
@@ -276,6 +279,12 @@ static int netlink_release(struct socket *sock)
skb_queue_purge
(
&
sk
->
write_queue
);
if
(
sk
->
protinfo
.
af_netlink
->
pid
&&
!
sk
->
protinfo
.
af_netlink
->
groups
)
{
struct
netlink_notify
n
=
{
protocol
:
sk
->
protocol
,
pid:
sk
->
protinfo
.
af_netlink
->
pid
};
notifier_call_chain
(
&
netlink_chain
,
NETLINK_URELEASE
,
&
n
);
}
sock_put
(
sk
);
return
0
;
}
...
...
@@ -967,6 +976,16 @@ static int netlink_read_proc(char *buffer, char **start, off_t offset,
}
#endif
int
netlink_register_notifier
(
struct
notifier_block
*
nb
)
{
return
notifier_chain_register
(
&
netlink_chain
,
nb
);
}
int
netlink_unregister_notifier
(
struct
notifier_block
*
nb
)
{
return
notifier_chain_unregister
(
&
netlink_chain
,
nb
);
}
struct
proto_ops
netlink_ops
=
{
family:
PF_NETLINK
,
...
...
net/netsyms.c
View file @
9acee33f
...
...
@@ -402,6 +402,8 @@ EXPORT_SYMBOL(netlink_unicast);
EXPORT_SYMBOL
(
netlink_kernel_create
);
EXPORT_SYMBOL
(
netlink_dump_start
);
EXPORT_SYMBOL
(
netlink_ack
);
EXPORT_SYMBOL
(
netlink_register_notifier
);
EXPORT_SYMBOL
(
netlink_unregister_notifier
);
#if defined(CONFIG_NETLINK_DEV) || defined(CONFIG_NETLINK_DEV_MODULE)
EXPORT_SYMBOL
(
netlink_attach
);
EXPORT_SYMBOL
(
netlink_detach
);
...
...
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