| @@ -22,12 +22,8 @@ · 21 unmodified lines |
| 22 | 22 | #include <net/netfilter/nf_conntrack_l4proto.h> |
| 23 | 23 | #include <net/netfilter/nf_conntrack_timeout.h> |
| 24 | 24 | |
| 25 | | −struct nf_ct_timeout * |
| 26 | | −(*nf_ct_timeout_find_get_hook)(struct net *net, const char *name) __read_mostly; |
| 27 | | −EXPORT_SYMBOL_GPL(nf_ct_timeout_find_get_hook); |
| 28 | | − |
| 29 | | −void (*nf_ct_timeout_put_hook)(struct nf_ct_timeout *timeout) __read_mostly; |
| 30 | | −EXPORT_SYMBOL_GPL(nf_ct_timeout_put_hook); |
| 25 | +const struct nf_ct_timeout_hooks *nf_ct_timeout_hook __read_mostly; |
| 26 | +EXPORT_SYMBOL_GPL(nf_ct_timeout_hook); |
| 31 | 27 | |
| 32 | 28 | static int untimeout(struct nf_conn *ct, void *timeout) |
| 33 | 29 | { |
| @@ -48,31 +44,30 @@ EXPORT_SYMBOL_GPL(nf_ct_untimeout); · 14 unmodified lines |
| 48 | 44 | |
| 49 | 45 | static void __nf_ct_timeout_put(struct nf_ct_timeout *timeout) |
| 50 | 46 | { |
| 51 | | − typeof(nf_ct_timeout_put_hook) timeout_put; |
| 47 | + const struct nf_ct_timeout_hooks *h = rcu_dereference(nf_ct_timeout_hook); |
| 52 | 48 | |
| 53 | | − timeout_put = rcu_dereference(nf_ct_timeout_put_hook); |
| 54 | | − if (timeout_put) |
| 55 | | − timeout_put(timeout); |
| 49 | + if (h) |
| 50 | + h->timeout_put(timeout); |
| 56 | 51 | } |
| 57 | 52 | |
| 58 | 53 | int nf_ct_set_timeout(struct net *net, struct nf_conn *ct, |
| 59 | 54 | u8 l3num, u8 l4num, const char *timeout_name) |
| 60 | 55 | { |
| 61 | | − typeof(nf_ct_timeout_find_get_hook) timeout_find_get; |
| 56 | + const struct nf_ct_timeout_hooks *h; |
| 62 | 57 | struct nf_ct_timeout *timeout; |
| 63 | 58 | struct nf_conn_timeout *timeout_ext; |
| 64 | 59 | const char *errmsg = NULL; |
| 65 | 60 | int ret = 0; |
| 66 | 61 | |
| 67 | 62 | rcu_read_lock(); |
| 68 | | − timeout_find_get = rcu_dereference(nf_ct_timeout_find_get_hook); |
| 69 | | − if (!timeout_find_get) { |
| 63 | + h = rcu_dereference(nf_ct_timeout_hook); |
| 64 | + if (!h) { |
| 70 | 65 | ret = -ENOENT; |
| 71 | 66 | errmsg = "Timeout policy base is empty"; |
| 72 | 67 | goto out; |
| 73 | 68 | } |
| 74 | 69 | |
| 75 | | − timeout = timeout_find_get(net, timeout_name); |
| 70 | + timeout = h->timeout_find_get(net, timeout_name); |
| 76 | 71 | if (!timeout) { |
| 77 | 72 | ret = -ENOENT; |
| 78 | 73 | pr_info_ratelimited("No such timeout policy \"%s\"\n", |
| @@ -119,15 +114,15 @@ EXPORT_SYMBOL_GPL(nf_ct_set_timeout); · 40 unmodified lines |
| 119 | 114 | void nf_ct_destroy_timeout(struct nf_conn *ct) |
| 120 | 115 | { |
| 121 | 116 | struct nf_conn_timeout *timeout_ext; |
| 122 | | − typeof(nf_ct_timeout_put_hook) timeout_put; |
| 117 | + const struct nf_ct_timeout_hooks *h; |
| 123 | 118 | |
| 124 | 119 | rcu_read_lock(); |
| 125 | | − timeout_put = rcu_dereference(nf_ct_timeout_put_hook); |
| 120 | + h = rcu_dereference(nf_ct_timeout_hook); |
| 126 | 121 | |
| 127 | | − if (timeout_put) { |
| 122 | + if (h) { |
| 128 | 123 | timeout_ext = nf_ct_timeout_find(ct); |
| 129 | 124 | if (timeout_ext) { |
| 130 | | − timeout_put(timeout_ext->timeout); |
| 125 | + h->timeout_put(timeout_ext->timeout); |
| 131 | 126 | RCU_INIT_POINTER(timeout_ext->timeout, NULL); |
| 132 | 127 | } |
| 133 | 128 | } |