Commit Graph

55 Commits

Author SHA1 Message Date
Xiang Xiao
581dbb22fe netlink: Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
369a0fa4fb netlink: all request to NETLINK_ROUTE should use rtgenmsg
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib7a05dbf08277f56882e19a886a12a153889ca38
2020-04-10 08:18:07 -06:00
Xiang Xiao
70012bc4a2 netlink: Remove netlink_route_recvfrom
The same functionality could be implemented in the common place(netlink_recvfrom)

Change-Id: I8aedb29c4f0572f020ca5c0775f06c5e1e17ae4a
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
16dbe373c0 netlink: Implement netlink_connect and netlink_getpeername
and refine netlink_bind and netlink_send implmentation

Change-Id: I2b3e7980eac01dc42927cfaa0a64874df52d6bf5
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
5708015674 netlink: Sync the macro with Linux definition
Change-Id: I0c0895fa17e167c67fb12acfdfc6dc3a7fb63b3b
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
e6c30629a1 netlink: Return -EBUSY if some notifier was setup in netlink_notifier_setup
Change-Id: I62d036bb43420934efbf0e9b990ca2cf3dd0b2e5
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
3421ec90b4 netlink: Shouldn't call netlink_notify_response in netlink_poll
to avoid sleep inside netlink_poll

Change-Id: Id801c2dae805455a9b91f2e091d001679f0b3d4b
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
Xiang Xiao
9fb6eee5fe netlink: Remove the unused netlink_active
Change-Id: I976b3fbab033baa4eaec35f8f443d4eb971db142
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-10 08:18:07 -06:00
chao.an
42d97079de net/netlink/netlink_route.c: Correct the return value 2020-02-25 07:33:18 -06:00
Xiang Xiao
cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao
bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
chao.an
c65d8e6a23 net/socket: add MSG_DONTWAIT support
MSG_DONTWAIT (since Linux 2.2)
  Enables nonblocking operation; if the operation would block, the
  call fails with the error EAGAIN or EWOULDBLOCK. This provides
  similar behavior to setting the O_NONBLOCK flag (via the fcntl(2)
  F_SETFL operation), but differs in that MSG_DONTWAIT is a per-call
  option, whereas O_NONBLOCK is a setting on the open file description
  (see open(2)), which will affect all threads in the calling process
  and as well as other processes that hold file descriptors referring
  to the same open file description.
2020-02-19 12:21:28 -06:00
Gregory Nutt
0b25b96759 net/netlink/netlink_route.c: Fix a typo. 2020-02-13 15:04:45 -03:00
Xiang Xiao
5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao
6e6c670190 Move _SF_BOUND and _SF_CONNECTED modification to common place 2020-01-31 13:45:14 -06:00
Xiang Xiao
68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
chao.an
a4aa8ae491 wqueue/notifier: update the work notifier usage
usage changed after commit 90c52e6f8f

Change-Id: Ifb0d739b046a6794b5b3ac177f489fb9a1c5c799
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-01-21 14:16:19 +08:00
Xiang Xiao
6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt
16b1c276bd net/netlink/netlink_conn.c: Fix some really basic errors in the redesign of the asynchronous Netlink response logic. 2019-11-28 16:14:59 -06:00
Gregory Nutt
4ae09a3b80 net/netlink: Redesign the logic that handles notifications of when response data is available. Signal handlers are sub-optimal inside the OS (especially after the preceding change which forces the hand). Instead, use the work queue notifiers as is done with all other network notifiers. 2019-11-28 14:20:40 -06:00
Gregory Nutt
69318b1024 Re-implements reverted commit 344f7bc9f6 in a way that should not have the undesired side-effect. include/nuttx/sched.h: Add a bit to the TCB flags to indicat the thread is a user thread in a syscall. sched/nuttx/nxsig_dispatch.c: Delay dispatching to signal handlers if within a system call. In all syscall implementations: Process delayed signal handling when exiting system call. 2019-11-28 12:47:36 -06:00
Gregory Nutt
cbdd590c82 Revert "include/nuttx/sched.h: Add storage for a previous signal mask. arch/: In all syscall implementations, block all signals before dispatching a system call; resotre signal mask when the system call returns."
Using the sigprocmask() for this purpose has too many side-effects.

This reverts commit 344f7bc9f6.
2019-11-28 11:57:54 -06:00
Gregory Nutt
344f7bc9f6 include/nuttx/sched.h: Add storage for a previous signal mask. arch/: In all syscall implemenations, block all signals before dispatching a system call; resotre signal mask when the system call returnes. 2019-11-28 10:51:29 -06:00
Gregory Nutt
d1593bb336 Squashed commit of the following:
net/netlink/netlink_sockif.c:  At implementation of response available signal handler needed for POLLIN logic.
    net/netlink/netlink_sockif.c:  Add logic to set up signal handler to receive the response notification.
