1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
19321: examples/gnrc_border_router: add BLE as downlink option r=benpicco a=benpicco



19325: esptools/install.sh: Fix shellcheck issues r=benpicco a=bergzand

### Contribution description

Quote all the things!


### Testing procedure

The script should still work as before


### Issues/PRs references

None

19327: shell/cmds: GNRC: replace puts() with printf() r=benpicco a=benpicco



19328: pkg/u8g2: bump version r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
This commit is contained in:
bors[bot] 2023-02-27 16:30:53 +00:00 committed by GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 154 additions and 153 deletions

View File

@ -8,7 +8,7 @@ ESP32_OPENOCD_VERSION="v0.11.0-esp32-20211220"
ESP32_OPENOCD_VERSION_TGZ="0.11.0-esp32-20211220" ESP32_OPENOCD_VERSION_TGZ="0.11.0-esp32-20211220"
# set the tool path to the default if not already set # set the tool path to the default if not already set
if [ -z ${IDF_TOOLS_PATH} ]; then if [ -z "${IDF_TOOLS_PATH}" ]; then
IDF_TOOLS_PATH=${HOME}/.espressif IDF_TOOLS_PATH=${HOME}/.espressif
fi fi
@ -64,9 +64,9 @@ esac
download() download()
{ {
if [ "${URL_GET}" = "curl" ]; then if [ "${URL_GET}" = "curl" ]; then
curl -L $1 -o $2 curl -L "$1" -o "$2"
elif [ "${URL_GET}" = "wget" ]; then elif [ "${URL_GET}" = "wget" ]; then
wget $1 -O $2 wget "$1" -O "$2"
else else
exit 1 exit 1
fi fi
@ -99,8 +99,8 @@ install_arch()
URL=${URL_PATH}/${ESP32_GCC_RELEASE}/${URL_TGZ} URL=${URL_PATH}/${ESP32_GCC_RELEASE}/${URL_TGZ}
echo "Creating directory ${TOOLS_DIR} ..." && \ echo "Creating directory ${TOOLS_DIR} ..." && \
mkdir -p ${TOOLS_DIR} && \ mkdir -p "${TOOLS_DIR}" && \
cd ${TOOLS_DIR} && \ cd "${TOOLS_DIR}" && \
echo "Downloading ${URL_TGZ} ..." && \ echo "Downloading ${URL_TGZ} ..." && \
download ${URL} ${URL_TGZ} && \ download ${URL} ${URL_TGZ} && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \ echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
@ -119,8 +119,8 @@ install_openocd()
URL=${URL_PATH}/${ESP32_OPENOCD_VERSION}/${URL_TGZ} URL=${URL_PATH}/${ESP32_OPENOCD_VERSION}/${URL_TGZ}
echo "Creating directory ${TOOLS_DIR} ..." && \ echo "Creating directory ${TOOLS_DIR} ..." && \
mkdir -p ${TOOLS_DIR} && \ mkdir -p "${TOOLS_DIR}" && \
cd ${TOOLS_DIR} && \ cd "${TOOLS_DIR}" && \
echo "Downloading ${URL_TGZ} ..." && \ echo "Downloading ${URL_TGZ} ..." && \
download ${URL} ${URL_TGZ} && \ download ${URL} ${URL_TGZ} && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \ echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
@ -151,8 +151,8 @@ install_qemu()
URL=${URL_PATH}/${ESP32_QEMU_VERSION}/${URL_TGZ} URL=${URL_PATH}/${ESP32_QEMU_VERSION}/${URL_TGZ}
echo "Creating directory ${TOOLS_DIR} ..." && \ echo "Creating directory ${TOOLS_DIR} ..." && \
mkdir -p ${TOOLS_DIR} && \ mkdir -p "${TOOLS_DIR}" && \
cd ${TOOLS_DIR} && \ cd "${TOOLS_DIR}" && \
echo "Downloading ${URL_TGZ} ..." && \ echo "Downloading ${URL_TGZ} ..." && \
download ${URL} ${URL_TGZ} && \ download ${URL} ${URL_TGZ} && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \ echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
@ -162,14 +162,14 @@ install_qemu()
echo "QEMU for ESP32 installed in ${TOOLS_DIR}" echo "QEMU for ESP32 installed in ${TOOLS_DIR}"
} }
if [ -z $1 ]; then if [ -z "$1" ]; then
echo "Usage: install.sh <tool>" echo "Usage: install.sh <tool>"
echo "tool = all | esp32 | esp32c3 | esp32s2 | esp32s3 | openocd | qemu" echo "tool = all | esp32 | esp32c3 | esp32s2 | esp32s3 | openocd | qemu"
exit 1 exit 1
elif [ "$1" = "all" ]; then elif [ "$1" = "all" ]; then
ARCH_ALL="esp32 esp32c3 esp32s2 esp32s3" ARCH_ALL="esp32 esp32c3 esp32s2 esp32s3"
for arch in ${ARCH_ALL}; do for arch in ${ARCH_ALL}; do
install_arch $arch install_arch "$arch"
done done
install_openocd install_openocd
install_qemu install_qemu
@ -178,7 +178,7 @@ elif [ "$1" = "openocd" ]; then
elif [ "$1" = "qemu" ]; then elif [ "$1" = "qemu" ]; then
install_qemu install_qemu
else else
install_arch $1 install_arch "$1"
fi fi
echo "Use following command to extend the PATH variable:" echo "Use following command to extend the PATH variable:"

View File

@ -7,11 +7,16 @@ ifeq (,$(filter native,$(BOARD)))
else ifeq (wifi,$(UPLINK)) else ifeq (wifi,$(UPLINK))
ifneq (,$(filter esp32 esp8266,$(CPU))) ifneq (,$(filter esp32 esp8266,$(CPU)))
USEMODULE += esp_wifi USEMODULE += esp_wifi
USEMODULE += esp_now ifneq (ble, $(DOWNLINK))
USEMODULE += esp_now
endif
else else
$(error Only esp32 and esp8266 are currently supported) $(error Only esp32 and esp8266 are currently supported)
endif endif
endif endif
ifeq (ble, $(DOWNLINK))
USEMODULE += nimble_rpble
endif
else else
USEMODULE += netdev_tap USEMODULE += netdev_tap
USEMODULE += socket_zep USEMODULE += socket_zep

View File

