|
@@ -188,13 +188,15 @@ static int loopback_wait ( void *data, size_t len ) {
|
188
|
188
|
* @v sender Sending network device
|
189
|
189
|
* @v receiver Received network device
|
190
|
190
|
* @v mtu Packet size (excluding link-layer headers)
|
|
191
|
+ * @v broadcast Use broadcast link-layer address
|
191
|
192
|
* @ret rc Return status code
|
192
|
193
|
*/
|
193
|
194
|
int loopback_test ( struct net_device *sender, struct net_device *receiver,
|
194
|
|
- size_t mtu ) {
|
|
195
|
+ size_t mtu, int broadcast ) {
|
195
|
196
|
uint8_t *buf;
|
196
|
197
|
uint32_t *seq;
|
197
|
198
|
struct io_buffer *iobuf;
|
|
199
|
+ const void *ll_dest;
|
198
|
200
|
unsigned int i;
|
199
|
201
|
unsigned int successes;
|
200
|
202
|
int rc;
|
|
@@ -219,9 +221,13 @@ int loopback_test ( struct net_device *sender, struct net_device *receiver,
|
219
|
221
|
return -ENOMEM;
|
220
|
222
|
seq = ( ( void * ) buf );
|
221
|
223
|
|
|
224
|
+ /* Determine destination address */
|
|
225
|
+ ll_dest = ( broadcast ? sender->ll_broadcast : receiver->ll_addr );
|
|
226
|
+
|
222
|
227
|
/* Print initial statistics */
|
223
|
|
- printf ( "Performing loopback test from %s to %s with %zd byte MTU\n",
|
224
|
|
- sender->name, receiver->name, mtu );
|
|
228
|
+ printf ( "Performing %sloopback test from %s to %s with %zd byte MTU\n",
|
|
229
|
+ ( broadcast ? "broadcast " : "" ), sender->name,
|
|
230
|
+ receiver->name, mtu );
|
225
|
231
|
ifstat ( sender );
|
226
|
232
|
ifstat ( receiver );
|
227
|
233
|
|
|
@@ -250,7 +256,7 @@ int loopback_test ( struct net_device *sender, struct net_device *receiver,
|
250
|
256
|
|
251
|
257
|
/* Transmit packet */
|
252
|
258
|
if ( ( rc = net_tx ( iob_disown ( iobuf ), sender,
|
253
|
|
- &lotest_protocol, receiver->ll_addr,
|
|
259
|
+ &lotest_protocol, ll_dest,
|
254
|
260
|
sender->ll_addr ) ) != 0 ) {
|
255
|
261
|
printf ( "\nFailed to transmit packet: %s",
|
256
|
262
|
strerror ( rc ) );
|