|
|
@@ -24,6 +24,7 @@
|
|
24
|
24
|
#include <assert.h>
|
|
25
|
25
|
#include <gpxe/if_arp.h>
|
|
26
|
26
|
#include <gpxe/if_ether.h>
|
|
|
27
|
+#include <gpxe/in.h>
|
|
27
|
28
|
#include <gpxe/netdevice.h>
|
|
28
|
29
|
#include <gpxe/iobuf.h>
|
|
29
|
30
|
#include <gpxe/ethernet.h>
|
|
|
@@ -92,8 +93,8 @@ static int eth_pull ( struct io_buffer *iobuf,
|
|
92
|
93
|
/**
|
|
93
|
94
|
* Transcribe Ethernet address
|
|
94
|
95
|
*
|
|
95
|
|
- * @v ll_addr Link-layer address
|
|
96
|
|
- * @ret string Link-layer address in human-readable format
|
|
|
96
|
+ * @v ll_addr Link-layer address
|
|
|
97
|
+ * @ret string Link-layer address in human-readable format
|
|
97
|
98
|
*/
|
|
98
|
99
|
const char * eth_ntoa ( const void *ll_addr ) {
|
|
99
|
100
|
static char buf[18]; /* "00:00:00:00:00:00" */
|
|
|
@@ -105,6 +106,32 @@ const char * eth_ntoa ( const void *ll_addr ) {
|
|
105
|
106
|
return buf;
|
|
106
|
107
|
}
|
|
107
|
108
|
|
|
|
109
|
+/**
|
|
|
110
|
+ * Hash multicast address
|
|
|
111
|
+ *
|
|
|
112
|
+ * @v af Address family
|
|
|
113
|
+ * @v net_addr Network-layer address
|
|
|
114
|
+ * @v ll_addr Link-layer address to fill in
|
|
|
115
|
+ * @ret rc Return status code
|
|
|
116
|
+ */
|
|
|
117
|
+static int eth_mc_hash ( unsigned int af, const void *net_addr,
|
|
|
118
|
+ void *ll_addr ) {
|
|
|
119
|
+ const uint8_t *net_addr_bytes = net_addr;
|
|
|
120
|
+ uint8_t *ll_addr_bytes = ll_addr;
|
|
|
121
|
+
|
|
|
122
|
+ switch ( af ) {
|
|
|
123
|
+ case AF_INET:
|
|
|
124
|
+ ll_addr_bytes[0] = 0x01;
|
|
|
125
|
+ ll_addr_bytes[1] = 0x00;
|
|
|
126
|
+ ll_addr_bytes[2] = 0x5e;
|
|
|
127
|
+ ll_addr_bytes[3] = net_addr_bytes[1] & 0x7f;
|
|
|
128
|
+ ll_addr_bytes[4] = net_addr_bytes[2];
|
|
|
129
|
+ ll_addr_bytes[5] = net_addr_bytes[3];
|
|
|
130
|
+ default:
|
|
|
131
|
+ return -ENOTSUP;
|
|
|
132
|
+ }
|
|
|
133
|
+}
|
|
|
134
|
+
|
|
108
|
135
|
/** Ethernet protocol */
|
|
109
|
136
|
struct ll_protocol ethernet_protocol __ll_protocol = {
|
|
110
|
137
|
.name = "Ethernet",
|
|
|
@@ -115,4 +142,5 @@ struct ll_protocol ethernet_protocol __ll_protocol = {
|
|
115
|
142
|
.push = eth_push,
|
|
116
|
143
|
.pull = eth_pull,
|
|
117
|
144
|
.ntoa = eth_ntoa,
|
|
|
145
|
+ .mc_hash = eth_mc_hash,
|
|
118
|
146
|
};
|