Commit 3c9fba65 authored by Jan Engelhardt's avatar Jan Engelhardt Committed by Patrick McHardy

[NETFILTER]: nf_conntrack: replace NF_CT_DUMP_TUPLE macro indrection by function call

Directly call IPv4 and IPv6 variants where the address family is
easily known.
Signed-off-by: default avatarJan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 12c33aa2
...@@ -151,8 +151,6 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) ...@@ -151,8 +151,6 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t)
} }
} }
#define NF_CT_DUMP_TUPLE(tp) nf_ct_dump_tuple(tp)
/* If we're the first tuple, it's the original dir. */ /* If we're the first tuple, it's the original dir. */
#define NF_CT_DIRECTION(h) \ #define NF_CT_DIRECTION(h) \
((enum ip_conntrack_dir)(h)->tuple.dst.dir) ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
......
...@@ -331,7 +331,7 @@ clusterip_tg(struct sk_buff *skb, const struct net_device *in, ...@@ -331,7 +331,7 @@ clusterip_tg(struct sk_buff *skb, const struct net_device *in,
} }
#ifdef DEBUG #ifdef DEBUG
NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); nf_ct_dump_tuple_ip(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
#endif #endif
pr_debug("hash=%u ct_hash=%u ", hash, ct->mark); pr_debug("hash=%u ct_hash=%u ", hash, ct->mark);
if (!clusterip_responsible(cipinfo->config, hash)) { if (!clusterip_responsible(cipinfo->config, hash)) {
......
...@@ -115,7 +115,7 @@ static bool icmp_new(struct nf_conn *ct, const struct sk_buff *skb, ...@@ -115,7 +115,7 @@ static bool icmp_new(struct nf_conn *ct, const struct sk_buff *skb,
/* Can't create a new ICMP `conn' with this. */ /* Can't create a new ICMP `conn' with this. */
pr_debug("icmp: can't create new conn with type %u\n", pr_debug("icmp: can't create new conn with type %u\n",
ct->tuplehash[0].tuple.dst.u.icmp.type); ct->tuplehash[0].tuple.dst.u.icmp.type);
NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple); nf_ct_dump_tuple_ip(&ct->tuplehash[0].tuple);
return false; return false;
} }
atomic_set(&ct->proto.icmp.count, 0); atomic_set(&ct->proto.icmp.count, 0);
......
...@@ -72,7 +72,7 @@ static void pptp_nat_expected(struct nf_conn *ct, ...@@ -72,7 +72,7 @@ static void pptp_nat_expected(struct nf_conn *ct,
} }
pr_debug("trying to unexpect other dir: "); pr_debug("trying to unexpect other dir: ");
NF_CT_DUMP_TUPLE(&t); nf_ct_dump_tuple_ip(&t);
other_exp = nf_ct_expect_find_get(&t); other_exp = nf_ct_expect_find_get(&t);
if (other_exp) { if (other_exp) {
nf_ct_unexpect_related(other_exp); nf_ct_unexpect_related(other_exp);
......
...@@ -115,7 +115,7 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb, ...@@ -115,7 +115,7 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb,
/* Can't create a new ICMPv6 `conn' with this. */ /* Can't create a new ICMPv6 `conn' with this. */
pr_debug("icmpv6: can't create new conn with type %u\n", pr_debug("icmpv6: can't create new conn with type %u\n",
type + 128); type + 128);
NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple); nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple);
return false; return false;
} }
atomic_set(&ct->proto.icmp.count, 0); atomic_set(&ct->proto.icmp.count, 0);
......
...@@ -763,7 +763,7 @@ void nf_conntrack_alter_reply(struct nf_conn *ct, ...@@ -763,7 +763,7 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); NF_CT_ASSERT(!nf_ct_is_confirmed(ct));
pr_debug("Altering reply tuple of %p to ", ct); pr_debug("Altering reply tuple of %p to ", ct);
NF_CT_DUMP_TUPLE(newreply); nf_ct_dump_tuple(newreply);
ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply; ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
if (ct->master || (help && help->expecting != 0)) if (ct->master || (help && help->expecting != 0))
......
...@@ -303,9 +303,9 @@ static int expect_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct, ...@@ -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(rtp_exp) == 0) {
if (nf_ct_expect_related(rtcp_exp) == 0) { if (nf_ct_expect_related(rtcp_exp) == 0) {
pr_debug("nf_ct_h323: expect RTP "); 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 "); pr_debug("nf_ct_h323: expect RTCP ");
NF_CT_DUMP_TUPLE(&rtcp_exp->tuple); nf_ct_dump_tuple(&rtcp_exp->tuple);
} else { } else {
nf_ct_unexpect_related(rtp_exp); nf_ct_unexpect_related(rtp_exp);
ret = -1; ret = -1;
...@@ -360,7 +360,7 @@ static int expect_t120(struct sk_buff *skb, ...@@ -360,7 +360,7 @@ static int expect_t120(struct sk_buff *skb,
} else { /* Conntrack only */ } else { /* Conntrack only */
if (nf_ct_expect_related(exp) == 0) { if (nf_ct_expect_related(exp) == 0) {
pr_debug("nf_ct_h323: expect T.120 "); pr_debug("nf_ct_h323: expect T.120 ");
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
} else } else
ret = -1; ret = -1;
} }
...@@ -582,7 +582,7 @@ static int h245_help(struct sk_buff *skb, unsigned int protoff, ...@@ -582,7 +582,7 @@ static int h245_help(struct sk_buff *skb, unsigned int protoff,
while (get_tpkt_data(skb, protoff, ct, ctinfo, while (get_tpkt_data(skb, protoff, ct, ctinfo,
&data, &datalen, &dataoff)) { &data, &datalen, &dataoff)) {
pr_debug("nf_ct_h245: TPKT len=%d ", datalen); 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 */ /* Decode H.245 signal */
ret = DecodeMultimediaSystemControlMessage(data, datalen, ret = DecodeMultimediaSystemControlMessage(data, datalen,
...@@ -695,7 +695,7 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct, ...@@ -695,7 +695,7 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
} else { /* Conntrack only */ } else { /* Conntrack only */
if (nf_ct_expect_related(exp) == 0) { if (nf_ct_expect_related(exp) == 0) {
pr_debug("nf_ct_q931: expect H.245 "); pr_debug("nf_ct_q931: expect H.245 ");
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
} else } else
ret = -1; ret = -1;
} }
...@@ -810,7 +810,7 @@ static int expect_callforwarding(struct sk_buff *skb, ...@@ -810,7 +810,7 @@ static int expect_callforwarding(struct sk_buff *skb,
} else { /* Conntrack only */ } else { /* Conntrack only */
if (nf_ct_expect_related(exp) == 0) { if (nf_ct_expect_related(exp) == 0) {
pr_debug("nf_ct_q931: expect Call Forwarding "); pr_debug("nf_ct_q931: expect Call Forwarding ");
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
} else } else
ret = -1; ret = -1;
} }
...@@ -1130,7 +1130,7 @@ static int q931_help(struct sk_buff *skb, unsigned int protoff, ...@@ -1130,7 +1130,7 @@ static int q931_help(struct sk_buff *skb, unsigned int protoff,
while (get_tpkt_data(skb, protoff, ct, ctinfo, while (get_tpkt_data(skb, protoff, ct, ctinfo,
&data, &datalen, &dataoff)) { &data, &datalen, &dataoff)) {
pr_debug("nf_ct_q931: TPKT len=%d ", datalen); 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 */ /* Decode Q.931 signal */
ret = DecodeQ931(data, datalen, &q931); ret = DecodeQ931(data, datalen, &q931);
...@@ -1279,7 +1279,7 @@ static int expect_q931(struct sk_buff *skb, struct nf_conn *ct, ...@@ -1279,7 +1279,7 @@ static int expect_q931(struct sk_buff *skb, struct nf_conn *ct,
} else { /* Conntrack only */ } else { /* Conntrack only */
if (nf_ct_expect_related(exp) == 0) { if (nf_ct_expect_related(exp) == 0) {
pr_debug("nf_ct_ras: expect Q.931 "); 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 */ /* Save port for looking up expect in processing RCF */
info->sig_port[dir] = port; info->sig_port[dir] = port;
...@@ -1343,7 +1343,7 @@ static int process_gcf(struct sk_buff *skb, struct nf_conn *ct, ...@@ -1343,7 +1343,7 @@ static int process_gcf(struct sk_buff *skb, struct nf_conn *ct,
if (nf_ct_expect_related(exp) == 0) { if (nf_ct_expect_related(exp) == 0) {
pr_debug("nf_ct_ras: expect RAS "); pr_debug("nf_ct_ras: expect RAS ");
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
} else } else
ret = -1; ret = -1;
...@@ -1427,7 +1427,7 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct, ...@@ -1427,7 +1427,7 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct,
pr_debug("nf_ct_ras: set Q.931 expect " pr_debug("nf_ct_ras: set Q.931 expect "
"timeout to %u seconds for", "timeout to %u seconds for",
info->timeout); info->timeout);
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
set_expect_timeout(exp, info->timeout); set_expect_timeout(exp, info->timeout);
} }
spin_unlock_bh(&nf_conntrack_lock); spin_unlock_bh(&nf_conntrack_lock);
...@@ -1548,7 +1548,7 @@ static int process_acf(struct sk_buff *skb, struct nf_conn *ct, ...@@ -1548,7 +1548,7 @@ static int process_acf(struct sk_buff *skb, struct nf_conn *ct,
if (nf_ct_expect_related(exp) == 0) { if (nf_ct_expect_related(exp) == 0) {
pr_debug("nf_ct_ras: expect Q.931 "); pr_debug("nf_ct_ras: expect Q.931 ");
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
} else } else
ret = -1; ret = -1;
...@@ -1601,7 +1601,7 @@ static int process_lcf(struct sk_buff *skb, struct nf_conn *ct, ...@@ -1601,7 +1601,7 @@ static int process_lcf(struct sk_buff *skb, struct nf_conn *ct,
if (nf_ct_expect_related(exp) == 0) { if (nf_ct_expect_related(exp) == 0) {
pr_debug("nf_ct_ras: expect Q.931 "); pr_debug("nf_ct_ras: expect Q.931 ");
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
} else } else
ret = -1; ret = -1;
...@@ -1705,7 +1705,7 @@ static int ras_help(struct sk_buff *skb, unsigned int protoff, ...@@ -1705,7 +1705,7 @@ static int ras_help(struct sk_buff *skb, unsigned int protoff,
if (data == NULL) if (data == NULL)
goto accept; goto accept;
pr_debug("nf_ct_ras: RAS message len=%d ", datalen); 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 */ /* Decode RAS message */
ret = DecodeRasMessage(data, datalen, &ras); ret = DecodeRasMessage(data, datalen, &ras);
......
...@@ -119,7 +119,7 @@ static void pptp_expectfn(struct nf_conn *ct, ...@@ -119,7 +119,7 @@ static void pptp_expectfn(struct nf_conn *ct,
/* obviously this tuple inversion only works until you do NAT */ /* obviously this tuple inversion only works until you do NAT */
nf_ct_invert_tuplepr(&inv_t, &exp->tuple); nf_ct_invert_tuplepr(&inv_t, &exp->tuple);
pr_debug("trying to unexpect other dir: "); pr_debug("trying to unexpect other dir: ");
NF_CT_DUMP_TUPLE(&inv_t); nf_ct_dump_tuple(&inv_t);
exp_other = nf_ct_expect_find_get(&inv_t); exp_other = nf_ct_expect_find_get(&inv_t);
if (exp_other) { if (exp_other) {
...@@ -141,7 +141,7 @@ static int destroy_sibling_or_exp(const struct nf_conntrack_tuple *t) ...@@ -141,7 +141,7 @@ static int destroy_sibling_or_exp(const struct nf_conntrack_tuple *t)
struct nf_conn *sibling; struct nf_conn *sibling;
pr_debug("trying to timeout ct or exp for tuple "); pr_debug("trying to timeout ct or exp for tuple ");
NF_CT_DUMP_TUPLE(t); nf_ct_dump_tuple(t);
h = nf_conntrack_find_get(t); h = nf_conntrack_find_get(t);
if (h) { if (h) {
......
...@@ -82,7 +82,7 @@ static __be16 gre_keymap_lookup(struct nf_conntrack_tuple *t) ...@@ -82,7 +82,7 @@ static __be16 gre_keymap_lookup(struct nf_conntrack_tuple *t)
read_unlock_bh(&nf_ct_gre_lock); read_unlock_bh(&nf_ct_gre_lock);
pr_debug("lookup src key 0x%x for ", key); pr_debug("lookup src key 0x%x for ", key);
NF_CT_DUMP_TUPLE(t); nf_ct_dump_tuple(t);
return key; return key;
} }
...@@ -113,7 +113,7 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir, ...@@ -113,7 +113,7 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
*kmp = km; *kmp = km;
pr_debug("adding new entry %p: ", km); pr_debug("adding new entry %p: ", km);
NF_CT_DUMP_TUPLE(&km->tuple); nf_ct_dump_tuple(&km->tuple);
write_lock_bh(&nf_ct_gre_lock); write_lock_bh(&nf_ct_gre_lock);
list_add_tail(&km->list, &gre_keymap_list); list_add_tail(&km->list, &gre_keymap_list);
...@@ -238,7 +238,7 @@ static bool gre_new(struct nf_conn *ct, const struct sk_buff *skb, ...@@ -238,7 +238,7 @@ static bool gre_new(struct nf_conn *ct, const struct sk_buff *skb,
unsigned int dataoff) unsigned int dataoff)
{ {
pr_debug(": "); pr_debug(": ");
NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); nf_ct_dump_tuple(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
/* initialize to sane value. Ideally a conntrack helper /* initialize to sane value. Ideally a conntrack helper
* (e.g. in case of pptp) is increasing them */ * (e.g. in case of pptp) is increasing them */
......
...@@ -505,7 +505,7 @@ static bool tcp_in_window(const struct nf_conn *ct, ...@@ -505,7 +505,7 @@ static bool tcp_in_window(const struct nf_conn *ct,
pr_debug("tcp_in_window: START\n"); pr_debug("tcp_in_window: START\n");
pr_debug("tcp_in_window: "); pr_debug("tcp_in_window: ");
NF_CT_DUMP_TUPLE(tuple); nf_ct_dump_tuple(tuple);
pr_debug("seq=%u ack=%u sack=%u win=%u end=%u\n", pr_debug("seq=%u ack=%u sack=%u win=%u end=%u\n",
seq, ack, sack, win, end); seq, ack, sack, win, end);
pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i "
...@@ -592,7 +592,7 @@ static bool tcp_in_window(const struct nf_conn *ct, ...@@ -592,7 +592,7 @@ static bool tcp_in_window(const struct nf_conn *ct,
seq = end = sender->td_end; seq = end = sender->td_end;
pr_debug("tcp_in_window: "); pr_debug("tcp_in_window: ");
NF_CT_DUMP_TUPLE(tuple); nf_ct_dump_tuple(tuple);
pr_debug("seq=%u ack=%u sack =%u win=%u end=%u\n", pr_debug("seq=%u ack=%u sack =%u win=%u end=%u\n",
seq, ack, sack, win, end); seq, ack, sack, win, end);
pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i "
...@@ -936,7 +936,7 @@ static int tcp_packet(struct nf_conn *ct, ...@@ -936,7 +936,7 @@ static int tcp_packet(struct nf_conn *ct,
ct->proto.tcp.last_dir = dir; ct->proto.tcp.last_dir = dir;
pr_debug("tcp_conntracks: "); pr_debug("tcp_conntracks: ");
NF_CT_DUMP_TUPLE(tuple); nf_ct_dump_tuple(tuple);
pr_debug("syn=%i ack=%i fin=%i rst=%i old=%i new=%i\n", pr_debug("syn=%i ack=%i fin=%i rst=%i old=%i new=%i\n",
(th->syn ? 1 : 0), (th->ack ? 1 : 0), (th->syn ? 1 : 0), (th->ack ? 1 : 0),
(th->fin ? 1 : 0), (th->rst ? 1 : 0), (th->fin ? 1 : 0), (th->rst ? 1 : 0),
......
...@@ -147,7 +147,7 @@ static int help(struct sk_buff *skb, ...@@ -147,7 +147,7 @@ static int help(struct sk_buff *skb,
IPPROTO_TCP, NULL, &reply->port); IPPROTO_TCP, NULL, &reply->port);
pr_debug("nf_ct_sane: expect: "); pr_debug("nf_ct_sane: expect: ");
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
/* Can't expect this? Best to drop packet now. */ /* Can't expect this? Best to drop packet now. */
if (nf_ct_expect_related(exp) != 0) if (nf_ct_expect_related(exp) != 0)
......
...@@ -55,8 +55,8 @@ static int tftp_help(struct sk_buff *skb, ...@@ -55,8 +55,8 @@ static int tftp_help(struct sk_buff *skb,
case TFTP_OPCODE_READ: case TFTP_OPCODE_READ:
case TFTP_OPCODE_WRITE: case TFTP_OPCODE_WRITE:
/* RRQ and WRQ works the same way */ /* RRQ and WRQ works the same way */
NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); nf_ct_dump_tuple(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
NF_CT_DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); nf_ct_dump_tuple(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
exp = nf_ct_expect_alloc(ct); exp = nf_ct_expect_alloc(ct);
if (exp == NULL) if (exp == NULL)
...@@ -68,7 +68,7 @@ static int tftp_help(struct sk_buff *skb, ...@@ -68,7 +68,7 @@ static int tftp_help(struct sk_buff *skb,
IPPROTO_UDP, NULL, &tuple->dst.u.udp.port); IPPROTO_UDP, NULL, &tuple->dst.u.udp.port);
pr_debug("expect: "); pr_debug("expect: ");
NF_CT_DUMP_TUPLE(&exp->tuple); nf_ct_dump_tuple(&exp->tuple);
nf_nat_tftp = rcu_dereference(nf_nat_tftp_hook); nf_nat_tftp = rcu_dereference(nf_nat_tftp_hook);
if (nf_nat_tftp && ct->status & IPS_NAT_MASK) if (nf_nat_tftp && ct->status & IPS_NAT_MASK)
......
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