summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/in.h
diff options
context:
space:
mode:
authorMichael Brown2013-08-06 16:56:54 +0200
committerMichael Brown2013-08-06 16:56:54 +0200
commit252d28f098bfd12df59fe147d7e8354be61a6da8 (patch)
tree234bc573f3c7a27730d04016c809dc6ae5ba8c24 /src/include/ipxe/in.h
parent[ipv6] Rename sin_{family,port} to sin6_{family,port} in struct sockaddr_in6 (diff)
downloadipxe-252d28f098bfd12df59fe147d7e8354be61a6da8.tar.gz
ipxe-252d28f098bfd12df59fe147d7e8354be61a6da8.tar.xz
ipxe-252d28f098bfd12df59fe147d7e8354be61a6da8.zip
[tcpip] Allow binding to unspecified privileged ports (below 1024)
Originally-implemented-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/in.h')
-rw-r--r--src/include/ipxe/in.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/include/ipxe/in.h b/src/include/ipxe/in.h
index 1208ae38..eee9159f 100644
--- a/src/include/ipxe/in.h
+++ b/src/include/ipxe/in.h
@@ -59,19 +59,22 @@ struct sockaddr_in {
* Always set to @c AF_INET for IPv4 addresses
*/
sa_family_t sin_family;
+ /** Flags (part of struct @c sockaddr_tcpip) */
+ uint16_t sin_flags;
/** TCP/IP port (part of struct @c sockaddr_tcpip) */
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.
+ * This ensures that a struct @c sockaddr_in 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 ) ];
+ char pad[ sizeof ( struct sockaddr ) -
+ ( sizeof ( sa_family_t ) /* sin_family */ +
+ sizeof ( uint16_t ) /* sin_flags */ +
+ sizeof ( uint16_t ) /* sin_port */ +
+ sizeof ( struct in_addr ) /* sin_addr */ ) ];
} __attribute__ (( may_alias ));
/**
@@ -83,11 +86,26 @@ struct sockaddr_in6 {
* Always set to @c AF_INET6 for IPv6 addresses
*/
sa_family_t sin6_family;
+ /** Flags (part of struct @c sockaddr_tcpip) */
+ uint16_t sin6_flags;
/** TCP/IP port (part of struct @c sockaddr_tcpip) */
uint16_t sin6_port;
uint32_t sin6_flowinfo; /* Flow number */
struct in6_addr sin6_addr; /* 128-bit destination address */
uint32_t sin6_scope_id; /* Scope ID */
+ /** Padding
+ *
+ * This ensures that a struct @c sockaddr_in6 is large
+ * enough to hold a socket address for any TCP/IP address
+ * family.
+ */
+ char pad[ sizeof ( struct sockaddr ) -
+ ( sizeof ( sa_family_t ) /* sin6_family */ +
+ sizeof ( uint16_t ) /* sin6_flags */ +
+ sizeof ( uint16_t ) /* sin6_port */ +
+ sizeof ( uint32_t ) /* sin6_flowinfo */ +
+ sizeof ( struct in6_addr ) /* sin6_addr */ +
+ sizeof ( uint32_t ) /* sin6_scope_id */ ) ];
} __attribute__ (( may_alias ));
extern int inet_aton ( const char *cp, struct in_addr *inp );