You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'nla_align-more'
Nicolas Dichtel says: ==================== netlink: align attributes when needed (patchset #1) This is the continuation of the work done to align netlink attributes when these attributes contain some 64-bit fields. David, if the third patch is too big (or maybe the series), I can split it. Just tell me what you prefer. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -351,7 +351,8 @@ ip_set_put_skbinfo(struct sk_buff *skb, struct ip_set_skbinfo *skbinfo)
|
||||
return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
|
||||
nla_put_net64(skb, IPSET_ATTR_SKBMARK,
|
||||
cpu_to_be64((u64)skbinfo->skbmark << 32 |
|
||||
skbinfo->skbmarkmask))) ||
|
||||
skbinfo->skbmarkmask),
|
||||
IPSET_ATTR_PAD)) ||
|
||||
(skbinfo->skbprio &&
|
||||
nla_put_net32(skb, IPSET_ATTR_SKBPRIO,
|
||||
cpu_to_be32(skbinfo->skbprio))) ||
|
||||
@@ -374,9 +375,11 @@ static inline bool
|
||||
ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter)
|
||||
{
|
||||
return nla_put_net64(skb, IPSET_ATTR_BYTES,
|
||||
cpu_to_be64(ip_set_get_bytes(counter))) ||
|
||||
cpu_to_be64(ip_set_get_bytes(counter)),
|
||||
IPSET_ATTR_PAD) ||
|
||||
nla_put_net64(skb, IPSET_ATTR_PACKETS,
|
||||
cpu_to_be64(ip_set_get_packets(counter)));
|
||||
cpu_to_be64(ip_set_get_packets(counter)),
|
||||
IPSET_ATTR_PAD);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
+43
-17
@@ -102,10 +102,12 @@
|
||||
* nla_put_s8(skb, type, value) add s8 attribute to skb
|
||||
* nla_put_s16(skb, type, value) add s16 attribute to skb
|
||||
* nla_put_s32(skb, type, value) add s32 attribute to skb
|
||||
* nla_put_s64(skb, type, value) add s64 attribute to skb
|
||||
* nla_put_s64(skb, type, value,
|
||||
* padattr) add s64 attribute to skb
|
||||
* nla_put_string(skb, type, str) add string attribute to skb
|
||||
* nla_put_flag(skb, type) add flag attribute to skb
|
||||
* nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
|
||||
* nla_put_msecs(skb, type, jiffies,
|
||||
* padattr) add msecs attribute to skb
|
||||
* nla_put_in_addr(skb, type, addr) add IPv4 address attribute to skb
|
||||
* nla_put_in6_addr(skb, type, addr) add IPv6 address attribute to skb
|
||||
*
|
||||
@@ -856,36 +858,56 @@ static inline int nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_put_be64 - Add a __be64 netlink attribute to a socket buffer
|
||||
* nla_put_u64_64bit - Add a u64 netlink attribute to a skb and align it
|
||||
* @skb: socket buffer to add attribute to
|
||||
* @attrtype: attribute type
|
||||
* @value: numeric value
|
||||
* @padattr: attribute type for the padding
|
||||
*/
|
||||
static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
|
||||
static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
|
||||
u64 value, int padattr)
|
||||
{
|
||||
return nla_put(skb, attrtype, sizeof(__be64), &value);
|
||||
return nla_put_64bit(skb, attrtype, sizeof(u64), &value, padattr);
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_put_net64 - Add 64-bit network byte order netlink attribute to a socket buffer
|
||||
* nla_put_be64 - Add a __be64 netlink attribute to a socket buffer and align it
|
||||
* @skb: socket buffer to add attribute to
|
||||
* @attrtype: attribute type
|
||||
* @value: numeric value
|
||||
* @padattr: attribute type for the padding
|
||||
*/
|
||||
static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value)
|
||||
static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value,
|
||||
int padattr)
|
||||
{
|
||||
return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, value);
|
||||
return nla_put_64bit(skb, attrtype, sizeof(__be64), &value, padattr);
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_put_le64 - Add a __le64 netlink attribute to a socket buffer
|
||||
* nla_put_net64 - Add 64-bit network byte order nlattr to a skb and align it
|
||||
* @skb: socket buffer to add attribute to
|
||||
* @attrtype: attribute type
|
||||
* @value: numeric value
|
||||
* @padattr: attribute type for the padding
|
||||
*/
|
||||
static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value)
|
||||
static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value,
|
||||
int padattr)
|
||||
{
|
||||
return nla_put(skb, attrtype, sizeof(__le64), &value);
|
||||
return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, value,
|
||||
padattr);
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_put_le64 - Add a __le64 netlink attribute to a socket buffer and align it
|
||||
* @skb: socket buffer to add attribute to
|
||||
* @attrtype: attribute type
|
||||
* @value: numeric value
|
||||
* @padattr: attribute type for the padding
|
||||
*/
|
||||
static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value,
|
||||
int padattr)
|
||||
{
|
||||
return nla_put_64bit(skb, attrtype, sizeof(__le64), &value, padattr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -922,14 +944,16 @@ static inline int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value)
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_put_s64 - Add a s64 netlink attribute to a socket buffer
|
||||
* nla_put_s64 - Add a s64 netlink attribute to a socket buffer and align it
|
||||
* @skb: socket buffer to add attribute to
|
||||
* @attrtype: attribute type
|
||||
* @value: numeric value
|
||||
* @padattr: attribute type for the padding
|
||||
*/
|
||||
static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value)
|
||||
static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value,
|
||||
int padattr)
|
||||
{
|
||||
return nla_put(skb, attrtype, sizeof(s64), &value);
|
||||
return nla_put_64bit(skb, attrtype, sizeof(s64), &value, padattr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -955,16 +979,18 @@ static inline int nla_put_flag(struct sk_buff *skb, int attrtype)
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_put_msecs - Add a msecs netlink attribute to a socket buffer
|
||||
* nla_put_msecs - Add a msecs netlink attribute to a skb and align it
|
||||
* @skb: socket buffer to add attribute to
|
||||
* @attrtype: attribute type
|
||||
* @njiffies: number of jiffies to convert to msecs
|
||||
* @padattr: attribute type for the padding
|
||||
*/
|
||||
static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
|
||||
unsigned long njiffies)
|
||||
unsigned long njiffies, int padattr)
|
||||
{
|
||||
u64 tmp = jiffies_to_msecs(njiffies);
|
||||
return nla_put(skb, attrtype, sizeof(u64), &tmp);
|
||||
|
||||
return nla_put_64bit(skb, attrtype, sizeof(u64), &tmp, padattr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -138,6 +138,8 @@ enum nl802154_attrs {
|
||||
NL802154_ATTR_SEC_KEY,
|
||||
#endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
|
||||
|
||||
NL802154_ATTR_PAD,
|
||||
|
||||
__NL802154_ATTR_AFTER_LAST,
|
||||
NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
|
||||
};
|
||||
@@ -295,6 +297,7 @@ enum nl802154_dev_addr_attrs {
|
||||
NL802154_DEV_ADDR_ATTR_MODE,
|
||||
NL802154_DEV_ADDR_ATTR_SHORT,
|
||||
NL802154_DEV_ADDR_ATTR_EXTENDED,
|
||||
NL802154_DEV_ADDR_ATTR_PAD,
|
||||
|
||||
/* keep last */
|
||||
__NL802154_DEV_ADDR_ATTR_AFTER_LAST,
|
||||
@@ -320,6 +323,7 @@ enum nl802154_key_id_attrs {
|
||||
NL802154_KEY_ID_ATTR_IMPLICIT,
|
||||
NL802154_KEY_ID_ATTR_SOURCE_SHORT,
|
||||
NL802154_KEY_ID_ATTR_SOURCE_EXTENDED,
|
||||
NL802154_KEY_ID_ATTR_PAD,
|
||||
|
||||
/* keep last */
|
||||
__NL802154_KEY_ID_ATTR_AFTER_LAST,
|
||||
@@ -402,6 +406,7 @@ enum nl802154_dev {
|
||||
NL802154_DEV_ATTR_EXTENDED_ADDR,
|
||||
NL802154_DEV_ATTR_SECLEVEL_EXEMPT,
|
||||
NL802154_DEV_ATTR_KEY_MODE,
|
||||
NL802154_DEV_ATTR_PAD,
|
||||
|
||||
/* keep last */
|
||||
__NL802154_DEV_ATTR_AFTER_LAST,
|
||||
@@ -414,6 +419,7 @@ enum nl802154_devkey {
|
||||
NL802154_DEVKEY_ATTR_FRAME_COUNTER,
|
||||
NL802154_DEVKEY_ATTR_EXTENDED_ADDR,
|
||||
NL802154_DEVKEY_ATTR_ID,
|
||||
NL802154_DEVKEY_ATTR_PAD,
|
||||
|
||||
/* keep last */
|
||||
__NL802154_DEVKEY_ATTR_AFTER_LAST,
|
||||
|
||||
@@ -49,6 +49,7 @@ enum {
|
||||
FRA_TABLE, /* Extended table id */
|
||||
FRA_FWMASK, /* mask for netfilter mark */
|
||||
FRA_OIFNAME,
|
||||
FRA_PAD,
|
||||
__FRA_MAX
|
||||
};
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ enum {
|
||||
L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
|
||||
L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* u8 */
|
||||
L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* u8 */
|
||||
L2TP_ATTR_PAD,
|
||||
__L2TP_ATTR_MAX,
|
||||
};
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ enum lwtunnel_ip_t {
|
||||
LWTUNNEL_IP_TTL,
|
||||
LWTUNNEL_IP_TOS,
|
||||
LWTUNNEL_IP_FLAGS,
|
||||
LWTUNNEL_IP_PAD,
|
||||
__LWTUNNEL_IP_MAX,
|
||||
};
|
||||
|
||||
@@ -35,6 +36,7 @@ enum lwtunnel_ip6_t {
|
||||
LWTUNNEL_IP6_HOPLIMIT,
|
||||
LWTUNNEL_IP6_TC,
|
||||
LWTUNNEL_IP6_FLAGS,
|
||||
LWTUNNEL_IP6_PAD,
|
||||
__LWTUNNEL_IP6_MAX,
|
||||
};
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@ enum {
|
||||
NDTPA_LOCKTIME, /* u64, msecs */
|
||||
NDTPA_QUEUE_LENBYTES, /* u32 */
|
||||
NDTPA_MCAST_REPROBES, /* u32 */
|
||||
NDTPA_PAD,
|
||||
__NDTPA_MAX
|
||||
};
|
||||
#define NDTPA_MAX (__NDTPA_MAX - 1)
|
||||
@@ -160,6 +161,7 @@ enum {
|
||||
NDTA_PARMS, /* nested TLV NDTPA_* */
|
||||
NDTA_STATS, /* struct ndt_stats, read-only */
|
||||
NDTA_GC_INTERVAL, /* u64, msecs */
|
||||
NDTA_PAD,
|
||||
__NDTA_MAX
|
||||
};
|
||||
#define NDTA_MAX (__NDTA_MAX - 1)
|
||||
|
||||
@@ -118,6 +118,7 @@ enum {
|
||||
IPSET_ATTR_SKBMARK,
|
||||
IPSET_ATTR_SKBPRIO,
|
||||
IPSET_ATTR_SKBQUEUE,
|
||||
IPSET_ATTR_PAD,
|
||||
__IPSET_ATTR_ADT_MAX,
|
||||
};
|
||||
#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
|
||||
|
||||
@@ -182,6 +182,7 @@ enum nft_chain_attributes {
|
||||
NFTA_CHAIN_USE,
|
||||
NFTA_CHAIN_TYPE,
|
||||
NFTA_CHAIN_COUNTERS,
|
||||
NFTA_CHAIN_PAD,
|
||||
__NFTA_CHAIN_MAX
|
||||
};
|
||||
#define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1)
|
||||
@@ -206,6 +207,7 @@ enum nft_rule_attributes {
|
||||
NFTA_RULE_COMPAT,
|
||||
NFTA_RULE_POSITION,
|
||||
NFTA_RULE_USERDATA,
|
||||
NFTA_RULE_PAD,
|
||||
__NFTA_RULE_MAX
|
||||
};
|
||||
#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
|
||||
@@ -308,6 +310,7 @@ enum nft_set_attributes {
|
||||
NFTA_SET_TIMEOUT,
|
||||
NFTA_SET_GC_INTERVAL,
|
||||
NFTA_SET_USERDATA,
|
||||
NFTA_SET_PAD,
|
||||
__NFTA_SET_MAX
|
||||
};
|
||||
#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
|
||||
@@ -341,6 +344,7 @@ enum nft_set_elem_attributes {
|
||||
NFTA_SET_ELEM_EXPIRATION,
|
||||
NFTA_SET_ELEM_USERDATA,
|
||||
NFTA_SET_ELEM_EXPR,
|
||||
NFTA_SET_ELEM_PAD,
|
||||
__NFTA_SET_ELEM_MAX
|
||||
};
|
||||
#define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1)
|
||||
@@ -584,6 +588,7 @@ enum nft_dynset_attributes {
|
||||
NFTA_DYNSET_SREG_DATA,
|
||||
NFTA_DYNSET_TIMEOUT,
|
||||
NFTA_DYNSET_EXPR,
|
||||
NFTA_DYNSET_PAD,
|
||||
__NFTA_DYNSET_MAX,
|
||||
};
|
||||
#define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1)
|
||||
@@ -806,6 +811,7 @@ enum nft_limit_attributes {
|
||||
NFTA_LIMIT_BURST,
|
||||
NFTA_LIMIT_TYPE,
|
||||
NFTA_LIMIT_FLAGS,
|
||||
NFTA_LIMIT_PAD,
|
||||
__NFTA_LIMIT_MAX
|
||||
};
|
||||
#define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1)
|
||||
@@ -820,6 +826,7 @@ enum nft_counter_attributes {
|
||||
NFTA_COUNTER_UNSPEC,
|
||||
NFTA_COUNTER_BYTES,
|
||||
NFTA_COUNTER_PACKETS,
|
||||
NFTA_COUNTER_PAD,
|
||||
__NFTA_COUNTER_MAX
|
||||
};
|
||||
#define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1)
|
||||
@@ -1055,6 +1062,7 @@ enum nft_trace_attibutes {
|
||||
NFTA_TRACE_MARK,
|
||||
NFTA_TRACE_NFPROTO,
|
||||
NFTA_TRACE_POLICY,
|
||||
NFTA_TRACE_PAD,
|
||||
__NFTA_TRACE_MAX
|
||||
};
|
||||
#define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1)
|
||||
|
||||
@@ -29,6 +29,7 @@ enum nfnl_acct_type {
|
||||
NFACCT_FLAGS,
|
||||
NFACCT_QUOTA,
|
||||
NFACCT_FILTER,
|
||||
NFACCT_PAD,
|
||||
__NFACCT_MAX
|
||||
};
|
||||
#define NFACCT_MAX (__NFACCT_MAX - 1)
|
||||
|
||||
@@ -116,6 +116,7 @@ enum ctattr_protoinfo_dccp {
|
||||
CTA_PROTOINFO_DCCP_STATE,
|
||||
CTA_PROTOINFO_DCCP_ROLE,
|
||||
CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ,
|
||||
CTA_PROTOINFO_DCCP_PAD,
|
||||
__CTA_PROTOINFO_DCCP_MAX,
|
||||
};
|
||||
#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
|
||||
@@ -135,6 +136,7 @@ enum ctattr_counters {
|
||||
CTA_COUNTERS_BYTES, /* 64bit counters */
|
||||
CTA_COUNTERS32_PACKETS, /* old 32bit counters, unused */
|
||||
CTA_COUNTERS32_BYTES, /* old 32bit counters, unused */
|
||||
CTA_COUNTERS_PAD,
|
||||
__CTA_COUNTERS_MAX
|
||||
};
|
||||
#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
|
||||
@@ -143,6 +145,7 @@ enum ctattr_tstamp {
|
||||
CTA_TIMESTAMP_UNSPEC,
|
||||
CTA_TIMESTAMP_START,
|
||||
CTA_TIMESTAMP_STOP,
|
||||
CTA_TIMESTAMP_PAD,
|
||||
__CTA_TIMESTAMP_MAX
|
||||
};
|
||||
#define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1)
|
||||
|
||||
@@ -351,6 +351,7 @@ enum ovs_tunnel_key_attr {
|
||||
OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested OVS_VXLAN_EXT_* */
|
||||
OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */
|
||||
OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */
|
||||
OVS_TUNNEL_KEY_ATTR_PAD,
|
||||
__OVS_TUNNEL_KEY_ATTR_MAX
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ enum {
|
||||
TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */
|
||||
TCP_METRICS_ATTR_SADDR_IPV4, /* u32 */
|
||||
TCP_METRICS_ATTR_SADDR_IPV6, /* binary */
|
||||
TCP_METRICS_ATTR_PAD,
|
||||
|
||||
__TCP_METRICS_ATTR_MAX,
|
||||
};
|
||||
|
||||
@@ -302,6 +302,7 @@ enum xfrm_attr_type_t {
|
||||
XFRMA_SA_EXTRA_FLAGS, /* __u32 */
|
||||
XFRMA_PROTO, /* __u8 */
|
||||
XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */
|
||||
XFRMA_PAD,
|
||||
__XFRMA_MAX
|
||||
|
||||
#define XFRMA_MAX (__XFRMA_MAX - 1)
|
||||
|
||||
+5
-32
@@ -357,10 +357,6 @@ static int parse(struct nlattr *na, struct cpumask *mask)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_64BIT) && !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
|
||||
#define TASKSTATS_NEEDS_PADDING 1
|
||||
#endif
|
||||
|
||||
static struct taskstats *mk_reply(struct sk_buff *skb, int type, u32 pid)
|
||||
{
|
||||
struct nlattr *na, *ret;
|
||||
@@ -370,29 +366,6 @@ static struct taskstats *mk_reply(struct sk_buff *skb, int type, u32 pid)
|
||||
? TASKSTATS_TYPE_AGGR_PID
|
||||
: TASKSTATS_TYPE_AGGR_TGID;
|
||||
|
||||
/*
|
||||
* The taskstats structure is internally aligned on 8 byte
|
||||
* boundaries but the layout of the aggregrate reply, with
|
||||
* two NLA headers and the pid (each 4 bytes), actually
|
||||
* force the entire structure to be unaligned. This causes
|
||||
* the kernel to issue unaligned access warnings on some
|
||||
* architectures like ia64. Unfortunately, some software out there
|
||||
* doesn't properly unroll the NLA packet and assumes that the start
|
||||
* of the taskstats structure will always be 20 bytes from the start
|
||||
* of the netlink payload. Aligning the start of the taskstats
|
||||
* structure breaks this software, which we don't want. So, for now
|
||||
* the alignment only happens on architectures that require it
|
||||
* and those users will have to update to fixed versions of those
|
||||
* packages. Space is reserved in the packet only when needed.
|
||||
* This ifdef should be removed in several years e.g. 2012 once
|
||||
* we can be confident that fixed versions are installed on most
|
||||
* systems. We add the padding before the aggregate since the
|
||||
* aggregate is already a defined type.
|
||||
*/
|
||||
#ifdef TASKSTATS_NEEDS_PADDING
|
||||
if (nla_put(skb, TASKSTATS_TYPE_NULL, 0, NULL) < 0)
|
||||
goto err;
|
||||
#endif
|
||||
na = nla_nest_start(skb, aggr);
|
||||
if (!na)
|
||||
goto err;
|
||||
@@ -401,7 +374,8 @@ static struct taskstats *mk_reply(struct sk_buff *skb, int type, u32 pid)
|
||||
nla_nest_cancel(skb, na);
|
||||
goto err;
|
||||
}
|
||||
ret = nla_reserve(skb, TASKSTATS_TYPE_STATS, sizeof(struct taskstats));
|
||||
ret = nla_reserve_64bit(skb, TASKSTATS_TYPE_STATS,
|
||||
sizeof(struct taskstats), TASKSTATS_TYPE_NULL);
|
||||
if (!ret) {
|
||||
nla_nest_cancel(skb, na);
|
||||
goto err;
|
||||
@@ -500,10 +474,9 @@ static size_t taskstats_packet_size(void)
|
||||
size_t size;
|
||||
|
||||
size = nla_total_size(sizeof(u32)) +
|
||||
nla_total_size(sizeof(struct taskstats)) + nla_total_size(0);
|
||||
#ifdef TASKSTATS_NEEDS_PADDING
|
||||
size += nla_total_size(0); /* Padding for alignment */
|
||||
#endif
|
||||
nla_total_size_64bit(sizeof(struct taskstats)) +
|
||||
nla_total_size(0);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -359,10 +359,11 @@ EXPORT_SYMBOL(__nla_reserve);
|
||||
* @skb: socket buffer to reserve room on
|
||||
* @attrtype: attribute type
|
||||
* @attrlen: length of attribute payload
|
||||
* @padattr: attribute type for the padding
|
||||
*
|
||||
* Adds a netlink attribute header to a socket buffer and reserves
|
||||
* room for the payload but does not copy it. It also ensure that this
|
||||
* attribute will be 64-bit aign.
|
||||
* attribute will have a 64-bit aligned nla_data() area.
|
||||
*
|
||||
* The caller is responsible to ensure that the skb provides enough
|
||||
* tailroom for the attribute header and payload.
|
||||
@@ -424,10 +425,11 @@ EXPORT_SYMBOL(nla_reserve);
|
||||
* @skb: socket buffer to reserve room on
|
||||
* @attrtype: attribute type
|
||||
* @attrlen: length of attribute payload
|
||||
* @padattr: attribute type for the padding
|
||||
*
|
||||
* Adds a netlink attribute header to a socket buffer and reserves
|
||||
* room for the payload but does not copy it. It also ensure that this
|
||||
* attribute will be 64-bit aign.
|
||||
* attribute will have a 64-bit aligned nla_data() area.
|
||||
*
|
||||
* Returns NULL if the tailroom of the skb is insufficient to store
|
||||
* the attribute header and payload.
|
||||
@@ -493,6 +495,7 @@ EXPORT_SYMBOL(__nla_put);
|
||||
* @attrtype: attribute type
|
||||
* @attrlen: length of attribute payload
|
||||
* @data: head of attribute payload
|
||||
* @padattr: attribute type for the padding
|
||||
*
|
||||
* The caller is responsible to ensure that the skb provides enough
|
||||
* tailroom for the attribute header and payload.
|
||||
@@ -551,6 +554,7 @@ EXPORT_SYMBOL(nla_put);
|
||||
* @attrtype: attribute type
|
||||
* @attrlen: length of attribute payload
|
||||
* @data: head of attribute payload
|
||||
* @padattr: attribute type for the padding
|
||||
*
|
||||
* Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
|
||||
* the attribute header and payload.
|
||||
|
||||
@@ -549,7 +549,7 @@ static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops,
|
||||
+ nla_total_size(4) /* FRA_SUPPRESS_IFGROUP */
|
||||
+ nla_total_size(4) /* FRA_FWMARK */
|
||||
+ nla_total_size(4) /* FRA_FWMASK */
|
||||
+ nla_total_size(8); /* FRA_TUN_ID */
|
||||
+ nla_total_size_64bit(8); /* FRA_TUN_ID */
|
||||
|
||||
if (ops->nlmsg_payload)
|
||||
payload += ops->nlmsg_payload(rule);
|
||||
@@ -607,7 +607,7 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
|
||||
(rule->target &&
|
||||
nla_put_u32(skb, FRA_GOTO, rule->target)) ||
|
||||
(rule->tun_id &&
|
||||
nla_put_be64(skb, FRA_TUN_ID, rule->tun_id)))
|
||||
nla_put_be64(skb, FRA_TUN_ID, rule->tun_id, FRA_PAD)))
|
||||
goto nla_put_failure;
|
||||
|
||||
if (rule->suppress_ifgroup != -1) {
|
||||
|
||||
+10
-9
@@ -1763,21 +1763,22 @@ static int neightbl_fill_parms(struct sk_buff *skb, struct neigh_parms *parms)
|
||||
NEIGH_VAR(parms, MCAST_PROBES)) ||
|
||||
nla_put_u32(skb, NDTPA_MCAST_REPROBES,
|
||||
NEIGH_VAR(parms, MCAST_REPROBES)) ||
|
||||
nla_put_msecs(skb, NDTPA_REACHABLE_TIME, parms->reachable_time) ||
|
||||
nla_put_msecs(skb, NDTPA_REACHABLE_TIME, parms->reachable_time,
|
||||
NDTPA_PAD) ||
|
||||
nla_put_msecs(skb, NDTPA_BASE_REACHABLE_TIME,
|
||||
NEIGH_VAR(parms, BASE_REACHABLE_TIME)) ||
|
||||
NEIGH_VAR(parms, BASE_REACHABLE_TIME), NDTPA_PAD) ||
|
||||
nla_put_msecs(skb, NDTPA_GC_STALETIME,
|
||||
NEIGH_VAR(parms, GC_STALETIME)) ||
|
||||
NEIGH_VAR(parms, GC_STALETIME), NDTPA_PAD) ||
|
||||
nla_put_msecs(skb, NDTPA_DELAY_PROBE_TIME,
|
||||
NEIGH_VAR(parms, DELAY_PROBE_TIME)) ||
|
||||
NEIGH_VAR(parms, DELAY_PROBE_TIME), NDTPA_PAD) ||
|
||||
nla_put_msecs(skb, NDTPA_RETRANS_TIME,
|
||||
NEIGH_VAR(parms, RETRANS_TIME)) ||
|
||||
NEIGH_VAR(parms, RETRANS_TIME), NDTPA_PAD) ||
|
||||
nla_put_msecs(skb, NDTPA_ANYCAST_DELAY,
|
||||
NEIGH_VAR(parms, ANYCAST_DELAY)) ||
|
||||
NEIGH_VAR(parms, ANYCAST_DELAY), NDTPA_PAD) ||
|
||||
nla_put_msecs(skb, NDTPA_PROXY_DELAY,
|
||||
NEIGH_VAR(parms, PROXY_DELAY)) ||
|
||||
NEIGH_VAR(parms, PROXY_DELAY), NDTPA_PAD) ||
|
||||
nla_put_msecs(skb, NDTPA_LOCKTIME,
|
||||
NEIGH_VAR(parms, LOCKTIME)))
|
||||
NEIGH_VAR(parms, LOCKTIME), NDTPA_PAD))
|
||||
goto nla_put_failure;
|
||||
return nla_nest_end(skb, nest);
|
||||
|
||||
@@ -1804,7 +1805,7 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl,
|
||||
ndtmsg->ndtm_pad2 = 0;
|
||||
|
||||
if (nla_put_string(skb, NDTA_NAME, tbl->id) ||
|
||||
nla_put_msecs(skb, NDTA_GC_INTERVAL, tbl->gc_interval) ||
|
||||
nla_put_msecs(skb, NDTA_GC_INTERVAL, tbl->gc_interval, NDTA_PAD) ||
|
||||
nla_put_u32(skb, NDTA_THRESH1, tbl->gc_thresh1) ||
|
||||
nla_put_u32(skb, NDTA_THRESH2, tbl->gc_thresh2) ||
|
||||
nla_put_u32(skb, NDTA_THRESH3, tbl->gc_thresh3))
|
||||
|
||||
@@ -722,7 +722,8 @@ ieee802154_llsec_send_key_id(struct sk_buff *msg,
|
||||
break;
|
||||
case NL802154_DEV_ADDR_EXTENDED:
|
||||
if (nla_put_le64(msg, NL802154_DEV_ADDR_ATTR_EXTENDED,
|
||||
desc->device_addr.extended_addr))
|
||||
desc->device_addr.extended_addr,
|
||||
NL802154_DEV_ADDR_ATTR_PAD))
|
||||
return -ENOBUFS;
|
||||
break;
|
||||
default:
|
||||
@@ -742,7 +743,8 @@ ieee802154_llsec_send_key_id(struct sk_buff *msg,
|
||||
break;
|
||||
case NL802154_KEY_ID_MODE_INDEX_EXTENDED:
|
||||
if (nla_put_le64(msg, NL802154_KEY_ID_ATTR_SOURCE_EXTENDED,
|
||||
desc->extended_source))
|
||||
desc->extended_source,
|
||||
NL802154_KEY_ID_ATTR_PAD))
|
||||
return -ENOBUFS;
|
||||
break;
|
||||
default:
|
||||
@@ -819,7 +821,8 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags,
|
||||
|
||||
/* address settings */
|
||||
if (nla_put_le64(msg, NL802154_ATTR_EXTENDED_ADDR,
|
||||
wpan_dev->extended_addr) ||
|
||||
wpan_dev->extended_addr,
|
||||
NL802154_ATTR_PAD) ||
|
||||
nla_put_le16(msg, NL802154_ATTR_SHORT_ADDR,
|
||||
wpan_dev->short_addr) ||
|
||||
nla_put_le16(msg, NL802154_ATTR_PAN_ID, wpan_dev->pan_id))
|
||||
@@ -1614,7 +1617,7 @@ static int nl802154_send_device(struct sk_buff *msg, u32 cmd, u32 portid,
|
||||
nla_put_le16(msg, NL802154_DEV_ATTR_SHORT_ADDR,
|
||||
dev_desc->short_addr) ||
|
||||
nla_put_le64(msg, NL802154_DEV_ATTR_EXTENDED_ADDR,
|
||||
dev_desc->hwaddr) ||
|
||||
dev_desc->hwaddr, NL802154_DEV_ATTR_PAD) ||
|
||||
nla_put_u8(msg, NL802154_DEV_ATTR_SECLEVEL_EXEMPT,
|
||||
dev_desc->seclevel_exempt) ||
|
||||
nla_put_u32(msg, NL802154_DEV_ATTR_KEY_MODE, dev_desc->key_mode))
|
||||
@@ -1778,7 +1781,7 @@ static int nl802154_send_devkey(struct sk_buff *msg, u32 cmd, u32 portid,
|
||||
goto nla_put_failure;
|
||||
|
||||
if (nla_put_le64(msg, NL802154_DEVKEY_ATTR_EXTENDED_ADDR,
|
||||
extended_addr) ||
|
||||
extended_addr, NL802154_DEVKEY_ATTR_PAD) ||
|
||||
nla_put_u32(msg, NL802154_DEVKEY_ATTR_FRAME_COUNTER,
|
||||
devkey->frame_counter))
|
||||
goto nla_put_failure;
|
||||
|
||||
@@ -271,7 +271,8 @@ static int ip_tun_fill_encap_info(struct sk_buff *skb,
|
||||
{
|
||||
struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
|
||||
|
||||
if (nla_put_be64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id) ||
|
||||
if (nla_put_be64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id,
|
||||
LWTUNNEL_IP_PAD) ||
|
||||
nla_put_in_addr(skb, LWTUNNEL_IP_DST, tun_info->key.u.ipv4.dst) ||
|
||||
nla_put_in_addr(skb, LWTUNNEL_IP_SRC, tun_info->key.u.ipv4.src) ||
|
||||
nla_put_u8(skb, LWTUNNEL_IP_TOS, tun_info->key.tos) ||
|
||||
@@ -284,7 +285,7 @@ static int ip_tun_fill_encap_info(struct sk_buff *skb,
|
||||
|
||||
static int ip_tun_encap_nlsize(struct lwtunnel_state *lwtstate)
|
||||
{
|
||||
return nla_total_size(8) /* LWTUNNEL_IP_ID */
|
||||
return nla_total_size_64bit(8) /* LWTUNNEL_IP_ID */
|
||||
+ nla_total_size(4) /* LWTUNNEL_IP_DST */
|
||||
+ nla_total_size(4) /* LWTUNNEL_IP_SRC */
|
||||
+ nla_total_size(1) /* LWTUNNEL_IP_TOS */
|
||||
@@ -366,7 +367,8 @@ static int ip6_tun_fill_encap_info(struct sk_buff *skb,
|
||||
{
|
||||
struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
|
||||
|
||||
if (nla_put_be64(skb, LWTUNNEL_IP6_ID, tun_info->key.tun_id) ||
|
||||
if (nla_put_be64(skb, LWTUNNEL_IP6_ID, tun_info->key.tun_id,
|
||||
LWTUNNEL_IP6_PAD) ||
|
||||
nla_put_in6_addr(skb, LWTUNNEL_IP6_DST, &tun_info->key.u.ipv6.dst) ||
|
||||
nla_put_in6_addr(skb, LWTUNNEL_IP6_SRC, &tun_info->key.u.ipv6.src) ||
|
||||
nla_put_u8(skb, LWTUNNEL_IP6_TC, tun_info->key.tos) ||
|
||||
@@ -379,7 +381,7 @@ static int ip6_tun_fill_encap_info(struct sk_buff *skb,
|
||||
|
||||
static int ip6_tun_encap_nlsize(struct lwtunnel_state *lwtstate)
|
||||
{
|
||||
return nla_total_size(8) /* LWTUNNEL_IP6_ID */
|
||||
return nla_total_size_64bit(8) /* LWTUNNEL_IP6_ID */
|
||||
+ nla_total_size(16) /* LWTUNNEL_IP6_DST */
|
||||
+ nla_total_size(16) /* LWTUNNEL_IP6_SRC */
|
||||
+ nla_total_size(1) /* LWTUNNEL_IP6_HOPLIMIT */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user