From aa160211c22da70cce4a28d19fb5bd00b16e840d Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 9 Jun 2008 22:56:48 +0100 Subject: [udp] Verify local socket address (if specified) for UDP sockets UDP sockets can be used for multicast, at which point it becomes plausible that we could receive packets that aren't destined for us but that still match on a port number. --- src/include/gpxe/in.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/include') diff --git a/src/include/gpxe/in.h b/src/include/gpxe/in.h index 89530a559..40e4d4073 100644 --- a/src/include/gpxe/in.h +++ b/src/include/gpxe/in.h @@ -62,6 +62,15 @@ struct sockaddr_in { uint16_t sin_port; /** IPv4 address */ struct in_addr sin_addr; + /** Padding + * + * This ensures that a struct @c sockaddr_tcpip is large + * enough to hold a socket address for any TCP/IP address + * family. + */ + char pad[ sizeof ( struct sockaddr ) - sizeof ( sa_family_t ) + - sizeof ( uint16_t ) + - sizeof ( struct in_addr ) ]; }; /** -- cgit v1.2.3-55-g7522