[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.
This commit is contained in:
Michael Brown
2008-06-09 22:56:48 +01:00
parent 77a5cc6b13
commit aa160211c2
2 changed files with 38 additions and 22 deletions

View File

@@ -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 ) ];
};
/**