diff options
| -rw-r--r-- | include/linux/netfilter/nf_conntrack_common.h | 4 | ||||
| -rw-r--r-- | net/netfilter/nf_conntrack_helper.c | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h index 0d3dd66322ec..d146872a0b91 100644 --- a/include/linux/netfilter/nf_conntrack_common.h +++ b/include/linux/netfilter/nf_conntrack_common.h | |||
| @@ -83,6 +83,10 @@ enum ip_conntrack_status { | |||
| 83 | /* Conntrack is a fake untracked entry */ | 83 | /* Conntrack is a fake untracked entry */ |
| 84 | IPS_UNTRACKED_BIT = 12, | 84 | IPS_UNTRACKED_BIT = 12, |
| 85 | IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), | 85 | IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), |
| 86 | |||
| 87 | /* Conntrack got a helper explicitly attached via CT target. */ | ||
| 88 | IPS_HELPER_BIT = 13, | ||
| 89 | IPS_HELPER = (1 << IPS_HELPER_BIT), | ||
| 86 | }; | 90 | }; |
| 87 | 91 | ||
| 88 | /* Connection tracking event types */ | 92 | /* Connection tracking event types */ |
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c index 317f6e43db87..4fa2ff961f5a 100644 --- a/net/netfilter/nf_conntrack_helper.c +++ b/net/netfilter/nf_conntrack_helper.c | |||
| @@ -182,10 +182,21 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl, | |||
| 182 | struct net *net = nf_ct_net(ct); | 182 | struct net *net = nf_ct_net(ct); |
| 183 | int ret = 0; | 183 | int ret = 0; |
| 184 | 184 | ||
| 185 | /* We already got a helper explicitly attached. The function | ||
| 186 | * nf_conntrack_alter_reply - in case NAT is in use - asks for looking | ||
| 187 | * the helper up again. Since now the user is in full control of | ||
| 188 | * making consistent helper configurations, skip this automatic | ||
| 189 | * re-lookup, otherwise we'll lose the helper. | ||
| 190 | */ | ||
| 191 | if (test_bit(IPS_HELPER_BIT, &ct->status)) | ||
| 192 | return 0; | ||
| 193 | |||
| 185 | if (tmpl != NULL) { | 194 | if (tmpl != NULL) { |
| 186 | help = nfct_help(tmpl); | 195 | help = nfct_help(tmpl); |
| 187 | if (help != NULL) | 196 | if (help != NULL) { |
| 188 | helper = help->helper; | 197 | helper = help->helper; |
| 198 | set_bit(IPS_HELPER_BIT, &ct->status); | ||
| 199 | } | ||
| 189 | } | 200 | } |
| 190 | 201 | ||
| 191 | help = nfct_help(ct); | 202 | help = nfct_help(ct); |
