From patchwork Thu Dec 6 08:43:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas Dichtel X-Patchwork-Id: 204175 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 56D732C0106 for ; Thu, 6 Dec 2012 19:43:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754752Ab2LFInw (ORCPT ); Thu, 6 Dec 2012 03:43:52 -0500 Received: from mail-wg0-f46.google.com ([74.125.82.46]:58259 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752538Ab2LFInv (ORCPT ); Thu, 6 Dec 2012 03:43:51 -0500 Received: by mail-wg0-f46.google.com with SMTP id dr13so3576460wgb.1 for ; Thu, 06 Dec 2012 00:43:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:reply-to:organization:user-agent:mime-version :to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding:x-gm-message-state; bh=ejJGdaeiDhW6WM9iNFsqXuqgu27XhF8E0DABD5h1xPU=; b=XW8C4+bDWsK/j/yGnTd4EgD9zLEwhB7HYDui/nqQyC8aOKbgpdjPc+cBL9ZSpCk/Fg EBhnO2lCPcFhpDtUShmFXCGOP5T4k24Xn3dJ6dsd5s067ypLhGNmhBs7KeWKF+KRNkHD V0IcTWXEGX70SD0TvHzHEhVhPvcgemgNNX/5vZgjb/bKQS7egEqMNxKIgVvh/M9LJTjr dCnOaB82fc4rR42zJK1iRBfo7URQbN3fu14fjjMhLsERpVvfbApqCEpt+4PWb3G0gcHS pwQRXufqya1KOcJvlfykFONBd39b1vVwNIHufO7+rXq+QmP9hO5hjI8+82NHUzm0X18y qQdA== Received: by 10.216.201.31 with SMTP id a31mr282641weo.181.1354783429289; Thu, 06 Dec 2012 00:43:49 -0800 (PST) Received: from [192.168.1.4] (schneckos.n1c0.com. [88.182.61.195]) by mx.google.com with ESMTPS id t17sm10016044wiv.6.2012.12.06.00.43.47 (version=SSLv3 cipher=OTHER); Thu, 06 Dec 2012 00:43:47 -0800 (PST) Message-ID: <50C05AC2.1050504@6wind.com> Date: Thu, 06 Dec 2012 09:43:46 +0100 From: Nicolas Dichtel Reply-To: nicolas.dichtel@6wind.com Organization: 6WIND User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: David Miller CC: David.Laight@ACULAB.COM, netdev@vger.kernel.org Subject: Re: [PATCH net-next 0/7] Allow to monitor multicast cache event via rtnetlink References: <50BE56D3.2030704@6wind.com> <50BF29DA.7020903@6wind.com> <20121205.125453.1457654258131828976.davem@davemloft.net> In-Reply-To: <20121205.125453.1457654258131828976.davem@davemloft.net> X-Gm-Message-State: ALoCoQls+V6i5/c5z/YI9WFgInRZfY/aIBVbJm4QL/xMmDDE8H9tlQsSpLqoyXf1skBaZWtQc7nc Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Le 05/12/2012 18:54, David Miller a écrit : > From: "David Laight" > Date: Wed, 5 Dec 2012 11:41:33 -0000 > >> Probably worth commenting that the 64bit items might only be 32bit aligned. >> Just to stop anyone trying to read/write them with pointer casts. > > Rather, let's not create this situation at all. > > It's totally inappropriate to have special code to handle every single > time we want to put 64-bit values into netlink messages. > > We need a real solution to this issue. > The easiest way is to update *_ALIGNTO values (maybe we can keep NLMSG_ALIGNTO to 4). But I think that many userland apps have these values hardcoded and, the most important thing, this may increase size of many netlink messages. Hence we need probably to find something better. --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/uapi/linux/netfilter/nfnetlink_compat.h b/include/uapi/linux/netfilter/nfnetlink_compat.h index ffb9503..121e62a 100644 --- a/include/uapi/linux/netfilter/nfnetlink_compat.h +++ b/include/uapi/linux/netfilter/nfnetlink_compat.h @@ -33,7 +33,7 @@ struct nfattr { #define NFNL_NFA_NEST 0x8000 #define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) -#define NFA_ALIGNTO 4 +#define NFA_ALIGNTO 8 #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) #define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ && (nfa)->nfa_len <= (len)) diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index 78d5b8a..66d2a26 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h @@ -75,7 +75,7 @@ struct nlmsghdr { Check NLM_F_EXCL */ -#define NLMSG_ALIGNTO 4U +#define NLMSG_ALIGNTO 8U #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) @@ -145,7 +145,7 @@ struct nlattr { #define NLA_F_NET_BYTEORDER (1 << 14) #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) -#define NLA_ALIGNTO 4 +#define NLA_ALIGNTO 8 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index 33d29ce..ee898c1 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h @@ -146,7 +146,7 @@ struct rtattr { /* Macros to handle rtattributes */ -#define RTA_ALIGNTO 4 +#define RTA_ALIGNTO 8 #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ (rta)->rta_len >= sizeof(struct rtattr) && \ @@ -322,7 +322,7 @@ struct rtnexthop { /* Macros to handle hexthops */ -#define RTNH_ALIGNTO 4 +#define RTNH_ALIGNTO 8 #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ ((int)(rtnh)->rtnh_len) <= (len))