From: Dmitry Yusupov <dmitry_yus@yahoo.com>
To: netdev@oss.sgi.com
Cc: "David S. Miller" <davem@davemloft.net>
Subject: [PATCH] NETLINK_UESTABLISHED notifier event
Date: Tue, 05 Apr 2005 12:54:49 -0700 [thread overview]
Message-ID: <1112730889.16753.17.camel@beastie> (raw)
[-- Attachment #1: Type: text/plain, Size: 338 bytes --]
This patch provides:
* new event for unicast connections NETLINK_UESTABLISHED.
* netlink alloc_skb() now uses sk_allocation instead of hard-coded
GFP_KERNEL
* since netlink event described via proto and pid,
netlink_getsockbypid() is exported, so netlink user can identify socket.
Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com>
[-- Attachment #2: netlink_uestablish_event.patch --]
[-- Type: text/x-patch, Size: 3418 bytes --]
--- linux-2.6.11-um/net/netlink/af_netlink.c 2005-04-05 12:40:33.000000000 -0700
+++ linux-2.6.11.orig/net/netlink/af_netlink.c 2005-03-01 23:38:09.000000000 -0800
@@ -467,14 +467,8 @@
return err;
}
- if (!nladdr->nl_groups && !nlk->groups) {
- struct netlink_notify n = {
- .protocol = sk->sk_protocol,
- .pid = nladdr->nl_pid,
- };
- notifier_call_chain(&netlink_chain, NETLINK_UESTABLISHED, &n);
+ if (!nladdr->nl_groups && !nlk->groups)
return 0;
- }
netlink_table_grab();
if (nlk->groups && !nladdr->nl_groups)
@@ -510,6 +504,7 @@
if (!nlk->pid)
err = netlink_autobind(sock);
+
if (err == 0) {
sk->sk_state = NETLINK_CONNECTED;
nlk->dst_pid = nladdr->nl_pid;
@@ -547,7 +542,7 @@
}
}
-struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
+static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
{
int protocol = ssk->sk_protocol;
struct sock *sock;
@@ -925,7 +920,7 @@
if (len > sk->sk_sndbuf - 32)
goto out;
err = -ENOBUFS;
- skb = alloc_skb(len, sk->sk_allocation);
+ skb = alloc_skb(len, GFP_KERNEL);
if (skb==NULL)
goto out;
@@ -1184,7 +1179,7 @@
else
size = NLMSG_SPACE(4 + NLMSG_ALIGN(nlh->nlmsg_len));
- skb = alloc_skb(size, in_skb->sk->sk_allocation);
+ skb = alloc_skb(size, GFP_KERNEL);
if (!skb) {
struct sock *sk;
@@ -1470,5 +1465,4 @@
EXPORT_SYMBOL(netlink_set_nonroot);
EXPORT_SYMBOL(netlink_unicast);
EXPORT_SYMBOL(netlink_unregister_notifier);
-EXPORT_SYMBOL(netlink_getsockbypid);
--- linux-2.6.11-um/include/linux/notifier.h 2005-04-05 12:30:10.000000000 -0700
+++ linux-2.6.11.orig/include/linux/notifier.h 2005-03-01 23:37:48.000000000 -0800
@@ -62,15 +62,14 @@
#define SYS_HALT 0x0002 /* Notify of system halt */
#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
-#define NETLINK_UESTABLISHED 0x0001 /* Unicast netlink socket established */
-#define NETLINK_URELEASE 0x0002 /* Unicast netlink socket released */
+#define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */
-#define CPU_ONLINE 0x0003 /* CPU (unsigned)v is up */
-#define CPU_UP_PREPARE 0x0004 /* CPU (unsigned)v coming up */
-#define CPU_UP_CANCELED 0x0005 /* CPU (unsigned)v NOT coming up */
-#define CPU_DOWN_PREPARE 0x0006 /* CPU (unsigned)v going down */
-#define CPU_DOWN_FAILED 0x0007 /* CPU (unsigned)v NOT going down */
-#define CPU_DEAD 0x0008 /* CPU (unsigned)v dead */
+#define CPU_ONLINE 0x0002 /* CPU (unsigned)v is up */
+#define CPU_UP_PREPARE 0x0003 /* CPU (unsigned)v coming up */
+#define CPU_UP_CANCELED 0x0004 /* CPU (unsigned)v NOT coming up */
+#define CPU_DOWN_PREPARE 0x0005 /* CPU (unsigned)v going down */
+#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */
+#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
#endif /* __KERNEL__ */
#endif /* _LINUX_NOTIFIER_H */
--- linux-2.6.11-um/include/linux/netlink.h 2005-04-05 11:35:15.000000000 -0700
+++ linux-2.6.11.orig/include/linux/netlink.h 2005-03-01 23:38:25.000000000 -0800
@@ -124,7 +124,6 @@
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);
-extern struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid);
/* finegrained unicast helpers: */
struct sock *netlink_getsockbyfilp(struct file *filp);
next reply other threads:[~2005-04-05 19:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-05 19:54 Dmitry Yusupov [this message]
2005-04-05 21:39 ` [PATCH] NETLINK_UESTABLISHED notifier event Jean-Mickael Guerin
2005-04-05 23:53 ` Dmitry Yusupov
2005-04-06 0:13 ` Dmitry Yusupov
2005-04-06 2:45 ` Herbert Xu
2005-04-06 5:55 ` Dmitry Yusupov
2005-04-06 6:03 ` Herbert Xu
2005-04-06 15:16 ` Dmitry Yusupov
2005-04-06 16:23 ` Mike Christie
2005-04-06 21:29 ` Herbert Xu
2005-04-06 21:37 ` Dmitry Yusupov
2005-04-06 22:04 ` Herbert Xu
2005-04-06 22:26 ` Dmitry Yusupov
2005-04-07 11:30 ` jamal
2005-04-07 15:05 ` Dmitry Yusupov
2005-04-07 21:32 ` Herbert Xu
2005-04-07 23:36 ` Dmitry Yusupov
2005-04-08 11:36 ` Herbert Xu
2005-04-08 15:30 ` Dmitry Yusupov
2005-04-09 1:44 ` Herbert Xu
2005-04-09 16:02 ` Dmitry Yusupov
2005-04-09 19:36 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1112730889.16753.17.camel@beastie \
--to=dmitry_yus@yahoo.com \
--cc=davem@davemloft.net \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).