summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/in.h
diff options
context:
space:
mode:
authorMichael Brown2015-07-21 15:54:11 +0200
committerMichael Brown2015-07-28 14:48:29 +0200
commit2bcf13f13aff503c47041caaab7cb42bb7ed1484 (patch)
tree0df326f4fb82e26babc7ce5d55a2e8b84ac996e1 /src/include/ipxe/in.h
parent[ipv4] Redefine IP address constants to avoid unnecessary byte swapping (diff)
downloadipxe-2bcf13f13aff503c47041caaab7cb42bb7ed1484.tar.gz
ipxe-2bcf13f13aff503c47041caaab7cb42bb7ed1484.tar.xz
ipxe-2bcf13f13aff503c47041caaab7cb42bb7ed1484.zip
[ipv4] Allow IPv4 socket addresses to include a scope ID
Extend the IPv6 concept of "scope ID" (indicating the network device index) to IPv4 socket addresses, so that IPv4 multicast transmissions may specify the transmitting network device. The scope ID is not (currently) exposed via the string representation of the socket address, since IPv4 does not use the IPv6 concept of link-local addresses (which could legitimately be specified in a URI). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/in.h')
-rw-r--r--src/include/ipxe/in.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/include/ipxe/in.h b/src/include/ipxe/in.h
index 2a49b00b..0ebf441c 100644
--- a/src/include/ipxe/in.h
+++ b/src/include/ipxe/in.h
@@ -85,6 +85,11 @@ struct sockaddr_in {
uint16_t sin_flags;
/** TCP/IP port (part of struct @c sockaddr_tcpip) */
uint16_t sin_port;
+ /** Scope ID (part of struct @c sockaddr_tcpip)
+ *
+ * For multicast addresses, this is the network device index.
+ */
+ uint16_t sin_scope_id;
/** IPv4 address */
struct in_addr sin_addr;
/** Padding
@@ -96,6 +101,7 @@ struct sockaddr_in {
( sizeof ( sa_family_t ) /* sin_family */ +
sizeof ( uint16_t ) /* sin_flags */ +
sizeof ( uint16_t ) /* sin_port */ +
+ sizeof ( uint16_t ) /* sin_scope_id */ +
sizeof ( struct in_addr ) /* sin_addr */ ) ];
} __attribute__ (( packed, may_alias ));
@@ -112,9 +118,10 @@ struct sockaddr_in6 {
uint16_t sin6_flags;
/** TCP/IP port (part of struct @c sockaddr_tcpip) */
uint16_t sin6_port;
- /** Scope ID
+ /** Scope ID (part of struct @c sockaddr_tcpip)
*
- * For link-local addresses, this is the network device index.
+ * For link-local or multicast addresses, this is the network
+ * device index.
*/
uint16_t sin6_scope_id;
/** IPv6 address */