[riot-notifications] [RIOT-OS/RIOT] TCP client cannot send read only data (#16541)

Marian Buschsieweke notifications at github.com
Wed Jun 9 09:23:19 CEST 2021


I used the following patch

```diff
diff --git a/examples/gnrc_networking/udp.c b/examples/gnrc_networking/udp.c
index 54f00afd7e..e72e026c63 100644
--- a/examples/gnrc_networking/udp.c
+++ b/examples/gnrc_networking/udp.c
@@ -36,7 +36,7 @@ static gnrc_netreg_entry_t server = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX
                                                                KERNEL_PID_UNDEF);
 
 
-static void send(char *addr_str, char *port_str, char *data, unsigned int num,
+static void send(char *addr_str, char *port_str, const char *data, unsigned int num,
                  unsigned int delay)
 {
     gnrc_netif_t *netif = NULL;
@@ -149,7 +149,7 @@ static void stop_server(void)
 int udp_cmd(int argc, char **argv)
 {
     if (argc < 2) {
-        printf("usage: %s [send|server]\n", argv[0]);
+        printf("usage: %s [send|server|const]\n", argv[0]);
         return 1;
     }
 
@@ -169,6 +169,23 @@ int udp_cmd(int argc, char **argv)
         }
         send(argv[2], argv[3], argv[4], num, delay);
     }
+    else if (strcmp(argv[1], "const") == 0) {
+        uint32_t num = 1;
+        uint32_t delay = 1000000;
+        if (argc < 4) {
+            printf("usage: %s send <addr> <port> [<num> [<delay in us>]]\n",
+                   argv[0]);
+            return 1;
+        }
+        if (argc > 4) {
+            num = atoi(argv[4]);
+        }
+        if (argc > 5) {
+            delay = atoi(argv[5]);
+        }
+        const char *data = "Hallo world!";
+        send(argv[2], argv[3], data, num, delay);
+    }
     else if (strcmp(argv[1], "server") == 0) {
         if (argc < 3) {
             printf("usage: %s server [start|stop]\n", argv[0]);
```

flashed `examples/gnrc_networking` to a Nucleo-F767ZI and did the following:

```
2021-06-09 09:17:47,217 # udp const fe80::.... 12345
2021-06-09 09:17:47,223 # Success: sent 12 byte(s) to [fe80::....]:12345
```

With Wireshark, I can see a valid UDP datagram being received that contains "Hello world!" as payload. The Ethernet peripheral for STM32 is as far as I know identical for all STM32 MCUs. So that should also work on F4.

@kex2017 Could you provide the exact source code so that I can try to reproduce? If it is based on an example program, you can just provide the output of `git diff` here.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/16541#issuecomment-857454502
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210609/c0115292/attachment.htm>


More information about the notifications mailing list