Skip to content

Leverage the simplification of the IPv6 parsing primitive #8003

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

Merged
merged 1 commit into from
Oct 24, 2018
Merged

Leverage the simplification of the IPv6 parsing primitive #8003

merged 1 commit into from
Oct 24, 2018

Conversation

Taiki-San
Copy link
Contributor

Description

Apply the changes of PR #6293 to the IPv6 parser.
Thanks to changes introduced by PelionIoT/nanostack-libservice#72, we can now report the success or failure of the parsing and not rely on simply returning an empty string on failure.
This PR shouldn't be merged before PelionIoT/nanostack-libservice#72 is merged and integrated into mbedOS.

Pull request type

[ ] Fix
[x] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

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

Looks fine, for once LibService has been updated.

@NirSonnenschein
Copy link
Contributor

NirSonnenschein commented Sep 13, 2018

@Taiki-San , looks like there is a build issue, please take a look:

Compile [ 69.1%]: SocketAddress.cpp

[Error] SocketAddress.cpp@63,30: could not convert 'stoip6(addr, strlen(addr), ((void*)((uint8_t*)(&((SocketAddress*)this)->SocketAddress::_addr.nsapi_addr::bytes))))' from 'void' to 'bool'

[Warning] SocketAddress.cpp@70,1: control reaches end of non-void function [-Wreturn-type]

[ERROR] ./features/netsocket/SocketAddress.cpp: In member function 'bool SocketAddress::set_ip_address(const char*)':

./features/netsocket/SocketAddress.cpp:63:30: error: could not convert 'stoip6(addr, strlen(addr), ((void*)((uint8_t*)(&((SocketAddress*)this)->SocketAddress::_addr.nsapi_addr::bytes))))' from 'void' to 'bool'

@Taiki-San
Copy link
Contributor Author

@NirSonnenschein That's expected from the missing PR: stoip6 signature has been changed and its return value turned from void to bool.

@NirSonnenschein
Copy link
Contributor

@Taiki-San , sorry, I missed that interface change. restored "needs: review" status.

@kjbracey
Copy link
Contributor

Part of me wants to give this a red cross because of you verbing the word "leverage", but resisting temptation.

@Taiki-San
Copy link
Contributor Author

Ah ah, sorry about that. Do you have a better suggestion for posterity?

@kjbracey
Copy link
Contributor

No, you do you. Not totally serious :)

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 24, 2018

This PR shouldn't be merged before PelionIoT/nanostack-libservice#72 is merged and integrated into mbedOS.

@kjbracey-arm when this fix can move forward?

@kjbracey
Copy link
Contributor

When the next libService subtree merge comes in. That's normally done as part of the once-per-release Nanostack update, but we could do an extra one because of this. @artokin, @deepakvenugopal ?

@kjbracey
Copy link
Contributor

Waiting for #8245. Also needs a conflict resolution rebase.

@Taiki-San
Copy link
Contributor Author

For the record, this PR is waiting for the next libService merge.

@cmonr
Copy link
Contributor

cmonr commented Oct 19, 2018

@Taiki-San Looks like #8245 is now in. Was this what you mentioned with libService or is that something else?

@Taiki-San
Copy link
Contributor Author

Not really involved in the process but if it wasn't reverted, #8245 contains the code this PR is depending on. Tests should run fine this time.

@cmonr
Copy link
Contributor

cmonr commented Oct 19, 2018

@Taiki-San You might want to take a look at the Travis CI tests. I've restarted them just in case, but the errors looks legit.

@Taiki-San
Copy link
Contributor Author

I don't have access to the internal CI, but this PR couldn't build until libservice was merged (a function signature changed).
Hopefully, we shouldn't get any more failures.

@kjbracey
Copy link
Contributor

There's a unit test stub for stoip6 that blew up. Seems there's a dummy definition of stoip6 without the return value in UNITTESTS/target_h/ip6string.h.

@Taiki-San
Copy link
Contributor Author

Thanks, just patched it.

@cmonr
Copy link
Contributor

cmonr commented Oct 22, 2018

@Taiki-San Thanks. Manually restarted unittests since GitHub's webhooks are disabled right now.

Results should be ready in about 20 mins.

@Taiki-San
Copy link
Contributor Author

jenkins-ci/unittests is reporting a failure, is that normal?

@cmonr
Copy link
Contributor

cmonr commented Oct 22, 2018

@Taiki-San Nope.
This command will run the unittests: python ./UNITTESTS/mbed_unittest.py --compile --coverage both

Please take a look at the failure.

