diff options
| -rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 40 | 
1 files changed, 22 insertions, 18 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index aa1a97ee514b..d6d39e241327 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c  | |||
| @@ -830,11 +830,6 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[]) | |||
| 830 | char *helpname; | 830 | char *helpname; | 
| 831 | int err; | 831 | int err; | 
| 832 | 832 | ||
| 833 | if (!help) { | ||
| 834 | /* FIXME: we need to reallocate and rehash */ | ||
| 835 | return -EBUSY; | ||
| 836 | } | ||
| 837 | |||
| 838 | /* don't change helper of sibling connections */ | 833 | /* don't change helper of sibling connections */ | 
| 839 | if (ct->master) | 834 | if (ct->master) | 
| 840 | return -EINVAL; | 835 | return -EINVAL; | 
| @@ -843,25 +838,34 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[]) | |||
| 843 | if (err < 0) | 838 | if (err < 0) | 
| 844 | return err; | 839 | return err; | 
| 845 | 840 | ||
| 846 | helper = __nf_conntrack_helper_find_byname(helpname); | 841 | if (!strcmp(helpname, "")) { | 
| 847 | if (!helper) { | 842 | if (help && help->helper) { | 
| 848 | if (!strcmp(helpname, "")) | ||
| 849 | helper = NULL; | ||
| 850 | else | ||
| 851 | return -EINVAL; | ||
| 852 | } | ||
| 853 | |||
| 854 | if (help->helper) { | ||
| 855 | if (!helper) { | ||
| 856 | /* we had a helper before ... */ | 843 | /* we had a helper before ... */ | 
| 857 | nf_ct_remove_expectations(ct); | 844 | nf_ct_remove_expectations(ct); | 
| 858 | help->helper = NULL; | 845 | help->helper = NULL; | 
| 859 | } else { | ||
| 860 | /* need to zero data of old helper */ | ||
| 861 | memset(&help->help, 0, sizeof(help->help)); | ||
| 862 | } | 846 | } | 
| 847 | |||
| 848 | return 0; | ||
| 863 | } | 849 | } | 
| 864 | 850 | ||
| 851 | if (!help) { | ||
| 852 | /* FIXME: we need to reallocate and rehash */ | ||
| 853 | return -EBUSY; | ||
| 854 | } | ||
| 855 | |||
| 856 | helper = __nf_conntrack_helper_find_byname(helpname); | ||
| 857 | if (helper == NULL) | ||
| 858 | return -EINVAL; | ||
| 859 | |||
| 860 | if (help->helper == helper) | ||
| 861 | return 0; | ||
| 862 | |||
| 863 | if (help->helper) | ||
| 864 | /* we had a helper before ... */ | ||
| 865 | nf_ct_remove_expectations(ct); | ||
| 866 | |||
| 867 | /* need to zero data of old helper */ | ||
| 868 | memset(&help->help, 0, sizeof(help->help)); | ||
| 865 | help->helper = helper; | 869 | help->helper = helper; | 
| 866 | 870 | ||
| 867 | return 0; | 871 | return 0; | 
