Skip to content

Commit fb04883

Browse files
Eric Dumazetummakynes
authored andcommitted
netfilter: add more values to enum ip_conntrack_info
Following error is raised (and other similar ones) : net/ipv4/netfilter/nf_nat_standalone.c: In function ‘nf_nat_fn’: net/ipv4/netfilter/nf_nat_standalone.c:119:2: warning: case value ‘4’ not in enumerated type ‘enum ip_conntrack_info’ gcc barfs on adding two enum values and getting a not enumerated result : case IP_CT_RELATED+IP_CT_IS_REPLY: Add missing enum values Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: David Miller <davem@davemloft.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 374eeb5 commit fb04883

16 files changed

Lines changed: 26 additions & 27 deletions

‎include/linux/netfilter/nf_conntrack_common.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ enum ip_conntrack_info {
1818
/* >= this indicates reply direction */
1919
IP_CT_IS_REPLY,
2020

21+
IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY,
22+
IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY,
23+
IP_CT_NEW_REPLY = IP_CT_NEW + IP_CT_IS_REPLY,
2124
/* Number of distinct IP_CT types (no NEW in reply dirn). */
2225
IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
2326
};

‎net/ipv4/netfilter/ipt_CLUSTERIP.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
307307
* error messages (RELATED) and information requests (see below) */
308308
if (ip_hdr(skb)->protocol == IPPROTO_ICMP &&
309309
(ctinfo == IP_CT_RELATED ||
310-
ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY))
310+
ctinfo == IP_CT_RELATED_REPLY))
311311
return XT_CONTINUE;
312312

313313
/* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO,
@@ -321,12 +321,12 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
321321
ct->mark = hash;
322322
break;
323323
case IP_CT_RELATED:
324-
case IP_CT_RELATED+IP_CT_IS_REPLY:
324+
case IP_CT_RELATED_REPLY:
325325
/* FIXME: we don't handle expectations at the
326326
* moment. they can arrive on a different node than
327327
* the master connection (e.g. FTP passive mode) */
328328
case IP_CT_ESTABLISHED:
329-
case IP_CT_ESTABLISHED+IP_CT_IS_REPLY:
329+
case IP_CT_ESTABLISHED_REPLY:
330330
break;
331331
default:
332332
break;

‎net/ipv4/netfilter/ipt_MASQUERADE.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ masquerade_tg(struct sk_buff *skb, const struct xt_action_param *par)
6060
nat = nfct_nat(ct);
6161

6262
NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED ||
63-
ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
63+
ctinfo == IP_CT_RELATED_REPLY));
6464

6565
/* Source address is 0.0.0.0 - locally generated packet that is
6666
* probably not supposed to be masqueraded.

‎net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static unsigned int ipv4_confirm(unsigned int hooknum,
101101

102102
/* This is where we call the helper: as the packet goes out. */
103103
ct = nf_ct_get(skb, &ctinfo);
104-
if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)
104+
if (!ct || ctinfo == IP_CT_RELATED_REPLY)
105105
goto out;
106106

107107
help = nfct_help(ct);

‎net/ipv4/netfilter/nf_nat_core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct,
433433

434434
/* Must be RELATED */
435435
NF_CT_ASSERT(skb->nfctinfo == IP_CT_RELATED ||
436-
skb->nfctinfo == IP_CT_RELATED+IP_CT_IS_REPLY);
436+
skb->nfctinfo == IP_CT_RELATED_REPLY);
437437

438438
/* Redirects on non-null nats must be dropped, else they'll
439439
start talking to each other without our translation, and be

‎net/ipv4/netfilter/nf_nat_rule.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ipt_snat_target(struct sk_buff *skb, const struct xt_action_param *par)
5353

5454
/* Connection must be valid and new. */
5555
NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED ||
56-
ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
56+
ctinfo == IP_CT_RELATED_REPLY));
5757
NF_CT_ASSERT(par->out != NULL);
5858

5959
return nf_nat_setup_info(ct, &mr->range[0], IP_NAT_MANIP_SRC);

‎net/ipv4/netfilter/nf_nat_standalone.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ nf_nat_fn(unsigned int hooknum,
116116

117117
switch (ctinfo) {
118118
case IP_CT_RELATED:
119-
case IP_CT_RELATED+IP_CT_IS_REPLY:
119+
case IP_CT_RELATED_REPLY:
120120
if (ip_hdr(skb)->protocol == IPPROTO_ICMP) {
121121
if (!nf_nat_icmp_reply_translation(ct, ctinfo,
122122
hooknum, skb))
@@ -144,7 +144,7 @@ nf_nat_fn(unsigned int hooknum,
144144
default:
145145
/* ESTABLISHED */
146146
NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED ||
147-
ctinfo == (IP_CT_ESTABLISHED+IP_CT_IS_REPLY));
147+
ctinfo == IP_CT_ESTABLISHED_REPLY);
148148
}
149149

150150
return nf_nat_packet(ct, ctinfo, hooknum, skb);

‎net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
160160

161161
/* This is where we call the helper: as the packet goes out. */
162162
ct = nf_ct_get(skb, &ctinfo);
163-
if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)
163+
if (!ct || ctinfo == IP_CT_RELATED_REPLY)
164164
goto out;
165165

166166
help = nfct_help(ct);

‎net/netfilter/nf_conntrack_core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
850850

851851
/* It exists; we have (non-exclusive) reference. */
852852
if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) {
853-
*ctinfo = IP_CT_ESTABLISHED + IP_CT_IS_REPLY;
853+
*ctinfo = IP_CT_ESTABLISHED_REPLY;
854854
/* Please set reply bit if this packet OK */
855855
*set_reply = 1;
856856
} else {
@@ -1143,7 +1143,7 @@ static void nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb)
11431143
/* This ICMP is in reverse direction to the packet which caused it */
11441144
ct = nf_ct_get(skb, &ctinfo);
11451145
if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL)
1146-
ctinfo = IP_CT_RELATED + IP_CT_IS_REPLY;
1146+
ctinfo = IP_CT_RELATED_REPLY;
11471147
else
11481148
ctinfo = IP_CT_RELATED;
11491149

‎net/netfilter/nf_conntrack_ftp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ static int help(struct sk_buff *skb,
368368

369369
/* Until there's been traffic both ways, don't look in packets. */
370370
if (ctinfo != IP_CT_ESTABLISHED &&
371-
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
371+
ctinfo != IP_CT_ESTABLISHED_REPLY) {
372372
pr_debug("ftp: Conntrackinfo = %u\n", ctinfo);
373373
return NF_ACCEPT;
374374
}

0 commit comments

Comments
 (0)