Commit d3f2d0a2 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: h323: merge nat hook pointers into one

sparse complains about incorrect rcu usage.

Code uses the correct rcu access primitives, but the function pointers
lack rcu annotations.

Collapse all of them into a single structure, then annotate the pointer.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent e14575fa
...@@ -38,60 +38,63 @@ void nf_conntrack_h245_expect(struct nf_conn *new, ...@@ -38,60 +38,63 @@ void nf_conntrack_h245_expect(struct nf_conn *new,
struct nf_conntrack_expect *this); struct nf_conntrack_expect *this);
void nf_conntrack_q931_expect(struct nf_conn *new, void nf_conntrack_q931_expect(struct nf_conn *new,
struct nf_conntrack_expect *this); struct nf_conntrack_expect *this);
extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff,
unsigned char **data, int dataoff, struct nfct_h323_nat_hooks {
H245_TransportAddress *taddr, int (*set_h245_addr)(struct sk_buff *skb, unsigned int protoff,
union nf_inet_addr *addr,
__be16 port);
extern int (*set_h225_addr_hook) (struct sk_buff *skb, unsigned int protoff,
unsigned char **data, int dataoff,
TransportAddress *taddr,
union nf_inet_addr *addr,
__be16 port);
extern int (*set_sig_addr_hook) (struct sk_buff *skb,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff, unsigned char **data,
TransportAddress *taddr, int count);
extern int (*set_ras_addr_hook) (struct sk_buff *skb,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff, unsigned char **data,
TransportAddress *taddr, int count);
extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff, unsigned char **data,
int dataoff,
H245_TransportAddress *taddr,
__be16 port, __be16 rtp_port,
struct nf_conntrack_expect *rtp_exp,
struct nf_conntrack_expect *rtcp_exp);
extern int (*nat_t120_hook) (struct sk_buff *skb, struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff,
unsigned char **data, int dataoff, unsigned char **data, int dataoff,
H245_TransportAddress *taddr, __be16 port, H245_TransportAddress *taddr,
struct nf_conntrack_expect *exp); union nf_inet_addr *addr, __be16 port);
extern int (*nat_h245_hook) (struct sk_buff *skb, struct nf_conn *ct, int (*set_h225_addr)(struct sk_buff *skb, unsigned int protoff,
enum ip_conntrack_info ctinfo,
unsigned int protoff,
unsigned char **data, int dataoff, unsigned char **data, int dataoff,
TransportAddress *taddr, __be16 port, TransportAddress *taddr,
struct nf_conntrack_expect *exp); union nf_inet_addr *addr, __be16 port);
extern int (*nat_callforwarding_hook) (struct sk_buff *skb, int (*set_sig_addr)(struct sk_buff *skb,
struct nf_conn *ct, struct nf_conn *ct,
enum ip_conntrack_info ctinfo, enum ip_conntrack_info ctinfo,
unsigned int protoff, unsigned int protoff, unsigned char **data,
unsigned char **data, int dataoff, TransportAddress *taddr, int count);
TransportAddress *taddr, int (*set_ras_addr)(struct sk_buff *skb,
__be16 port, struct nf_conn *ct,
struct nf_conntrack_expect *exp); enum ip_conntrack_info ctinfo,
extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct, unsigned int protoff, unsigned char **data,
enum ip_conntrack_info ctinfo, TransportAddress *taddr, int count);
unsigned int protoff, int (*nat_rtp_rtcp)(struct sk_buff *skb,
unsigned char **data, TransportAddress *taddr, struct nf_conn *ct,
int idx, __be16 port, enum ip_conntrack_info ctinfo,
struct nf_conntrack_expect *exp); unsigned int protoff,
unsigned char **data, int dataoff,
H245_TransportAddress *taddr,
__be16 port, __be16 rtp_port,
struct nf_conntrack_expect *rtp_exp,
struct nf_conntrack_expect *rtcp_exp);
int (*nat_t120)(struct sk_buff *skb,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff,
unsigned char **data, int dataoff,
H245_TransportAddress *taddr, __be16 port,
struct nf_conntrack_expect *exp);
int (*nat_h245)(struct sk_buff *skb,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff,
unsigned char **data, int dataoff,
TransportAddress *taddr, __be16 port,
struct nf_conntrack_expect *exp);
int (*nat_callforwarding)(struct sk_buff *skb,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff,
unsigned char **data, int dataoff,
TransportAddress *taddr, __be16 port,
struct nf_conntrack_expect *exp);
int (*nat_q931)(struct sk_buff *skb,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff,
unsigned char **data, TransportAddress *taddr, int idx,
__be16 port, struct nf_conntrack_expect *exp);
};
extern const struct nfct_h323_nat_hooks __rcu *nfct_h323_nat_hook;
#endif #endif
...@@ -579,28 +579,22 @@ static struct nf_ct_helper_expectfn callforwarding_nat = { ...@@ -579,28 +579,22 @@ static struct nf_ct_helper_expectfn callforwarding_nat = {
.expectfn = ip_nat_callforwarding_expect, .expectfn = ip_nat_callforwarding_expect,
}; };
static const struct nfct_h323_nat_hooks nathooks = {
.set_h245_addr = set_h245_addr,
.set_h225_addr = set_h225_addr,
.set_sig_addr = set_sig_addr,
.set_ras_addr = set_ras_addr,
.nat_rtp_rtcp = nat_rtp_rtcp,
.nat_t120 = nat_t120,
.nat_h245 = nat_h245,
.nat_callforwarding = nat_callforwarding,
.nat_q931 = nat_q931,
};
/****************************************************************************/ /****************************************************************************/
static int __init nf_nat_h323_init(void) static int __init nf_nat_h323_init(void)
{ {
BUG_ON(set_h245_addr_hook != NULL); RCU_INIT_POINTER(nfct_h323_nat_hook, &nathooks);
BUG_ON(set_h225_addr_hook != NULL);
BUG_ON(set_sig_addr_hook != NULL);
BUG_ON(set_ras_addr_hook != NULL);
BUG_ON(nat_rtp_rtcp_hook != NULL);
BUG_ON(nat_t120_hook != NULL);
BUG_ON(nat_h245_hook != NULL);
BUG_ON(nat_callforwarding_hook != NULL);
BUG_ON(nat_q931_hook != NULL);
RCU_INIT_POINTER(set_h245_addr_hook, set_h245_addr);
RCU_INIT_POINTER(set_h225_addr_hook, set_h225_addr);
RCU_INIT_POINTER(set_sig_addr_hook, set_sig_addr);
RCU_INIT_POINTER(set_ras_addr_hook, set_ras_addr);
RCU_INIT_POINTER(nat_rtp_rtcp_hook, nat_rtp_rtcp);
RCU_INIT_POINTER(nat_t120_hook, nat_t120);
RCU_INIT_POINTER(nat_h245_hook, nat_h245);
RCU_INIT_POINTER(nat_callforwarding_hook, nat_callforwarding);
RCU_INIT_POINTER(nat_q931_hook, nat_q931);
nf_ct_helper_expectfn_register(&q931_nat); nf_ct_helper_expectfn_register(&q931_nat);
nf_ct_helper_expectfn_register(&callforwarding_nat); nf_ct_helper_expectfn_register(&callforwarding_nat);
return 0; return 0;
...@@ -609,15 +603,7 @@ static int __init nf_nat_h323_init(void) ...@@ -609,15 +603,7 @@ static int __init nf_nat_h323_init(void)
/****************************************************************************/ /****************************************************************************/
static void __exit nf_nat_h323_fini(void) static void __exit nf_nat_h323_fini(void)
{ {
RCU_INIT_POINTER(set_h245_addr_hook, NULL); RCU_INIT_POINTER(nfct_h323_nat_hook, NULL);
RCU_INIT_POINTER(set_h225_addr_hook, NULL);
RCU_INIT_POINTER(set_sig_addr_hook, NULL);
RCU_INIT_POINTER(set_ras_addr_hook, NULL);
RCU_INIT_POINTER(nat_rtp_rtcp_hook, NULL);
RCU_INIT_POINTER(nat_t120_hook, NULL);
RCU_INIT_POINTER(nat_h245_hook, NULL);
RCU_INIT_POINTER(nat_callforwarding_hook, NULL);
RCU_INIT_POINTER(nat_q931_hook, NULL);
nf_ct_helper_expectfn_unregister(&q931_nat); nf_ct_helper_expectfn_unregister(&q931_nat);
nf_ct_helper_expectfn_unregister(&callforwarding_nat); nf_ct_helper_expectfn_unregister(&callforwarding_nat);
synchronize_rcu(); synchronize_rcu();
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment