Date   

Re: Need help with otgc build error(solved)

Jaimin Parmar
 

I have the same error due to JavaFX.
I solved using installing new Java with inbuild JavaFx and the problem is solved.
You can find the java package with JavaFx at https://bell-sw.com/pages/downloads/
 If you find any issues then let me know.
Hope it's useful.
Thanks :)


Discovery out of memory DDOS?

Farid BENAMROUCHE
 

Hello,

I'm starting to have a better understanding of the iotivity-lite code.
What I've seen is that when my application (android) do a discovery request, a session is created.
In some embedded device, with not a lot of RAM, if it receives many requests before the idle timeout, it will go out of memory and crash.

I'm using OC_DYNAMIC, and found that the issue for me was in oc_tls.c allocation ssl contexts.

One solution that works for me was to change the OC_MEMB at the top of the file to OC_MEMB_FIXED and make sure that OC_MAX_TLS_PEERS is defined in oc_config.h

Is my understanding correct?

Thanks


Re: esp32 port of iotivity-lite: discovery memory issue

Clarke Stevens
 

Farid,

 

I don’t remember when I sent you the ESP32 instructions, but there were some issues that Jozef fixed with some patches. I’m enclosing the instructions that show how to install those patches. Also, we’re right in the middle of merging these changes into the main repo, so this will be a bit easier and cleaner shortly.

 

Thanks,

-Clarke

 

 

IoTivity-lite setup for esp32

  • cd ~
  • curl https://openconnectivity.github.io/IOTivity-Lite-setup/install.sh | bash
  • Use the following steps to get the esp32 branch until it is merged

 