@ -12,7 +12,6 @@ BOARD_INSUFFICIENT_MEMORY := \
bluepill-stm32f103c8 \ bluepill-stm32f103c8 \
derfmega128 \ derfmega128 \
i-nucleo-lrwan1 \ i-nucleo-lrwan1 \
microduino-corerf \
msb-430 \ msb-430 \
msb-430h \ msb-430h \
nucleo-f030r8 \ nucleo-f030r8 \

View File

@ -1,6 +1,6 @@
PKG_NAME=u8g2 PKG_NAME=u8g2
PKG_URL=https://github.com/olikraus/u8g2 PKG_URL=https://github.com/olikraus/u8g2
PKG_VERSION=3500b1056b33999b285387d196c78fe4ab707f79 PKG_VERSION=3d41860b4308d60a920f56b65e1b01c155fdfe81
PKG_LICENSE=BSD-2-Clause PKG_LICENSE=BSD-2-Clause
include $(RIOTBASE)/pkg/pkg.mk include $(RIOTBASE)/pkg/pkg.mk

View File

@ -13,7 +13,4 @@ ifneq (,$(filter u8g2_sdl,$(USEMODULE)))
LINKFLAGS += $(shell sdl2-config --libs) LINKFLAGS += $(shell sdl2-config --libs)
endif endif
# https://github.com/olikraus/u8g2/pull/2101
CFLAGS += -Wno-error=sign-compare
PSEUDOMODULES += u8g2 PSEUDOMODULES += u8g2

View File

@ -21,7 +21,7 @@
void sixlowpan_print(uint8_t *data, size_t size) void sixlowpan_print(uint8_t *data, size_t size)
{ {
if (data[0] == SIXLOWPAN_UNCOMP) { if (data[0] == SIXLOWPAN_UNCOMP) {
puts("Uncompressed IPv6 packet"); printf("Uncompressed IPv6 packet\n");
/* might just be the dispatch (or fragmented) so better check */ /* might just be the dispatch (or fragmented) so better check */
if (size > sizeof(ipv6_hdr_t)) { if (size > sizeof(ipv6_hdr_t)) {
@ -32,13 +32,13 @@ void sixlowpan_print(uint8_t *data, size_t size)
} }
} }
else if (sixlowpan_nalp(data[0])) { else if (sixlowpan_nalp(data[0])) {
puts("Not a LoWPAN (NALP) frame"); printf("Not a LoWPAN (NALP) frame\n");
od_hex_dump(data, size, OD_WIDTH_DEFAULT); od_hex_dump(data, size, OD_WIDTH_DEFAULT);
} }
else if ((data[0] & SIXLOWPAN_FRAG_DISP_MASK) == SIXLOWPAN_FRAG_1_DISP) { else if ((data[0] & SIXLOWPAN_FRAG_DISP_MASK) == SIXLOWPAN_FRAG_1_DISP) {
sixlowpan_frag_t *hdr = (sixlowpan_frag_t *)data; sixlowpan_frag_t *hdr = (sixlowpan_frag_t *)data;
puts("Fragmentation Header (first)"); printf("Fragmentation Header (first)\n");
printf("datagram size: %u\n", printf("datagram size: %u\n",
(byteorder_ntohs(hdr->disp_size) & SIXLOWPAN_FRAG_SIZE_MASK)); (byteorder_ntohs(hdr->disp_size) & SIXLOWPAN_FRAG_SIZE_MASK));
printf("tag: 0x%04x\n", byteorder_ntohs(hdr->tag)); printf("tag: 0x%04x\n", byteorder_ntohs(hdr->tag));
@ -50,7 +50,7 @@ void sixlowpan_print(uint8_t *data, size_t size)
else if ((data[0] & SIXLOWPAN_FRAG_DISP_MASK) == SIXLOWPAN_FRAG_N_DISP) { else if ((data[0] & SIXLOWPAN_FRAG_DISP_MASK) == SIXLOWPAN_FRAG_N_DISP) {
sixlowpan_frag_n_t *hdr = (sixlowpan_frag_n_t *)data; sixlowpan_frag_n_t *hdr = (sixlowpan_frag_n_t *)data;
puts("Fragmentation Header (subsequent)"); printf("Fragmentation Header (subsequent)\n");
printf("datagram size: %u\n", printf("datagram size: %u\n",
(byteorder_ntohs(hdr->disp_size) & SIXLOWPAN_FRAG_SIZE_MASK)); (byteorder_ntohs(hdr->disp_size) & SIXLOWPAN_FRAG_SIZE_MASK));
printf("tag: 0x%04x\n", byteorder_ntohs(hdr->tag)); printf("tag: 0x%04x\n", byteorder_ntohs(hdr->tag));
@ -62,51 +62,51 @@ void sixlowpan_print(uint8_t *data, size_t size)
} }
else if ((data[0] & SIXLOWPAN_IPHC1_DISP_MASK) == SIXLOWPAN_IPHC1_DISP) { else if ((data[0] & SIXLOWPAN_IPHC1_DISP_MASK) == SIXLOWPAN_IPHC1_DISP) {
uint8_t offset = SIXLOWPAN_IPHC_HDR_LEN; uint8_t offset = SIXLOWPAN_IPHC_HDR_LEN;
puts("IPHC dispatch"); printf("IPHC dispatch\n");
switch (data[0] & SIXLOWPAN_IPHC1_TF) { switch (data[0] & SIXLOWPAN_IPHC1_TF) {
case 0x00: case 0x00:
puts("TF: ECN + DSCP + Flow Label (4 bytes)"); printf("TF: ECN + DSCP + Flow Label (4 bytes)\n");
break; break;
case 0x08: case 0x08:
puts("TF: ECN + Flow Label (3 bytes)"); printf("TF: ECN + Flow Label (3 bytes)\n");
break; break;
case 0x10: case 0x10:
puts("TF: ECN + DSCP (1 bytes)"); printf("TF: ECN + DSCP (1 bytes)\n");
break; break;
case 0x18: case 0x18:
puts("TF: traffic class and flow label elided"); printf("TF: traffic class and flow label elided\n");
break; break;
} }
switch (data[0] & SIXLOWPAN_IPHC1_NH) { switch (data[0] & SIXLOWPAN_IPHC1_NH) {
case 0x00: case 0x00:
puts("NH: inline"); printf("NH: inline\n");
break; break;
case 0x04: case 0x04:
puts("NH: LOWPAN_NHC"); printf("NH: LOWPAN_NHC\n");
break; break;
} }
switch (data[0] & SIXLOWPAN_IPHC1_HL) { switch (data[0] & SIXLOWPAN_IPHC1_HL) {
case 0x00: case 0x00:
puts("HLIM: inline"); printf("HLIM: inline\n");
break; break;
case 0x01: case 0x01:
puts("HLIM: 1"); printf("HLIM: 1\n");
break; break;
case 0x02: case 0x02:
puts("HLIM: 64"); printf("HLIM: 64\n");
break; break;
case 0x03: case 0x03:
puts("HLIM: 255"); printf("HLIM: 255\n");
break; break;
} }
@ -115,19 +115,19 @@ void sixlowpan_print(uint8_t *data, size_t size)
switch (data[1] & SIXLOWPAN_IPHC2_SAM) { switch (data[1] & SIXLOWPAN_IPHC2_SAM) {
case 0x00: case 0x00:
puts("unspecified address (::)"); printf("unspecified address (::)\n");
break; break;
case 0x10: case 0x10:
puts("64 bits inline"); printf("64 bits inline\n");
break; break;
case 0x20: case 0x20:
puts("16 bits inline"); printf("16 bits inline\n");
break; break;
case 0x30: case 0x30:
puts("elided (use L2 address)"); printf("elided (use L2 address)\n");
break; break;
} }
} }
@ -136,57 +136,57 @@ void sixlowpan_print(uint8_t *data, size_t size)
switch (data[1] & SIXLOWPAN_IPHC2_SAM) { switch (data[1] & SIXLOWPAN_IPHC2_SAM) {
case 0x00: case 0x00:
puts("128 bits inline"); printf("128 bits inline\n");
break; break;
case 0x10: case 0x10:
puts("64 bits inline"); printf("64 bits inline\n");
break; break;
case 0x20: case 0x20:
puts("16 bits inline"); printf("16 bits inline\n");
break; break;
case 0x30: case 0x30:
puts("elided (use L2 address)"); printf("elided (use L2 address)\n");
break; break;
} }
} }
if (data[1] & SIXLOWPAN_IPHC2_M) { if (data[1] & SIXLOWPAN_IPHC2_M) {
if (data[1] & SIXLOWPAN_IPHC2_DAC) { if (data[1] & SIXLOWPAN_IPHC2_DAC) {
puts("Stateful destination multicast address compression:"); printf("Stateful destination multicast address compression:\n");
switch (data[1] & SIXLOWPAN_IPHC2_DAM) { switch (data[1] & SIXLOWPAN_IPHC2_DAM) {
case 0x00: case 0x00:
puts(" 48 bits carried inline (Unicast-Prefix-based)"); printf(" 48 bits carried inline (Unicast-Prefix-based)\n");
break; break;
case 0x01: case 0x01:
case 0x02: case 0x02:
case 0x03: case 0x03:
puts(" reserved"); printf(" reserved\n");
break; break;
} }
} }
else { else {
puts("Stateless destination multicast address compression:"); printf("Stateless destination multicast address compression:\n");
switch (data[1] & SIXLOWPAN_IPHC2_DAM) { switch (data[1] & SIXLOWPAN_IPHC2_DAM) {
case 0x00: case 0x00:
puts(" 128 bits carried inline"); printf(" 128 bits carried inline\n");
break; break;
case 0x01: case 0x01:
puts(" 48 bits carried inline"); printf(" 48 bits carried inline\n");
break; break;
case 0x02: case 0x02:
puts(" 32 bits carried inline"); printf(" 32 bits carried inline\n");
break; break;
case 0x03: case 0x03:
puts(" 8 bits carried inline"); printf(" 8 bits carried inline\n");
break; break;
} }
} }
@ -197,19 +197,19 @@ void sixlowpan_print(uint8_t *data, size_t size)
switch (data[1] & SIXLOWPAN_IPHC2_DAM) { switch (data[1] & SIXLOWPAN_IPHC2_DAM) {
case 0x00: case 0x00:
puts("reserved"); printf("reserved\n");
break; break;
case 0x01: case 0x01:
puts("64 bits inline"); printf("64 bits inline\n");
break; break;
case 0x02: case 0x02:
puts("16 bits inline"); printf("16 bits inline\n");
break; break;
case 0x03: case 0x03:
puts("elided (use L2 address)"); printf("elided (use L2 address)\n");
break; break;
} }
} }
@ -218,19 +218,19 @@ void sixlowpan_print(uint8_t *data, size_t size)
switch (data[1] & SIXLOWPAN_IPHC2_DAM) { switch (data[1] & SIXLOWPAN_IPHC2_DAM) {
case 0x00: case 0x00:
puts("128 bits inline"); printf("128 bits inline\n");
break; break;
case 0x01: case 0x01:
puts("64 bits inline"); printf("64 bits inline\n");
break; break;
case 0x02: case 0x02:
puts("16 bits inline"); printf("16 bits inline\n");
break; break;
case 0x03: case 0x03:
puts("elided (use L2 address)"); printf("elided (use L2 address)\n");
break; break;
} }
} }