2019-11-27 21:30:01 -06:00
Gregory Nutt
a8f3c3651a net/netlink/netlink_conn.c: Use nxsig_queue() instead of nxsig_kill() so that we can pass a reference to the connection structure with the signal. 2019-11-27 19:31:23 -06:00
Gregory Nutt
93ed8b66d9 net/netlink: Add partial support for the NETLINK poll() operation. Still missing is some signal handling logic that actually wakes up the poll() when an asynchronous NETLLINK response is available.
So although the poll() implemenation is still not yet usable, the commit is useful because it (1) does not harm, and (2) incidentally fixes a few other issues in the NETLONK response queuing that I noted in the process.
2019-11-26 18:52:22 -06:00
Gregory Nutt
bc8d964cb9 net/netlink: Add some comments about 'Input Parameters' 2019-11-19 20:46:43 -06:00
Gregory Nutt
b72f7cf47f net/netlink/netlink_route.c: Fix a case where #if was used but #ifdef was intended. 2019-11-19 09:47:57 -06:00
Gregory Nutt
b659c74440 net/netlink/netlink_sockif.c: Netlink sockets may be set to non-blocking. 2019-11-19 07:50:46 -06:00
Gregory Nutt
936d69da1f net/netlink and include/nuttx/net/netlink.h: Make netlink_add_response() a globally access part of the network interface. This is necesssary to support netlink components that reside outside of the net/ sandbox. 2019-11-18 21:12:50 -06:00
Gregory Nutt
a7a1b0888e net/netlink/netlink_route.c: Remove dangling whitespace at the end of lines. 2019-11-18 10:47:35 -06:00
Gregory Nutt
6479775721 net/netlink/netlink_conn.c: Add support for asynchronous Netlink responses. 2019-11-18 09:48:14 -06:00
Gregory Nutt
ab78f0ca0a include/netpacket/netlink.h: Backout some preliminary NETLINK_CRYPTO definitions. These are premature (but may come back). 2019-11-17 10:47:24 -06:00
Gregory Nutt
82a4111a2b include/netpacket/netlink.h: Add definitions that will be needed for future NETLINK_CRYPTO support. 2019-11-14 09:18:11 -06:00
Gregory Nutt
9d6c607afc net/netlink/netlink_route.c: Add some comments. 2019-11-12 10:36:05 -06:00
Gregory Nutt
3e1937b49b net/netlink: Add options to disable individual NETLINK_ROUTE commands. This will probably become quite large and will need to be higher tunable for smaller platforms. 2019-11-12 10:19:42 -06:00
Gregory Nutt
3811a0f5cc net/netlink/netlink_route.c: Update some comments. 2019-11-12 07:59:43 -06:00
Gregory Nutt
ecbd5a85d7 net/netlink: Fixes from testing with new apps/examples/netlink_route. 2019-11-11 13:38:11 -06:00
Gregory Nutt
71a968ad71 net/netlink/netlink_route.c: Add missing routing table list terminating response. 2019-11-10 15:00:05 -06:00
Gregory Nutt
3a8a829088 net/netlink/netlink_route.c: Add support for obtaining the entire routing table. 2019-11-10 14:11:44 -06:00
Gregory Nutt
bda0a9c6a7 net/netlink: Fix offset in rtattr. include/net/route.h: Correct form and naming of sruct rtentry. include/netpacket/netlink.h: Add some definitions that will be needed to access routing tables. 2019-11-10 12:35:15 -06:00
Gregory Nutt
8c85ecf531 net/netlink/netlink_route.c: Add support for the NETLINK_ROUTE RTM_GETLINK command that is used to obtain a list of all devices in the UP state. 2019-11-09 17:36:30 -06:00
Gregory Nutt
dbbabcd33c Squashed commit of the following:
net/netlink/netlink_route.c:  Add Netlink socket NETLINK_ROUTE support for getting a snopshot of the Neighbor table.

    net/neighbor/neighbor_snapshot.c:  Add neighbor_snapshot() that will eventually be used by the Netlink sockets.  Also fixed naming violation 'struct neighbor_entry' -> 'struct neighbor_entry_s'.

    include/nuttx/net/neighbor.h:  Expose format of the IPv6 neighbor table for use with Netlink sockets.
2019-11-08 11:16:04 -06:00
Gregory Nutt
d31411189e net/netlink/Kconfig: Remove dependency on EXPERIMENTAL. Although the Netlink implementation is still only fragmentary, there is no usable functionality there and no reason for it to depend on EXPERIMENTAL. Also minor changes to the menu organization so that the Netlink options appear the same was as do other network options. 2019-11-07 14:10:35 -06:00
Gregory Nutt
38e527deeb net/netlink: Fix cosmetic issues, mostly typo fixes. 2019-11-04 14:06:07 -06:00
Gregory Nutt
6d13705e93 net/netlink: The NETLINK_ROUTE logic needs to return the first queued response and not attempt to match up reponses with requests. That is the Linux compatible way. Also, use queue.h functions for list management and fix an error in arp_snapshot(). 2019-11-04 09:02:14 -06:00
Gregory Nutt
7bd045130c net/netlink/: Misc bugfixes from initial testing using NSH 'arp -t' command. 2019-11-03 19:27:58 -06:00
Gregory Nutt
2991987018 net/netlink/netlink_route.c (mostly): This completes a minimal netlink implementation that will retrieve the ARP table.
net/netlink:  Add basic hooks (only) to support the NETLINK_ROUTE protocol.
2019-11-03 13:59:42 -06:00
Gregory Nutt
3b275fcf4e net/: Run nxstyle against all C files. 2019-10-25 11:31:42 -06:00
Gregory Nutt
6266e067e9 net/: Re-order the content of all address-family socket 'connection' structures so that they begin with a comomon prologue. This permits better use of logic for different address family types. 2019-09-01 08:47:01 -06:00