Subject: Re: [RFC][PATCH] Fixing SA/SP dumps on netlink/af_key

From: Timo Teräs <[email-masked]>
Date: Thu, 17 Jan 2008 12:01:17 +0200

David Miller wrote:
> From: Timo_Teräs <[email-masked]>
> Date: Thu, 17 Jan 2008 11:38:13 +0200
> 
>> The af_key issue is that in big dumps you get only first X
>> entries. The rest of the entries are dropped because the
>> socket receive buffer goes full. You get data corruption:
>> missing entries.
> 
> This is an inherent aspect of AF_KEY (and what it was
> derived from, BSD routing sockets).

Yes, this is the way BSD does it.
 
> It has to provide dumps atomically, and if there is no
> space there is no way to provide those entries which
> would require more rcvbuf space.

RFC does not say it has to be atomic.

It does say that the dump is terminated with SADB_DUMP
message having sadb_seq field set to zero. Currently
that is dropped too when the problem occurs. Thus the
socket is left in a bad state: dump ends never. This
can cause applications without any workarounds to hang.

- Timo