Re: xfrm_user reliability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 7 Oct 2003 15:12:06 +0400 (MSD)
kuznet@ms2.inr.ac.ru wrote:

> > Rather netlink_set_err(), which walks through socket table.
> > I think it is to be some new function, which sets overrun bit in socket
> > state as well.
> 
> The second sentence is wrong. When we cannot allocate skb to send,
> it is enough to call netlink_set_err(), overrun bit is set only on
> shortage of receiver rcvbuf.

But I don't understand why we must walk socket table.  If only
one socket is going to receive this netlink_ack() built packet,
why need we set error on any other socket?

For example, I think this patch would solve all the problems.

--- net/netlink/af_netlink.c.~1~	Tue Oct  7 04:04:55 2003
+++ net/netlink/af_netlink.c	Tue Oct  7 04:12:07 2003
@@ -898,8 +898,17 @@
 		size = NLMSG_SPACE(4 + NLMSG_ALIGN(nlh->nlmsg_len));
 
 	skb = alloc_skb(size, GFP_KERNEL);
-	if (!skb)
+	if (!skb) {
+		struct sock *sk;
+
+		sk = netlink_lookup(in_skb->sk->sk_protocol,
+				    NETLINK_CB(in_skb).pid);
+		if (sk) {
+			sk->sk_err = ENOBUFS;
+			sk->sk_error_report(sk);
+		}
 		return;
+	}
 
 	rep = __nlmsg_put(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
 			  NLMSG_ERROR, sizeof(struct nlmsgerr));
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux