Commit Graph

1668 Commits

Author SHA1 Message Date
Gregory Nutt
e59b26370d Squashed commit of the following:
Fix a few typo/compilation problems.
    net/:  Remove all CONFIG_NET_xxx_TCP_RECVWNDO configuration variables.  They were used only to initialize the d_recwndo of the network device structure which no longer exists.
    net/:  Remove the device TCP receive window field (d_recvwndo) from the device structure.  That value is no longer retained, but is calculated dynamically.
    Remove some dangling references to CONFIG_NET_TCP_RWND_CONTROL.
    net/tcp:  Take read-ahead throttling into account when calculating the TCP receive window size.
    net/tcp: tcp_get_recvwindow() now returns the receive window size directly (vs. indirectly via the device structure).
    net/tcp:  Remove CONFIG_NET_TCP_RWND_CONTROL.  TCP window algorithm is now trigged only by CONFIG_NET_TCP_READAHEAD.
2018-07-01 07:59:33 -06:00
Gregory Nutt
b32d8b1714 net/tcp and sixlowpan: Separate the the TCP receive window calculations to a separate header file. It must also be used by the special 6LoWPAN TCP logic. 2018-06-30 20:50:07 -06:00
Gregory Nutt
cf3dd19352 Fix a typo. 2018-06-26 07:01:27 -06:00
Gregory Nutt
8e6afb958a net/udp: If the interface index of the device bound to a UDP socket is no longer valid because the device has been unregistered, then un-bind the UDP socket. 2018-06-26 06:53:13 -06:00
Gregory Nutt
e2c442cdcb net/procfs: Fix a design REVISIT from the integration the IFINDEX logic and the existing ifconfig/procfs logic. 2018-06-25 17:42:56 -06:00
Gregory Nutt
bdb73a60ca Fix some errors found in build testing. 2018-06-25 17:06:29 -06:00
Gregory Nutt
c439b93627 net/procfs and netdev: Fix some problems with ifconfig introduced with last changes. Also picks up one of Sebastien's changes that did not make it it before. net/udp: Fixes a DEBUGASSERT. 2018-06-25 17:06:11 -06:00
Sebastien Lorquet
65be13bffe net/udp: Finish support for the UDP_BINDTODEVICE protocol socket option 2018-06-25 15:07:53 -06:00
Gregory Nutt
2a29fe0223 net/netdev: Fix.. Too many calls to net_unlock() 2018-06-25 14:21:33 -06:00
Gregory Nutt
872a11b4a0 Correct some errors found in build testing. 2018-06-25 14:16:19 -06:00
Gregory Nutt
5a0cf3c9a8 net/netdev: Add an algorithm to prevent an interface index from being reused until all network interfaces have by assigned once. The prevents removable devices from being removed, unregistered and re-installed, re-registered and keeping the same interface index. 2018-06-25 12:57:42 -06:00
Gregory Nutt
c65e1aa3df Squashed commit of the following:
syscalls/:  Add syscall support for if_nametoindex() and if_indextoname()
    net/: Update some comments.
2018-06-25 12:41:28 -06:00
Gregory Nutt
7c1394d814 Squashed commit of the following:
net/netdev:  Add implementation of if_nametoindex() and if indextoname().
    net/pkt:  Raw AF_PACKET sockets now depend on CONFIG_NETDEV_IFINDEX.
    net/procfs:  Tweak to handle traversal of interfaces if CONFIG_NETDEV_IFINDEX is not defined.
    net/netdev.h:  Update netdev_findbyaddr() to use the assigned device index.
    Trivial typo fix
    net/netdev:  Add support for assigned an interface index to a device when it is regisgtered.
2018-06-25 12:08:10 -06:00
Gregory Nutt
589e3aa54e net/udp: Fix a whole in the address lookup logic. 2018-06-25 07:51:21 -06:00
Gregory Nutt
25686a9dac Remove if #if 0 logic. Update some comments. 2018-06-24 15:50:45 -06:00
Gregory Nutt
715d561c41 Trivial spelling corrections in comments; update some comments in a Kconfig file. 2018-06-24 15:01:49 -06:00
Gregory Nutt
0786b5d053 net/tcp: Re-think CONFIG_NET_TCP_RWND_CONTROL TCP windowing controls. 2018-06-24 14:46:12 -06:00
Gregory Nutt
433f29eea2 net/: Rename CONFIG_TCP_REASSEMBLY to CONFIG_IPv4_REASSEMBLY. Add some fixes to get a clen compile with CONFIG_IPv4_REASSEMBLY enabled. There are several problems with the current implementation: It is untested (and depends on CONFIG_EXPERMIMENTAL). It uses some Ethernet specific definitions (and depends on CONFIG_NET_ETHERNET). There is only a single reassembly buffer. The last two issues prevent use of this feature in any context where IPv4 packets may be reassembled for multiple network devices concurrently). 2018-06-24 12:06:12 -06:00
Gregory Nutt
1acfac3eb6 net/: More fixes to wrong comments from old change from the interrupt driven network to the work-queue driven network. 2018-06-23 15:03:01 -06:00
Gregory Nutt
aabdc00e8c net/: Fix some incorrect comments that go back for years (but have also been cloned in newer files). The network was once interrupt driver, but now runs on the work queue with a semaphore to enforce mutual exclusion. 2018-06-23 14:09:06 -06:00
Gregory Nutt
a0e169ad7b net/: Fix a sixlowpan typo bug recently introduced; Rename g_ipv6_allzeroaddre with the more meaning g_ipv6_unspecaddr since the all-zero address is the IPv6 unspecified address (sometime IN6_ADDR_ANY). Remove more inline tests for IPv6 multicast with tcommint net_is_addr_mcast() macro. Update some comments. 2018-06-23 12:53:27 -06:00
Gregory Nutt
5bb216fb90 net/: There are many different checks for IPv6 multicast addresses. Most of the checks are different. RFC 3513 clearly specifies how to detect an IPv6 multilcast address: they should begin with 0xffxx. I did not change some of the checks in ipv6_input.c, however. In that file, the comments indicate that the code should only pick of certain mulicast address that begin withi 0xff02. 2018-06-23 10:13:38 -06:00
Gregory Nutt
706a6a2c19 Trivial typo fixes 2018-06-23 06:20:25 -06:00
Gregory Nutt
daa04c2eae net/udp: Fix yet another confusion between raddr and laddr introduced in a recent change. 2018-06-22 10:14:47 -06:00
Gregory Nutt
66db9f09f6 Fix a typo introduced in 1b6990b69f. Also some minor design improvment. 2018-06-22 10:09:47 -06:00
Gregory Nutt
1b6990b69f net/udp: When sending a broadcast (or multicast) packet do not attempt to look up the device by the destination IP address. Rather, use the locally bound address for these cases to select the correct network device. 2018-06-22 08:19:17 -06:00
Gregory Nutt
668df010ec Committed defconfigs for working configurations should never have CONFIG_EXPERIMENTAL set because the opens the doors for untested and incomplete configurations. Conversely, if there are released configurations that use features with dependencies on CONFIG_EXPERIMENTAL, then those configurations are in use and those dependencies should be removed:
graphics/vnc/server/Kconfig:  Remove a dependency on CONFIG_EXPERIMENTAL
net/tcp/Kconfig:  Remove a dependency on CONFIG_EXPERIMENTAL
wireless/bluetooth/Kconfig:  Remove a dependency on CONFIG_EXPERIMENTAL