Ubuntu

  • I’m not sure if you’ll need to do this, but I had to do it to get permission to use my serial port
    • sudo usermod -a -G tty <username> (then I had to logout and login)
    • sudo usermod -a -G dialout <username> (I’m not sure which of these will work or if you need both)
    • groups (to verify if you have been added to tty and/or dialout groups
  • sudo apt install -y git wget flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache libffi-dev libssl-dev libusb-1.0-0
  • cd ~/iot-lite/iotivity/port/esp32
  • git clone --recursive https://github.com/espressif/esp-idf.git
  • ./esp-idf/install.sh
  • . ./esp-idf/export.sh
  • jump to the common steps below

Windows (note that the windows steps are from Jozef and I have not tested them yet)

Common steps

  • idf.py set-target esp32
  • idf.py menuconfig // set wifi (This will bring up a GUI where you need to set SSID and SSID password under the IoTivity menu item. Exit and save.)
  • ( cd esp-idf/components/mbedtls/mbedtls && git am ../../../../patches/mbedtls/*.patch )
  • ( cd esp-idf && find ../patches/esp-idf/ -type f -name '*.patch' -exec patch -p1 -i {} \; )
  • ( cd esp-idf/components/lwip/lwip && find ../../../../patches/lwip/ -type f -name '*.patch' -exec patch -p1 -i {} \; )
  • idf.py build
  • idf.py erase_flash (optional if you want to erase flash on the esp32)
  • idf.py -p (PORT) flash monitor (on my machine, the PORT is /dev/ttyUSB0)
  • Note: If you are logging in to an account fresh and you’ve already done the above steps, it seem you need to do the following to compile and upload it successfully
    • cd ~/iot-lite/iotivity-lite/port/esp32
    • . ./esp-idf/export.sh
    • idf.py build
    • idf.py erase_flash (optional)
    • idf.py -p (port) flash monitor
      • Note: When in monitor mode, you can use Ctrl + ] to break out (like Ctrl + C)

Scripts and examples for using DeviceBuilder

  • cd ~
  • curl https://openconnectivity.github.io/Project-Scripts/install.sh | bash
  • curl https://raw.githubusercontent.com/openconnectivity/ESP32-Code/main/esp32/install.sh | bash
  • You can then use the following process to build an esp32 project. I usually create a ~/workspace directory and cd ~/workspace
    • create_project.sh esp32test
    • cd esp32test
    • cp ~/ESP32-Code/IotTivity-lite/esp32-example/setup .
    • ./setup
  • Once that is done, you can repeat the following commands to build the device
    • gen.sh (this will run DeviceBuilder to create the device described in the esp32test-config.json file)
    • build.sh (at least once after you login, you will need to do the following:)
      • cd ~/iot-lite/iotivity/port/esp32
      • . ./esp-idf/export.sh
    • reset.sh (to set to RFOTM)
    • run.sh (this will upload the code to the esp32 and start the monitor mode so you can get some feedback)
      • NOTE: You can use Ctrl + ] to exit the monitor (This will stop feedback from the esp32 and get you back to the command line.)

 

 

 

From: "iotivity-dev@iotivity.groups.io" <iotivity-dev@iotivity.groups.io> on behalf of "Farid BENAMROUCHE via groups.io" <fariouche@...>
Reply-To: "fariouche@..." <fariouche@...>
Date: Tuesday, December 8, 2020 at 5:21 AM
To: "iotivity-dev@iotivity.groups.io" <iotivity-dev@iotivity.groups.io>
Subject: Re: [dev] esp32 port of iotivity-lite: discovery memory issue

 

Hello,

By the way, I'm now using the esp32 port from "Clarke Stevens", and it is working, but still have the same issues.

By the way, I'm trying to use ipv6 only, with the android iotivity-lite sample application.
Discovery does not work, the sendmsg() function returns an error, errno 118.

This seems to be because the esp32 does not find any route src ipv6 address (I'm using the esp32 as an AP, so my android smartphone is connected directly to the esp32's wifi AP)
I've narrowed it down to udp_sendto_if_chksum() in lwip returning ERR_RTE because ip6_select_source_address() returns a NULL src_ip.
The comment is: No suitable source address was found.

Have you seen this issue?


Re: esp32 port of iotivity-lite: discovery memory issue

Farid BENAMROUCHE
 

Hello,

By the way, I'm now using the esp32 port from "Clarke Stevens", and it is working, but still have the same issues.

By the way, I'm trying to use ipv6 only, with the android iotivity-lite sample application.
Discovery does not work, the sendmsg() function returns an error, errno 118.

This seems to be because the esp32 does not find any route src ipv6 address (I'm using the esp32 as an AP, so my android smartphone is connected directly to the esp32's wifi AP)
I've narrowed it down to udp_sendto_if_chksum() in lwip returning ERR_RTE because ip6_select_source_address() returns a NULL src_ip.
The comment is: No suitable source address was found.

Have you seen this issue?


Re: esp32 port of iotivity-lite: discovery memory issue

Farid BENAMROUCHE
 

Hello,

Anyone knows how to solve the discovery memory issue?

Thank you
Regards,


Re: Question: Saving OBT tool state

Jozef Kralik
 

| I didn't see in the client cloud and server cloud example anything about sharing this csr. Maybe handled inside iotivity-lite and only the obt tool can retrieve it?
At first they don't share CSRs. Every device/OBT(onboarding tool) has its own private and public key and each of them sends CSR to the cloud.
So OBT retrieves the device resource /oic/sec/csr which returns CSR for the device and the CSR is sent to the cloud for sign.

| I didn't check the plgd.mobile app, but is it behaving as an onboarding tool too? So I believe that I must do the onboarding using this app instead of the onboarding tool from iotivity-lite (that is not cloud aware)?
Yes it is OBT. With OBT from iotivity-lite it is more complicated and it doesn't support flow as I described in previous email. If you want to try you need to use steps: https://github.com/plgd-dev/cloud/tree/master/bundle#secured-iotivity-lite-sample-device-example

| I've logged to the portal.try.plgd.cloud url you provided, and I see a "onboard" button. So this cloud server can also do the onboarding?
It just provides you authorization code for onboard the device to the cloud, which needs to be set during the cloud configuration resource update of the device (https://openconnectivity.org/specs/OCF_Device_To_Cloud_Services_Specification_v2.2.0.pdf). It doesn't onboard the device to the cloud.

Jozef


On Fri, 27 Nov 2020 at 20:52, Farid BENAMROUCHE via groups.io <fariouche=yahoo.fr@groups.io> wrote:
Thank you Jozef.
Not sure I understand clearly, so let me know if I understood:
I've looked at the github readme and this is what I understood.

Client and Server and Cloud are all sharing the same certificate (cloudca.pem), so Client and server can connect to Cloud.
OBT tool does not share this certificate, but as far as I understand, the obt will generate a private key (if none is provided) and use it to pair both Client and Server.

I didn't see in the client cloud and server cloud example anything about sharing this csr. Maybe handled inside iotivity-lite and only the obt tool can retrieve it?
I didn't check the plgd.mobile app, but is it behaving as an onboarding tool too? So I believe that I must do the onboarding using this app instead of the onboarding tool from iotivity-lite (that is not cloud aware)?

I've logged to the portal.try.plgd.cloud url you provided, and I see a "onboard" button. So this cloud server can also do the onboarding?


Sorry, so many questions :)

Thank you again!


Re: Question: Saving OBT tool state

Farid BENAMROUCHE
 

Thank you Jozef.
Not sure I understand clearly, so let me know if I understood:
I've looked at the github readme and this is what I understood.

Client and Server and Cloud are all sharing the same certificate (cloudca.pem), so Client and server can connect to Cloud.
OBT tool does not share this certificate, but as far as I understand, the obt will generate a private key (if none is provided) and use it to pair both Client and Server.

I didn't see in the client cloud and server cloud example anything about sharing this csr. Maybe handled inside iotivity-lite and only the obt tool can retrieve it?
I didn't check the plgd.mobile app, but is it behaving as an onboarding tool too? So I believe that I must do the onboarding using this app instead of the onboarding tool from iotivity-lite (that is not cloud aware)?

I've logged to the portal.try.plgd.cloud url you provided, and I see a "onboard" button. So this cloud server can also do the onboarding?


Sorry, so many questions :)

Thank you again!


Re: Question: Saving OBT tool state

Jozef Kralik
 

Hi Farid

So I can say how we solve it in plgd.cloud. We created application(https://github.com/plgd-dev/plgd.mobile) for android and iphone, which allows you to onboard the device to the cloud (https://portal.try.plgd.cloud/) or bundle (https://github.com/plgd-dev/cloud/tree/master/bundle) .
User just need to make to OAuth authentication and after that cloud provides identity certificate for the mobile application.
During onboarding the device via justworks, mobile application gets CSR from the device and forwards it to the cloud(bundle) for signing it.

So the user can login from any mobile device to get certificates for managing devices on his network because communication is established through certificates.

Jozef


On Fri, 27 Nov 2020 at 17:23, Farid BENAMROUCHE via groups.io <fariouche=yahoo.fr@groups.io> wrote:
Hi,

I can do an onboarding of my client (a smartphone) and server (an esp32 IOT device), and be able to use the cloud to access my server from anywhere.
If for some reason I loose my smartphone that was used for the onboarding, I have to redo the full onboarding again.
How can I avoid that? Using a new smartphone, install the OBT tools and restore the creds folder is enough? Or only part of it?
Does the ocf cloud have a mechanism for that?

Thank you!
Regards


Question: Saving OBT tool state

Farid BENAMROUCHE
 

Hi,

I can do an onboarding of my client (a smartphone) and server (an esp32 IOT device), and be able to use the cloud to access my server from anywhere.
If for some reason I loose my smartphone that was used for the onboarding, I have to redo the full onboarding again.
How can I avoid that? Using a new smartphone, install the OBT tools and restore the creds folder is enough? Or only part of it?
Does the ocf cloud have a mechanism for that?

Thank you!
Regards


delayed callbacks issue: missing signal_event_loop

Farid BENAMROUCHE
 

Hello,

I'm not sure if this is indeed a bug or if it's me that is not using the delayed callbacks properly... anyway, here is the issue I'm facing:
When I start iotivity-lite loop, I quickly enter the pthread_cond_wait() because next_event is zero. This is googd since I do not have any event, no network activity etc.

Now I start a delayed callback... I can see it being registered, but it's never firing.
The reason is that the loop is never run, because it is in the pthread_cond_wait() call.

I have the feeling that a call to _oc_signal_event_loop() is missing? (or maybe the intention was to let the user call it's signal_event_loop itself which is not very user friendly)


Thank you!


Re: esp32 port of iotivity-lite: discovery memory issue

Farid BENAMROUCHE
 

I think I understand what is happening:
When discovering a owned device, there is an UDP ssl session that is created to retrieve data (I'm doing an oc_get("/oic/d")).
And the only way to keep track of this connection is to have this idle timer to remove unused connections.

My problem remains the same: is it possible to limit the number of current sessions?


Re: esp32 port of iotivity-lite: discovery memory issue

Farid BENAMROUCHE
 

great, thanks.
My port is a bit simpler than yours (no ancillary data, no lwip patches, no ip reconfiguration if network is up/down)
I will give it a try.

But I believe that you will get the same issue as me. You have to exit the obt tool before retrying a new discover to generate a new request id.


Re: esp32 port of iotivity-lite: discovery memory issue

Clarke Stevens
 

Hello,

 

I’m Clarke Stevens and I run the developer Tools group in OCF. I don’t have the answer to your question at the moment, but there are others on this forum that can do that. What I want to tell you is that we a member company that has also recently done a port for ESP32 and they have both security and IPv6 working. I’m including those instructions below. It runs on the ESP32 using FreeRTOS.  They are also able to connect to an OCF cloud.

 

I have also been able to get OCF’s DeviceBuilder tool to work with this and automatically generate working code. All these instructions are included below.

 

I have successfully tested this with the Adafruit Huzzah32 and the Espressif Pico board. I am in the process of putting this example on the IoTivity web site, but it’s not up there yet.

 

Thanks,

-Clarke

 

IoTivity-lite setup for esp32

  • cd ~
  • curl https://openconnectivity.github.io/IOTivity-Lite-setup/install.sh | bash
  • Use the following steps to get the esp32 branch until it is merged

 

Ubuntu

  • I’m not sure if you’ll need to do this, but I had to do it to get permission to use my serial port
    • sudo usermod -a -G tty <username> (then I had to logout and login)
    • sudo usermod -a -G dialout <username> (I’m not sure which of these will work or if you need both)
    • groups (to verify if you have been added to tty and/or dialout groups
  • sudo apt install -y git wget flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache libffi-dev libssl-dev libusb-1.0-0
  • cd ~/iot-lite/iotivity/port/esp32
  • git clone --recursive https://github.com/espressif/esp-idf.git
  • ./esp-idf/install.sh
  • . ./esp-idf/export.sh
  • jump to the common steps below

Windows (note that the windows steps are from Jozef and I have not tested them yet)

Common steps

  • idf.py set-target esp32
  • idf.py menuconfig // set wifi (This will bring up a GUI where you need to set SSID and SSID password under the IoTivity menu item. Exit and save.)
  • ( cd esp-idf/components/mbedtls/mbedtls && git am ../../../../patches/mbedtls/*.patch )
  • ( cd esp-idf && find ../patches/esp-idf/ -type f -name '*.patch' -exec patch -p1 -i {} \; )
  • ( cd esp-idf/components/lwip/lwip && find ../../../../patches/lwip/ -type f -name '*.patch' -exec patch -p1 -i {} \; )
  • idf.py build
  • idf.py erase_flash (optional if you want to erase flash on the esp32)
  • idf.py -p (PORT) flash monitor (on my machine, the PORT is /dev/ttyUSB0)
  • Note: If you are logging in to an account fresh and you’ve already done the above steps, it seem you need to do the following to compile and upload it successfully
    • cd ~/iot-lite/iotivity-lite/port/esp32
    • . ./esp-idf/export.sh
    • idf.py build
    • idf.py erase_flash (optional)
    • idf.py -p (port) flash monitor
      • Note: When in monitor mode, you can use Ctrl + ] to break out (like Ctrl + C)

Scripts and examples for using DeviceBuilder

  • cd ~
  • curl https://openconnectivity.github.io/Project-Scripts/install.sh | bash
  • curl https://raw.githubusercontent.com/openconnectivity/ESP32-Code/main/esp32/install.sh | bash
  • You can then use the following process to build an esp32 project. I usually create a ~/workspace directory and cd ~/workspace
    • create_project.sh esp32test
    • cd esp32test
    • cp ~/ESP32-Code/IotTivity-lite/esp32-example/setup .
    • ./setup
  • Once that is done, you can repeat the following commands to build the device
    • gen.sh (this will run DeviceBuilder to create the device described in the esp32test-config.json file)
    • build.sh (at least once after you login, you will need to do the following:)
      • cd ~/iot-lite/iotivity/port/esp32
      • . ./esp-idf/export.sh
    • reset.sh (to set to RFOTM)
    • run.sh (this will upload the code to the esp32 and start the monitor mode so you can get some feedback)
      • NOTE: You can use Ctrl + ] to exit the monitor (This will stop feedback from the esp32 and get you back to the command line.)

 

 

 

From: "iotivity-dev@iotivity.groups.io" <iotivity-dev@iotivity.groups.io> on behalf of "Farid BENAMROUCHE via groups.io" <fariouche@...>
Reply-To: "fariouche@..." <fariouche@...>
Date: Wednesday, November 4, 2020 at 8:43 AM
To: "iotivity-dev@iotivity.groups.io" <iotivity-dev@iotivity.groups.io>
Subject: [dev] esp32 port of iotivity-lite: discovery memory issue

 

Hello,

I have a working port of iotivity-lite for the esp32 chip.
I would like to submit this port to the community, but before that I have 2 issues to fix. ipv6 is not working properly yet (esp32 stack issue) and one that is the reason of this post:

I'm very resources constrained, and mostly optimized everything now. However I've discovered that some memory are kept by iotivity-lite for 10min for each discovery requests...
The problem is that for each received discovery request, an ssl context is allocated and kept for 10min.
However, if it receives an other discvery request, an additionnal chunk (20KB!) of memory is allocated again for 10min.
So after 3 discovery requests, I'm out of memory...


Why is that mechanism in place? Is it possible to limit the number of pending discovery requests to 1 only? (clean the previous one before processing the new one?)

Isn't it an security issue on all platforms? (if a code sends enough discovery requests as fast as possible it can DDOS any iotivity-lite server)

Is my understanding correct?

Thank you!
Regards


esp32 port of iotivity-lite: discovery memory issue

Farid BENAMROUCHE
 

Hello,

I have a working port of iotivity-lite for the esp32 chip.
I would like to submit this port to the community, but before that I have 2 issues to fix. ipv6 is not working properly yet (esp32 stack issue) and one that is the reason of this post:

I'm very resources constrained, and mostly optimized everything now. However I've discovered that some memory are kept by iotivity-lite for 10min for each discovery requests...
The problem is that for each received discovery request, an ssl context is allocated and kept for 10min.
However, if it receives an other discvery request, an additionnal chunk (20KB!) of memory is allocated again for 10min.
So after 3 discovery requests, I'm out of memory...


Why is that mechanism in place? Is it possible to limit the number of pending discovery requests to 1 only? (clean the previous one before processing the new one?)

Isn't it an security issue on all platforms? (if a code sends enough discovery requests as fast as possible it can DDOS any iotivity-lite server)

Is my understanding correct?

Thank you!
Regards


Re: onboarding just works does not complete sometimes

Farid BENAMROUCHE
 

Hi,

SOrry for the loong delay, the covid disturbed me a lot, but I'm back on business.

I do not remember exactly why I had to create two devices, (at the begining I've created only one acting as both a client and a obt, but I've reached an limitation which I could not remember...)
Now I've moved on the esp32 for the server, no longer testing the linux version of the server....

For now, I will close this subject until I see it again.
Thank you for your help


How can I treat /oic/res?

김정진
 

Hi.

I'm preparing conformance test for server.
I'm working from iotivity-setup.
First it was iotivity-lite 2.0.5, and i checkout 2.2.0 now.

The server expose "oic.r.sdi", "oic.r.ael", "oic.wk.res" for /olc/res eventhough IDD cbor does not include these resource.
The PICS file created from cms webpage does not include "oic.r.sdi", "oic.r.ael", "oic.wk.res" and I can't find the way including them.

I think there are 2 ways:
1. Remove "oic.r.sdi", "oic.r.ael", "oic.wk.res" from /oic/res response.
2. Add "oic.r.sdi", "oic.r.ael", "oic.wk.res" into PICS file on cms webpage.

But I can't find the way.
I need your advice.

Thanks in advance.


Re: Control the device on cloud(go-ocf)

Jozef Kralik
 

Hi Alex
I'm not sure if this question belows to the iotivity-dev group. Pls create an issue for that https://github.com/plgd-dev/cloud/issues.

If you mean:

You need to put json to stdin and call it with args "deviceid", "href". eg:
echo '{ "state": true }' | grpc --update --deviceid <deviceid> --href /light/1

Regards
Jozef



On Thu, 24 Sep 2020 at 11:11, <alexlee2898@...> wrote:
Hi. 

I'm trying to control the sample devices on cloud(using grpc client).

Getting the status of the device was successful, but I don't know how to control it(ex, light turn on/off).

How can I control it?

Thank you for reading my question. 


Control the device on cloud(go-ocf)

alexlee2898@...
 

Hi. 

I'm trying to control the sample devices on cloud(using grpc client).

Getting the status of the device was successful, but I don't know how to control it(ex, light turn on/off).

How can I control it?

Thank you for reading my question. 


Need help with otgc build error

alexlee2898@...
 
Edited

Hello.
 
I have some problems while working on the iotivity sample. 
(working on Ubuntu 20.04)
 
1. Otgc build error due to JavaFX.
While following the 'getting started - device simulation' on iotivity.org, 
There is no problem when installing the server app part, 
but there is a problem when trying to install the device part.
 
I'm trying to build OTGC by running this command.
 
curl https://openconnectivity.github.io/otgc-linux/setup.sh | bash
 
but failed due to a problem with openjfx. 
 
+ sudo apt-get -y install openjfx=8u161-b12-1ubuntu2 --allow-downgrades
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '8u161-b12-1ubuntu2' for 'openjfx' was not found
+ sudo apt-get -y install libopenjfx-java=8u161-b12-1ubuntu2 --allow-downgrades
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '8u161-b12-1ubuntu2' for 'libopenjfx-java' was not found
+ sudo apt-get -y install libopenjfx-jni=8u161-b12-1ubuntu2 --allow-downgrades
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '8u161-b12-1ubuntu2' for 'libopenjfx-jni' was not found
 
So I installed openjfx. and after installing openfjx, i commented out the command to remove(and reinstall) openjfx from steup.sh.
Unfortunately, an error has occurred again.
 
 
2. I have installed iotivity-lite and want to use ocf-cloud but can't find it. 
Where can I find this?
 
Any hint will be appreciated. 
Thank you for reading my question.


Re: Receiving events through the OCF native cloud in the web application.

Ondrej Tomcik
 

Hello Soonun

 

Could you please tell me how and where did you install OCF Native Cloud?

Then I can help you further.

 

Best

 

Ondrej Tomcik :: KISTLER :: measure, analyze, innovate

 

 

Confidentiality Notice: This e-mail is privileged and confidential and for the use of the addressee only. Should you have received this e-mail in error please notify us by replying directly to the sender or by sending a message to info@.... Unauthorised dissemination, disclosure or copying of the contents of this e-mail, or any similar action, is prohibited.

From: iotivity-dev@iotivity.groups.io <iotivity-dev@iotivity.groups.io> On Behalf Of rockbach@...
Sent: piatok, 31. júla 2020 11:43
To: iotivity-dev@iotivity.groups.io
Subject: [dev] Receiving events through the OCF native cloud in the web application.

 

I would like to receive events from OCF devices by integrating the OCF native cloud on my web application.

I installed OCF native cloud, but I am wondering if there are any samples or guides on what to do afterwards.

Thank you for your help
Soonun Yoon.

1 - 20 of 10415