aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>2007-05-10 17:15:58 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-05-11 02:47:47 -0400
commitdf293bbb6ff80f40a2308140ba4cbc2d3c1b18da (patch)
treeff61b3f0ec620ad6f8b188b3d29ca9bda72f7383 /net
parentfda61436835f6d46b6d85d4fe9206ffe682fe7f0 (diff)
[NETFILTER]: ctnetlink: clear helper area and handle unchanged helper
This patch - Clears private area for helper even if no helper is assigned to conntrack. It might be used by old helper. - Unchanges if the same helper as the used one is specified. - Does not find helper if no helper is specified. And it does not require private area for helper in that case. Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nf_conntrack_netlink.c40
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;