The log: **[linux] test 4
[linux] 
[linux]       Start  4: features-netsocket-NetworkStack
[linux] 
[linux] 
[linux] 
[linux] 4: Test command: /builds/ws/mbed-os-ci_unittests/unitTest-531/mbed-os/build/features-netsocket-NetworkStack
[linux] 
[linux] 4: Test timeout computed to be: 9.99988e+06
[linux] 
[linux] 4: Running main() from gmock_main.cc
[linux] 
[linux] 4: [==========] Running 13 tests from 1 test case.
[linux] 
[linux] 4: [----------] Global test environment set-up.
[linux] 
[linux] 4: [----------] 13 tests from TestNetworkStack
[linux] 
[linux] 4: [ RUN      ] TestNetworkStack.constructor
[linux] 
[linux] 4: [       OK ] TestNetworkStack.constructor (0 ms)
[linux] 
[linux] 4: [ RUN      ] TestNetworkStack.get_ip_address_default
[linux] 
[linux] 4: [       OK ] TestNetworkStack.get_ip_address_default (0 ms)
[linux] 
[linux] 4: [ RUN      ] TestNetworkStack.gethostbyname
[linux] 
[linux] 4: /builds/ws/mbed-os-ci_unittests/unitTest-531/mbed-os/UNITTESTS/features/netsocket/NetworkStack/test_NetworkStack.cpp:156: Failure
[linux] 
[linux] 4: Expected equality of these values:
[linux] 
[linux] 4:   stack->gethostbyname("host", &a, NSAPI_UNSPEC)
[linux] 
[linux] 4:     Which is: 0
[linux] 
[linux] 4:   NSAPI_ERROR_DNS_FAILURE
[linux] 
[linux] 4:     Which is: -3009
[linux] 
[linux] 4: [  FAILED  ] TestNetworkStack.gethostbyname (0 ms)
[linux] 
[linux] 4: [ RUN      ] TestNetworkStack.gethostbyname_simple_address
[linux] 
[linux] 4: [       OK ] TestNetworkStack.gethostbyname_simple_address (0 ms)
[linux] 
[linux] 4: [ RUN      ] TestNetworkStack.gethostbyname_simple_address_right_version
[linux] 
[linux] 4: [       OK ] TestNetworkStack.gethostbyname_simple_address_right_version (0 ms)
[linux] 
[linux] 4: [ RUN      ] TestNetworkStack.gethostbyname_simple_address_wrong_version
[linux] 
[linux] 4: [       OK ] TestNetworkStack.gethostbyname_simple_address_wrong_version (0 ms)
[linux] 
[linux] 4: [ RUN      ] TestNetworkStack.gethostbyname_empty_host
[linux] 
[linux] 4: [       OK ] TestNetworkStack.gethostbyname_empty_host (0 ms)
[linux] 
[linux] 4: [ RUN      ] TestNetworkStack.gethostbyname_async_delay
[linux] 
[linux] 4: /builds/ws/mbed-os-ci_unittests/unitTest-531/mbed-os/UNITTESTS/features/netsocket/NetworkStack/test_NetworkStack.cpp:193: Failure
[linux] 
[linux] 4: Expected equality of these values:
[linux] 
[linux] 4:   stack->gethostbyname_async("localhost", mbed::callback(my_callback), NSAPI_UNSPEC)
[linux] 
[linux] 4:     Which is: 0
[linux] 
[linux] 4:   NSAPI_ERROR_DNS_FAILURE
[linux] 
[linux] 4:     Which is: -3009
[linux] 
[linux] 4: mbed assertation failed: _ops, file: /builds/ws/mbed-os-ci_unittests/unitTest-531/mbed-os/UNITTESTS/../platform/Callback.h, line 1818 
[linux] 
[linux]  4/37 Test  #4: features-netsocket-NetworkStack .........................***Exception: SegFault  0.29 sec **

@Taiki-San
Copy link
Contributor Author

That's weird, I can't reproduce this error on my computer. I'm running macOS/clang.
Moreover, after having a look at the test case that was failing, I'm not quite sure how this PR could be affecting its outcome...

@cmonr
Copy link
Contributor

cmonr commented Oct 23, 2018

@ARMmbed/mbed-os-test Would y'all be able to help out here?

@kjbracey
Copy link
Contributor

Those unit tests are checking response to bad IP addresses. Presumably would have worked when the "is it an IPv6 address" tests were inside NetworkStack.cpp, but now it's using stubbed stoip6 which always returns success?

No, actually you aren't returning anything in ip6string.h.

I see that the cmake file for the test is actually pulling in real stoip4.c -you could also pull in real stoip6.c for consistency. (And then if you're doing that, remove the dummies from ip6string_h?)

@Taiki-San
Copy link
Contributor Author

Oh, so that's why it's randomly succeeding! It's basically just using whatever was on the stack/register as the success indicator.
I removed the dummy header and added the libip6string files to any target that was building libip4string. It's working, but I don't think building ip6tos.c is strictly necessary. Should I go forward with it nevertheless?

@kjbracey
Copy link
Contributor

I don't have a view on what the correct thing to do for those tests is, except that ip4 and ip6 should be consistent. It would seem natural to leave the working ip4 as-is and bring ip6 inline.

@Taiki-San
Copy link
Contributor Author

Ok, I kept libip6string consistent with libip4string.

@cmonr
Copy link
Contributor

cmonr commented Oct 24, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 24, 2018

Build : SUCCESS

Build number : 3448
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8003/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Oct 24, 2018

@mbed-ci
Copy link

mbed-ci commented Oct 24, 2018

@kjbracey
Copy link
Contributor

Apparently spurious test failure on K82F-GCC_ARM.tests-mbed_hal-qspi.qspi frequency setting test

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 24, 2018

/morph test
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Oct 24, 2018

Test : SUCCESS

Build number : 3241
Test logs :http://mbed-os-logs.s3-website-us-west-1.amazonaws.com/?prefix=logs/8003/3241

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 5, 2018

Depends on #8245 (moved to 5.11)

@0xc0170 0xc0170 mentioned this pull request Nov 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants