Commit Graph

2850 Commits

Author SHA1 Message Date
Zhe Weng
8e8d86a7bb net/ioctl: Add default print for sockets without FIOC_FILEPATH support
Example of /proc/PID/group/fd in this case:

FD  OFLAGS  TYPE POS       PATH
17  67      9    0         socket:[domain 16, type 2, proto 0]

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-15 15:00:59 +08:00
liqinhui
719191ac72 net/local: Return an error when write the too big packet.
Verification:
  Write a packet, the length is bigger than CONFIG_DEV_FIFO_SIZE.
  The return value should be -1, and the errno is EMSGSIZE.
Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-08-14 23:46:08 +08:00
liqinhui
2d0df3b5f2 net/local: Fix the error return length when read the bigger packet.
Verifiction:
  Write a bigger packet and read the packet using a smaller buffer.
  The return length of reading should be the length of smaller buffer.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-08-14 21:11:30 +08:00
liqinhui
8631e0c6b5 net/tcp: Fix the sack byte aligment error.
The error log is as follows:
  tcp/tcp_send_buffered.c:376:57: runtime error: member access within misaligned
  address 0x10075942 for type 'struct tcp_sack_s', which requires 4 byte alignment

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-08-14 20:46:09 +08:00
Zhe Weng
d98bfc3e49 net/icmpv6: Fix icmpv6_neighbor for link-local address
The netdev of link-local address cannot be auto decided, and the link-local address should always be reguarded as address on local network.

The problem we met:
When using `icmpv6_autoconfig` with multiple netdev, the `icmpv6_neighbor` may take out wrong netdev with ip address already set, then it may send solicitation with wrong address (`dev->d_ipv6draddr`) on wrong device, and regard the link-local address as conflict (because `dev->d_ipv6draddr` exists on this network).

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-11 02:00:39 +08:00
hujun5
34dcd1c50a net: remove [enter|leave]_critical_section and sched_[un]lock
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-08-10 12:24:30 +03:00
Zhe Weng
c2ba0dfd6c net/netdev: Simplify handling of SIOCSIFMTU
The call of netdev_ifr_dev is already simplified by commit fd53db56b6

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-09 18:29:26 +08:00
Petro Karashchenko
1b0baa8337 nuttx: use lib_free for memory de-allocation after strdup or asprintf
The memory allocated with strdup and asprintf is done via lib_malloc
so we need to use lib_free to deallocate memory otherwise the assertion
"Free memory from the wrong heap" is hit with flat mode and user separated
heap enabled mode.

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
zhangyuan21
114d641f4a net: add poll lock for local socket poll
net_lock/unlock is a big lock and repleace it to internal pool lock
to avoid the priority inversion problem.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-08-08 08:43:18 +02:00
Zhe Weng
817a43de4d net: Add FIOC_FILEPATH ioctl support for tcp/udp/local sockets
Example of /proc/PID/group/fd, which prints the file path:

FD  OFLAGS  TYPE POS       PATH
0   3       1    0         /dev/console
1   3       1    0         /dev/console
2   3       1    0         /dev/console
3   3       9    0         udp:[0.0.0.0:10197<->114.118.7.163:123, tx 0/16384, rx 0/16384, flg 1]
4   1027    9    0         tcp:[0.0.0.0:23<->0.0.0.0:0, tx 0/16384, rx 0/16384 + ofo 0, st 01, flg 31]
5   67      9    0         local:[md:ap]

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-07 08:08:37 -07:00
Zhe Weng
194d0cdec9 net/procfs: Simplify logic for tcp/udp stats
By:
1. Take out net_ip_binding_laddr/raddr macro
2. INET6_ADDRSTRLEN is long enough for all address buffer and no need to
   add 0 to the end of buffer since inet_ntop will do so

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-07 08:08:37 -07:00
ligd
0383377d78 rpmsg_socket: rpmsg_socket_ns_bound() with lock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-03 08:01:31 -07:00
ligd
17010ff811 rpmsg_socket: move nameid outof user define space
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-03 08:01:31 -07:00
wangchen
5c798dd297 inet/inet_sockif.c:In tcp protocol, Add random ports during the listening phase, if no ports are bound
In tcp protocol, if no ports are bound, Add random ports during the listening phase

