Skip to contentSkip to conversation

netfilter: icmp: Enhance the return value check of nf_nat_icmp(v6)_reply_translation

PATCH In review Feng Gao 2 participants 2 messages Sep 20, 2015 – Sep 24, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Feng Gao

author
#0 lore raw

PATCH 1/1 netfilter: icmp: Enhance the return value check of nf_nat_icmp(v6)_reply_translation

It could enhance the codes readability and save one extra instruction than before

---
 net/ipv4/netfilter/nf_nat_l3proto_ipv4.c |    6 +++---
 net/ipv6/netfilter/nf_nat_l3proto_ipv6.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

b/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c
index 22f4579..f5c0754 100644

net/ipv4/netfilter/nf_nat_l3proto_ipv4.c +0 -0
@@ -294,11 +294,11 @@ nf_nat_ipv4_fn(const struct nf_hook_ops *ops, struct

sk_buff *skb,
case IP_CT_RELATED:
case IP_CT_RELATED_REPLY:
if (ip_hdr(skb)->protocol == IPPROTO_ICMP) {
- if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo,
+ if (nf_nat_icmp_reply_translation(skb, ct, ctinfo,
ops->hooknum))
- return NF_DROP;
- else
return NF_ACCEPT;
+ else
+ return NF_DROP;
}
/* Fall thru... (Only ICMPs can be IP_CT_IS_REPLY) */
case IP_CT_NEW:

(quoted diff) +0 -0

b/net/ipv6/netfilter/nf_nat_l3proto_ipv6.c
index 70fbaed..40c0a49 100644

net/ipv6/netfilter/nf_nat_l3proto_ipv6.c +0 -0
@@ -302,12 +302,12 @@ nf_nat_ipv6_fn(const struct nf_hook_ops *ops, struct

sk_buff *skb,
&nexthdr, &frag_off);

if (hdrlen >= 0 && nexthdr == IPPROTO_ICMPV6) {
- if (!nf_nat_icmpv6_reply_translation(skb, ct,
ctinfo,
+ if (nf_nat_icmpv6_reply_translation(skb, ct, ctinfo,
ops->hooknum, hdrlen))
- return NF_DROP;
- else
return NF_ACCEPT;
+ else
+ return NF_DROP;
}
/* Fall thru... (Only ICMPs can be IP_CT_IS_REPLY) */
case IP_CT_NEW:

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · Feng Gao

Hi Pablo,

How about this patch?
If it is ok, I have more confidence to try to commit more patches.

The patch format looks good, patchwork is catching it.

I'll go back to the pending list of patches as soon as the netns bunch gets merged mainstream.