View File

@ -155,17 +155,17 @@ static void _usage(char *cmdname)
{ {
printf("%s [-c <count>] [-h] [-i <ms interval>] [-s <packetsize>]\n", printf("%s [-c <count>] [-h] [-i <ms interval>] [-s <packetsize>]\n",
cmdname); cmdname);
puts(" [-t hoplimit] [-W <ms timeout>] <host>[%<interface>]"); printf(" [-t hoplimit] [-W <ms timeout>] <host>[%%<interface>]\n");
puts(" count: number of pings (default: 3)"); printf(" count: number of pings (default: 3)\n");
puts(" ms interval: wait interval milliseconds between sending " printf(" ms interval: wait interval milliseconds between sending "
"(default: 1000)"); "(default: 1000)\"");
puts(" packetsize: number of bytes in echo payload; must be >= 4 to " printf(" packetsize: number of bytes in echo payload; must be >= 4 to "
"measure round trip time (default: 4)"); "measure round trip time (default: 4)\n");
puts(" hoplimit: Set the IP time to life/hoplimit " printf(" hoplimit: Set the IP time to life/hoplimit "
"(default: interface config)"); "(default: interface config)\n");
puts(" ms timeout: Time to wait for a response in milliseconds " printf(" ms timeout: Time to wait for a response in milliseconds "
"(default: 1000). The option affects only timeout in absence " "(default: 1000). The option affects only timeout in absence "
"of any responses, otherwise wait for two RTTs"); "of any responses, otherwise wait for two RTTs\n");
} }
static int _configure(int argc, char **argv, _ping_data_t *data) static int _configure(int argc, char **argv, _ping_data_t *data)
@ -277,7 +277,7 @@ static void _pinger(_ping_data_t *data)
case 0: case 0:
break; break;
case ENOMEM: case ENOMEM:
puts("error: packet buffer full"); printf("error: packet buffer full\n");
break; break;
default: default:
printf("error: %d\n", res); printf("error: %d\n", res);

