mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
ipv6: remove hard coded limitation on ipv6_pinfo
IPv6 inet sockets are supposed to have a "struct ipv6_pinfo"
field at the end of their definition, so that inet6_sk_generic()
can derive from socket size the offset of the "struct ipv6_pinfo".
This is very fragile, and prevents adding bigger alignment
in sockets, because inet6_sk_generic() does not work
if the compiler adds padding after the ipv6_pinfo component.
We are currently working on a patch series to reorganize
TCP structures for better data locality and found issues
similar to the one fixed in commit f5d547676c
("tcp: fix tcp_inet6_sk() for 32bit kernels")
Alternative would be to force an alignment on "struct ipv6_pinfo",
greater or equal to __alignof__(any ipv6 sock) to ensure there is
no padding. This does not look great.
v2: fix typo in mptcp_proto_v6_init() (Paolo)
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Chao Wu <wwchao@google.com>
Cc: Wei Wang <weiwan@google.com>
Cc: Coco Li <lixiaoyan@google.com>
Cc: YiFei Zhu <zhuyifei@google.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
1671bcfd76
commit
f5f80e32de
@@ -200,14 +200,7 @@ struct inet6_cork {
|
||||
u8 tclass;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ipv6_pinfo - ipv6 private area
|
||||
*
|
||||
* In the struct sock hierarchy (tcp6_sock, upd6_sock, etc)
|
||||
* this _must_ be the last member, so that inet6_sk_generic
|
||||
* is able to calculate its offset from the base struct sock
|
||||
* by using the struct proto->slab_obj_size member. -acme
|
||||
*/
|
||||
/* struct ipv6_pinfo - ipv6 private area */
|
||||
struct ipv6_pinfo {
|
||||
struct in6_addr saddr;
|
||||
struct in6_pktinfo sticky_pktinfo;
|
||||
@@ -307,19 +300,19 @@ struct raw6_sock {
|
||||
__u32 offset; /* checksum offset */
|
||||
struct icmp6_filter filter;
|
||||
__u32 ip6mr_table;
|
||||
/* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */
|
||||
|
||||
struct ipv6_pinfo inet6;
|
||||
};
|
||||
|
||||
struct udp6_sock {
|
||||
struct udp_sock udp;
|
||||
/* ipv6_pinfo has to be the last member of udp6_sock, see inet6_sk_generic */
|
||||
|
||||
struct ipv6_pinfo inet6;
|
||||
};
|
||||
|
||||
struct tcp6_sock {
|
||||
struct tcp_sock tcp;
|
||||
/* ipv6_pinfo has to be the last member of tcp6_sock, see inet6_sk_generic */
|
||||
|
||||
struct ipv6_pinfo inet6;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user