On 01/17/2017 05:44 PM, Stephen Hemminger wrote: > What happens when many many policies are installed? > It looks like your patch would silently stop deleting. > Does the the code flush all of them?
Yes, it flushes all of them. xfrm_policy_list_or_deleteall() performs multiple rounds until there are no more policies left to delete (xb.nlmsg_count becomes 0). The previous code failed with > Policy buffer overflow > Delete-all terminated upon reaching the end of the buffer. This already happens for 102 policies on my system. The new code fills the buffer, sends the corresponding netlink message and then re-checks for remaining policies to delete. You can check the old and new behavior via the following commands: # for((i=0;i<255;++i)); do ip x p a src 0.0.0.$i dst 127.0.0.0/24 dev lo dir out action allow priority 10000; done # ip -s -s x p deleteall action allow priority 10000 Regards Alex