View File

@ -159,7 +159,7 @@ static int _netif_stats(netif_t *iface, unsigned module, bool reset)
sizeof(stats)); sizeof(stats));
if (res < 0) { if (res < 0) {
puts(" Protocol or device doesn't provide statistics."); printf(" Protocol or device doesn't provide statistics.\n");
} }
else if (reset) { else if (reset) {
res = netif_set_opt(iface, NETOPT_STATS, module, NULL, 0); res = netif_set_opt(iface, NETOPT_STATS, module, NULL, 0);
@ -194,7 +194,7 @@ static void _link_usage(char *cmd_name)
static void _set_usage(char *cmd_name) static void _set_usage(char *cmd_name)
{ {
printf("usage: %s <if_id> set <key> <value>\n", cmd_name); printf("usage: %s <if_id> set <key> <value>\n", cmd_name);
puts(" Sets an hardware specific specific value\n" printf(" Sets an hardware specific specific value\n"
" <key> may be one of the following\n" " <key> may be one of the following\n"
" * \"addr\" - sets (short) address\n" " * \"addr\" - sets (short) address\n"
" * \"addr_long\" - sets long address\n" " * \"addr_long\" - sets long address\n"
@ -287,7 +287,7 @@ static void _del_usage(char *cmd_name)
static void _stats_usage(char *cmd_name) static void _stats_usage(char *cmd_name)
{ {
printf("usage: %s <if_id> stats [l2|ipv6] [reset]\n", cmd_name); printf("usage: %s <if_id> stats [l2|ipv6] [reset]\n", cmd_name);
puts(" reset can be only used if the module is specified."); printf(" reset can be only used if the module is specified.\n");
} }
#endif #endif
@ -921,9 +921,9 @@ static void _netif_list(netif_t *iface)
res = netif_get_opt(iface, NETOPT_L2FILTER, 0, &filter, sizeof(filter)); res = netif_get_opt(iface, NETOPT_L2FILTER, 0, &filter, sizeof(filter));
if (res > 0) { if (res > 0) {
#ifdef MODULE_L2FILTER_WHITELIST #ifdef MODULE_L2FILTER_WHITELIST
puts("\n White-listed link layer addresses:"); printf("\n White-listed link layer addresses:\n");
#else #else
puts("\n Black-listed link layer addresses:"); printf("\n Black-listed link layer addresses:\n");
#endif #endif
int count = 0; int count = 0;
for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) { for (unsigned i = 0; i < CONFIG_L2FILTER_LISTSIZE; i++) {
@ -935,7 +935,7 @@ static void _netif_list(netif_t *iface)
} }
} }
if (count == 0) { if (count == 0) {
puts(" --- none ---"); printf(" --- none ---\n");
} }
} }
#endif #endif
@ -958,15 +958,15 @@ static int _netif_set_u32(netif_t *iface, netopt_t opt, uint32_t context,
if (fmt_is_number(u32_str)) { if (fmt_is_number(u32_str)) {
if ((res = strtoul(u32_str, NULL, 10)) == ULONG_MAX) { if ((res = strtoul(u32_str, NULL, 10)) == ULONG_MAX) {
puts("error: unable to parse value.\n" printf("error: unable to parse value.\n"
"Must be a 32-bit unsigned integer (dec or hex)\n"); "Must be a 32-bit unsigned integer (dec or hex)\n");
return 1; return 1;
} }
} }
else { else {
if ((res = strtoul(u32_str, NULL, 32)) == ULONG_MAX) { if ((res = strtoul(u32_str, NULL, 32)) == ULONG_MAX) {
puts("error: unable to parse value.\n" printf("error: unable to parse value.\n"
"Must be a 32-bit unsigned integer (dec or hex)\n"); "Must be a 32-bit unsigned integer (dec or hex)\n");
return 1; return 1;
} }
@ -1014,7 +1014,7 @@ static int _netif_set_bandwidth(netif_t *iface, char *value)
bw = LORA_BW_500_KHZ; bw = LORA_BW_500_KHZ;
} }
else { else {
puts("usage: ifconfig <if_id> set bw [125|250|500]"); printf("usage: ifconfig <if_id> set bw [125|250|500]\n");
return 1; return 1;
} }
if (netif_set_opt(iface, NETOPT_BANDWIDTH, 0, if (netif_set_opt(iface, NETOPT_BANDWIDTH, 0,
@ -1046,7 +1046,7 @@ static int _netif_set_coding_rate(netif_t *iface, char *value)
cr = LORA_CR_4_8; cr = LORA_CR_4_8;
} }
else { else {
puts("usage: ifconfig <if_id> set cr [4/5|4/6|4/7|4/8]"); printf("usage: ifconfig <if_id> set cr [4/5|4/6|4/7|4/8]\n");
return 1; return 1;
} }
if (netif_set_opt(iface, NETOPT_CODING_RATE, 0, if (netif_set_opt(iface, NETOPT_CODING_RATE, 0,
@ -1083,7 +1083,7 @@ static int _netif_set_fsk_fec(netif_t *iface, char *value)
return 0; return 0;
} }
puts("usage: ifconfig <if_id> set fec [none|NRNSC|RSC]"); printf("usage: ifconfig <if_id> set fec [none|NRNSC|RSC]\n");
return 1; return 1;
} }
@ -1155,15 +1155,15 @@ static int _netif_set_u16(netif_t *iface, netopt_t opt, uint16_t context,
if (fmt_is_number(u16_str)) { if (fmt_is_number(u16_str)) {
if ((res = strtoul(u16_str, NULL, 10)) == ULONG_MAX) { if ((res = strtoul(u16_str, NULL, 10)) == ULONG_MAX) {
puts("error: unable to parse value.\n" printf("error: unable to parse value.\n"
"Must be a 16-bit unsigned integer (dec or hex)\n"); "Must be a 16-bit unsigned integer (dec or hex)\n");
return 1; return 1;
} }
} }
else { else {
if ((res = strtoul(u16_str, NULL, 16)) == ULONG_MAX) { if ((res = strtoul(u16_str, NULL, 16)) == ULONG_MAX) {
puts("error: unable to parse value.\n" printf("error: unable to parse value.\n"
"Must be a 16-bit unsigned integer (dec or hex)\n"); "Must be a 16-bit unsigned integer (dec or hex)\n");
return 1; return 1;
} }
@ -1171,8 +1171,8 @@ static int _netif_set_u16(netif_t *iface, netopt_t opt, uint16_t context,
} }
if (res > 0xffff) { if (res > 0xffff) {
puts("error: unable to parse value.\n" printf("error: unable to parse value.\n"
"Must be a 16-bit unsigned integer (dec or hex)\n"); "Must be a 16-bit unsigned integer (dec or hex)\n");
return 1; return 1;
} }
@ -1245,7 +1245,7 @@ static int _netif_set_u8(netif_t *iface, netopt_t opt, uint16_t context,
static int _netif_set_flag(netif_t *iface, netopt_t opt, netopt_enable_t set) static int _netif_set_flag(netif_t *iface, netopt_t opt, netopt_enable_t set)
{ {
if (netif_set_opt(iface, opt, 0, &set, sizeof(netopt_enable_t)) < 0) { if (netif_set_opt(iface, opt, 0, &set, sizeof(netopt_enable_t)) < 0) {
puts("error: unable to set option"); printf("error: unable to set option\n");
return 1; return 1;
} }
printf("success: %sset option\n", (set) ? "" : "un"); printf("success: %sset option\n", (set) ? "" : "un");
@ -1277,7 +1277,7 @@ static int _netif_set_lw_key(netif_t *iface, netopt_t opt, char *key_str)
expected_len = LORAMAC_DEVEUI_LEN; expected_len = LORAMAC_DEVEUI_LEN;
} }
if (!key_len || key_len != expected_len) { if (!key_len || key_len != expected_len) {
puts("error: unable to parse key.\n"); printf("error: unable to parse key.\n");
return 1; return 1;
} }
@ -1297,9 +1297,9 @@ static int _netif_set_addr(netif_t *iface, netopt_t opt, char *addr_str)
size_t addr_len = gnrc_netif_addr_from_str(addr_str, addr); size_t addr_len = gnrc_netif_addr_from_str(addr_str, addr);
if (addr_len == 0) { if (addr_len == 0) {
puts("error: unable to parse address.\n" printf("error: unable to parse address.\n"
"Must be of format [0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*\n" "Must be of format [0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*\n"
"(hex pairs delimited by colons)"); "(hex pairs delimited by colons)\n");
return 1; return 1;
} }
@ -1351,7 +1351,7 @@ static int _netif_set_state(netif_t *iface, char *state_str)
state = NETOPT_STATE_STANDBY; state = NETOPT_STATE_STANDBY;
} }
else { else {
puts("usage: ifconfig <if_id> set state [off|sleep|idle|rx|tx|reset|standby]"); printf("usage: ifconfig <if_id> set state [off|sleep|idle|rx|tx|reset|standby]\n");
return 1; return 1;
} }
if (netif_set_opt(iface, NETOPT_STATE, 0, if (netif_set_opt(iface, NETOPT_STATE, 0,
@ -1416,7 +1416,7 @@ static int _netif_set_encrypt_key(netif_t *iface, netopt_t opt, char *key_str)
int i2 = _hex_to_int(key_str[i + 1]); int i2 = _hex_to_int(key_str[i + 1]);
if (i1 == -1 || i2 == -1) { if (i1 == -1 || i2 == -1) {
puts("error: unable to parse key"); printf("error: unable to parse key\n");
return 1; return 1;
} }
@ -1424,7 +1424,7 @@ static int _netif_set_encrypt_key(netif_t *iface, netopt_t opt, char *key_str)
} }
if (netif_set_opt(iface, opt, 0, key, key_len) < 0) { if (netif_set_opt(iface, opt, 0, key, key_len) < 0) {
puts("error: unable to set encryption key"); printf("error: unable to set encryption key\n");
return 1; return 1;
} }
@ -1446,23 +1446,23 @@ static int _netif_addrm_l2filter(netif_t *iface, char *val, bool add)
size_t addr_len = gnrc_netif_addr_from_str(val, addr); size_t addr_len = gnrc_netif_addr_from_str(val, addr);
if ((addr_len == 0) || (addr_len > CONFIG_L2FILTER_ADDR_MAXLEN)) { if ((addr_len == 0) || (addr_len > CONFIG_L2FILTER_ADDR_MAXLEN)) {
puts("error: given address is invalid"); printf("error: given address is invalid\n");
return 1; return 1;
} }
if (add) { if (add) {
if (netif_set_opt(iface, NETOPT_L2FILTER, 0, addr, addr_len) < 0) { if (netif_set_opt(iface, NETOPT_L2FILTER, 0, addr, addr_len) < 0) {
puts("unable to add link layer address to filter"); printf("unable to add link layer address to filter\n");
return 1; return 1;
} }
puts("successfully added address to filter"); printf("successfully added address to filter\n");
} }
else { else {
if (netif_set_opt(iface, NETOPT_L2FILTER_RM, 0, addr, addr_len) < 0) { if (netif_set_opt(iface, NETOPT_L2FILTER_RM, 0, addr, addr_len) < 0) {
puts("unable to remove link layer address from filter"); printf("unable to remove link layer address from filter\n");
return 1; return 1;
} }
puts("successfully removed address to filter"); printf("successfully removed address to filter\n");
} }
return 0; return 0;
} }
@ -1709,7 +1709,7 @@ static int _netif_add(char *cmd_name, netif_t *iface, int argc, char **argv)
prefix_len = _get_prefix_len(addr_str); prefix_len = _get_prefix_len(addr_str);
if (ipv6_addr_from_str(&addr, addr_str) == NULL) { if (ipv6_addr_from_str(&addr, addr_str) == NULL) {
puts("error: unable to parse IPv6 address."); printf("error: unable to parse IPv6 address.\n");
return 1; return 1;
} }
@ -1742,7 +1742,7 @@ static int _netif_add(char *cmd_name, netif_t *iface, int argc, char **argv)
(void)iface; (void)iface;
(void)argc; (void)argc;
(void)argv; (void)argv;
puts("error: unable to add IPv6 address."); printf("error: unable to add IPv6 address.\n");
return 1; return 1;
#endif #endif
@ -1754,7 +1754,7 @@ static int _netif_del(netif_t *iface, char *addr_str)
ipv6_addr_t addr; ipv6_addr_t addr;
if (ipv6_addr_from_str(&addr, addr_str) == NULL) { if (ipv6_addr_from_str(&addr, addr_str) == NULL) {
puts("error: unable to parse IPv6 address."); printf("error: unable to parse IPv6 address.\n");
return 1; return 1;
} }
@ -1781,7 +1781,7 @@ static int _netif_del(netif_t *iface, char *addr_str)
#else #else
(void)iface; (void)iface;
(void)addr_str; (void)addr_str;
puts("error: unable to delete IPv6 address."); printf("error: unable to delete IPv6 address.\n");
return 1; return 1;
#endif #endif
} }
@ -1804,7 +1804,7 @@ static int _gnrc_netif_send(int argc, char **argv)
iface = netif_get_by_name(argv[1]); iface = netif_get_by_name(argv[1]);
if (!iface) { if (!iface) {
puts("error: invalid interface given"); printf("error: invalid interface given\n");
return 1; return 1;
} }
@ -1816,7 +1816,7 @@ static int _gnrc_netif_send(int argc, char **argv)
flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST; flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST;
} }
else { else {
puts("error: invalid address given"); printf("error: invalid address given\n");
return 1; return 1;
} }
} }
@ -1824,12 +1824,12 @@ static int _gnrc_netif_send(int argc, char **argv)
/* put packet together */ /* put packet together */
pkt = gnrc_pktbuf_add(NULL, argv[3], strlen(argv[3]), GNRC_NETTYPE_UNDEF); pkt = gnrc_pktbuf_add(NULL, argv[3], strlen(argv[3]), GNRC_NETTYPE_UNDEF);
if (pkt == NULL) { if (pkt == NULL) {
puts("error: packet buffer full"); printf("error: packet buffer full\n");
return 1; return 1;
} }
hdr = gnrc_netif_hdr_build(NULL, 0, addr, addr_len); hdr = gnrc_netif_hdr_build(NULL, 0, addr, addr_len);
if (hdr == NULL) { if (hdr == NULL) {
puts("error: packet buffer full"); printf("error: packet buffer full\n");
gnrc_pktbuf_release(pkt); gnrc_pktbuf_release(pkt);
return 1; return 1;
} }
@ -1838,7 +1838,7 @@ static int _gnrc_netif_send(int argc, char **argv)
nethdr->flags = flags; nethdr->flags = flags;
/* and send it */ /* and send it */
if (gnrc_netif_send(container_of(iface, gnrc_netif_t, netif), pkt) < 1) { if (gnrc_netif_send(container_of(iface, gnrc_netif_t, netif), pkt) < 1) {
puts("error: unable to send"); printf("error: unable to send\n");
gnrc_pktbuf_release(pkt); gnrc_pktbuf_release(pkt);
return 1; return 1;
} }
@ -1881,7 +1881,7 @@ int _gnrc_netif_config(int argc, char **argv)
return 0; return 0;
} }
else { else {
puts("error: invalid interface given"); printf("error: invalid interface given\n");
return 1; return 1;
} }
} }