libuvtestcase:
TEST_IMPL(tcp_listen_without_bind) {
int r;
uv_tcp_t server;

r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0);
r = uv_listen((uv_stream_t*)&server, 128, NULL);
ASSERT(r == 0);

MAKE_VALGRIND_HAPPY();
return 0;
}

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-08-03 03:24:23 -07:00
wangchen
d528d2c410 net/local/local_sockif.c:add local_getpeername function implementation
this testcast
TEST_IMPL(udp_send_unix) {
  /* Test that "uv_udp_send()" supports sending over
     a "sockaddr_un" address. */
  struct sockaddr_un addr;
  uv_udp_t handle;
  uv_udp_send_t req;
  uv_loop_t* loop;
  uv_buf_t buf = uv_buf_init("PING", 4);
  int fd;
  int r;

  loop = uv_default_loop();

  memset(&addr, 0, sizeof addr);
  addr.sun_family = AF_UNIX;
  ASSERT(strlen(TEST_PIPENAME) < sizeof(addr.sun_path));
  memcpy(addr.sun_path, TEST_PIPENAME, strlen(TEST_PIPENAME));

  fd = socket(AF_UNIX, SOCK_STREAM, 0);
  ASSERT(fd >= 0);

  unlink(TEST_PIPENAME);
  ASSERT(0 == bind(fd, (const struct sockaddr*)&addr, sizeof addr));
  ASSERT(0 == listen(fd, 1));

  r = uv_udp_init(loop, &handle);
  ASSERT(r == 0);
  r = uv_udp_open(&handle, fd);
  ASSERT(r == 0);
  uv_run(loop, UV_RUN_DEFAULT);

  r = uv_udp_send(&req,
                  &handle,
                  &buf,
                  1,
                  (const struct sockaddr*) &addr,
                  NULL);
  ASSERT(r == 0);

  uv_close((uv_handle_t*)&handle, NULL);
  uv_run(loop, UV_RUN_DEFAULT);
  close(fd);
  unlink(TEST_PIPENAME);

  MAKE_VALGRIND_HAPPY();
  return 0;
}

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-08-03 03:23:17 -07:00
wangchen
b10d6be17a net:Add check for address binding
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-08-03 03:16:31 -07:00
wangchen
14202651b2 net:Resolve udp disconnection, status not synchronized error
libuvtestcase:
TEST_IMPL(udp_connect) {
  RETURN_SKIP(
      "IBMi PASE's UDP connection can not be disconnected with AF_UNSPEC.");
  uv_udp_send_t req;
  struct sockaddr_in ext_addr;
  struct sockaddr_in tmp_addr;
  int r;
  int addrlen;

  close_cb_called = 0;
  cl_send_cb_called = 0;
  sv_recv_cb_called = 0;

  ASSERT(0 == uv_ip4_addr("[0.0.0.0](http://0.0.0.0/)", TEST_PORT, &lo_addr));

  r = uv_udp_init(uv_default_loop(), &server);
  ASSERT(r == 0);

  r = uv_udp_bind(&server, (const struct sockaddr*) &lo_addr, 0);
  ASSERT(r == 0);

  r = uv_udp_recv_start(&server, alloc_cb, sv_recv_cb);
  ASSERT(r == 0);

  r = uv_udp_init(uv_default_loop(), &client);
  ASSERT(r == 0);

  buf = uv_buf_init("EXIT", 4);

  /* connect() to INADDR_ANY fails on Windows wih WSAEADDRNOTAVAIL */
  ASSERT_EQ(0, uv_ip4_addr("[0.0.0.0](http://0.0.0.0/)", TEST_PORT, &tmp_addr));
  r = uv_udp_connect(&client, (const struct sockaddr*) &tmp_addr);
  ASSERT_EQ(r, UV_EADDRNOTAVAIL);
  ASSERT_EQ(r, 0);
  r = uv_udp_connect(&client, NULL);
  ASSERT_EQ(r, 0);

  ASSERT(0 == uv_ip4_addr("[8.8.8.8](http://8.8.8.8/)", TEST_PORT, &ext_addr));
  ASSERT(0 == uv_ip4_addr("[127.0.0.1](http://127.0.0.1/)", TEST_PORT, &lo_addr));

  r = uv_udp_connect(&client, (const struct sockaddr*) &lo_addr);
  ASSERT(r == 0);
  r = uv_udp_connect(&client, (const struct sockaddr*) &ext_addr);
  ASSERT(r == UV_EISCONN);

  addrlen = sizeof(tmp_addr);
  r = uv_udp_getpeername(&client, (struct sockaddr*) &tmp_addr, &addrlen);
  ASSERT(r == 0);

  /* To send messages in connected UDP sockets addr must be NULL */
  r = uv_udp_try_send(&client, &buf, 1, (const struct sockaddr*) &lo_addr);
  ASSERT(r == UV_EISCONN);
  r = uv_udp_try_send(&client, &buf, 1, NULL);
  ASSERT(r == 4);
  r = uv_udp_try_send(&client, &buf, 1, (const struct sockaddr*) &ext_addr);
  ASSERT(r == UV_EISCONN);

  r = uv_udp_connect(&client, NULL);
  ASSERT(r == 0);
  r = uv_udp_connect(&client, NULL);
  ASSERT(r == UV_ENOTCONN);

  addrlen = sizeof(tmp_addr);
  r = uv_udp_getpeername(&client, (struct sockaddr*) &tmp_addr, &addrlen);
  ASSERT(r == UV_ENOTCONN);

  /* To send messages in disconnected UDP sockets addr must be set */
  r = uv_udp_try_send(&client, &buf, 1, (const struct sockaddr*) &lo_addr);
  ASSERT(r == 4);
  r = uv_udp_try_send(&client, &buf, 1, NULL);
  ASSERT(r == UV_EDESTADDRREQ);

  r = uv_udp_connect(&client, (const struct sockaddr*) &lo_addr);
  ASSERT(r == 0);
  r = uv_udp_send(&req,
                  &client,
                  &buf,
                  1,
                  (const struct sockaddr*) &lo_addr,
                  cl_send_cb);
  ASSERT(r == UV_EISCONN);
  r = uv_udp_send(&req, &client, &buf, 1, NULL, cl_send_cb);
  ASSERT(r == 0);

  uv_run(uv_default_loop(), UV_RUN_DEFAULT);

  ASSERT(close_cb_called == 2);
  ASSERT(sv_recv_cb_called == 4);
  ASSERT(cl_send_cb_called == 2);

  ASSERT(client.send_queue_size == 0);
  ASSERT(server.send_queue_size == 0);

  MAKE_VALGRIND_HAPPY();
  return 0;
}

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-08-03 03:12:17 -07:00
wangchen
842b6b88d3 net/udp:add check of the ip packet length
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-08-03 00:15:28 -07:00
wangchen
44442a655e inet/ipv4_setsockopt.c:fix libuv udp option error
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-08-02 22:54:13 -07:00
wangchen
bdf82d2087 net/tcp: Return -EINVAL if bind is called more than once
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-08-02 22:48:07 -07:00
wangyingdong
032a456c83 net/local:Add support for MSG_DONTWAIT to SOCK_STREAM
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2023-08-01 22:55:40 -07:00
Petro Karashchenko
6621dc016b net/udp: remove FAR from non-pointer variables
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-31 18:56:40 -07:00
dongjiuzhu1
44b08d3a67 net/rpmsg: read receiving data after unbind
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-29 07:04:43 -07:00
dongjiuzhu1
9a22741e32 net/rpmsg: get credentials between client and server
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 07:40:00 -07:00
wangyingdong
5ac8c71663 net/ipfrag:Fixed ref not initializing warning issue
CC: libssh/src/auth.c
1ipfrag/ipv4_frag.c: In function 'ipv4_fragout':
ipfrag/ipv4_frag.c:224:7: error: 'ref' may be used uninitialized in this function [-Werror-maybe-uninitialized]
      224 |      lmemcpy(ipv4, ref, iphdrlen);
