Patrick McHardy wrote: > jamal wrote: > >>All very valid points. >>Yikes, the directionality is not something i thought clearly about or >>tested well. I can fix this but this code will only get fuglier. How >>about the following approach: >> >>I add a new callback which is passed in the invocation to walk. >>This callback is invoked at the end to signal the end of the walk, sort >>of what done() does in netlink. >>netlink doesnt use this call but pfkey does. So the burden is then moved >>to pfkey to keep track of the stoopid count. >> >>Thoughts? > > I think the complications come from the fact that you remeber two > policies, but only one seems necessary. How about this (completely > untested) patch? It simply uses increasing sequence numbers for all > but the last entry and uses zero for the last one. And the same for SAs.