View File

@ -36,7 +36,7 @@ int _gnrc_rpl_init(char *arg)
{ {
kernel_pid_t iface_pid = atoi(arg); kernel_pid_t iface_pid = atoi(arg);
if (gnrc_netif_get_by_pid(iface_pid) == NULL) { if (gnrc_netif_get_by_pid(iface_pid) == NULL) {
puts("unknown interface specified"); printf("unknown interface specified\n");
return 1; return 1;
} }
@ -51,7 +51,7 @@ int _gnrc_rpl_dodag_root(char *arg1, char *arg2)
ipv6_addr_t dodag_id; ipv6_addr_t dodag_id;
if (ipv6_addr_from_str(&dodag_id, arg2) == NULL) { if (ipv6_addr_from_str(&dodag_id, arg2) == NULL) {
puts("error: <dodag_id> must be a valid IPv6 address"); printf("error: <dodag_id> must be a valid IPv6 address\n");
return 1; return 1;
} }
@ -75,12 +75,12 @@ int _gnrc_rpl_find(char *arg1, char *arg2)
ipv6_addr_t target; ipv6_addr_t target;
if (ipv6_addr_from_str(&dodag_id, arg1) == NULL) { if (ipv6_addr_from_str(&dodag_id, arg1) == NULL) {
puts("<dodag_id> must be a valid IPv6 address"); printf("<dodag_id> must be a valid IPv6 address\n");
return 1; return 1;
} }
if (ipv6_addr_from_str(&target, arg2) == NULL) { if (ipv6_addr_from_str(&target, arg2) == NULL) {
puts("<target> must be a valid IPv6 address"); printf("<target> must be a valid IPv6 address\n");
return 1; return 1;
} }
@ -122,7 +122,7 @@ int _gnrc_rpl_trickle_reset(char *arg1)
char addr_str[IPV6_ADDR_MAX_STR_LEN]; char addr_str[IPV6_ADDR_MAX_STR_LEN];
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) { if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
puts("error: could not find the <instance_id>"); printf("error: could not find the <instance_id>\n");
return 1; return 1;
} }
@ -141,7 +141,7 @@ int _gnrc_rpl_trickle_stop(char *arg1)
char addr_str[IPV6_ADDR_MAX_STR_LEN]; char addr_str[IPV6_ADDR_MAX_STR_LEN];
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) { if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
puts("error: could not find the <instance_id>"); printf("error: could not find the <instance_id>\n");
return 1; return 1;
} }
trickle_stop(&(inst->dodag.trickle)); trickle_stop(&(inst->dodag.trickle));
@ -159,7 +159,7 @@ int _gnrc_rpl_trickle_start(char *arg1)
char addr_str[IPV6_ADDR_MAX_STR_LEN]; char addr_str[IPV6_ADDR_MAX_STR_LEN];
if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) { if ((inst = gnrc_rpl_instance_get(instance_id)) == NULL) {
puts("error: could not find the <instance_id>"); printf("error: could not find the <instance_id>\n");
return 1; return 1;
} }
@ -190,7 +190,7 @@ int _gnrc_rpl_send_dis_w_sol_opt(char* VID, char* version, char* instance, char*
{ {
gnrc_rpl_internal_opt_t* opt[] = {(gnrc_rpl_internal_opt_t*)&sol}; gnrc_rpl_internal_opt_t* opt[] = {(gnrc_rpl_internal_opt_t*)&sol};
gnrc_rpl_send_DIS(NULL, (ipv6_addr_t *) &ipv6_addr_all_rpl_nodes, opt, 1); gnrc_rpl_send_DIS(NULL, (ipv6_addr_t *) &ipv6_addr_all_rpl_nodes, opt, 1);
puts("success: send a DIS with SOL option\n"); printf("success: send a DIS with SOL option\n\n");
} }
return 0; return 0;
} }
@ -199,7 +199,7 @@ int _gnrc_rpl_send_dis(void)
{ {
gnrc_rpl_send_DIS(NULL, (ipv6_addr_t *) &ipv6_addr_all_rpl_nodes, NULL, 0); gnrc_rpl_send_DIS(NULL, (ipv6_addr_t *) &ipv6_addr_all_rpl_nodes, NULL, 0);
puts("success: send a DIS\n"); printf("success: send a DIS\n\n");
return 0; return 0;
} }
@ -242,7 +242,7 @@ static void _print_stats_block(netstats_rpl_block_t *block, const char *name)
int _stats(void) int _stats(void)
{ {
puts( "Statistics (ucast) RX / TX RX / TX (mcast)"); printf( "Statistics (ucast) RX / TX RX / TX (mcast)\n");
_print_stats_block(&gnrc_rpl_netstats.dio, "DIO"); _print_stats_block(&gnrc_rpl_netstats.dio, "DIO");
_print_stats_block(&gnrc_rpl_netstats.dis, "DIS"); _print_stats_block(&gnrc_rpl_netstats.dis, "DIS");
_print_stats_block(&gnrc_rpl_netstats.dao, "DAO"); _print_stats_block(&gnrc_rpl_netstats.dao, "DAO");
@ -450,25 +450,25 @@ static int _gnrc_rpl(int argc, char **argv)
#endif #endif
#ifdef MODULE_GNRC_RPL_P2P #ifdef MODULE_GNRC_RPL_P2P
puts("* find <dodag_id> <target>\t\t\t- initiate a P2P-RPL route discovery"); printf("* find <dodag_id> <target>\t\t\t- initiate a P2P-RPL route discovery\n");
#endif #endif
puts("* help\t\t\t\t\t- show usage"); printf("* help\t\t\t\t\t- show usage\n");
puts("* init <if_id>\t\t\t\t- initialize RPL on the given interface"); printf("* init <if_id>\t\t\t\t- initialize RPL on the given interface\n");
puts("* leaf <instance_id>\t\t\t- operate as leaf in the instance"); printf("* leaf <instance_id>\t\t\t- operate as leaf in the instance\n");
puts("* trickle reset <instance_id>\t\t- reset the trickle timer"); printf("* trickle reset <instance_id>\t\t- reset the trickle timer\n");
puts("* trickle start <instance_id>\t\t- start the trickle timer"); printf("* trickle start <instance_id>\t\t- start the trickle timer\n");
puts("* trickle stop <instance_id>\t\t- stop the trickle timer"); printf("* trickle stop <instance_id>\t\t- stop the trickle timer\n");
puts("* rm <instance_id>\t\t\t- delete the given instance and related dodag"); printf("* rm <instance_id>\t\t\t- delete the given instance and related dodag\n");
puts("* root <inst_id> <dodag_id>\t\t- add a dodag to a new or existing instance"); printf("* root <inst_id> <dodag_id>\t\t- add a dodag to a new or existing instance\n");
puts("* router <instance_id>\t\t\t- operate as router in the instance"); printf("* router <instance_id>\t\t\t- operate as router in the instance\n");
puts("* send dis\t\t\t\t- send a multicast DIS"); printf("* send dis\t\t\t\t- send a multicast DIS\n");
puts("* send dis <VID_flags> <version> <instance_id> <dodag_id> - send a multicast DIS with SOL option"); printf("* send dis <VID_flags> <version> <instance_id> <dodag_id> - send a multicast DIS with SOL option\n");
if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_PIO)) { if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_PIO)) {
puts("* set pio <on/off> <instance_id>\t- (de-)activate PIO transmissions in DIOs"); printf("* set pio <on/off> <instance_id>\t- (de-)activate PIO transmissions in DIOs\n");
} }
puts("* show\t\t\t\t\t- show instance and dodag tables"); printf("* show\t\t\t\t\t- show instance and dodag tables\n");
return 0; return 0;
} }