ipfrag/ipv4_frag.c:364:26: note: 'ref' was declared here
      364 |   FAR struct ipv4_hdr_s *ref;
CC: tls/task initinfo c

Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2023-07-26 08:36:04 -03:00
chao an
49dec5b48c cmake/build: fix build break on cmake
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-25 15:00:10 +02:00
Zhe Weng
9fd26195d1 net/setsockopt: Add IP_TTL support
We have IPV6_UNICAST_HOPS and IPV6_MULTICAST_HOPS in ipv6_setsockopt,
but only IP_MULTICAST_TTL in ipv4_setsockopt. So add IP_TTL support.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-24 09:46:37 -07:00
wangchen
bde91a2abd inet:fix libuvtest udp multicast error
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-07-24 09:46:37 -07:00
chao an
9004a49431 net/local: forward threshold ioctl() to pipe
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-22 11:39:28 +08:00
Zhe Weng
075eb6a6d2 net/udp: Change conn->readahead to I/O buffer chain
When using IOB queue to store readahead data, we use one IOB for each
UDP packet. Then if the packets are very small, like 10Bytes per packet,
we'll use ~1600 IOBs just for 16KB recv buffer size, which is wasteful
and dangerous. So change conn->readahead to a single IOB chain like TCP.

Benefits:
- Using memory and IOBs more efficiently (small packets are common in
  UDP)

