Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network-socket: Optionally return peer address from accept(). #2434

Merged
merged 4 commits into from
Aug 19, 2016

Conversation

infinnovation-dev
Copy link
Contributor

Fixes issue #2399 by optionally returning a SocketAddress from
TCPServer::accept().

This entails changes to underlying NetworkStack and nsapi. This
commit deals only with lwip and higher level APIs; other users of
NetworkStack and nsapi may be affected. Currently lwip is the only
in-tree user of nsapi.

Fixes issue ARMmbed#2399 by optionally returning a SocketAddress from
TCPServer::accept().

This entails changes to underlying NetworkStack and nsapi.  This
commit deals only with lwip and higher level APIs; other users of
NetworkStack and nsapi may be affected.  Currently lwip is the only
in-tree user of nsapi.
@ciarmcom
Copy link
Member

Can one of the admins verify this patch?

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 12, 2016

cc @geky @bogdanm

@jupe
Copy link
Contributor

jupe commented Aug 12, 2016

@tommikas have you seen this already?

@@ -292,7 +292,7 @@ static int lwip_socket_connect(nsapi_stack_t *stack, nsapi_socket_t handle, nsap
return lwip_err_remap(err);
}

static int lwip_socket_accept(nsapi_stack_t *stack, nsapi_socket_t *handle, nsapi_socket_t server)
static int lwip_socket_accept(nsapi_stack_t *stack, nsapi_socket_t server, nsapi_socket_t *handle, nsapi_addr_t *addr, uint16_t *port)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this is a better argument order. And now is the best time for the change.

@geky
Copy link
Contributor

geky commented Aug 12, 2016

+1 This looks great!

Before we merge this, we need to update Nanostack (FEATURE_IPV6) so it at least compiles. I can look into the updating the esp8266-driver. Unfortunately there may be other implementations that have been started, but this is a significan short-sight that needs fixing.

* @return 0 on success, negative error code on failure
*/
virtual int socket_accept(nsapi_socket_t *handle, nsapi_socket_t server) = 0;
virtual int socket_accept(nsapi_socket_t *handle, nsapi_socket_t server, SocketAddress *address=0) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these parameters be reordered to match the C api's socket_accept?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yes I think they should.

Copy link
Contributor

@geky geky Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed a patch to a fork from your fork as a part of looking at the other implementations: infinnovation-dev#1

Fee free to steal it, or I'll make a pr onto this branch once nanostack is updated. (not sure if there is a better way to handle this)

Make the argument order more sensible, in line with nsapi.
@infinnovation-dev
Copy link
Contributor Author

Ah, I see @geky's pull-request against my pull-request crossed in the post with my update. I'll merge it once I get my head around the git(hub) wworkflow.

@geky
Copy link
Contributor

geky commented Aug 12, 2016

The conflict should be fixed : )

Feel free to just manually copy over the changes, github doesn't make it too easy to suggest a modification to someone else's prs.

network-socket: Peer address update for Nanostack
@geky
Copy link
Contributor

geky commented Aug 15, 2016

Everything looks good now 👍

@geky
Copy link
Contributor

geky commented Aug 15, 2016

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 643

Test failed!

@geky
Copy link
Contributor

geky commented Aug 15, 2016

The failing test appears to be a spurious issue with the tools. Should be good to go 👍 .

@geky
Copy link
Contributor

geky commented Aug 17, 2016

LGTM?

@sg-
Copy link
Contributor

sg- commented Aug 17, 2016

LGTM 👍

@0xc0170 0xc0170 merged commit da69629 into ARMmbed:master Aug 19, 2016
artokin pushed a commit to artokin/mbed-os that referenced this pull request Sep 2, 2020
…..91acece