configs/lc823450-xgevk/audio/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/bt/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/ipl2/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/nsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/rndis/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lc823450-xgevk/usb/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/lpcxpresso-lpc54628/netnsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/moxa/nsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/olimex-stm32-p407/module/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/photon/wlan/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sabre-6quad/smp/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sam4cmp-db/nsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sama5d4-ek/elf/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sama5d4-ek/knsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/samv71-xult/module/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/samv71-xult/vnc/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/samv71-xult/vnxwm/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/bluetooth/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/pf_ieee802154/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/pktradio/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/sixlowpan/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/traveler/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/sim/userfs/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/stm32f4discovery/hciuart/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/stm32f4discovery/pseudoterm/defconfig:  Remove CONFIG_EXPERIMENTAL=y
configs/teensy-3.x/usbnsh/defconfig:  Remove CONFIG_EXPERIMENTAL=y
2018-06-17 10:30:01 -06:00
Gregory Nutt
8fdbb1e0a4 Elimate use of the non-standard type systime_t and replace it the equivalent, standard type clock_t
Squashed commit of the following:

    sched:  Rename all use of system_t to clock_t.
    syscall:  Rename all use of system_t to clock_t.
    net:  Rename all use of system_t to clock_t.
    libs:  Rename all use of system_t to clock_t.
    fs:  Rename all use of system_t to clock_t.
    drivers:  Rename all use of system_t to clock_t.
    arch:  Rename all use of system_t to clock_t.
    include:  Remove definition of systime_t; rename all use of system_t to clock_t.