Side effects:
- UDP recv buffer size may count the overhead
- A little bit drop in performance (<1%, more seek & copy)

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-18 10:51:45 +08:00
Zhe Weng
4b7604cf81 net: Rename tcp_dataconcat to net_iob_concat
Allow other protocols like UDP to use concat logic.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-18 10:51:45 +08:00
zhanghongyu
3db1654b80 net/local: remove client from server.lc_waiters when client close
if client is a noblocking socket, user can do close when server has not yet
invoke accept interface, so we need remove this socket from server.lc_waiters.
avoid server socket access the freed memory.

==936564==ERROR: AddressSanitizer: heap-use-after-free on address 0xf23071c8 at pc 0x58eaac3b bp 0xf0b9e218 sp 0xf0b9e208
READ of size 4 at 0xf23071c8 thread T0
    #0 0x58eaac3a in dq_remfirst queue/dq_remfirst.c:45
    #1 0x58fd1efe in local_accept local/local_accept.c:141
    #2 0x58f66df6 in psock_accept socket/accept.c:149
    #3 0x58f672a4 in accept4 socket/accept.c:280
    #4 0x5be9ee0c in accept net/lib_accept.c:50
    #5 0x592d6a5d in uv__accept libuv/src/unix/core.c:502
    #6 0x5930d83b in uv__server_io libuv/src/unix/stream.c:550
    #7 0x592efbde in uv__io_poll libuv/src/unix/posix-poll.c:335
    #8 0x592d649a in uv_run libuv/src/unix/core.c:387
    #9 0x5a7180f7 in service_schedule_loop service/common/service_loop.c:146
    #10 0x591f300b in pthread_startup pthread/pthread_create.c:59
    #11 0x5be8134f in pthread_start pthread/pthread_create.c:139
    #12 0x58ee2762 in pre_start sim/sim_initialstate.c:53

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-17 09:01:36 +02:00
Xiang Xiao
abfe082a6f Kconfig: Simplify the conditional default statement
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:39:20 -03:00
wangyingdong
a7926405ca net/udp: Fix the bug of overwriting when the udp recv buffer is full
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2023-07-14 07:53:37 +02:00
yintao
7544b68aa9 net/local: Support the abstract path to connect
Signed-off-by: yintao <yintao@xiaomi.com>
2023-07-14 09:57:24 +08:00
wangyingdong
57bf3e1fea net: Add msg_peek support for udp and tcp
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2023-07-13 19:40:04 +08:00
Zhe Weng
4ffd2cc84c net/nat: Fix compiler warning
We found warning of "%x" mismatch with "in_addr_t" on some platforms.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-12 19:29:14 +08:00
liqinhui
a7a47621fa net/local: Support the socketpair interface of local udp socket.
Add the proccessing logic of udp socketpair, and modify the
logic of sending and receiving for udp socketpair.

