Skip to content

Commit

Permalink
shell: adapt netif shell commands for bc flag
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Mar 29, 2015
1 parent 5909e31 commit 760fb21
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions sys/shell/commands/sc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,10 @@ int _netif_send(int argc, char **argv)
size_t addr_len;
ng_pktsnip_t *pkt;
ng_netif_hdr_t *nethdr;

uint8_t flags = 0x00;

if (argc < 4) {
printf("usage: %s <if> <addr> <data>\n", argv[0]);
printf("usage: %s <if> [<addr>|bcast] <data>\n", argv[0]);
return 1;
}

Expand All @@ -349,8 +349,13 @@ int _netif_send(int argc, char **argv)
addr_len = _parse_hwaddr(argv[2], addr);

if (addr_len == 0) {
puts("error: invalid address given");
return 1;
if (strcmp(argv[2], "bcast") == 0) {
flags |= NG_NETIF_HDR_FLAGS_BROADCAST;
}
else {
puts("error: invalid address given");
return 1;
}
}

/* put packet together */
Expand All @@ -360,6 +365,7 @@ int _netif_send(int argc, char **argv)
nethdr = (ng_netif_hdr_t *)pkt->data;
ng_netif_hdr_init(nethdr, 0, addr_len);
ng_netif_hdr_set_dst_addr(nethdr, addr, addr_len);
nethdr->flags = flags;
/* and send it */
ng_netapi_send(dev, pkt);

Expand Down

0 comments on commit 760fb21

Please sign in to comment.