linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* packed structures used in socket options
@ 2020-06-07 10:49 Michael Tuexen
  2020-06-07 13:53 ` David Laight
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Michael Tuexen @ 2020-06-07 10:49 UTC (permalink / raw)
  To: linux-sctp

Dear all,

since gcc uses -Werror­dress-of-packed-member, I get warnings for my variant
of packetdrill, which supports SCTP.

Here is why:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/sctp.h?h=v5.7
contains:

struct sctp_paddrparams {
	sctp_assoc_t		spp_assoc_id;
	struct sockaddr_storage	spp_address;
	__u32			spp_hbinterval;
	__u16			spp_pathmaxrxt;
	__u32			spp_pathmtu;
	__u32			spp_sackdelay;
	__u32			spp_flags;
	__u32			spp_ipv6_flowlabel;
	__u8			spp_dscp;
} __attribute__((packed, aligned(4)));

This structure is only used in the IPPROTO_SCTP level socket option SCTP_PEER_ADDR_PARAMS.
Why is it packed?

Accessing spp_address, spp_pathmtu, spp_sackdelay, spp_flags, and spp_ipv6_flowlabel
results in warnings related to -Werror­dress-of-packed-member.

Am I supposed to access these fields via memcpy only?

Please note that a similar problem exists also with other structures in that file, I
used struct sctp_paddrparams as an example.

Best regards
Michael

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-06-08 21:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-07 10:49 packed structures used in socket options Michael Tuexen
2020-06-07 13:53 ` David Laight
2020-06-07 15:15 ` Michael Tuexen
2020-06-07 17:14 ` David Laight
2020-06-07 17:23 ` Michael Tuexen
2020-06-07 20:21 ` David Laight
2020-06-07 21:35 ` Ivan Skytte Jørgensen
2020-06-08 16:18   ` David Laight
2020-06-08 17:37     ` Michael Tuexen
2020-06-08 21:13       ` David Laight
2020-06-07 21:51 ` Michael Tuexen
2020-06-08  8:17   ` David Laight
2020-06-07 21:55 ` Michael Tuexen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).