Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932876AbcLHXPC (ORCPT ); Thu, 8 Dec 2016 18:15:02 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:45156 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753896AbcLHXPB (ORCPT ); Thu, 8 Dec 2016 18:15:01 -0500 Date: Thu, 08 Dec 2016 18:14:53 -0500 (EST) Message-Id: <20161208.181453.1681964885150767592.davem@davemloft.net> To: Jason@zx2c4.com Cc: dave.taht@gmail.com, netdev@vger.kernel.org, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, wireguard@lists.zx2c4.com Subject: Re: Misalignment, MIPS, and ip_hdr(skb)->version From: David Miller In-Reply-To: References: <20161207.193716.50344961208535056.davem@davemloft.net> X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 08 Dec 2016 14:15:36 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 761 Lines: 18 From: "Jason A. Donenfeld" Date: Thu, 8 Dec 2016 23:20:04 +0100 > Hi David, > > On Thu, Dec 8, 2016 at 1:37 AM, David Miller wrote: >> You really have to land the IP header on a proper 4 byte boundary. >> >> I would suggest pushing 3 dummy garbage bytes of padding at the front >> or the end of your header. > > Are you sure 3 bytes to get 4 byte alignment is really the best? I was > thinking that adding 1 byte to get 2 byte alignment might be better, > since it would then ensure that the subsequent TCP header winds up > being 4 byte aligned. Or is this in fact not the desired trade off, > and so I should stick with the 3 bytes you suggested? If the IP header is 4 byte aligned, the TCP header will be as well.