91acece Remove test files
6568bc1 Merge branch 'release_internal' into release_external
4192cc8 Added configuration for RADIUS retry timer (ARMmbed#2438)
684b714 Added support for retries and multiple sockets to RADIUS client (ARMmbed#2426)
89e0ae0 WS: Restart auto CCA threshold after discovery (ARMmbed#2435)
dbb09b1 MAC/WS: Min possible Tack to 1ms and CCA interval to 2ms (ARMmbed#2434)
43b2ae2 Cca threshold test (ARMmbed#2436)
28108e1 Added device min sensitivity setting and stack information
7060c70 Cca threshold test (ARMmbed#2432)
640be71 WS: temporarily set default CCA threshold to -80 (ARMmbed#2431)
0a472ae WS: Calculate UFSI drift and trace (ARMmbed#2430)
61d3db8 Create APIs for DNS cache results
587add5 MAC: Validate TX time (ARMmbed#2429)
a1bfed4 Added typecast when computing max_timout from drift (ARMmbed#2428)
089fb3b Neighbour temporary entry update and Enhanced ACK tx update
70244f6 Wi-sun parameter and debug trace update
5752eae Created validate TX time handler (ARMmbed#2423)
022d61f Wi-sun Neighbour table update and DHCP new callback
857b41f Merge pull request ARMmbed#2421 from ARMmbed/update_from_mbed_os
1a9dd13 (via Mbed-OS)WS Management API missing include
4318f37 Calculate drift in critical state (ARMmbed#2419)
01a1909 FHSS WS: Do not use drift compensation with unpredictable linux timer (ARMmbed#2418)

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: 91acece
artokin pushed a commit to artokin/mbed-os that referenced this pull request Sep 7, 2020
…..d879e6d

d879e6d Merge branch 'release_internal' into release_external
eef9246 Fixed network border router timeout recovery and EAPOL relay address fix
bac7ca6 Changed RADIUS MTU and small fixes
a9f8b75 Addeed support for DHCP vendor data
d8f0003 DHCPv6 functionality update
7fe0423 Added DHCPv6 vendor data generation for DNS queries
639f9db FHSS: Changed retry backoffs when no BC schedule or TX slots (ARMmbed#2440)
91acece Remove test files
6568bc1 Merge branch 'release_internal' into release_external
4192cc8 Added configuration for RADIUS retry timer (ARMmbed#2438)
684b714 Added support for retries and multiple sockets to RADIUS client (ARMmbed#2426)
89e0ae0 WS: Restart auto CCA threshold after discovery (ARMmbed#2435)
dbb09b1 MAC/WS: Min possible Tack to 1ms and CCA interval to 2ms (ARMmbed#2434)
43b2ae2 Cca threshold test (ARMmbed#2436)
28108e1 Added device min sensitivity setting and stack information
7060c70 Cca threshold test (ARMmbed#2432)
640be71 WS: temporarily set default CCA threshold to -80 (ARMmbed#2431)
0a472ae WS: Calculate UFSI drift and trace (ARMmbed#2430)
61d3db8 Create APIs for DNS cache results
587add5 MAC: Validate TX time (ARMmbed#2429)
a1bfed4 Added typecast when computing max_timout from drift (ARMmbed#2428)
089fb3b Neighbour temporary entry update and Enhanced ACK tx update
70244f6 Wi-sun parameter and debug trace update
5752eae Created validate TX time handler (ARMmbed#2423)
022d61f Wi-sun Neighbour table update and DHCP new callback
857b41f Merge pull request ARMmbed#2421 from ARMmbed/update_from_mbed_os
1a9dd13 (via Mbed-OS)WS Management API missing include
4318f37 Calculate drift in critical state (ARMmbed#2419)
01a1909 FHSS WS: Do not use drift compensation with unpredictable linux timer (ARMmbed#2418)

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: d879e6d
artokin pushed a commit to artokin/mbed-os that referenced this pull request Sep 7, 2020
…8609ae..d879e6d

d879e6d Merge branch 'release_internal' into release_external
eef9246 Fixed network border router timeout recovery and EAPOL relay address fix
bac7ca6 Changed RADIUS MTU and small fixes
a9f8b75 Addeed support for DHCP vendor data
d8f0003 DHCPv6 functionality update
7fe0423 Added DHCPv6 vendor data generation for DNS queries
639f9db FHSS: Changed retry backoffs when no BC schedule or TX slots (ARMmbed#2440)
91acece Remove test files
6568bc1 Merge branch 'release_internal' into release_external
4192cc8 Added configuration for RADIUS retry timer (ARMmbed#2438)
684b714 Added support for retries and multiple sockets to RADIUS client (ARMmbed#2426)
89e0ae0 WS: Restart auto CCA threshold after discovery (ARMmbed#2435)
dbb09b1 MAC/WS: Min possible Tack to 1ms and CCA interval to 2ms (ARMmbed#2434)
43b2ae2 Cca threshold test (ARMmbed#2436)
28108e1 Added device min sensitivity setting and stack information
7060c70 Cca threshold test (ARMmbed#2432)
640be71 WS: temporarily set default CCA threshold to -80 (ARMmbed#2431)
0a472ae WS: Calculate UFSI drift and trace (ARMmbed#2430)
61d3db8 Create APIs for DNS cache results
587add5 MAC: Validate TX time (ARMmbed#2429)
a1bfed4 Added typecast when computing max_timout from drift (ARMmbed#2428)
089fb3b Neighbour temporary entry update and Enhanced ACK tx update
70244f6 Wi-sun parameter and debug trace update
5752eae Created validate TX time handler (ARMmbed#2423)
022d61f Wi-sun Neighbour table update and DHCP new callback
857b41f Merge pull request ARMmbed#2421 from ARMmbed/update_from_mbed_os
1a9dd13 (via Mbed-OS)WS Management API missing include
4318f37 Calculate drift in critical state (ARMmbed#2419)
01a1909 FHSS WS: Do not use drift compensation with unpredictable linux timer (ARMmbed#2418)

git-subtree-dir: connectivity/nanostack/sal-stack-nanostack
git-subtree-split: d879e6d
winneymj pushed a commit to winneymj/mbed-os that referenced this pull request Sep 29, 2020
…8609ae..d879e6d

d879e6d Merge branch 'release_internal' into release_external
eef9246 Fixed network border router timeout recovery and EAPOL relay address fix
bac7ca6 Changed RADIUS MTU and small fixes
a9f8b75 Addeed support for DHCP vendor data
d8f0003 DHCPv6 functionality update
7fe0423 Added DHCPv6 vendor data generation for DNS queries
639f9db FHSS: Changed retry backoffs when no BC schedule or TX slots (ARMmbed#2440)
91acece Remove test files
6568bc1 Merge branch 'release_internal' into release_external
4192cc8 Added configuration for RADIUS retry timer (ARMmbed#2438)
684b714 Added support for retries and multiple sockets to RADIUS client (ARMmbed#2426)
89e0ae0 WS: Restart auto CCA threshold after discovery (ARMmbed#2435)
dbb09b1 MAC/WS: Min possible Tack to 1ms and CCA interval to 2ms (ARMmbed#2434)
43b2ae2 Cca threshold test (ARMmbed#2436)
28108e1 Added device min sensitivity setting and stack information
7060c70 Cca threshold test (ARMmbed#2432)
640be71 WS: temporarily set default CCA threshold to -80 (ARMmbed#2431)
0a472ae WS: Calculate UFSI drift and trace (ARMmbed#2430)
61d3db8 Create APIs for DNS cache results
587add5 MAC: Validate TX time (ARMmbed#2429)
a1bfed4 Added typecast when computing max_timout from drift (ARMmbed#2428)
089fb3b Neighbour temporary entry update and Enhanced ACK tx update
70244f6 Wi-sun parameter and debug trace update
5752eae Created validate TX time handler (ARMmbed#2423)
022d61f Wi-sun Neighbour table update and DHCP new callback
857b41f Merge pull request ARMmbed#2421 from ARMmbed/update_from_mbed_os
1a9dd13 (via Mbed-OS)WS Management API missing include
4318f37 Calculate drift in critical state (ARMmbed#2419)
01a1909 FHSS WS: Do not use drift compensation with unpredictable linux timer (ARMmbed#2418)

git-subtree-dir: connectivity/nanostack/sal-stack-nanostack
git-subtree-split: d879e6d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants