xtables-addons 3.18 condition - Improved network namespace support
My intention was removed special var 'after_clear'. The main idea was use a list as a flag.
But Jeremy has right, I used list_empty_careful() in wrong place. I can change this for that:
static void condition_mt_destroy(const struct xt_mtdtor_param *par) {
const struct xt_condition_mtinfo *info = par->matchinfo; struct condition_variable *var = info->condvar; struct condition_net *cnet = get_condition_pernet(par->net);
mutex_lock(&proc_lock);
// is called after net namespace deleted?
if (list_empty_careful(&cnet->conditions_list)) { mutex_unlock(&proc_lock);
return;
}
if (--var->refcount == 0) {
list_del(&var->list); remove_proc_entry(var->name, cnet->proc_net_condition); mutex_unlock(&proc_lock);
kfree(var);
return;
}
mutex_unlock(&proc_lock);
}
But now I realized that one var bool is less expensive than call a function. So my improved is turned out the fail :) ... sorry for taking the time.
Signature · 1 line
Grzegorz Kuczyński
Quoted 28 lines · Grzegorz Kuczyński
My intention was removed special var '
after_clear'. The main idea was use a list as a flag.But Jeremy has right, I used
list_empty_careful()in wrong place. I can change this for that:static void
condition_mt_destroy(const struct xt_mtdtor_param *par){
const structxt_condition_mtinfo*info =par->matchinfo; structcondition_variable*var =info->condvar; structcondition_net*cnet =get_condition_pernet(par->net);
mutex_lock(&proc_lock);
// is called after net namespace deleted?
if (list_empty_careful(&cnet->conditions_list)) {mutex_unlock(&proc_lock);
return;
}
if (--var->refcount == 0) {
list_del(&var->list);remove_proc_entry(var->name, cnet->proc_net_condition);mutex_unlock(&proc_lock);
kfree(var);
return;
}
mutex_unlock(&proc_lock);
}
Quoted 3 lines
But now I realized that one var bool is less expensive than call a function. So my improved is turned out the fail :) ... sorry for taking the time.
I think there are some improvements that can be made. Will send patches.
J.