From mboxrd@z Thu Jan 1 00:00:00 1970 From: jamal Subject: Re: [XFRM] Optimize SA dumping Date: Mon, 04 Dec 2006 08:27:46 -0500 Message-ID: <1165238866.3664.43.camel@localhost> References: <1165163610.3517.96.camel@localhost> <4574164B.1000505@trash.net> Reply-To: hadi@cyberus.ca Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: David Miller , netdev@vger.kernel.org Return-path: Received: from nz-out-0506.google.com ([64.233.162.235]:44046 "EHLO nz-out-0102.google.com") by vger.kernel.org with ESMTP id S936830AbWLDN1u (ORCPT ); Mon, 4 Dec 2006 08:27:50 -0500 Received: by nz-out-0102.google.com with SMTP id s1so1856101nze for ; Mon, 04 Dec 2006 05:27:50 -0800 (PST) To: Patrick McHardy In-Reply-To: <4574164B.1000505@trash.net> Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Mon, 2006-04-12 at 13:36 +0100, Patrick McHardy wrote: > jamal wrote: > > for (i = 0; i <= xfrm_state_hmask; i++) { > > hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) { > > + if (count && send_x != last_x) { > > + err = func(send_x, count, data); > > + if (err) > > + goto out; > > + send_x = NULL; > > + } > > if (!xfrm_id_proto_match(x->id.proto, proto)) > > continue; > > After you sent send_x and set it to NULL, it will be different from > last_x (since that is != NULL) and the NULL pointer will be given > to func() when continuing here. > This one you lost me. Can you give me an example? one or two SAs found? In any case, if i go the done callback approach, I can get rid of all this tracking thing ... cheers, jamal > > - err = func(x, --count, data); > > - if (err) > > - goto out; > > + > > + if (!count) { > > + last_x = send_x = x; > > + } else { > > + send_x = last_x; > > + last_x = x; > > + } > > + count++; > > } > > } > > > >