From: Dmitry Yusupov <dmitry_yus@yahoo.com>
To: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
Cc: netdev@oss.sgi.com
Subject: Re: [PATCH] NETLINK_UESTABLISHED notifier event
Date: Tue, 05 Apr 2005 17:13:31 -0700 [thread overview]
Message-ID: <1112746411.16753.29.camel@beastie> (raw)
In-Reply-To: <4253059C.1080000@6wind.com>
[-- Attachment #1: Type: text/plain, Size: 304 bytes --]
resend.
On Tue, 2005-04-05 at 23:39 +0200, Jean-Mickael Guerin wrote:
> Dmitry Yusupov wrote:
> > This patch provides:
> >
> > * new event for unicast connections NETLINK_UESTABLISHED.
>
> Which kind of application takes benefit of this event ?
>
> btw your diff is reversed ;-)
>
> Jean-Mickael
>
[-- Attachment #2: netlink_uestablish_event.patch --]
[-- Type: text/x-patch, Size: 3418 bytes --]
--- linux-2.6.11.orig/net/netlink/af_netlink.c 2005-03-01 23:38:09.000000000 -0800
+++ linux-2.6.11-um/net/netlink/af_netlink.c 2005-04-05 12:40:33.000000000 -0700
@@ -467,8 +467,14 @@
return err;
}
- if (!nladdr->nl_groups && !nlk->groups)
+ 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);
return 0;
+ }
netlink_table_grab();
if (nlk->groups && !nladdr->nl_groups)
@@ -504,7 +510,6 @@
if (!nlk->pid)
err = netlink_autobind(sock);
-
if (err == 0) {
sk->sk_state = NETLINK_CONNECTED;
nlk->dst_pid = nladdr->nl_pid;
@@ -542,7 +547,7 @@
}
}
-static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
+struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
{
int protocol = ssk->sk_protocol;
struct sock *sock;
@@ -920,7 +925,7 @@
if (len > sk->sk_sndbuf - 32)
goto out;
err = -ENOBUFS;
- skb = alloc_skb(len, GFP_KERNEL);
+ skb = alloc_skb(len, sk->sk_allocation);
if (skb==NULL)
goto out;
@@ -1179,7 +1184,7 @@
else
size = NLMSG_SPACE(4 + NLMSG_ALIGN(nlh->nlmsg_len));
- skb = alloc_skb(size, GFP_KERNEL);
+ skb = alloc_skb(size, in_skb->sk->sk_allocation);
if (!skb) {
struct sock *sk;
@@ -1465,4 +1470,5 @@
EXPORT_SYMBOL(netlink_set_nonroot);
EXPORT_SYMBOL(netlink_unicast);
EXPORT_SYMBOL(netlink_unregister_notifier);
+EXPORT_SYMBOL(netlink_getsockbypid);
--- linux-2.6.11.orig/include/linux/notifier.h 2005-03-01 23:37:48.000000000 -0800
+++ linux-2.6.11-um/include/linux/notifier.h 2005-04-05 12:30:10.000000000 -0700
@@ -62,14 +62,15 @@
#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 */
+#define NETLINK_UESTABLISHED 0x0001 /* Unicast netlink socket established */
+#define NETLINK_URELEASE 0x0002 /* Unicast netlink socket released */
-#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 */
+#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 */
#endif /* __KERNEL__ */
#endif /* _LINUX_NOTIFIER_H */
--- linux-2.6.11.orig/include/linux/netlink.h 2005-03-01 23:38:25.000000000 -0800
+++ linux-2.6.11-um/include/linux/netlink.h 2005-04-05 11:35:15.000000000 -0700
@@ -124,6 +124,7 @@
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 prev parent reply other threads:[~2005-04-06 0:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-05 19:54 [PATCH] NETLINK_UESTABLISHED notifier event Dmitry Yusupov
2005-04-05 21:39 ` Jean-Mickael Guerin
2005-04-05 23:53 ` Dmitry Yusupov
2005-04-06 0:13 ` Dmitry Yusupov [this message]
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=1112746411.16753.29.camel@beastie \
--to=dmitry_yus@yahoo.com \
--cc=jean-mickael.guerin@6wind.com \
--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).