2018-06-16 12:16:13 -06:00
Gregory Nutt
a186383f2a Recent changes to UDP in order to correct problems with UDP connection mode introduced a new bug: The 'to' address passed to sendto() must now be NULL in connection mode. But there are errors because there was one place where the 'to' address was still being used.
This commit adds logic to first check for UDP connection mode.  If the UDP socket is connected, then the NULL 'to' address is ignored and saved connection address is used instead.
2018-05-17 07:46:09 -06:00
Anthony Merlino
5e2d7c227d net/sixlowpan: TCP send should have PSH and ACK flags set when sending. This matches the standard network (Ethernet) TCP send logic. 2018-05-17 06:45:46 -06:00
Anthony Merlino
19ebdb4ef9 Merged in antmerlino/nuttx/sixlowpan_hc06_fix (pull request #644)
sixlowpan: Preserve big-endian (network order) when uncompressing address.

This change is the counterpart to another recent endianness fix that occurred on compression of the ip address.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-05-15 17:32:40 +00:00
Gregory Nutt
4e8e726ca3 net/udp: Trivial correct in comments due to copy-paste. 2018-05-14 06:36:59 -06:00
Gregory Nutt
3ee61fb890 net/udp: Associated with last commit. Make sure that the new connection flag is cleared when a new UDP connection structure is allocated. 2018-05-13 10:03:55 -06:00
Gregory Nutt
fb8cf9373c net/udp: Resolve race condition in connection-less UDP sockets with read-ahead buffering.
In connection-mode UDP sockets, a remote address is retained in the UDP connection structure.  This determines both there send() will send the packets and which packets recv() will accept.

This same mechanism is used for connection-less UDP sendto:  A temporary remote address is written into the connection structure to support the sendto() operation.  That address persists until the next recvfrom() when it is reset to accept any address.

When UDP read-ahead buffering is enabled, however, that means that the old, invalid remote address can be left in the connection structure for some time.  This can cause read-ahead buffer to fail, dropping UDP packets.

Shortening the time between when he remote address is reset (i.e., immediately after the sendto() completes) is not a solution, that does not eliminate the race condition; in only makes it smaller.

With this change, a flag was added to the connection structure to indicate if the UDP socket is in connection mode or if it is connection-less.  This change effects only UDP receive operations:  The remote address in the UDP connection is always ignored if the UDP socket is not in connection-mode.

No for connection-mode sockets, that remote address behaves as before.  But for connection-less sockets, it is only used by sendto().
2018-05-13 09:57:34 -06:00
Gregory Nutt
d6f9000077 net/socket: Missing semicolon in last fstat() change. 2018-04-30 09:57:43 -06:00
Gregory Nutt
fd844f8eac include/nuttx/wireless/bluetooth: Move Bluetooth header files from include/nuttx/wireless to include/nuttx/wireless/bluetooth for symmetry with other wireless technologies. 2018-04-29 12:43:09 -06:00
Gregory Nutt
efed1b6aa1 net/udp: Remove an unused variable warning. Add some comments. 2018-04-27 18:26:38 -06:00
Gregory Nutt
f5d0fc7447 fs/vfs and net/udp: Repartition logic of commit 0c963449d6, moving into net/udp. Add support to handle connected UDP sockets. The correct 'optimal blksize' to return is the MSS. The MTU is always too big. 2018-04-27 08:36:25 -06:00
Gregory Nutt
119ce8730f net/udp: Fix a backward conditional test added in commit 434da18cd7. 2018-04-27 06:35:51 -06:00
Gregory Nutt
434da18cd7 net/udp: Correct an error introduce in recent fixes for UDP connected sockets. The interaction between psock_udp_send() and psock_udp_sendto() was perverse: It should always pass a NULL destinatino address. 2018-04-26 21:58:09 -06:00
hhuysqt
144e335b85 drivers/wiresless/ieee80211: Correct some initialization problems with BCM43362 chip. Adds BCM43428 support. arch/arm/src: Add support for SDIO card to SDIO driver.
Squashed commit of the following:

Author: Gregory Nutt <gnutt@nuttx.org>
    include/nuttx/wireless/ieee80211:  Cosmetic, coding standard changes from review of last merge.
    drivers/wireless/ieee80211:  Cosmetic, coding standard changes from review of last merge.
    configs/photon:  Cosmetic, coding standard changes from review of last merge.
    arch/arm/src/stm32:  SDIO changes from last review:  Fix a few long lines and other coding standard issues; Make additions for SDIO card support dependent on a configuration option.

Author: hhuysqt <hyq9606@126.com>
    Return IEEE 802.11 MAC address just as ethernet does
    Modifyed bcmf_board_setup_oob_irq declaration
    Modified OOB ISR function types
    Add some logic according to WICED SDK
    Bug fixed: data_offset counts in 4-bytes
    Add BCM43438 logic for future developement
    Add tips on using telnet
    Use SDIO in-band interrupt instead of OOB interrupt, because Photon seems to unconnect the OOB interrupt line...
    add SDIO in-band interrupt logic
2018-04-26 08:10:23 -06:00
Gregory Nutt
cfc5f86862 net/udp: Minor update from review of 091e3f732e. In connect(), AF_UNSPEC is used to disconnect UDP socket. However, initial commit lacked logic to mark the socket as disconnected. 2018-04-25 10:13:59 -06:00
Gregory Nutt
091e3f732e net/udp: Fix several issues using connected UDP sockets: sendto() should not accept and address. Normally send() should be used instead. recvfrom() is no longer necessary. recvfrom() and poll() should not reset to accept any addresses but should, instead, only accept inputs and events from the connected remore peer. On of these issues was noted by 李桂丁 <liguiding@pinecone.net>. Changes were made as summarized here: http://www.masterraghu.com/subjects/np/introduction/unix_network_programming_v1.3/ch08lev1sec11.html 2018-04-25 08:43:38 -06:00
Pelle Windestam
303e6499bd net/tcp: Extended support for sending to non-blocking tcp sockets. 2018-04-20 07:37:51 -06:00
Gregory Nutt
d93b22d042 net/sixlowpan: Fix a nasty, byte-ordering/endian-ness problem. The root cause has been found and corrected. And a half dozen or so bandaid fixes were reverted. 2018-04-17 15:34:12 -06:00
Gregory Nutt
5fc2f7a36c net/sixlowpan: Simplify redundant check in the previous commit. If fullmac == true, then we must also have usemac == true and so checking usemac in that context is redundant. 2018-04-16 10:33:35 -06:00
Gregory Nutt
9ddce0b324 net/sixlowpan: Grrr.. got conditional logic reversed in the last commit 2018-04-16 08:02:42 -06:00
Gregory Nutt
12002d1604 net/sixlowpan: When uncompressing link local addresses, the source of the address matters. Apparently address by byte reversed in IP addresses. But if the source of the address is the locally assigned address, bytes are not reversed. 2018-04-16 07:34:02 -06:00
Gregory Nutt
06aee06a8d Revert "net/sixlowpan: Fix a constant value used in IPv6 address decompression. The 0x0200 value used in the address modification should be in network order."
This reverts commit e8832be8f1.
2018-04-16 06:40:10 -06:00
Gregory Nutt
e8832be8f1 net/sixlowpan: Fix a constant value used in IPv6 address decompression. The 0x0200 value used in the address modification should be in network order. 2018-04-13 08:17:25 -06:00
Gregory Nutt
cab7ba8b8f Bluetooth: Better integrate NuttX Bluetooth IOCTL commands and NetBSD IOCTL commands. Stanardize naming. 2018-04-06 09:42:41 -06:00
Gregory Nutt
39e393fa5f net/bluetooth: Since the max header is always reported, the max frame size for purposes of allocation is the max header lenght plus the max payload, even though the frames with the max payload never have the max header length. 2018-04-05 16:40:59 -06:00
Gregory Nutt
0142a5ad13 arch/sim/src: Variable fixes to get a Bluetooth simulation build. 2018-04-03 10:00:56 -06:00
Gregory Nutt
a91edf7f3c net/Kconfig: Remove some trivial kruft from Kconfig file. 2018-04-03 08:13:11 -06:00
Gregory Nutt
5dd11f465b net/bluetooth: Add support for connection to any address and any channel. 2018-04-01 17:53:07 -06:00
Gregory Nutt
aae0d92598 wireless/bluetooth and net/bluetooth: Clean up some garbage left in Kconfig file that broke 'make menuconfig'. Clean up some craziness with Bluetooth frame length definitions. 2018-04-01 15:21:58 -06:00
Gregory Nutt
f7bcad502a Bluetooth: Bring in some definitions from NetBSD. Update some usage and naming to be more consistent. 2018-03-31 16:31:51 -06:00
Gregory Nutt
0c007be4bd This comment adds (1) basic support for AF_BLUETOOTH sockets. The logic compiles but is still incomplete. Support for Bluetooth is general is still dependent on CONFIG_EXPERMIMENTAL because it is not yet ready for used.
Squashed commit of the following:

    wireless/bluetooth:  Some small changes that gets to a clean compile by just eliminating some incorrect implementations (still with a lot of warnings.  The logic is still incomplete but now not so lethal.
    wireless/bluetooth:  Restructuring:  Connection interfaces should internal to wireless/bluetooth.  include/nuttx/wireless/bt_conn.h removed and merged with wireless/bluetooth/bt_conn.h.  Several fix to get closer to bt_netdev.c compiling.  Need to design some not interfaces and use some existing interfaces to send and receiv packets.
    wireless/bluetooth: Some organization with some network device compile errors fixed.  Still not even close to compiling.
    net/bluetooth:  Fix numerous compile issues; Still open design issues with regard to the interface with the Bluetooth stack.
    wireless/bluetooth:  Create bt_netdev.c with a crude copy of mac802154_netdev.c.  Does not not even compile yet.
    include/nuttx/net:  Add bluetooth.h.  Content is not yet correct.
    net/netpackets:  Add bluetooth.h.  Update net/bluetooth to use new socket address definition.
    net/bluetooth:  Some fixes for initial build.
    net/bluetooth:  Add initial support for Bluetooth sockets.  The initial cut is just the a clone of the IEEE 802.15.4 socket support with name changes.
    net/ieee802154:  Fix some typos noted when cloning to create net/bluetooth.
2018-03-31 14:55:03 -06:00
Gregory Nutt
c78b53a74c net/ieee802154: Add some missing logic in connect(). 2018-03-31 09:28:24 -06:00
Gregory Nutt
57f7677128 net/udp: Fix another related error in UDP condition compilatino (was actually using TCP setting, not UDP setting). 2018-03-30 15:30:45 -06:00
Gregory Nutt
2796b0245c net/ieee802154 and include/net/ieee802154: Fix a few more trivial typos. 2018-03-30 15:20:51 -06:00
Gregory Nutt
1a70e0b15e net/ieee802154: Fix more typos and cosmetic problems. 2018-03-30 13:42:55 -06:00
Gregory Nutt
2bb6ec41d1 net/: Trivial fix for a typo. 2018-03-30 12:27:04 -06:00
Gregory Nutt
51ee2cdd86 net/udp: Fix some errors in conditional compilation. 2018-03-30 12:08:53 -06:00
Gregory Nutt
a2f237065c net/ieee802154: Fix some typos noted when cloning to create net/bluetooth. 2018-03-30 12:08:29 -06:00
Masayuki Ishikawa
1d958980bd Merged in masayuki2009/nuttx.nuttx/fix_smp_bugs (pull request #615)
Fix SMP related bugs

* sched/sched: Fix a deadlock in SMP mode

    Two months ago, I introduced sched_tasklist_lock() and
    sched_tasklist_unlock() to protect tasklists in SMP mode.
    Actually, this change works pretty well for HTTP audio
    streaming aging test with lc823450-xgevk.

    However, I found a deadlock in the scheduler when I tried
    similar aging tests with DVFS autonomous mode where CPU
    clock speed changed based on cpu load. In this case, call
    sequences were as follows;

    cpu1: sched_unlock()->sched_mergepending()->sched_addreadytorun()->up_cpu_pause()
    cpu0: sched_lock()->sched_mergepending()

    To avoid this deadlock, I added sched_tasklist_unlock() when calling
    up_cpu_pause() and sched_addreadytorun(). Also, added
    sched_tasklist_lock() after the call.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* libc: Add critical section in lib_filesem.c for SMP

    To set my_pid into fs_folder atomically in SMP mode,
    critical section API must be used.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* mm: Add critical section in mm_sem.c for SMP

    To set my_pid into mm_folder atomically in SMP mode,
    critical section API must be used.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* net: Add critical section in net_lock.c for SMP

    To set my pid (me) into fs_folder atomically in SMP mode,
    critical section API must be used.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-03-20 12:34:38 +00:00
Gregory Nutt
b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt
1a990f99d1 libc/time: Add an implementationof clock() 2018-03-13 08:07:29 -06:00
Gregory Nutt
ae399b9b62 net/tcp: In tcp_input(), add the logic to detect, decode, and respond to TCP Keep-Alive packets. In tcp_timer(), fix some problems with the way that TCP Keep-Alive probes were being formatted. 2018-03-12 15:54:45 -06:00
Gregory Nutt
251924a734 Squashed commit of the following:
net/tcp:  Add logic to send probes when SO_KEEPALIVE is enabled.
    net/tcp:  TCP socket should not have to be connected to configure KeepAlive.
    net/: Add a separate configuration to enable/disable KEEPALIVE socket options.
    net/tcp: Arguments to TCP keep-alive timing functions probably should be struct timeval as are the times for other time-related socket options.
    net/tcp:  Fix a backward conditional
    net/tcp:  Add some more checks and debug output to TCP-protocol socket options.
    net/tcp:  Cosmetic changes to some alignment.
    net/:  Adds socket options needed to manage TCP-keepalive and TCP state machine logic to detect if that the remote peer is alive.  Still missing the timer poll logic to send the keep-alive probes and the state machine logic to respond to probes.
2018-03-12 10:59:46 -06:00
SP
52d54b2451 net/icmpv6/icmpv6: Eliminate warnings by correct the type uses to link structure into lists. 2018-02-23 08:04:50 -06:00
Gregory Nutt
9812f6f932 Trivial update to some comments 2018-02-22 18:42:27 -06:00
Gregory Nutt
3a2d0a06f4 net/tcp: Generalize Juho Grundstrom's IPv4 change for IPv6 as well. 2018-02-22 16:41:14 -06:00
Juho Grundstrom
13058858f2 net/tcp: tcp_send_[un]buffered.c: And header file inclusion missing in previous commit. 2018-02-22 16:30:46 -06:00
Juho Grundstrom
c065f0fd49 net/tcp: tcp_send_[un]buffered.c: Check routing table in psock_send_addrchck(). Previously only ARP table was considered when determining if the data will actually be sent. 2018-02-22 16:24:15 -06:00
Gianpaolo Ferroni Ariani
2c8eb5b240 net/tcp: Fixes hardfault when network goes done and network monitoring is in place. 2018-02-22 06:29:18 -06:00
Dmitriy Linikov
a8c58607e9 Merged in hardlulz/modem-3.0-nuttx/fix-sem-EINTR (pull request #603)
Added ECANCELED condition to DEBUGASSERT-s checking sem_wait result

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-02-20 18:24:53 +00:00
Dmitriy Linikov
9e8332e5c8 Merged in hardlulz/modem-3.0-nuttx/fixbuild-ipv4_forward (pull request #602)
Fixed misprint in ipv4_forward.c

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-02-20 18:23:48 +00:00
Gregory Nutt
2c17bf21af net/tcp: Missing header file inclusion in tcp_wrbuffer.c 2018-02-14 09:23:55 -06:00
Pelle Windestam
e0142f1d52 net/tcp: Fixed bad return value handling in psock_tcp_send(). send() expects psock_tcp_send() to return a negated errno value, not -1 with the errno set (GN: I added same change for tcp_send_buffered.c which has the same issue as tcp_send_unbuffered.c) 2018-02-13 08:02:42 -06:00
Alan Carvalho de Assis
fb50c44d08 Fix various issues noted by Coverity 2018-02-06 09:13:16 -06:00
Gregory Nutt
2683f713ab Make sure that labeling is used consistently in all function headers (part 3). 2018-02-01 12:17:03 -06:00
Gregory Nutt
7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt
3521aaf944 Squashed commit of the following:
binfmt/, configs/, grahics/, libc/, mm/, net/, sched/:  OS references to the errno variable should always use the set_errno(), get_errno() macros
    arch/arm/src/stm32 and stm32f7:  Architecture-specific code is not permitted to modify the errno variable.  drivers/ and libc/:  OS references to the errno variable should always use the set_errno(), get_errno() macros
2018-01-30 17:57:36 -06:00
Gregory Nutt
5e49e9e937 Update some comments. 2018-01-24 06:50:20 -06:00
Gregory Nutt
82cb799bb6 net/udp: Fix memory leak with UDP + write buffer is closed. Also update TODO and comments and refresh a configuration. 2018-01-23 11:54:03 -06:00
Gregory Nutt
f2017bded8 net/udp: UDP write buffering is basically functional but needs a lot more verification. 2018-01-23 07:32:17 -06:00
Gregory Nutt
289e4dde06 net/udp and tcp: Yet another (cosmetic) change to UDP and TCP write buffer macro naming. 2018-01-22 19:33:14 -06:00
Gregory Nutt
2d4fa19a54 net/udp: Resolves final design issues with UDP write buffering. 100% code complete but also 100% untested. 2018-01-22 19:27:05 -06:00
Gregory Nutt
fa3ad46897 net/udp: In sendto(), return EHOSTUNREACH if if the network is down. 2018-01-22 18:46:58 -06:00
Gregory Nutt
fef255e5be This commit adds an as-of-yet untested implemented of UDP write buffering.
Squashed commit of the following:

    net/udp:  Address most of the issues with UDP write buffering.  There is a remaining issue with handling one network going down in a multi-network environment.  None of this has been test but it is certainly ready for test.  Hence, the feature is marked EXPERIMENTAL.
    net/udp:  Some baby steps toward a corrected write buffering design.
    net/udp:  Remove pesky write buffer macros.
    Eliminate trailing space at the end of lines.
    net/udp:  A little more UDP write buffering logic.  Still at least on big gaping hole in the design.
    net/udp:  Undefined CONFIG_NET_SENDTO_TIMEOUT.
    net/udp:  Crude, naive port of the TCP write buffering logic into UDP.  This commit is certainly non-functional and is simply a starting point for the implementatin of UDP write buffering.
    net/udp:  Rename udp/udp_psock_sendto.c udp/udp_psock_sendto_unbuffered.c.
2018-01-22 18:32:02 -06:00
Gregory Nutt
0406fff888 net/udp: Remove some conditional logic that was true if there is only a single network device, but not true in the multi-device context. 2018-01-22 14:14:32 -06:00
Gregory Nutt
12d7125b75 net/tcp: Write buffering logic should not wait for a free buffer if the socket was opened non-blocking. Also, rename the TCP write buffering macros from WRB_* to TCPWB_* to make room in the namespace for write buffering with other protocols. 2018-01-22 11:11:23 -06:00
Gregory Nutt
376e30dab4 net/route: Fix a couple of compile-related issues that have crept in sense the last time the file-based routing table was used. 2018-01-05 08:57:22 -06:00
Gregory Nutt
e4652bd3dc Squashed commit of the following:
fs: Add truncate() support for userfs
    fs/unionfs:  Add truncate() support to the unionfs
    fs/tmpfs:  Add ftruncate() support to tmpfs
    syscall/: Add system call support for ftruncate()
    net/route:  Adding ftruncate() support eliminates an issue in file-based routing table management.
    fs:  Add basic framework to support truncate() and ftruncate().  The infrastructure is complete.  Now, however, the actual implementation of ftruncate() will have to be done for each file system.
2018-01-03 16:03:56 -06:00
Louis Mayencourt
aa1a068999 net/arp: Fix IGMP multicast address computation on Nuttx network stack. This change fixes the IGMP address computation to allow multicast UDP messages. The destination address was created with the incorrect bytes of the given IPv4 address. 2018-01-02 11:19:30 -06:00
Gregory Nutt
c3d3e91a3f arch/arm/src/lpc54xx: Correct handling of the Ethernet RBU error. With this fix, Ethernet now appears to be fully functional although still undertested. 2018-01-01 15:08:19 -06:00
Gregory Nutt
2a2cdb4df2 net: Fix an error introduced when ICMP and ICMP6 socket support was added in NuttX-7.3. A gratuitous ARP (or solitication) was being sent after receive of the ECHO replay (advertisement). 2018-01-01 11:15:21 -06:00
Masayuki Ishikawa
30070b06df Merged in masayuki2009/nuttx.nuttx/tcp_rcvwnd_control (pull request #555)
net/tcp: Introduce tcp receive window control based on I/O buffer

NOTE: The algorithm is still experimental but useful for http streaming.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-12-18 12:11:52 +00:00
Anthony Merlino
cc536ba606 Merged in antmerlino/nuttx/sixlowpan-address-context (pull request #553)
sixlowpan: Completes configuration options for specifying preloaded address contexts for compression

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-12-07 19:42:40 +00:00
Gregory Nutt
97434ac5e5 net/pkt: Eliminate a compile error due to missing include and also a warning. 2017-11-29 15:20:15 -06:00
Anthony Merlino
2b4f0b4a25 Merged in antmerlino/nuttx/ipfwd-remove-redundant-llheadersize (pull request #548)
net/devif: Do not add link layer header size to d_len inside devif_forward().

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-11-29 00:54:17 +00:00
Gregory Nutt
e1a1dbb459 net/netdev: Add support for the SIOCGIFBRDADDR ioctl() command. 2017-11-22 16:47:04 -06:00
Anthony Merlino
919841a383 sixlowpan: Fixes build error introduced by recent PR when routing table is enabled. 2017-11-22 17:16:54 -05:00
Anthony Merlino
827fa6796e Merged in antmerlino/nuttx/sixlowpan-route (pull request #537)
sixlowpan: Support sending to a router that is on-link and may be able to forward the packet for us if the destination is not reachable directly

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-11-22 18:10:39 +00:00
Gregory Nutt
c93320ccd6 net/: Fix some issues with regard to UDP broadcast handling. This is Bitbucket Issue #77. This commit tentatively closes the issues, subject to verification. 2017-11-22 12:06:36 -06:00
Gregory Nutt
af65eac4f2 net/icmp and icmpv6: Fix some errors in debug assertions introduced with last changes in this area. Also updates a REAME.txt file 2017-11-22 11:38:17 -06:00
Anthony Merlino
a645b18860 net/sixlowpan: Add htohs() in arguments to debug statements that print IP addresses so that they are all shown in friendlier host order 2017-11-21 11:01:11 -06:00
Gregory Nutt
306bd169f8 net/icmp: Ports the changes in ICMPv6 of commits 4629cf9461 and 74a633ea94 to ICMP. ICMP and ICMPv6 sockets are nearly identical, bug-for-bug. 2017-11-21 10:41:20 -06:00
Gregory Nutt
74a633ea94 net/icmpv6: Remove the 'list' field from struct icmpv6_conn_s. It is not used. 2017-11-21 10:25:27 -06:00
Gregory Nutt
4629cf9461 net/icmpv6: Fix an error in the poll logic. It was assume that the input parmeter pvconn was valid. It was not. Instead, the poll logic must work like the sendto() and recvfrom() logic: It must keep a copy of the conn structure in the private data. 2017-11-21 10:22:45 -06:00
Gregory Nutt
bcc61fed26 Update a README and a misnamed formal parameter. 2017-11-21 09:24:25 -06:00
Anthony Merlino
35a54d7a1e net/sixlowpan: The logic that extracts interface identifier from the IP address needs to be generalized to handle cases where the address is not a link local address. 2017-11-20 14:36:21 -06:00
Anthony Merlino
003a37e37f net/sixlowpan: Fix an endian-ness problem in 6LoWPAN address decompression. 2017-11-20 14:31:57 -06:00
Anthony Merlino
f954345dbe net/icmpv6: icmpv6_input() needs to set d_len to 0 after consuming echo reply, otherwise, garbage will get sent out. 2017-11-20 12:15:01 -06:00
Gregory Nutt
f81ef55834 Trivial re-ordering of socket option bit numbers to match order presented on OpenGroup.org. 2017-11-12 08:17:46 -06:00
Gregory Nutt
d741185c91 net/icmpv6/icmpv6_radvertise.c: set the prefix length to preconfigured value 2017-11-08 07:50:36 -06:00
Sakari Kapanen
795e884aea net/icmpv6/icmpv6_radvertise.c: Add option to manually specify router prefix 2017-11-08 07:47:41 -06:00
Gregory Nutt
471d306260 Add some comments in the area of the previously reverted code. 2017-11-04 07:21:03 -06:00
Gregory Nutt
5696e57bc9 Revert "net/inet: Fix a memory leak when closing a TCP socket."
This reverts commit 63a8d79553.
2017-11-04 07:21:03 -06:00
Gregory Nutt
63a8d79553 net/inet: Fix a memory leak when closing a TCP socket. 2017-11-03 06:44:40 -06:00
Gregory Nutt
21041af8a7 This commit modifies the Unix domain local socket design. Local sockets are built on top of pipes. The Local socket implementation maintained file descriptors to interrupt with the pipes. File descriptors have the bad property that they are valid only while running on the thread within the task that created the local socket.
As a policy, all internal OS implementations must use "detached" files which are valid in any context and do not depend on the validity of a file descriptor at any point in time.  This commit converts the usage of file descriptors to detached files throughout the local socket implementation.

Squashed commit of the following:

    net/local: Finish change to eliminate use of file descriptors.
    net/local:  A little more of the conversion.
    net/local: Beginning of chnages to eliminate use of file descriptors in the local socket implementeation. poll() will be a problem.
2017-11-02 08:23:38 -06:00
Anthony Merlino
14fb37c995 Merged in antmerlino/nuttx/sixlowpan-mac802154 (pull request #526)
ieee802154: Simplifies notify() and rxframe() calls to a single notify() call. dataind's and all other "notifs" are now "primitives" which aligns with standard terminology

* mac802154: Adds missing breaks from case statement

* sixlowpan: Fixes bad logic where ACK is not requested if address is not a broadcast

* ieee802154: Simplification of "notifs" and "datainds" to generic primitives passed via a single notify call to the layer above the MAC

* Directories.mk should reference CONFIG_WIRELESS instead of CONFIG_DRIVERS_WIRELESS

* xbee_netdev: Network must be locked when calling sixlowpan_input

* sixlowpan: Reassembly buffer can't be freed if provided by radio driver

* sixlowpan: Don't free IOB if there is an error processing it as the MAC will try to pass it along to another receiver

* ieee802154: Adds basic logging to ieee802154_primitive.c

* Minor fixes after rebase

* xbee: Adds AT query timeout to retry if XBee doesn't respond to request

* same70-xplained: Adds Xbee support. Makes mikroBus slot Kconfig 'choice'

* mac802154: Removes unused function declaration

* drivers/mrf24j40: Fixes compilation error using . operator rather than -> operator

* mac802154_device: Changes a few mac802154_primtive_free's to ieee802154_primitive_free() and changes notif to primitive in a couple places.

* mac802154: Adds promiscous mode logic to bypass parsing of incoming frames. MAC char device also checks for promiscous mode and passes whole frames including header and FCS to the application if promiscous mode is enabled.

* sixlowpan: Fixes logic to correctly check if packet is large enough to include header.  This would cause packets to be considered too small when they are sufficiently sized.

* sixlowpan: Fixes forwarding logic to use forwarding device rather than received device to look up destination link layer address

* net/ipforward: Fixes typo that caused build error when IP forwarding was enabled with CONFIG_NET_ICMPv6_NEIGHBOR enabled as well.

* configs/same70-xplained: Simple spelling fix

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-11-01 20:15:21 +00:00
Anthony Merlino
02721f9d95 net/icmpv6: Add some header file necessary for correct build.
drivers/wireless/ieee80211:  Fix typos and spelling errors as needed for Photon build.
2017-11-01 06:58:33 -06:00
Gregory Nutt
0614f9673b fs/userfs: Some fixes from initial testing. 2017-10-31 15:26:58 -06:00
Gregory Nutt
5692e340ab Move comments describing a problem out of the code and into the TODO list where it belongs. 2017-10-25 12:37:02 -06:00
Gregory Nutt
c3ce23ba35 Cosmetic update to a document and some comments. 2017-10-25 11:17:38 -06:00
Juha Niskanen
c0bf0b4d9d net/usrsock: fix compiler warnings, mostly about nxsem_post 2017-10-25 07:31:14 -06:00
Juha Niskanen
31f3f990c3 net/local: fix typo in config macro name 2017-10-25 07:23:48 -06:00
Gregory Nutt
6163033439 net/icmpv6: Remove prototype for obsolete, removed function. 2017-10-24 16:57:24 -06:00
Gregory Nutt
51c2fe321b net/icmp: Eliminate a warning. 2017-10-24 15:46:32 -06:00
Gregory Nutt
70c59a9d91 This commit adds support for semi-standard IPPROTO_ICMP6 sockets. This is a replacement for the non-standard ICMPv6 ping support that violated the portable POSIX OS interface.
Squashed commit of the following:

    net/icmpv6: IPPROT_ICMP6 socket logic now builds without error.
    net/icmpv6:  Add support for read-ahead and poll(). Initial commit is just cloned from ICMP with the appropriate name changes.
    configs/:  All defconfig filess that include CONFIG_NET_ICMPv6_SOCKET=y need to select CONFIG_SYSTEM_PING6=y and deselect CONFIG_DISABLE_POLL.
    Update NSH documention to show that ping6 is now a built in command.
    net/icmpv6:  Add icmpv6_sendto.c and icmpv6_recvfrom.c.  Initial versions are just clones from icmp/ with appropriate name changes.
    net/icmpv6:  Clone some ICMP socket logic as the beginning of support for ICMPv6 socket support.
    Rename CONFIG_NET_ICMPv6_PING to CONFIG_NET_ICMPv6_SOCKET.  Move prototype for icmpv6_ping from include/nuttx/net/icmpv6 to net/icmpv6/icmpv6.h
2017-10-24 11:23:08 -06:00
Gregory Nutt
bad3379bc4 net/icmp: Correct some comments, typings, spacing problems from last big ICMP socket change. 2017-10-23 14:27:31 -06:00
Gregory Nutt
fb3655e9f0 net/inet: Add check for protocol before handing out TCP and UDP sockets. 2017-10-23 09:58:11 -06:00
Gregory Nutt
cccc86da09 This change adds support for semi-standard IPPROTO_ICMP AF_INET datagram sockets. This replaces the old ad hoc, nonstandard way of implementing ping with a more standard, socket interface.
Squashed commit of the following:

    net/icmp:  Finishes off icmp_recvfrom().
    net/icmp:  Add readahead support for IPPROTO_ICMP sockets.
    net/icmp:  Add poll() support for IPPROTO_ICMP sockets.
    net/icmp:  Add a connection structure for IPPROTO_ICMP sockets.
    net/icmp:  Implements sendto for the IPPROTO_ICMP socket.
    net/icmp:  Move icmp_sendto() and icmp_recvfrom() to separate files.  They are likely to be complex (when they are implemented).
    net/icmp:  Hook IPPROTO_ICMP sockets into network.  Fix some naming collisions.  Still missing basic ICMP send/receive logic.
    configs: apps/system/ping current need poll() enabled.
    configs: All defconfig files that use to enable low-level support must now enabled CONFIG_SYSTEM_PING.
    net/icmp:  Adds basic build framework to support IPPROTO_ICMP sockets.
2017-10-23 08:45:12 -06:00
Gregory Nutt
9e73216bf2 net/tcp: Same change to tcp_send_buffered.c probably also applies to sixlowpan_tcpsend.c and inet_recvfrom.c 2017-10-19 16:45:00 -06:00
Gregory Nutt
8d023cb97f tcp_lost_connection() is called from two places in tcp_sendfile.c 2017-10-19 16:36:57 -06:00
Gregory Nutt
8c11a73d33 net/tcp: Same change to tcp_send_buffered.c probably also applies to tcp_sendfile.c. 2017-10-19 16:31:28 -06:00
Gregory Nutt
7d62a74915 Fix an error introduced in last commit. 2017-10-19 16:26:09 -06:00
Gregory Nutt
5a416be95b net/tcp: Same change to tcp_send_buffered.c probably also applies to tcp_send_unbuffered.c. 2017-10-19 16:14:38 -06:00
Gregory Nutt
cf5cba953d There was a possible recursion that could eventually overflow the stack. The error occurred when closing the socket with inet_close() while a socket callback was still queued. When the socket callback was executed by devif_conn_event(), this resulted in a call to psock_send_eventhandler() with TCP_CLOSE flag set which then called tcp_lost_connection(). tcp_shutdown_monitor() then called tcp_callback() again, which again called psock_send_eventhandler(), and so on.... Noted by Pascal Speck. Solution is also similar to a solution proposed by Pascal Speck. 2017-10-19 11:55:51 -06:00
Gregory Nutt
bc40403516 There was a reference counting problem in the TPC logic of net_clone(). net_clone() which is the common logic underlying dup() and dup2() for sockets. When net_clone() calls net_start_monitor() and net_start_monitor() returns a failure (because the underlying TCP connection) then net_clone() must back out the reference count on the structure. Problem noted by Pascal Speck and this implementation of the solution is based on his suggestion. 2017-10-19 11:09:23 -06:00
Anthony Merlino
e9fa96258b net/: Fix some build issues noted when both IPv4 and IPv6 are enabled. 2017-10-18 11:08:56 -06:00
Gregory Nutt
5907d3c6b6 The nx example no longer supports single user mode. 2017-10-14 10:54:38 -06:00
Gregory Nutt
2dab490cee 6LoWPAN: Fix a whole in the logic of the previous commit. It turns out that g_uncomp_hdrlen has other usages so it cannot be modified as I was doing. Instead, I needed to add a separate localt variable, protosize, to keep track of the two usages of g_uncomp_hdrlen. 2017-10-13 13:31:53 -06:00
Gregory Nutt
53c0938b53 6LoWPAN: Correct a bug in handling uncompressed frames (IPv6 dispatch) 2017-10-13 11:07:43 -06:00
Gregory Nutt
5ffd034f40 TCP Networking: When CONFIG_NET_TCP_WRITE_BUFF=y there is a situation where a NULL pointer may be dereferenced. In this configuration, the TCP connection's 'semi-permnanent' callback, s_sndcb was nullified in tcp_close_disconnect. However, other logic in tcp_lost_connection() attempt to use that callback reference after it was nullifed. Fixed in tcp_lost_connectino() by adding a NULL pointer change before the access. This was reported by Dmitriy Linikov in Bitbucket Issue 72. 2017-10-13 06:47:40 -06:00
Gregory Nutt
6de41b6cf3 net/local: Missed at least one change from read() to nx_read(). 2017-10-11 12:16:00 -06:00
Jussi Kivilinna
957831d2ba net/socket: psock_send/psock_sendto: remove assert check for null psock and buf input pointers. Removes check as 'psock == NULL' altogether because that checked for later in psock_send and psock_sendto. Change null check for 'buf' so that it is handled same as in recvfrom.c (return -EINVAL instead of
assert).
2017-10-11 11:04:05 -06:00
Gregory Nutt
a00d8e16a1 Adds OS internal function nx_write() which is functionally equivalent to write() except that it does not set the errno variable and do not cause cancellation points. 2017-10-11 10:18:30 -06:00
Gregory Nutt
af072d52bc Adds OS internal functions nx_send(), ns_recv(), and nx_recvfrom() which are functionally equivalent to send(), recv(), and recvfrom() except that they do not set the errno variable and do not cause cancellation points. 2017-10-11 09:25:43 -06:00
Gregory Nutt
6a13faf702 net/local: Need to include nuttx/semaphore.h to eliminate some new warnings. 2017-10-08 13:31:03 -06:00
Gregory Nutt
aeb3944f0a fs/vfs and net/socket: fcntl() is not return success fail for F_SETFL. Reported by Jussi Kivilinna. 2017-10-06 08:27:38 -06:00
Gregory Nutt
29b5b3667f sched/semaphore: sem_timedwait() is a cancellation point and, hence, cannot be called from within the OS. Created nxsem_timedwait() that is equivalent but does not modify the errno and does not cause cancellation. All calls to sem_timedwait() change to calls to nxsem_timedwait() in the OS. 2017-10-05 07:24:54 -06:00
Gregory Nutt
9568600ab1 Squashed commit of the following:
This commit backs out most of commit b4747286b1.  That change was added because sem_wait() would sometimes cause cancellation points inappropriated.  But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.

    In the OS, all calls to sem_wait() changed to nxsem_wait().  nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.

    In all OS functions (not libraries), change sem_wait() to nxsem_wait().  This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.

    sched/semaphore:  Add the function nxsem_wait().  This is a new internal OS interface.  It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
2017-10-04 15:22:27 -06:00
Gregory Nutt
42a0796615 Squashed commit of the following:
sched/semaphore:  Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable.  Changed all references to sem_post in the OS to nxsem_post().

    sched/semaphore:  Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable.  Changed all references to sem_destroy() in the OS to nxsem_destroy().

    libc/semaphore and sched/semaphore:  Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable.  Changed all references to sem_setprotocol in the OS to nxsem_setprotocol().  sem_getprotocol() was not used in the OS
2017-10-03 15:35:24 -06:00
Gregory Nutt
83cdb0c552 Squashed commit of the following:
libc/semaphore:  Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable.  Changed all references to sem_getvalue in the OS to nxsem_getvalue().

    sched/semaphore:  Rename all internal private functions from sem_xyz to nxsem_xyz.  The sem_ prefix is (will be) reserved only for the application semaphore interfaces.

    libc/semaphore:  Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable.  Changed all references to sem_init in the OS to nxsem_init().

    sched/semaphore:  Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.

    sched/semaphoate:  Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
2017-10-03 12:52:31 -06:00
Gregory Nutt
6ccb974910 net/route: Fix an error in cache list management. 2017-10-02 08:10:12 -06:00
Gregory Nutt
c76774cfb0 net/route: Add logic to mark a route as most-recently-used in the route cache. 2017-10-02 07:29:02 -06:00
Gregory Nutt
c4ab155002 compiler.h: Fix some GCC warnings introduced for SDCC support. Basically a naming collision. 2017-10-02 07:09:31 -06:00
Gregory Nutt
e4dd33280d Squashed commit of the following:
psock_close() and net_close() are internal OS functions and should not set the errno variable.

    psock_ioctl() and netdev_ioctl() are internal OS functions and should not set the errno variable.

    net_dupsd() and net_dupsd2() are internal OS functions and should not set the errno variable.

    net/ and fs/: net_vfcntl(), file_fcntl(), file_dup(), and file_dup2() are all internal OS interfaces and should not modify the errno value.
2017-09-30 10:41:21 -06:00
Gregory Nutt
2c2aa94b7d Squashed commit of the following:
net/: psock_recvfrom() is an internal interface and should not set the errno nor should it be a cancellation point.

    net/: psock_accept() is not a cancellation point.

    net/: psock_getsockopt() and psock_socket*9 are an internal interfaces and should not set the errno.

    net/: psock_getsockopt() is an internal interface and should not set the errno.

    net/: psock_listen() is an internal interface and should not set the errno.

    net/: psock_connect(( is an internal interface and should not set the errno nor should it be a cancellation point.

    net/: psock_bind() is an internal interface and should not set the errno.

    net/: psock_accept() is an internal interface and should not set the errno.
2017-09-30 08:18:08 -06:00
Gregory Nutt
054b147114 net/: Versions of psock_send() and pock_sendto() should not set errno. That is taken care of at a higher level in the send()/sendto() implementation as appropriate. 2017-09-30 06:41:56 -06:00
Gregory Nutt
6c5f254a5b psock_send() no longer sets errno, so send() must now set it. 2017-09-30 06:27:37 -06:00
Gregory Nutt
44736b721c net/sockets: psock_send() is an internal OS interface an should not set the errno variable. 2017-09-29 17:48:15 -06:00
Gregory Nutt
9e8529b1d0 net/sockets: psock_sendto() is an internal OS interface an should not set the errno variable. 2017-09-29 17:35:38 -06:00
Gregory Nutt
3963d1c85b net/route: File read/write logic should be able to handle short reads and writes. 2017-09-29 12:46:38 -06:00
Gregory Nutt
c4d03d81e2 Update some comments 2017-09-29 12:10:03 -06:00
Gregory Nutt
ae78a925eb Add support for an in-memory routing table cache in order to improve performance when the routing table is retained in a file. The cache holds the most recently used routing table entries and so can eliminate some file access.
Squashed commit of the following:

    net/route:  Flush in cache when any entry is deleted from the routing table.  When a router matching an IP address is found, add the routing table entry to the cache.

    net/route:  Add utility functions to manage an in-memory cache to improve performance when use a file-based routing table.
2017-09-29 12:04:45 -06:00
Gregory Nutt
44d88abb83 This commit adds support for routing tables in files in a file system. This might be useful for customized, per-unit routing tables.
There are two issues with it however:

1. Reading from file system on a per packet basis could be slow.  I think it probably should have a small, in-memory cache of most frequently used routes for good problem.

2. Currently the delroute logic is disabled due to a problem with the design.  NuttX does not currently support truncate().  Therefore, it is not possible to delete entries from the routing table file.

In this current implementation, that leaves the last entry intact at the end of the file.  An alternative design might include a tag on each record to indicate if the record is valid or not.  That would work but would add complexity to the other routing table functions.

The existing implementation is available for testing purposes only if CONFIG_EXPERIMENTAL=y.

Squashed commit of the following:

    net/route:  The current delroute design depends on file truncation.  However, NuttX does not currently support truncate.  Alternative, more complex designs are possible but not implemented.  At present the file routing table are otherwise functional but the delroute logic is disabled via CONFIG_EXPERIMENTAL.  Enable it only if you plan to fix it.

    net/route:  Fix some issues with locking routing table files.

    net/route:  Add partial implementation of delroute for the case where the routing table is in a file.

    net/route:  Add support for seeking to positions in the routing table.

    net/route: Add net_addroute_ipv4/6() using a file-based routing table.

    net/route: Add net_foreach_ipv4/4() using a file-based routing table.

    net/route:  Initial build, configuration, and fs utilies to support routing tables in a file.
2017-09-29 08:33:36 -06:00
Gregory Nutt
e761b80ea7 fs/vfs: file_read() is an internal OS interface and should not errors via the errno 2017-09-28 14:14:32 -06:00
Gregory Nutt
9043b9cb6a fs/vfs: file_seek() is an internal OS interface and should not errors via the errno 2017-09-28 13:55:36 -06:00
Gregory Nutt
ac63ffebb8 More minor cleanup after laster squashed merge. 2017-09-28 12:25:05 -06:00
Gregory Nutt
467c31637f Minor cleanup after laster squashed merge. 2017-09-28 09:23:03 -06:00
Gregory Nutt
3aa18ef56e Addes support for read-only routing tables. Prior to this change, routing tables were only support in RAM and had to be initialized with explicit logic to add the necessary routes to the routing table. With this change, routes may be defined in the pre-initialized, read-only routing table provided by the board-specific logic
This would be particularly useful, for example, in the case where there is only a single network adaptor and you want all output packets to go to the single adaptor in all cases.  So for that behavior you could add a read-only routing table to the board-specific long that contains a single entry, the default route: 0.0.0.0/0.

Squashed commit of the following:

    net/route:  RAM and ROM routing tables build correctly in all IPv4 and IPv6 configurations.

    net/route: Verify IPv6 ROM route build; Make number of ROM routes a variable, not a configuration item.

    net/route:  Add initial support for ROM-base, read-only routing tables.

    net/route:  Adjust and generalize some structures, rename some functions, and add configuration and build support that will eventually support read-only routing tables.

    net/route:  Some initial though experiments on use of a fixe, read-only routing table
2017-09-28 09:04:31 -06:00
Louis Mayencourt
b55005669a net/arp/arp_out.c: Fix IGMP Ethernet address computation 2017-09-28 07:50:52 -06:00
Gregory Nutt
d88583ffcf net/route: Permit IPv4 and IPv6 routing tables to be of different sizes 2017-09-27 12:04:51 -06:00
Bruno Herrera
24767a0c66 Fixes for problems found by Coverity in the nuttx repository:
net/socket/recvfrom.c: Check fromlen integrity before using it.

    net/socket/net_sockets.c: Always check for valid psock before using.

    net/tcp/tcp_send_unbuffered.c:  Avoid using psock beforing checking its integrity.

    sched/timer/timer_create.c: Fix watchdog resource leak if cannot allocate a new timer.
2017-09-25 07:17:09 -06:00
Louis Mayencourt
dfa0574e7b net/igmp/igmp_send.c: Fix incoming IGMP checksum calculation 2017-09-25 06:55:01 -06:00
Sakari Kapanen
d0f72617ef From b7b1826930c7da10416bceebce5d63dc8e4086ca Mon Sep 17 00:00:00 2001
From: Sakari Kapanen <sakari.kapanen@optofidelity.com>
Date: Sun, 24 Sep 2017 13:19:25 +0300
Subject: [PATCH] ICMPv6: fix router advertisement

Fixes several errors preventing icmpv6_radvertise.c from being compiled. Fixes conversions to network byte order (namely vlifetime, plifetime, mtu).

IPv6 source address is set to link-local IP address instead of the address in the netdev structure. This is in compliance to RFC 4861. RA didn't work on Linux before this change.

Finally, router prefix and prefix length are derived from the IPv6 address and netmask in the netdev structure. This seems to make more sense than using a predefined, separate prefix from the config.
2017-09-24 06:33:05 -06:00
Gregory Nutt
12c4c4c8a6 In some cases, packets are still not sent behind the router. I found that NuttX sends the ARP requests not to the router but to the target. Mistake in file net/route/netdev_router.c. From Aleksandr Kazantsev 2017-09-20 13:19:05 -06:00
Gregory Nutt
2790c3b024 Trivial fix in some comments. 2017-09-20 10:06:26 -06:00
Gregory Nutt
de34b96533 SIOCGIFCONF and SIOCGLIFCONF IOCTL commands should only report on network adatpors in the UP state. 2017-09-20 06:50:21 -06:00
Gregory Nutt
ae2a1d07b3 Networking: drivers/net/loopback.c: Eliminate a warning. net/netdev/netdev_ifconfig.c: Was not returning all of the address info. 2017-09-19 15:00:46 -06:00
Gregory Nutt
7af976c00a Squashed commit of the following:
Networking:  Add implementation of logic for SIOCGIFCONF and SIOCGLIFCOF IOCTL commnds.
    Networking:  Add definitions and stuctures to support SIOCGIFCONF and SIOCGLIFCONF IOCTL commands.
2017-09-19 14:17:05 -06:00
Gregory Nutt
0eee0f22cd Networking: IPv4 getsockname(): Fix a typo that can cause a compile error. 2017-09-19 10:52:01 -06:00
Gregory Nutt
780435d9f1 Networking: sockgetname() files need to include udp/udp.h and tcp/tcp.h or otherwise NET_UDP_HAVE_STACK and NET_TCP_HAVE_STACK are undefined and the logic is never compiled. Noted by Anthony Merlino 2017-09-18 13:14:57 -06:00
Gregory Nutt
684a59f8e8 Eliminate some warnings found in build testing. 2017-09-15 14:42:50 -06:00
Gregory Nutt
cca15891c9 Networking: Fix some errors found by Coverity 2017-09-13 13:04:26 -06:00
Gregory Nutt
80412df0b1 UDP Networking: Fix unitialized variable problem found by Coverity 2017-09-13 12:12:57 -06:00
Jussi Kivilinna
7846381e09 net/socket: send: verify that sockfd is valid, fixes assert when using send on closed socket 2017-09-12 07:40:13 -06:00
Jussi Kivilinna
1fa854285d net/socket: Do not enter cancellation point in psock_send() as this is already done in send() 2017-09-12 07:39:05 -06:00
Jussi Kivilinna
61878848ad net/sock: recvfrom: Fix double leave_cancellation_point on error path 2017-09-12 07:17:53 -06:00
Gregory Nutt
6a6bf1b62f :Remove CONFIG_NET_6LOWPAN_FRAMELEN. In this case where multiple radios are support3d, this may not be a constant. 6LoWPAN now always queries the driver to get the maximum frame length. 2017-09-10 11:40:54 -06:00
Gregory Nutt
c217c663ae 6LoWPAN: Remove the option to disable fragmentation support. Two reasons: (1) First fragementation is always required becaues IPv6 requires an MTU of 1280 bytes. The is no application use case that can work without fragmentation support. And (2) it greatly reduces the complexity of the code. 2017-09-10 10:49:27 -06:00
Gregory Nutt
334d1734dc 6LoWPAN/Radio: Rename radio property sp_pktlen to sp_framelen. Add 6LoWPAN utility to get the max frame length (not yet hooked in) 2017-09-10 10:13:33 -06:00
Gregory Nutt
ddde05db83 6LoWPAN: I believe, based on RFC review, that with the last multicast change, the NuttX 6LoWPAN is now compliant with RFC 6282. 2017-09-08 15:04:51 -06:00
Gregory Nutt
edf6359c87 Fix typos in Document and in some C comments. 2017-09-08 12:55:16 -06:00
Gregory Nutt
9cc85aadf6 6LoWPAN: Correct an error in uncompressing multicast address. 2017-09-08 09:23:40 -06:00
Jussi Kivilinna
547733cbb0 Update net_timedwait() and net_lockedwait() call sites to handle negated errno in return value 2017-09-04 07:56:51 -06:00