diff options
author | Kelvie Wong <kelvie@ieee.org> | 2012-05-02 14:39:24 +0000 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-05-08 19:40:59 +0200 |
commit | 9768e1ace458fa4ebf88bc3943fd8fb77113ed9c (patch) | |
tree | 42b47bc693694767bff2820811896a7b1580b58d /net/netfilter | |
parent | 6d8ebc8a27e1b187abfb06dd79b35a393aa9f2a2 (diff) | |
download | kernel_goldelico_gta04-9768e1ace458fa4ebf88bc3943fd8fb77113ed9c.zip kernel_goldelico_gta04-9768e1ace458fa4ebf88bc3943fd8fb77113ed9c.tar.gz kernel_goldelico_gta04-9768e1ace458fa4ebf88bc3943fd8fb77113ed9c.tar.bz2 |
netfilter: nf_ct_expect: partially implement ctnetlink_change_expect
This refreshes the "timeout" attribute in existing expectations if one is
given.
The use case for this would be for userspace helpers to extend the lifetime
of the expectation when requested, as this is not possible right now
without deleting/recreating the expectation.
I use this specifically for forwarding DCERPC traffic through:
DCERPC has a port mapper daemon that chooses a (seemingly) random port for
future traffic to go to. We expect this traffic (with a reasonable
timeout), but sometimes the port mapper will tell the client to continue
using the same port. This allows us to extend the expectation accordingly.
Signed-off-by: Kelvie Wong <kelvie@ieee.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 462ec2d..6f4b00a 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -2080,7 +2080,15 @@ static int ctnetlink_change_expect(struct nf_conntrack_expect *x, const struct nlattr * const cda[]) { - return -EOPNOTSUPP; + if (cda[CTA_EXPECT_TIMEOUT]) { + if (!del_timer(&x->timeout)) + return -ETIME; + + x->timeout.expires = jiffies + + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ; + add_timer(&x->timeout); + } + return 0; } static const struct nla_policy exp_nat_nla_policy[CTA_EXPECT_NAT_MAX+1] = { |