]> err.no Git - linux-2.6/blobdiff - net/netfilter/nf_conntrack_h323_main.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6] / net / netfilter / nf_conntrack_h323_main.c
index f23fd9598e199d3b6be8cada071222db7b6a61ee..95da1a24aab786e31eecd1a983a67faa81b44de0 100644 (file)
@@ -50,12 +50,12 @@ MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations "
 int (*set_h245_addr_hook) (struct sk_buff *skb,
                           unsigned char **data, int dataoff,
                           H245_TransportAddress *taddr,
-                          union nf_conntrack_address *addr, __be16 port)
+                          union nf_inet_addr *addr, __be16 port)
                           __read_mostly;
 int (*set_h225_addr_hook) (struct sk_buff *skb,
                           unsigned char **data, int dataoff,
                           TransportAddress *taddr,
-                          union nf_conntrack_address *addr, __be16 port)
+                          union nf_inet_addr *addr, __be16 port)
                           __read_mostly;
 int (*set_sig_addr_hook) (struct sk_buff *skb,
                          struct nf_conn *ct,
@@ -114,7 +114,8 @@ static int get_tpkt_data(struct sk_buff *skb, unsigned int protoff,
 {
        struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
        int dir = CTINFO2DIR(ctinfo);
-       struct tcphdr _tcph, *th;
+       const struct tcphdr *th;
+       struct tcphdr _tcph;
        int tcpdatalen;
        int tcpdataoff;
        unsigned char *tpkt;
@@ -212,12 +213,11 @@ static int get_tpkt_data(struct sk_buff *skb, unsigned int protoff,
 }
 
 /****************************************************************************/
-static int get_h245_addr(struct nf_conn *ct, unsigned char *data,
+static int get_h245_addr(struct nf_conn *ct, const unsigned char *data,
                         H245_TransportAddress *taddr,
-                        union nf_conntrack_address *addr, __be16 *port)
+                        union nf_inet_addr *addr, __be16 *port)
 {
-       unsigned char *p;
-       int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
+       const unsigned char *p;
        int len;
 
        if (taddr->choice != eH245_TransportAddress_unicastAddress)
@@ -225,13 +225,13 @@ static int get_h245_addr(struct nf_conn *ct, unsigned char *data,
 
        switch (taddr->unicastAddress.choice) {
        case eUnicastAddress_iPAddress:
-               if (family != AF_INET)
+               if (nf_ct_l3num(ct) != AF_INET)
                        return 0;
                p = data + taddr->unicastAddress.iPAddress.network;
                len = 4;
                break;
        case eUnicastAddress_iP6Address:
-               if (family != AF_INET6)
+               if (nf_ct_l3num(ct) != AF_INET6)
                        return 0;
                p = data + taddr->unicastAddress.iP6Address.network;
                len = 16;
@@ -257,7 +257,7 @@ static int expect_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
        int ret = 0;
        __be16 port;
        __be16 rtp_port, rtcp_port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        struct nf_conntrack_expect *rtp_exp;
        struct nf_conntrack_expect *rtcp_exp;
        typeof(nat_rtp_rtcp_hook) nat_rtp_rtcp;
@@ -276,7 +276,7 @@ static int expect_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
        /* Create expect for RTP */
        if ((rtp_exp = nf_ct_expect_alloc(ct)) == NULL)
                return -1;
-       nf_ct_expect_init(rtp_exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(rtp_exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          &ct->tuplehash[!dir].tuple.src.u3,
                          &ct->tuplehash[!dir].tuple.dst.u3,
                          IPPROTO_UDP, NULL, &rtp_port);
@@ -286,7 +286,7 @@ static int expect_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
                nf_ct_expect_put(rtp_exp);
                return -1;
        }
-       nf_ct_expect_init(rtcp_exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(rtcp_exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          &ct->tuplehash[!dir].tuple.src.u3,
                          &ct->tuplehash[!dir].tuple.dst.u3,
                          IPPROTO_UDP, NULL, &rtcp_port);
@@ -303,9 +303,9 @@ static int expect_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
                if (nf_ct_expect_related(rtp_exp) == 0) {
                        if (nf_ct_expect_related(rtcp_exp) == 0) {
                                pr_debug("nf_ct_h323: expect RTP ");
-                               NF_CT_DUMP_TUPLE(&rtp_exp->tuple);
+                               nf_ct_dump_tuple(&rtp_exp->tuple);
                                pr_debug("nf_ct_h323: expect RTCP ");
-                               NF_CT_DUMP_TUPLE(&rtcp_exp->tuple);
+                               nf_ct_dump_tuple(&rtcp_exp->tuple);
                        } else {
                                nf_ct_unexpect_related(rtp_exp);
                                ret = -1;
@@ -330,7 +330,7 @@ static int expect_t120(struct sk_buff *skb,
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        struct nf_conntrack_expect *exp;
        typeof(nat_t120_hook) nat_t120;
 
@@ -343,7 +343,7 @@ static int expect_t120(struct sk_buff *skb,
        /* Create expect for T.120 connections */
        if ((exp = nf_ct_expect_alloc(ct)) == NULL)
                return -1;
-       nf_ct_expect_init(exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          &ct->tuplehash[!dir].tuple.src.u3,
                          &ct->tuplehash[!dir].tuple.dst.u3,
                          IPPROTO_TCP, NULL, &port);
@@ -360,7 +360,7 @@ static int expect_t120(struct sk_buff *skb,
        } else {                /* Conntrack only */
                if (nf_ct_expect_related(exp) == 0) {
                        pr_debug("nf_ct_h323: expect T.120 ");
-                       NF_CT_DUMP_TUPLE(&exp->tuple);
+                       nf_ct_dump_tuple(&exp->tuple);
                } else
                        ret = -1;
        }
@@ -582,7 +582,7 @@ static int h245_help(struct sk_buff *skb, unsigned int protoff,
        while (get_tpkt_data(skb, protoff, ct, ctinfo,
                             &data, &datalen, &dataoff)) {
                pr_debug("nf_ct_h245: TPKT len=%d ", datalen);
-               NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
+               nf_ct_dump_tuple(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
 
                /* Decode H.245 signal */
                ret = DecodeMultimediaSystemControlMessage(data, datalen,
@@ -611,33 +611,36 @@ static int h245_help(struct sk_buff *skb, unsigned int protoff,
 }
 
 /****************************************************************************/
+static const struct nf_conntrack_expect_policy h245_exp_policy = {
+       .max_expected   = H323_RTP_CHANNEL_MAX * 4 + 2 /* T.120 */,
+       .timeout        = 240,
+};
+
 static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = {
        .name                   = "H.245",
        .me                     = THIS_MODULE,
-       .max_expected           = H323_RTP_CHANNEL_MAX * 4 + 2 /* T.120 */,
-       .timeout                = 240,
        .tuple.dst.protonum     = IPPROTO_UDP,
-       .help                   = h245_help
+       .help                   = h245_help,
+       .expect_policy          = &h245_exp_policy,
 };
 
 /****************************************************************************/
 int get_h225_addr(struct nf_conn *ct, unsigned char *data,
                  TransportAddress *taddr,
-                 union nf_conntrack_address *addr, __be16 *port)
+                 union nf_inet_addr *addr, __be16 *port)
 {
-       unsigned char *p;
-       int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
+       const unsigned char *p;
        int len;
 
        switch (taddr->choice) {
        case eTransportAddress_ipAddress:
-               if (family != AF_INET)
+               if (nf_ct_l3num(ct) != AF_INET)
                        return 0;
                p = data + taddr->ipAddress.ip;
                len = 4;
                break;
        case eTransportAddress_ip6Address:
-               if (family != AF_INET6)
+               if (nf_ct_l3num(ct) != AF_INET6)
                        return 0;
                p = data + taddr->ip6Address.ip;
                len = 16;
@@ -662,7 +665,7 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        struct nf_conntrack_expect *exp;
        typeof(nat_h245_hook) nat_h245;
 
@@ -675,7 +678,7 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
        /* Create expect for h245 connection */
        if ((exp = nf_ct_expect_alloc(ct)) == NULL)
                return -1;
-       nf_ct_expect_init(exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          &ct->tuplehash[!dir].tuple.src.u3,
                          &ct->tuplehash[!dir].tuple.dst.u3,
                          IPPROTO_TCP, NULL, &port);
@@ -692,7 +695,7 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
        } else {                /* Conntrack only */
                if (nf_ct_expect_related(exp) == 0) {
                        pr_debug("nf_ct_q931: expect H.245 ");
-                       NF_CT_DUMP_TUPLE(&exp->tuple);
+                       nf_ct_dump_tuple(&exp->tuple);
                } else
                        ret = -1;
        }
@@ -704,13 +707,18 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
 
 /* If the calling party is on the same side of the forward-to party,
  * we don't need to track the second call */
-static int callforward_do_filter(union nf_conntrack_address *src,
-                                union nf_conntrack_address *dst,
-                                int family)
+static int callforward_do_filter(const union nf_inet_addr *src,
+                                 const union nf_inet_addr *dst, int family)
 {
+       const struct nf_afinfo *afinfo;
        struct flowi fl1, fl2;
        int ret = 0;
 
+       /* rcu_read_lock()ed by nf_hook_slow() */
+       afinfo = nf_get_afinfo(family);
+       if (!afinfo)
+               return 0;
+
        memset(&fl1, 0, sizeof(fl1));
        memset(&fl2, 0, sizeof(fl2));
 
@@ -720,8 +728,8 @@ static int callforward_do_filter(union nf_conntrack_address *src,
 
                fl1.fl4_dst = src->ip;
                fl2.fl4_dst = dst->ip;
-               if (ip_route_output_key(&rt1, &fl1) == 0) {
-                       if (ip_route_output_key(&rt2, &fl2) == 0) {
+               if (!afinfo->route((struct dst_entry **)&rt1, &fl1)) {
+                       if (!afinfo->route((struct dst_entry **)&rt2, &fl2)) {
                                if (rt1->rt_gateway == rt2->rt_gateway &&
                                    rt1->u.dst.dev  == rt2->u.dst.dev)
                                        ret = 1;
@@ -731,16 +739,15 @@ static int callforward_do_filter(union nf_conntrack_address *src,
                }
                break;
        }
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+#if defined(CONFIG_NF_CONNTRACK_IPV6) || \
+    defined(CONFIG_NF_CONNTRACK_IPV6_MODULE)
        case AF_INET6: {
                struct rt6_info *rt1, *rt2;
 
                memcpy(&fl1.fl6_dst, src, sizeof(fl1.fl6_dst));
                memcpy(&fl2.fl6_dst, dst, sizeof(fl2.fl6_dst));
-               rt1 = (struct rt6_info *)ip6_route_output(NULL, &fl1);
-               if (rt1) {
-                       rt2 = (struct rt6_info *)ip6_route_output(NULL, &fl2);
-                       if (rt2) {
+               if (!afinfo->route((struct dst_entry **)&rt1, &fl1)) {
+                       if (!afinfo->route((struct dst_entry **)&rt2, &fl2)) {
                                if (!memcmp(&rt1->rt6i_gateway, &rt2->rt6i_gateway,
                                            sizeof(rt1->rt6i_gateway)) &&
                                    rt1->u.dst.dev == rt2->u.dst.dev)
@@ -767,7 +774,7 @@ static int expect_callforwarding(struct sk_buff *skb,
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        struct nf_conntrack_expect *exp;
        typeof(nat_callforwarding_hook) nat_callforwarding;
 
@@ -779,7 +786,7 @@ static int expect_callforwarding(struct sk_buff *skb,
         * we don't need to track the second call */
        if (callforward_filter &&
            callforward_do_filter(&addr, &ct->tuplehash[!dir].tuple.src.u3,
-                                 ct->tuplehash[!dir].tuple.src.l3num)) {
+                                 nf_ct_l3num(ct))) {
                pr_debug("nf_ct_q931: Call Forwarding not tracked\n");
                return 0;
        }
@@ -787,7 +794,7 @@ static int expect_callforwarding(struct sk_buff *skb,
        /* Create expect for the second call leg */
        if ((exp = nf_ct_expect_alloc(ct)) == NULL)
                return -1;
-       nf_ct_expect_init(exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          &ct->tuplehash[!dir].tuple.src.u3, &addr,
                          IPPROTO_TCP, NULL, &port);
        exp->helper = nf_conntrack_helper_q931;
@@ -803,7 +810,7 @@ static int expect_callforwarding(struct sk_buff *skb,
        } else {                /* Conntrack only */
                if (nf_ct_expect_related(exp) == 0) {
                        pr_debug("nf_ct_q931: expect Call Forwarding ");
-                       NF_CT_DUMP_TUPLE(&exp->tuple);
+                       nf_ct_dump_tuple(&exp->tuple);
                } else
                        ret = -1;
        }
@@ -823,7 +830,7 @@ static int process_setup(struct sk_buff *skb, struct nf_conn *ct,
        int ret;
        int i;
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        typeof(set_h225_addr_hook) set_h225_addr;
 
        pr_debug("nf_ct_q931: Setup\n");
@@ -837,7 +844,7 @@ static int process_setup(struct sk_buff *skb, struct nf_conn *ct,
 
        set_h225_addr = rcu_dereference(set_h225_addr_hook);
        if ((setup->options & eSetup_UUIE_destCallSignalAddress) &&
-           (set_h225_addr) && ct->status && IPS_NAT_MASK &&
+           (set_h225_addr) && ct->status & IPS_NAT_MASK &&
            get_h225_addr(ct, *data, &setup->destCallSignalAddress,
                          &addr, &port) &&
            memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) {
@@ -1123,7 +1130,7 @@ static int q931_help(struct sk_buff *skb, unsigned int protoff,
        while (get_tpkt_data(skb, protoff, ct, ctinfo,
                             &data, &datalen, &dataoff)) {
                pr_debug("nf_ct_q931: TPKT len=%d ", datalen);
-               NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
+               nf_ct_dump_tuple(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
 
                /* Decode Q.931 signal */
                ret = DecodeQ931(data, datalen, &q931);
@@ -1151,28 +1158,30 @@ static int q931_help(struct sk_buff *skb, unsigned int protoff,
 }
 
 /****************************************************************************/
+static const struct nf_conntrack_expect_policy q931_exp_policy = {
+       /* T.120 and H.245 */
+       .max_expected           = H323_RTP_CHANNEL_MAX * 4 + 4,
+       .timeout                = 240,
+};
+
 static struct nf_conntrack_helper nf_conntrack_helper_q931[] __read_mostly = {
        {
                .name                   = "Q.931",
                .me                     = THIS_MODULE,
-                                         /* T.120 and H.245 */
-               .max_expected           = H323_RTP_CHANNEL_MAX * 4 + 4,
-               .timeout                = 240,
                .tuple.src.l3num        = AF_INET,
                .tuple.src.u.tcp.port   = __constant_htons(Q931_PORT),
                .tuple.dst.protonum     = IPPROTO_TCP,
-               .help                   = q931_help
+               .help                   = q931_help,
+               .expect_policy          = &q931_exp_policy,
        },
        {
                .name                   = "Q.931",
                .me                     = THIS_MODULE,
-                                         /* T.120 and H.245 */
-               .max_expected           = H323_RTP_CHANNEL_MAX * 4 + 4,
-               .timeout                = 240,
                .tuple.src.l3num        = AF_INET6,
                .tuple.src.u.tcp.port   = __constant_htons(Q931_PORT),
                .tuple.dst.protonum     = IPPROTO_TCP,
-               .help                   = q931_help
+               .help                   = q931_help,
+               .expect_policy          = &q931_exp_policy,
        },
 };
 
@@ -1180,7 +1189,8 @@ static struct nf_conntrack_helper nf_conntrack_helper_q931[] __read_mostly = {
 static unsigned char *get_udp_data(struct sk_buff *skb, unsigned int protoff,
                                   int *datalen)
 {
-       struct udphdr _uh, *uh;
+       const struct udphdr *uh;
+       struct udphdr _uh;
        int dataoff;
 
        uh = skb_header_pointer(skb, protoff, sizeof(_uh), &_uh);
@@ -1195,7 +1205,7 @@ static unsigned char *get_udp_data(struct sk_buff *skb, unsigned int protoff,
 
 /****************************************************************************/
 static struct nf_conntrack_expect *find_expect(struct nf_conn *ct,
-                                              union nf_conntrack_address *addr,
+                                              union nf_inet_addr *addr,
                                               __be16 port)
 {
        struct nf_conntrack_expect *exp;
@@ -1237,7 +1247,7 @@ static int expect_q931(struct sk_buff *skb, struct nf_conn *ct,
        int ret = 0;
        int i;
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        struct nf_conntrack_expect *exp;
        typeof(nat_q931_hook) nat_q931;
 
@@ -1255,7 +1265,7 @@ static int expect_q931(struct sk_buff *skb, struct nf_conn *ct,
        /* Create expect for Q.931 */
        if ((exp = nf_ct_expect_alloc(ct)) == NULL)
                return -1;
-       nf_ct_expect_init(exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          gkrouted_only ? /* only accept calls from GK? */
                                &ct->tuplehash[!dir].tuple.src.u3 : NULL,
                          &ct->tuplehash[!dir].tuple.dst.u3,
@@ -1269,7 +1279,7 @@ static int expect_q931(struct sk_buff *skb, struct nf_conn *ct,
        } else {                /* Conntrack only */
                if (nf_ct_expect_related(exp) == 0) {
                        pr_debug("nf_ct_ras: expect Q.931 ");
-                       NF_CT_DUMP_TUPLE(&exp->tuple);
+                       nf_ct_dump_tuple(&exp->tuple);
 
                        /* Save port for looking up expect in processing RCF */
                        info->sig_port[dir] = port;
@@ -1306,7 +1316,7 @@ static int process_gcf(struct sk_buff *skb, struct nf_conn *ct,
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        struct nf_conntrack_expect *exp;
 
        pr_debug("nf_ct_ras: GCF\n");
@@ -1326,14 +1336,14 @@ static int process_gcf(struct sk_buff *skb, struct nf_conn *ct,
        /* Need new expect */
        if ((exp = nf_ct_expect_alloc(ct)) == NULL)
                return -1;
-       nf_ct_expect_init(exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          &ct->tuplehash[!dir].tuple.src.u3, &addr,
                          IPPROTO_UDP, NULL, &port);
        exp->helper = nf_conntrack_helper_ras;
 
        if (nf_ct_expect_related(exp) == 0) {
                pr_debug("nf_ct_ras: expect RAS ");
-               NF_CT_DUMP_TUPLE(&exp->tuple);
+               nf_ct_dump_tuple(&exp->tuple);
        } else
                ret = -1;
 
@@ -1410,17 +1420,17 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct,
                nf_ct_refresh(ct, skb, info->timeout * HZ);
 
                /* Set expect timeout */
-               read_lock_bh(&nf_conntrack_lock);
+               spin_lock_bh(&nf_conntrack_lock);
                exp = find_expect(ct, &ct->tuplehash[dir].tuple.dst.u3,
                                  info->sig_port[!dir]);
                if (exp) {
                        pr_debug("nf_ct_ras: set Q.931 expect "
                                 "timeout to %u seconds for",
                                 info->timeout);
-                       NF_CT_DUMP_TUPLE(&exp->tuple);
+                       nf_ct_dump_tuple(&exp->tuple);
                        set_expect_timeout(exp, info->timeout);
                }
-               read_unlock_bh(&nf_conntrack_lock);
+               spin_unlock_bh(&nf_conntrack_lock);
        }
 
        return 0;
@@ -1463,10 +1473,10 @@ static int process_arq(struct sk_buff *skb, struct nf_conn *ct,
                       enum ip_conntrack_info ctinfo,
                       unsigned char **data, AdmissionRequest *arq)
 {
-       struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
+       const struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
        int dir = CTINFO2DIR(ctinfo);
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        typeof(set_h225_addr_hook) set_h225_addr;
 
        pr_debug("nf_ct_ras: ARQ\n");
@@ -1508,7 +1518,7 @@ static int process_acf(struct sk_buff *skb, struct nf_conn *ct,
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        struct nf_conntrack_expect *exp;
        typeof(set_sig_addr_hook) set_sig_addr;
 
@@ -1530,7 +1540,7 @@ static int process_acf(struct sk_buff *skb, struct nf_conn *ct,
        /* Need new expect */
        if ((exp = nf_ct_expect_alloc(ct)) == NULL)
                return -1;
-       nf_ct_expect_init(exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          &ct->tuplehash[!dir].tuple.src.u3, &addr,
                          IPPROTO_TCP, NULL, &port);
        exp->flags = NF_CT_EXPECT_PERMANENT;
@@ -1538,7 +1548,7 @@ static int process_acf(struct sk_buff *skb, struct nf_conn *ct,
 
        if (nf_ct_expect_related(exp) == 0) {
                pr_debug("nf_ct_ras: expect Q.931 ");
-               NF_CT_DUMP_TUPLE(&exp->tuple);
+               nf_ct_dump_tuple(&exp->tuple);
        } else
                ret = -1;
 
@@ -1571,7 +1581,7 @@ static int process_lcf(struct sk_buff *skb, struct nf_conn *ct,
        int dir = CTINFO2DIR(ctinfo);
        int ret = 0;
        __be16 port;
-       union nf_conntrack_address addr;
+       union nf_inet_addr addr;
        struct nf_conntrack_expect *exp;
 
        pr_debug("nf_ct_ras: LCF\n");
@@ -1583,7 +1593,7 @@ static int process_lcf(struct sk_buff *skb, struct nf_conn *ct,
        /* Need new expect for call signal */
        if ((exp = nf_ct_expect_alloc(ct)) == NULL)
                return -1;
-       nf_ct_expect_init(exp, ct->tuplehash[!dir].tuple.src.l3num,
+       nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
                          &ct->tuplehash[!dir].tuple.src.u3, &addr,
                          IPPROTO_TCP, NULL, &port);
        exp->flags = NF_CT_EXPECT_PERMANENT;
@@ -1591,7 +1601,7 @@ static int process_lcf(struct sk_buff *skb, struct nf_conn *ct,
 
        if (nf_ct_expect_related(exp) == 0) {
                pr_debug("nf_ct_ras: expect Q.931 ");
-               NF_CT_DUMP_TUPLE(&exp->tuple);
+               nf_ct_dump_tuple(&exp->tuple);
        } else
                ret = -1;
 
@@ -1695,7 +1705,7 @@ static int ras_help(struct sk_buff *skb, unsigned int protoff,
        if (data == NULL)
                goto accept;
        pr_debug("nf_ct_ras: RAS message len=%d ", datalen);
-       NF_CT_DUMP_TUPLE(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
+       nf_ct_dump_tuple(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
 
        /* Decode RAS message */
        ret = DecodeRasMessage(data, datalen, &ras);
@@ -1722,26 +1732,29 @@ static int ras_help(struct sk_buff *skb, unsigned int protoff,
 }
 
 /****************************************************************************/
+static const struct nf_conntrack_expect_policy ras_exp_policy = {
+       .max_expected           = 32,
+       .timeout                = 240,
+};
+
 static struct nf_conntrack_helper nf_conntrack_helper_ras[] __read_mostly = {
        {
                .name                   = "RAS",
                .me                     = THIS_MODULE,
-               .max_expected           = 32,
-               .timeout                = 240,
                .tuple.src.l3num        = AF_INET,
                .tuple.src.u.udp.port   = __constant_htons(RAS_PORT),
                .tuple.dst.protonum     = IPPROTO_UDP,
                .help                   = ras_help,
+               .expect_policy          = &ras_exp_policy,
        },
        {
                .name                   = "RAS",
                .me                     = THIS_MODULE,
-               .max_expected           = 32,
-               .timeout                = 240,
                .tuple.src.l3num        = AF_INET6,
                .tuple.src.u.udp.port   = __constant_htons(RAS_PORT),
                .tuple.dst.protonum     = IPPROTO_UDP,
                .help                   = ras_help,
+               .expect_policy          = &ras_exp_policy,
        },
 };