netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: nf_nat_helper: tidy up adjust_tcp_sequence
@ 2009-09-22 16:00 Hannes Eder
  2009-11-05 14:53 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Eder @ 2009-09-22 16:00 UTC (permalink / raw)
  To: netdev; +Cc: netfilter-devel, linux-kernel

The variable 'other_way' gets initialized but is not read afterwards,
so remove it.  Pass the right arguments to a pr_debug call.

While being at tidy up a bit and it fix this checkpatch warning:
  WARNING: suspect code indent for conditional statements

Signed-off-by: Hannes Eder <heder@google.com>

 net/ipv4/netfilter/nf_nat_helper.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index 09172a6..56daa1b 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -41,18 +41,13 @@ adjust_tcp_sequence(u32 seq,
 		    struct nf_conn *ct,
 		    enum ip_conntrack_info ctinfo)
 {
-	int dir;
-	struct nf_nat_seq *this_way, *other_way;
+	int dir = CTINFO2DIR(ctinfo);
 	struct nf_conn_nat *nat = nfct_nat(ct);
+	struct nf_nat_seq *this_way = &nat->seq[dir];
 
-	pr_debug("adjust_tcp_sequence: seq = %u, sizediff = %d\n", seq, seq);
-
-	dir = CTINFO2DIR(ctinfo);
-
-	this_way = &nat->seq[dir];
-	other_way = &nat->seq[!dir];
+	pr_debug("%s(): seq = %u, sizediff = %d\n", __func__, seq, sizediff);
 
-	pr_debug("nf_nat_resize_packet: Seq_offset before: ");
+	pr_debug("%s(): Seq_offset before: ", __func__);
 	DUMP_OFFSET(this_way);
 
 	spin_lock_bh(&nf_nat_seqofs_lock);
@@ -63,13 +58,13 @@ adjust_tcp_sequence(u32 seq,
 	 * retransmit */
 	if (this_way->offset_before == this_way->offset_after ||
 	    before(this_way->correction_pos, seq)) {
-		   this_way->correction_pos = seq;
-		   this_way->offset_before = this_way->offset_after;
-		   this_way->offset_after += sizediff;
+		this_way->correction_pos = seq;
+		this_way->offset_before = this_way->offset_after;
+		this_way->offset_after += sizediff;
 	}
 	spin_unlock_bh(&nf_nat_seqofs_lock);
 
-	pr_debug("nf_nat_resize_packet: Seq_offset after: ");
+	pr_debug("%s(): Seq_offset after: ", __func__);
 	DUMP_OFFSET(this_way);
 }
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netfilter: nf_nat_helper: tidy up adjust_tcp_sequence
  2009-09-22 16:00 [PATCH] netfilter: nf_nat_helper: tidy up adjust_tcp_sequence Hannes Eder
@ 2009-11-05 14:53 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2009-11-05 14:53 UTC (permalink / raw)
  To: Hannes Eder; +Cc: netdev, netfilter-devel

Hannes Eder wrote:
> The variable 'other_way' gets initialized but is not read afterwards,
> so remove it.  Pass the right arguments to a pr_debug call.
> 
> While being at tidy up a bit and it fix this checkpatch warning:
>   WARNING: suspect code indent for conditional statements
> 
> Signed-off-by: Hannes Eder <heder@google.com>
> 

Applied with some minor changes (use enum ip_conntrack_dir instead
of int, use function name literally instead of "%s()" with __func__).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-05 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-22 16:00 [PATCH] netfilter: nf_nat_helper: tidy up adjust_tcp_sequence Hannes Eder
2009-11-05 14:53 ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).