From patchwork Sun Nov 17 04:37:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Oester X-Patchwork-Id: 291809 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4A0AF2C00CA for ; Sun, 17 Nov 2013 15:37:48 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753774Ab3KQEhq (ORCPT ); Sat, 16 Nov 2013 23:37:46 -0500 Received: from mail-pb0-f52.google.com ([209.85.160.52]:65509 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753732Ab3KQEhq (ORCPT ); Sat, 16 Nov 2013 23:37:46 -0500 Received: by mail-pb0-f52.google.com with SMTP id wy17so4109158pbc.11 for ; Sat, 16 Nov 2013 20:37:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=W1Set8XuK2bLfAaGbiTVtchVBEyshg1BWQ4rSaeQ638=; b=EI8iWFt7sKGcBbZsPWFJpBgJxkOQOcKg6IY03V+muSH42f+gcu5PNbLr5tJSqztk8l T8dqX5zz8fY1GK0YHwskdZhHk6ZILNHVrsn+Cn0DFWnv9fBPyQh4l72uuVy4HdPnRwnx cKfJLAXsIOE/RZpIV4gpqKCImfUUFRTqgpIlN0dvpzgHYw+Uiv8AQxzwU+/YDudb0hC8 NKdx/Z1gxgua82UoquHShwvUb8jWmh/WTLLZ5xkMj6VRCkG+XUJL/aB0gBckX7KDd8ae kjPMyb0EzwAN1f4XIrsv7m1ZezQ4LhiCYIts2s57HfSveKUtfVMjTwrKV0YunXUPbp++ qJbQ== X-Gm-Message-State: ALoCoQkWUEAw7GWZKHuVqhxhqlc44cF4Vblbe209grJWuDCTSTPOFZY/RnLX2STx8G3MnFvqXIgm X-Received: by 10.68.99.99 with SMTP id ep3mr6891642pbb.107.1384663065898; Sat, 16 Nov 2013 20:37:45 -0800 (PST) Received: from home (cpe-98-154-84-14.socal.res.rr.com. [98.154.84.14]) by mx.google.com with ESMTPSA id er3sm14520184pbb.40.2013.11.16.20.37.43 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 16 Nov 2013 20:37:44 -0800 (PST) Date: Sat, 16 Nov 2013 20:37:46 -0800 From: Phil Oester To: netfilter-devel@vger.kernel.org Cc: pablo@netfilter.org Subject: [PATCH] netfilter: byte order issue in nf_ct_seqadj_set Message-ID: <20131117043745.GA12111@home> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org In commit 41d73ec053d2, sequence number adjustments were moved to a separate file. Unfortunately, a necessary ntohl call was removed when the call to adjust_tcp_sequence was collapsed into nf_ct_seqadj_set. As reported by Dawid Stawiarsk, this broke the FTP NAT helper. Add back the byte order conversions. Fixes: 41d73ec053d2 ("netfilter: nf_conntrack: make sequence number adjustments usuable without NAT") Signed-off-by: Phil Oester diff --git a/net/netfilter/nf_conntrack_seqadj.c b/net/netfilter/nf_conntrack_seqadj.c index 5f9bfd0..17c1bcb 100644 --- a/net/netfilter/nf_conntrack_seqadj.c +++ b/net/netfilter/nf_conntrack_seqadj.c @@ -41,8 +41,8 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, spin_lock_bh(&ct->lock); this_way = &seqadj->seq[dir]; if (this_way->offset_before == this_way->offset_after || - before(this_way->correction_pos, seq)) { - this_way->correction_pos = seq; + before(this_way->correction_pos, ntohl(seq))) { + this_way->correction_pos = ntohl(seq); this_way->offset_before = this_way->offset_after; this_way->offset_after += off; }