View File

@ -45,14 +45,14 @@ void _del_cb(void *ptr)
static void _usage(char *cmd_str) static void _usage(char *cmd_str)
{ {
printf("usage: %s [{add <0-15> <prefix>/<prefix_len> <ltime in min>|del <ctx>}]\n", cmd_str); printf("usage: %s [{add <0-15> <prefix>/<prefix_len> <ltime in min>|del <ctx>}]\n", cmd_str);
puts(" `del` will only invalidate the context for compression. It can be"); printf(" `del` will only invalidate the context for compression. It can be\n");
puts(" reassigned after 5 min."); printf(" reassigned after 5 min.\n");
} }
static int _gnrc_6ctx_list(void) static int _gnrc_6ctx_list(void)
{ {
puts("cid|prefix |C|ltime"); printf("cid|prefix |C|ltime\n");
puts("-----------------------------------------------------------"); printf("-----------------------------------------------------------\n");
for (uint8_t cid = 0; cid < GNRC_SIXLOWPAN_CTX_SIZE; cid++) { for (uint8_t cid = 0; cid < GNRC_SIXLOWPAN_CTX_SIZE; cid++) {
gnrc_sixlowpan_ctx_t *ctx = gnrc_sixlowpan_ctx_lookup_id(cid); gnrc_sixlowpan_ctx_t *ctx = gnrc_sixlowpan_ctx_lookup_id(cid);
if (ctx != NULL) { if (ctx != NULL) {
@ -78,7 +78,7 @@ static int _gnrc_6ctx_add(char *cmd_str, char *ctx_str, char *prefix_str, char *
return 1; return 1;
} }
if (!IS_USED(MODULE_GNRC_IPV6_NIB_6LBR)) { if (!IS_USED(MODULE_GNRC_IPV6_NIB_6LBR)) {
puts("WARNING: context dissemination by non-6LBR not supported"); printf("WARNING: context dissemination by non-6LBR not supported\n");
} }
addr_str = strtok_r(prefix_str, "/", &save_ptr); addr_str = strtok_r(prefix_str, "/", &save_ptr);
if (addr_str == NULL) { if (addr_str == NULL) {
@ -92,18 +92,18 @@ static int _gnrc_6ctx_add(char *cmd_str, char *ctx_str, char *prefix_str, char *
} }
prefix_len = atoi(prefix_len_str); prefix_len = atoi(prefix_len_str);
if ((prefix_len - 1U) > 128U) { if ((prefix_len - 1U) > 128U) {
puts("ERROR: prefix_len < 1 || prefix_len > 128"); printf("ERROR: prefix_len < 1 || prefix_len > 128\n");
return 1; return 1;
} }
ipv6_addr_from_str(&prefix, addr_str); ipv6_addr_from_str(&prefix, addr_str);
if (ipv6_addr_is_unspecified(&prefix)) { if (ipv6_addr_is_unspecified(&prefix)) {
puts("ERROR: prefix may not be ::"); printf("ERROR: prefix may not be ::\n");
return 1; return 1;
} }
ltime = atoi(ltime_str); ltime = atoi(ltime_str);
if (gnrc_sixlowpan_ctx_update((uint8_t)ctx, &prefix, (uint8_t)prefix_len, ltime, if (gnrc_sixlowpan_ctx_update((uint8_t)ctx, &prefix, (uint8_t)prefix_len, ltime,
true) == NULL) { true) == NULL) {
puts("ERROR: can not add context"); printf("ERROR: can not add context\n");
return 1; return 1;
} }
return 0; return 0;
@ -118,7 +118,7 @@ static int _gnrc_6ctx_del(char *cmd_str, char *ctx_str)
return 1; return 1;
} }
if (!IS_USED(MODULE_GNRC_IPV6_NIB_6LBR)) { if (!IS_USED(MODULE_GNRC_IPV6_NIB_6LBR)) {
puts("WARNING: context dissemination by non-6LBR not supported"); printf("WARNING: context dissemination by non-6LBR not supported\n");
} }
if (del_timer[cid].callback == NULL) { if (del_timer[cid].callback == NULL) {
ctx = gnrc_sixlowpan_ctx_lookup_id(cid); ctx = gnrc_sixlowpan_ctx_lookup_id(cid);

View File

@ -52,13 +52,13 @@ static void _send(const char *addr_str, const char *port_str,
/* parse destination address */ /* parse destination address */
if (netutils_get_ipv6(&addr, &netif, addr_str) < 0) { if (netutils_get_ipv6(&addr, &netif, addr_str) < 0) {
puts("Error: unable to parse destination address"); printf("Error: unable to parse destination address\n");
return; return;
} }
/* parse port */ /* parse port */
port = atoi(port_str); port = atoi(port_str);
if (port == 0) { if (port == 0) {
puts("Error: unable to parse destination port"); printf("Error: unable to parse destination port\n");
return; return;
} }
@ -68,7 +68,7 @@ static void _send(const char *addr_str, const char *port_str,
/* allocate payload */ /* allocate payload */
payload = gnrc_pktbuf_add(NULL, data, strlen(data), GNRC_NETTYPE_UNDEF); payload = gnrc_pktbuf_add(NULL, data, strlen(data), GNRC_NETTYPE_UNDEF);
if (payload == NULL) { if (payload == NULL) {
puts("Error: unable to copy data to packet buffer"); printf("Error: unable to copy data to packet buffer\n");
return; return;
} }
/* store size for output */ /* store size for output */
@ -76,14 +76,14 @@ static void _send(const char *addr_str, const char *port_str,
/* allocate UDP header, set source port := destination port */ /* allocate UDP header, set source port := destination port */
udp = gnrc_udp_hdr_build(payload, port, port); udp = gnrc_udp_hdr_build(payload, port, port);
if (udp == NULL) { if (udp == NULL) {
puts("Error: unable to allocate UDP header"); printf("Error: unable to allocate UDP header\n");
gnrc_pktbuf_release(payload); gnrc_pktbuf_release(payload);
return; return;
} }
/* allocate IPv6 header */ /* allocate IPv6 header */
ip = gnrc_ipv6_hdr_build(udp, NULL, &addr); ip = gnrc_ipv6_hdr_build(udp, NULL, &addr);
if (ip == NULL) { if (ip == NULL) {
puts("Error: unable to allocate IPv6 header"); printf("Error: unable to allocate IPv6 header\n");
gnrc_pktbuf_release(udp); gnrc_pktbuf_release(udp);
return; return;
} }
@ -98,7 +98,7 @@ static void _send(const char *addr_str, const char *port_str,
/* send packet */ /* send packet */
if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP,
GNRC_NETREG_DEMUX_CTX_ALL, ip)) { GNRC_NETREG_DEMUX_CTX_ALL, ip)) {
puts("Error: unable to locate UDP thread"); printf("Error: unable to locate UDP thread\n");
gnrc_pktbuf_release(ip); gnrc_pktbuf_release(ip);
return; return;
} }
@ -132,7 +132,7 @@ static void _start_server(const char *port_str)
/* parse port */ /* parse port */
port = atoi(port_str); port = atoi(port_str);
if (port == 0) { if (port == 0) {
puts("Error: invalid port specified"); printf("Error: invalid port specified\n");
return; return;
} }
/* start server (which means registering pktdump for the chosen port) */ /* start server (which means registering pktdump for the chosen port) */
@ -152,7 +152,7 @@ static void _stop_server(void)
/* stop server */ /* stop server */
gnrc_netreg_unregister(GNRC_NETTYPE_UDP, &server); gnrc_netreg_unregister(GNRC_NETTYPE_UDP, &server);
server.target.pid = KERNEL_PID_UNDEF; server.target.pid = KERNEL_PID_UNDEF;
puts("Success: stopped UDP server"); printf("Success: stopped UDP server\n");
} }
static int _gnrc_udp_cmd(int argc, char **argv) static int _gnrc_udp_cmd(int argc, char **argv)
@ -196,11 +196,11 @@ static int _gnrc_udp_cmd(int argc, char **argv)
_stop_server(); _stop_server();
} }
else { else {
puts("error: invalid command"); printf("error: invalid command\n");
} }
} }
else { else {
puts("error: invalid command"); printf("error: invalid command\n");
} }
return 0; return 0;
} }