Verification:
 - Use the socketpair interface to create a pair of local udp sockets,
   and perform read and write operations.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-07-12 03:31:43 +08:00
simbit18
9681c52517 Fix nuttx coding style
Remove TABs
Fix indentation
2023-07-11 23:32:17 +08:00
zhanghongyu
3538d1b313 netlink: add some definition
In order to support the compilation of third-party library, we encounter
some situations where the macro is not defined, refer to the common
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-08 11:12:41 -03:00
chao an
6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Petro Karashchenko
3fe371f60f nuttx: replace getpid() with nxsched_getpid() in kernel code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-07 17:39:39 -03:00
chao an
6a4495e3b7 net/local: fix build warning on GCC 12.2.0
In file included from local/local_fifo.c:25:
In function ‘local_format_name’,
    inlined from ‘local_hd_name’ at local/local_fifo.c:132:3,
    inlined from ‘local_open_receiver’ at local/local_fifo.c:661:3:
local/local_fifo.c:77:16: warning: ‘%s’ directive output may be truncated writing up to 107 bytes into a region of size 100 [-Wformat-truncation=]
   77 |                CONFIG_NET_LOCAL_VFS_PATH "/%s%s", inpath, suffix);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
local/local_fifo.c: In function ‘local_open_receiver’:
local/local_fifo.c:82:44: note: format string is defined here
   82 |                CONFIG_NET_LOCAL_VFS_PATH "/%s%s%" PRIx32,
      |                                            ^~
In function ‘local_format_name’,
    inlined from ‘local_hd_name’ at local/local_fifo.c:132:3,
    inlined from ‘local_open_receiver’ at local/local_fifo.c:661:3:
local/local_fifo.c:76:7: note: ‘snprintf’ output between 12 and 119 bytes into a destination of size 109
   76 |       snprintf(outpath, LOCAL_FULLPATH_LEN - 1,
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   77 |                CONFIG_NET_LOCAL_VFS_PATH "/%s%s", inpath, suffix);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-06 13:19:21 +08:00
Zhe Weng
1072b5b564 net: Limit max value for Send/Recv bufsize
There're some apps trying to set too large SO_SNDBUF and SO_RCVBUF, which may use all IOBs in one socket and block all other network traffic.

Note:
Linux silently limits SO_SNDBUF to be less than `sysctl_wmem_max`, so we can also do this limit without returning any error.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-05 13:57:08 +08:00
Stuart Ianna
30f8cf541c net/udp: Populate the udp connection structure with the address family.
The udp connection structure contains the field, "domain", which defines which address family it belongs to. Prior to this change, this field was only populated correctly if IPv4 and IPv6 was enabled. As a result, packet information was not processed in udp_recvpktinfo, as expected when the appropriate socket option was enabled.
2023-06-27 14:58:12 +08:00
Stuart Ianna
42abf22eef socket/recvfrom: Fix buffer copy direction when using BUILD_KERNEL.
When using recvfrom, the data should be copied back to the user provided buffer after psock_recvfrom, not before.
2023-06-22 11:56:01 +08:00
zhanghongyu
76fde07d1c netdev: remove ASSERT when ifindex is invalid
There is no control over whether a valid index is input when user use
ioctl to get netdev information, so removing this assertion will allow
ENODEV to be returned.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-06-13 13:32:03 +08:00
Petro Karashchenko
1b801a5bbc style: remove extra spaces and align parameters
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-06-11 12:55:29 +08:00
SPRESENSE
54112ac070 drivers/modem/alt1250: Update alt1250 driver
Updated alt1250 driver with regarding to the following changes.
- Add LTE hibernation feature
- Split source code per module
- Some refactoring
- Some bug fixes
2023-06-08 07:48:17 +02:00
Zhe Weng
f71fb738c5 net/icmp: Save poll device in icmp_poll_s
ICMP's conn->dev is changing in icmp_sendmsg, when sending to different
address, or when error occurs (like NETDEV_DOWN). Then the poll callback
cannot be dropped from previous dev in free, because the dev is wrong.

So add dev to struct icmp_poll_s just like struct udp_poll_s.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-06-06 19:33:21 +08:00