* [PATCH] net: inet_diag -- Return error code if protocol handler is missed
@ 2012-11-03 19:30 Cyrill Gorcunov
2012-11-04 1:39 ` Pavel Emelyanov
0 siblings, 1 reply; 3+ messages in thread
From: Cyrill Gorcunov @ 2012-11-03 19:30 UTC (permalink / raw)
To: NETDEV; +Cc: David Miller, Eric Dumazet, Pavel Emelyanov
We've observed that in case if UDP diag module is not
supported in kernel the netlink returns NLMSG_DONE without
notifying a caller that handler is missed.
This patch makes __inet_diag_dump to return error code instead.
So as example it become possible to detect such situation
and handle it gracefully on userspace level.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: David Miller <davem@davemloft.net>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Pavel Emelyanov <xemul@parallels.com>
---
net/ipv4/inet_diag.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: linux-2.6.git/net/ipv4/inet_diag.c
===================================================================
--- linux-2.6.git.orig/net/ipv4/inet_diag.c
+++ linux-2.6.git/net/ipv4/inet_diag.c
@@ -895,13 +895,16 @@ static int __inet_diag_dump(struct sk_bu
struct inet_diag_req_v2 *r, struct nlattr *bc)
{
const struct inet_diag_handler *handler;
+ int err = 0;
handler = inet_diag_lock_handler(r->sdiag_protocol);
if (!IS_ERR(handler))
handler->dump(skb, cb, r, bc);
+ else
+ err = PTR_ERR(handler);
inet_diag_unlock_handler(handler);
- return skb->len;
+ return err ? : skb->len;
}
static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: inet_diag -- Return error code if protocol handler is missed
2012-11-03 19:30 [PATCH] net: inet_diag -- Return error code if protocol handler is missed Cyrill Gorcunov
@ 2012-11-04 1:39 ` Pavel Emelyanov
2012-11-04 5:57 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Emelyanov @ 2012-11-04 1:39 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: NETDEV, David Miller, Eric Dumazet
On 11/03/2012 11:30 PM, Cyrill Gorcunov wrote:
> We've observed that in case if UDP diag module is not
> supported in kernel the netlink returns NLMSG_DONE without
> notifying a caller that handler is missed.
>
> This patch makes __inet_diag_dump to return error code instead.
>
> So as example it become possible to detect such situation
> and handle it gracefully on userspace level.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> CC: David Miller <davem@davemloft.net>
> CC: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: inet_diag -- Return error code if protocol handler is missed
2012-11-04 1:39 ` Pavel Emelyanov
@ 2012-11-04 5:57 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-11-04 5:57 UTC (permalink / raw)
To: xemul; +Cc: gorcunov, netdev, eric.dumazet
From: Pavel Emelyanov <xemul@parallels.com>
Date: Sun, 04 Nov 2012 05:39:19 +0400
> On 11/03/2012 11:30 PM, Cyrill Gorcunov wrote:
>> We've observed that in case if UDP diag module is not
>> supported in kernel the netlink returns NLMSG_DONE without
>> notifying a caller that handler is missed.
>>
>> This patch makes __inet_diag_dump to return error code instead.
>>
>> So as example it become possible to detect such situation
>> and handle it gracefully on userspace level.
>>
>> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
>> CC: David Miller <davem@davemloft.net>
>> CC: Eric Dumazet <eric.dumazet@gmail.com>
>> CC: Pavel Emelyanov <xemul@parallels.com>
>
> Acked-by: Pavel Emelyanov <xemul@parallels.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-04 5:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-03 19:30 [PATCH] net: inet_diag -- Return error code if protocol handler is missed Cyrill Gorcunov
2012-11-04 1:39 ` Pavel Emelyanov
2012-11-04 5:57 ` David Miller
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).