Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/wakaama/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PKG_NAME=wakaama
PKG_URL=https://github.com/eclipse/wakaama.git
PKG_VERSION=ee80c224622684ee47c17c57918904cffd00c4d2
PKG_VERSION=da74b3c91570b9716fbb424e90935806b2b29814
PKG_LICENSE=EDL-1.0,EPL-1.0

.PHONY: all
Expand All @@ -12,6 +12,9 @@ patch: git-download
mkdir -p "$(PKG_BUILDDIR)/riotbuild"
cp $(PKG_BUILDDIR)/core/*.c $(PKG_BUILDDIR)/core/*.h $(PKG_BUILDDIR)/riotbuild
cp $(PKG_BUILDDIR)/core/er-coap-13/*.c $(PKG_BUILDDIR)/core/er-coap-13/*.h $(PKG_BUILDDIR)/riotbuild
cp $(PKG_BUILDDIR)/examples/client/object_server.c $(PKG_BUILDDIR)/riotbuild
cp $(PKG_BUILDDIR)/examples/client/object_security.c $(PKG_BUILDDIR)/riotbuild
cp $(PKG_BUILDDIR)/examples/client/object_access_control.c $(PKG_BUILDDIR)/riotbuild

echo 'MODULE:=wakaama' > $(PKG_BUILDDIR)/riotbuild/Makefile
echo 'include $$(RIOTBASE)/Makefile.base' >> $(PKG_BUILDDIR)/riotbuild/Makefile
Expand Down
2 changes: 1 addition & 1 deletion pkg/wakaama/Makefile.include
Original file line number Diff line number Diff line change
@@ -1 +1 @@
INCLUDES += -I$(RIOTPKG)/wakaama/wakaama
INCLUDES += -I$(PKGDIRBASE)/wakaama/riotbuild
16 changes: 8 additions & 8 deletions pkg/wakaama/patches/0009-fixed-warnings-in-observe.c.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
From 9c30634e5458827e8e398ca56a4f5294a61b1b92 Mon Sep 17 00:00:00 2001
From 13db42af916c31f9b6407a4f6f8ff800f3ac769b Mon Sep 17 00:00:00 2001
From: Christian Manal <moenoel@informatik.uni-bremen.de>
Date: Wed, 29 Nov 2017 15:33:46 +0100
Subject: [PATCH 09/12] fixed warnings in observe.c
Date: Mon, 7 May 2018 18:26:08 +0200
Subject: [PATCH] fixed warnings in observe.c

---
core/observe.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/observe.c b/core/observe.c
index 711c1d1..87c42b9 100644
index 0f2f1dd..8858a68 100644
--- a/core/observe.c
+++ b/core/observe.c
@@ -163,6 +163,7 @@ uint8_t observe_handleRequest(lwm2m_context_t * contextP,
{
@@ -164,6 +164,7 @@ uint8_t observe_handleRequest(lwm2m_context_t * contextP,
lwm2m_observed_t * observedP;
lwm2m_watcher_t * watcherP;
uint32_t count;
+ (void)size;

LOG_ARG("Code: %02X, server status: %s", message->code, STR_STATUS(serverP->status));
LOG_URI(uriP);
@@ -649,7 +650,7 @@ void observe_step(lwm2m_context_t * contextP,
@@ -653,7 +654,7 @@ void observe_step(lwm2m_context_t * contextP,
{
LOG_ARG("Checking minimal period (%d s)", watcherP->parameters->minPeriod);

Expand All @@ -28,7 +28,7 @@ index 711c1d1..87c42b9 100644
{
// Minimum Period did not elapse yet
interval = watcherP->lastTime + watcherP->parameters->minPeriod - currentTime;
@@ -671,7 +672,7 @@ void observe_step(lwm2m_context_t * contextP,
@@ -675,7 +676,7 @@ void observe_step(lwm2m_context_t * contextP,
{
LOG_ARG("Checking maximal period (%d s)", watcherP->parameters->maxPeriod);

Expand Down
101 changes: 101 additions & 0 deletions pkg/wakaama/patches/0013-fixed-warnings-in-example-objects.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
From 2ab2f722a18025be55f12f482975b66548ce307b Mon Sep 17 00:00:00 2001
From: Christian Manal <moenoel@informatik.uni-bremen.de>
Date: Tue, 9 Jan 2018 10:27:14 +0100
Subject: [PATCH] fixed warnings in example objects

---
examples/client/object_access_control.c | 2 +-
examples/client/object_security.c | 16 ----------------
examples/client/object_server.c | 22 ++++++----------------
3 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/examples/client/object_access_control.c b/examples/client/object_access_control.c
index 053546d..4a02438 100644
--- a/examples/client/object_access_control.c
+++ b/examples/client/object_access_control.c
@@ -261,7 +261,7 @@ static uint8_t prv_write_resources(uint16_t instanceId, int numData,
acc_ctrl_ri_t* acValListSave = accCtrlOiP->accCtrlValList;
accCtrlOiP->accCtrlValList = NULL;

- int ri;
+ unsigned int ri;
lwm2m_data_t* subTlvArray = tlvArray[i].value.asChildren.array;

if (tlvArray[i].value.asChildren.count == 0)
diff --git a/examples/client/object_security.c b/examples/client/object_security.c
index 901f92e..bfb5f85 100644
--- a/examples/client/object_security.c
+++ b/examples/client/object_security.c
@@ -479,22 +479,6 @@ void copy_security_object(lwm2m_object_t * objectDest, lwm2m_object_t * objectSr
}
}

-void display_security_object(lwm2m_object_t * object)
-{
-#ifdef WITH_LOGS
- fprintf(stdout, " /%u: Security object, instances:\r\n", object->objID);
- security_instance_t * instance = (security_instance_t *)object->instanceList;
- while (instance != NULL)
- {
- fprintf(stdout, " /%u/%u: instanceId: %u, uri: %s, isBootstrap: %s, shortId: %u, clientHoldOffTime: %u\r\n",
- object->objID, instance->instanceId,
- instance->instanceId, instance->uri, instance->isBootstrap ? "true" : "false",
- instance->shortID, instance->clientHoldOffTime);
- instance = (security_instance_t *)instance->next;
- }
-#endif
-}
-
void clean_security_object(lwm2m_object_t * objectP)
{
while (objectP->instanceList != NULL)
diff --git a/examples/client/object_server.c b/examples/client/object_server.c
index 2f0531e..d762c9b 100644
--- a/examples/client/object_server.c
+++ b/examples/client/object_server.c
@@ -150,6 +150,9 @@ static uint8_t prv_server_discover(uint16_t instanceId,
uint8_t result;
int i;

+ (void)instanceId;
+ (void)objectP;
+
result = COAP_205_CONTENT;

// is the server asking for the full object ?
@@ -339,6 +342,9 @@ static uint8_t prv_server_execute(uint16_t instanceId,
{
server_instance_t * targetP;

+ (void)buffer;
+ (void)length;
+
targetP = (server_instance_t *)lwm2m_list_find(objectP->instanceList, instanceId);
if (NULL == targetP) return COAP_404_NOT_FOUND;

@@ -428,22 +434,6 @@ void copy_server_object(lwm2m_object_t * objectDest, lwm2m_object_t * objectSrc)
}
}

-void display_server_object(lwm2m_object_t * object)
-{
-#ifdef WITH_LOGS
- fprintf(stdout, " /%u: Server object, instances:\r\n", object->objID);
- server_instance_t * serverInstance = (server_instance_t *)object->instanceList;
- while (serverInstance != NULL)
- {
- fprintf(stdout, " /%u/%u: instanceId: %u, shortServerId: %u, lifetime: %u, storing: %s, binding: %s\r\n",
- object->objID, serverInstance->instanceId,
- serverInstance->instanceId, serverInstance->shortServerId, serverInstance->lifetime,
- serverInstance->storing ? "true" : "false", serverInstance->binding);
- serverInstance = (server_instance_t *)serverInstance->next;
- }
-#endif
-}
-
lwm2m_object_t * get_server_object(int serverId,
const char* binding,
int lifetime,
--
2.1.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 47d78e80ceb80a06e0cb9b0b7f7c959d04bd2c22 Mon Sep 17 00:00:00 2001
From: Christian Manal <moenoel@informatik.uni-bremen.de>
Date: Mon, 5 Feb 2018 15:52:10 +0100
Subject: [PATCH] Use lwm2m_strdup() instead of strdup()

---
examples/client/object_security.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/client/object_security.c b/examples/client/object_security.c
index bfb5f85..d91f6e5 100644
--- a/examples/client/object_security.c
+++ b/examples/client/object_security.c
@@ -540,7 +540,7 @@ lwm2m_object_t * get_security_object(int serverId,
targetP->securityMode = LWM2M_SECURITY_MODE_PRE_SHARED_KEY;
if (bsPskId)
{
- targetP->publicIdentity = strdup(bsPskId);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@moenoel do you remember what was the reason for using lwm2m_strdup instead of strdup?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One of the reasons was consistency, as Wakaama defines prototypes for a few functions that it expects the specific implementation to fill in (e.g. lwm2m_malloc() and lwm2m_free()) and it just seemed to make sense to use those wrappers throughout the Wakaama related code.

There was at least one other reason, but I can't for the life of me remember what that was specifically.

+ targetP->publicIdentity = lwm2m_strdup(bsPskId);
targetP->publicIdLen = strlen(bsPskId);
}
if (pskLen > 0)
--
2.1.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 5d0fd8783b734e8adeec3b9393e84dc8f4f7eb1e Mon Sep 17 00:00:00 2001
From: Christian Manal <moenoel@informatik.uni-bremen.de>
Date: Wed, 16 May 2018 11:30:02 +0200
Subject: [PATCH] fixed alignment problem in lwm2m_data_t

---
core/liblwm2m.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/liblwm2m.h b/core/liblwm2m.h
index 3f16a6d..53616bf 100644
--- a/core/liblwm2m.h
+++ b/core/liblwm2m.h
@@ -299,7 +299,6 @@ typedef struct _lwm2m_data_t lwm2m_data_t;

struct _lwm2m_data_t
{
- lwm2m_data_type_t type;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@moenoel is this safe? E.g wakaama code could eventually cast _lwm2m_data_t to lwm2m_data_type_t because address_of(_lwm2m_data_t) == addess_of(_lwm2m_data_t->type). With this change, address_of(_lwm2m_data_t) == address_of(_lwm2m_data_t->id).

Do you remember the reason behind this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not entirely sure if it's safe, though I didn't encounter any obvious problems running it. The reason for that change was to get rid of a memory alignment issue on the ARM boards we used.

IIRC lwm2m_data_type_t is an enum and apparently enums can have strange widths, so all the following struct members got misaligned, leading to hard faults. Making the enum member the last one fixed that for us.

uint16_t id;
union
{
@@ -322,6 +321,7 @@ struct _lwm2m_data_t
uint16_t objectInstanceId;
} asObjLink;
} value;
+ lwm2m_data_type_t type;
};

typedef enum
--
2.1.4

24 changes: 24 additions & 0 deletions pkg/wakaama/patches/0016-change-liblwm2m-include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From c3d723c0544b51dcea92453856447a4b9da6d288 Mon Sep 17 00:00:00 2001
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
Date: Mon, 4 Feb 2019 12:02:14 +0100
Subject: [PATCH] change liblwm2m.h include in er-coap-13.c

---
core/er-coap-13/er-coap-13.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/er-coap-13/er-coap-13.c b/core/er-coap-13/er-coap-13.c
index 7b9d43a..647bb88 100644
--- a/core/er-coap-13/er-coap-13.c
+++ b/core/er-coap-13/er-coap-13.c
@@ -46,7 +46,7 @@

#include "er-coap-13.h"

-#include "../liblwm2m.h" /* for lwm2m_malloc() and lwm2m_free() */
+#include "liblwm2m.h" /* for lwm2m_malloc() and lwm2m_free() */

#define DEBUG 0
#if DEBUG
--
2.17.1
24 changes: 24 additions & 0 deletions pkg/wakaama/patches/0017-fix-access-control-object-read.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From e3fcae282ad8c1788fd082dc5431cc71944e64da Mon Sep 17 00:00:00 2001
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
Date: Tue, 19 Feb 2019 17:36:50 +0100
Subject: [PATCH] fix access control object read

---
examples/client/object_access_control.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/client/object_access_control.c b/examples/client/object_access_control.c
index e2b1f77..149ec24 100644
--- a/examples/client/object_access_control.c
+++ b/examples/client/object_access_control.c
@@ -95,7 +95,7 @@ static uint8_t prv_set_tlv(lwm2m_data_t* dataP, acc_ctrl_oi_t* accCtrlOiP)
subTlvP[ri].id = accCtrlRiP->resInstId;
lwm2m_data_encode_int(accCtrlRiP->accCtrlValue, &subTlvP[ri]);
}
- lwm2m_data_encode_instances(subTlvP, 2, dataP);
+ lwm2m_data_encode_instances(subTlvP, ri, dataP);
return COAP_205_CONTENT;
}
} break;
--
2.17.1