netdev
[Top] [All Lists]

Re: [PATCH] Improve behaviour of Netlink Sockets

To: hadi@xxxxxxxxxx
Subject: Re: [PATCH] Improve behaviour of Netlink Sockets
From: Pablo Neira <pablo@xxxxxxxxxxx>
Date: Tue, 28 Sep 2004 23:07:04 +0200
Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <1096367787.8662.146.camel@xxxxxxxxxxxxxxxx>
References: <20040923120707.GB32624@xxxxxxxxxxxxxxxxxxx> <1095995042.1044.34.camel@xxxxxxxxxxxxxxxx> <20040924032440.GB6384@xxxxxxxxxxxxxxxxxxx> <1096289189.1075.37.camel@xxxxxxxxxxxxxxxx> <20040927213607.GD7243@xxxxxxxxxxxxxxxxxxx> <1096339407.8660.33.camel@xxxxxxxxxxxxxxxx> <20040928024614.GA9911@xxxxxxxxxxxxxxxxxxx> <1096340772.8659.51.camel@xxxxxxxxxxxxxxxx> <20040928032321.GB10116@xxxxxxxxxxxxxxxxxxx> <1096343125.8661.96.camel@xxxxxxxxxxxxxxxx> <20040928035921.GA10675@xxxxxxxxxxxxxxxxxxx> <1096367787.8662.146.camel@xxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5
Hi,

If buffer overruns we lost all the messages which are enqueued, so before enqueing the packet, we can check if there's space available in the buffer. I think that this way we can save these messages at least.

I'm also thinking in doing something with netlink_ack's since they can be drop if buffer is full. We could give more priority to error messages in some way, for example, check if there's space for an error message in the buffer, if there's not, drop as many packets in buffer as we get space to enqueue the error message.

regards,
Pablo
===== net/netlink/af_netlink.c 1.58 vs edited =====
--- 1.58/net/netlink/af_netlink.c       Sat Sep 25 17:43:43 2004
+++ edited/net/netlink/af_netlink.c     Tue Sep 28 22:23:44 2004
@@ -475,7 +475,7 @@
        if (nlk->handler)
                return 0;
 #endif
-       if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
+       if (atomic_read(&sk->sk_rmem_alloc) + skb->len > sk->sk_rcvbuf ||
            test_bit(0, &nlk->state)) {
                DECLARE_WAITQUEUE(wait, current);
                if (!timeo) {
<Prev in Thread] Current Thread [Next in Thread>