author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
|---|---|---|---|---|---|---|---|---|---|
491,609
|
26.06.2017 10:24:17
| -7,200
|
be90bf1b89b3c989b66ba92445b1798bd5234dc9
|
Simplify option encoding.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -253,15 +253,8 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nmsg->payload[0] = COAP_PAYLOAD_MARKER;\n}\n- // fake run of opencoap_options_encode in order to get the necessary length\n- packetfunctions_reserveHeaderSize(msg, opencoap_options_encode(NULL,\n- coap_outgoingOptions,\n- coap_outgoingOptionsLen,\n- COAP_OPTION_CLASS_ALL,\n- TRUE));\n-\n// once header is reserved, encode the options to the openqueue payload buffer\n- opencoap_options_encode(msg->payload, coap_outgoingOptions, coap_outgoingOptionsLen, COAP_OPTION_CLASS_ALL, FALSE);\n+ opencoap_options_encode(msg, coap_outgoingOptions, coap_outgoingOptionsLen, COAP_OPTION_CLASS_ALL);\n//=== step 5. send that packet back\n@@ -509,19 +502,11 @@ owerror_t opencoap_send(\nclass = COAP_OPTION_CLASS_U;\n}\n- // fake run of opencoap_options_encode in order to get the necessary length\n- packetfunctions_reserveHeaderSize(msg, opencoap_options_encode(NULL,\n- options,\n- optionsLen,\n- class,\n- TRUE));\n-\n// once header is reserved, encode the options to the openqueue payload buffer\n- opencoap_options_encode(msg->payload,\n+ opencoap_options_encode(msg,\noptions,\noptionsLen,\n- class,\n- FALSE);\n+ class);\n// pre-pend CoAP header (version,type,TKL,code,messageID,Token)\npacketfunctions_reserveHeaderSize(msg,4+request->TKL);\n@@ -575,12 +560,11 @@ coap_option_class_t opencoap_get_option_class(coap_option_t type) {\n}\n//=========================== private =========================================\n-uint8_t opencoap_options_encode(\n- uint8_t* buffer,\n+owerror_t opencoap_options_encode(\n+ OpenQueueEntry_t* msg,\ncoap_option_iht* options,\nuint8_t optionsLen,\n- coap_option_class_t class,\n- bool fake\n+ coap_option_class_t class\n) {\nuint8_t i;\n@@ -606,7 +590,7 @@ uint8_t opencoap_options_encode(\n}\nif (options[i].type < lastOptionNum) {\n- return 0; // we require the options to be sorted\n+ return E_FAIL; // we require the options to be sorted\n}\ndelta = options[i].type - lastOptionNum;\n@@ -625,7 +609,7 @@ uint8_t opencoap_options_encode(\noptionDeltaExtLen = 2;\n}\nelse {\n- return 0;\n+ return E_FAIL;\n}\nif (options[i].length <= 12) {\n@@ -641,29 +625,23 @@ uint8_t opencoap_options_encode(\noptionLengthExtLen = 1;\n}\n- // write to buffer if fake is set to FALSE\n- // otherwise just return the necesasry length\n- if (fake == FALSE) {\n- buffer[index] = (optionDelta << 4) | optionLength;\n- }\n- index++;\n- if (fake == FALSE) {\n- memcpy(&buffer[index], optionDeltaExt, optionDeltaExtLen);\n- }\n- index += optionDeltaExtLen;\n- if (fake == FALSE) {\n- memcpy(&buffer[index], optionLengthExt, optionLengthExtLen);\n- }\n- index += optionLengthExtLen;\n- if (fake == FALSE) {\n- memcpy(&buffer[index], options[i].pValue, options[i].length);\n- }\n- index += options[i].length;\n+ // write to packet in reversed order\n+ packetfunctions_reserveHeaderSize(msg, options[i].length);\n+ memcpy(&msg->payload[0], options[i].pValue, options[i].length);\n+\n+ packetfunctions_reserveHeaderSize(msg, optionLengthExtLen);\n+ memcpy(&msg->payload[0], optionLengthExt, optionLengthExtLen);\n+\n+ packetfunctions_reserveHeaderSize(msg, optionDeltaExtLen);\n+ memcpy(&msg->payload[0], optionDeltaExt, optionDeltaExtLen);\n+\n+ packetfunctions_reserveHeaderSize(msg, 1);\n+ msg->payload[0] = (optionDelta << 4) | optionLength;\nlastOptionNum = options[i].type;\n}\n}\n- return index;\n+ return E_SUCCESS;\n}\nuint8_t opencoap_options_parse(\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.h",
"new_path": "openapps/opencoap/opencoap.h",
"diff": "@@ -188,11 +188,10 @@ owerror_t opencoap_send(\n// option handling\ncoap_option_class_t opencoap_get_option_class(coap_option_t type);\n-uint8_t opencoap_options_encode(uint8_t* buffer,\n+uint8_t opencoap_options_encode(OpenQueueEntry_t* msg,\ncoap_option_iht* options,\nuint8_t optionsLen,\n- coap_option_class_t class,\n- bool fake);\n+ coap_option_class_t class);\ncoap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, uint8_t arrayLen);\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "@@ -203,19 +203,11 @@ owerror_t openoscoap_protect_message(\npayloadPresent = FALSE;\n}\n- // fake run of opencoap_options_encode in order to get the necessary length\n- packetfunctions_reserveHeaderSize(msg, opencoap_options_encode(NULL,\n+ // encode the options to the openqueue payload buffer\n+ opencoap_options_encode(msg,\noptions,\noptionsLen,\n- COAP_OPTION_CLASS_E,\n- TRUE));\n-\n- // once header is reserved, encode the options to the openqueue payload buffer\n- opencoap_options_encode(msg->payload,\n- options,\n- optionsLen,\n- COAP_OPTION_CLASS_E,\n- FALSE);\n+ COAP_OPTION_CLASS_E);\npayload = &msg->payload[0];\npayloadLen = msg->length;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Simplify option encoding.
|
491,609
|
26.06.2017 10:35:28
| -7,200
|
7cceca7625d4973dfbcc842c470f9d0e9ac9da15
|
Move source code to reflect public-private organization.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -558,7 +558,6 @@ coap_option_class_t opencoap_get_option_class(coap_option_t type) {\nreturn COAP_OPTION_CLASS_U;\n}\n}\n-//=========================== private =========================================\nowerror_t opencoap_options_encode(\nOpenQueueEntry_t* msg,\n@@ -644,6 +643,23 @@ owerror_t opencoap_options_encode(\nreturn E_SUCCESS;\n}\n+coap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, uint8_t arrayLen) {\n+ uint8_t i;\n+\n+ if (array == NULL || arrayLen == 0) {\n+ return NULL;\n+ }\n+\n+ for (i = 0; i < arrayLen; i++) {\n+ if (array[i].type == COAP_OPTION_NUM_OBJECTSECURITY) {\n+ return &array[i];\n+ }\n+ }\n+ return NULL;\n+}\n+\n+//=========================== private =========================================\n+\nuint8_t opencoap_options_parse(\nOpenQueueEntry_t* msg,\ncoap_option_iht* options,\n@@ -722,19 +738,4 @@ uint8_t opencoap_options_parse(\nreturn index;\n}\n-coap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, uint8_t arrayLen) {\n- uint8_t i;\n-\n- if (array == NULL || arrayLen == 0) {\n- return NULL;\n- }\n-\n- for (i = 0; i < arrayLen; i++) {\n- if (array[i].type == COAP_OPTION_NUM_OBJECTSECURITY) {\n- return &array[i];\n- }\n- }\n- return NULL;\n-}\n-\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Move source code to reflect public-private organization.
|
491,609
|
26.06.2017 10:38:24
| -7,200
|
00c15b7cd1e215bfe6f518e78f27873a8666433b
|
Fix resetting of sequence number length.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "@@ -247,7 +247,7 @@ owerror_t openoscoap_protect_message(\nxor_arrays(nonce, partialIV, nonce, AES_CCM_16_64_128_IV_LEN);\n// do not encode sequence number and ID in the response\nrequestSeq = NULL;\n- requestSeq = 0;\n+ requestSeqLen = 0;\nrequestKid = NULL;\nrequestKidLen = 0;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Fix resetting of sequence number length.
|
491,609
|
26.06.2017 10:56:23
| -7,200
|
c579abf4ddbf2e58fd2527446621fd4b87975453
|
Remove remnant prototype.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -18,8 +18,6 @@ opencoap_vars_t opencoap_vars;\nuint8_t opencoap_options_parse(OpenQueueEntry_t* msg,\ncoap_option_iht* options,\nuint8_t optionsLen);\n-\n-coap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, uint8_t arrayLen);\n//=========================== public ==========================================\n//===== from stack\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Remove remnant prototype.
|
491,609
|
26.06.2017 14:35:11
| -7,200
|
ee58e7c13cf00731fba701de7e1053a89f37f0ed
|
ADd OSCOAP error codes to opendefs.
|
[
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "@@ -256,7 +256,9 @@ enum {\nERR_UNSUPPORTED_METADATA = 0x41, // the metadata type is not suppored\nERR_JOINED = 0x42, // node joined\nERR_SEQUENCE_NUMBER_OVERFLOW = 0x43, // OSCOAP sequence number reached maximum value\n- ERR_BUFFER_OVERFLOW = 0x44, // OSCOAP buffer overflow detected\n+ ERR_BUFFER_OVERFLOW = 0x44, // OSCOAP buffer overflow detected {code location {0}}\n+ ERR_REPLAY_FAILED = 0x45, // OSCOAP replay protection failed\n+ ERR_DECRYPTION_FAILED = 0x46, // OSCOAP decryption and tag verification failed\n};\n//=========================== typedef =========================================\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. ADd OSCOAP error codes to opendefs.
|
491,609
|
26.06.2017 14:36:48
| -7,200
|
1d5489664e4e3119cba156717b6e1df8122eb9b2
|
Towards OSCOAP verification of a response.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -17,7 +17,7 @@ opencoap_vars_t opencoap_vars;\n//=========================== prototype =======================================\nuint8_t opencoap_options_parse(OpenQueueEntry_t* msg,\ncoap_option_iht* options,\n- uint8_t optionsLen);\n+ uint8_t* optionsLen);\n//=========================== public ==========================================\n//===== from stack\n@@ -60,9 +60,13 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\ncoap_header_iht coap_header;\ncoap_option_iht coap_incomingOptions[MAX_COAP_OPTIONS];\ncoap_option_iht coap_outgoingOptions[MAX_COAP_OPTIONS];\n+ uint8_t coap_incomingOptionsLen;\nuint8_t coap_outgoingOptionsLen;\n+ owerror_t decStatus;\n- // init response options len\n+\n+ // init options len\n+ coap_incomingOptionsLen = MAX_COAP_OPTIONS;\ncoap_outgoingOptionsLen = 0;\n// take ownership over the received packet\n@@ -100,7 +104,7 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\npacketfunctions_tossHeader(msg,index);\n// parse options and toss header\n- index = opencoap_options_parse(msg, coap_incomingOptions, MAX_COAP_OPTIONS);\n+ index = opencoap_options_parse(msg, coap_incomingOptions, &coap_incomingOptionsLen);\n// toss options\npacketfunctions_tossHeader(msg,index);\n@@ -190,8 +194,23 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nfound=TRUE;\n}\n- // call the resource's callback\n+ // resource found, verify if it needs to be decrypted\nif (found==TRUE && temp_desc->callbackRx!=NULL) {\n+ if (temp_desc->securityContext != NULL) {\n+ decStatus = openoscoap_unprotect_message(temp_desc->securityContext,\n+ coap_header.Ver,\n+ coap_header.Code,\n+ coap_incomingOptions,\n+ coap_incomingOptionsLen,\n+ msg,\n+ temp_desc->last_request.oscoapSeqNum\n+ );\n+\n+ if (decStatus != E_SUCCESS) {\n+ return;\n+ }\n+ }\n+\ntemp_desc->callbackRx(msg,&coap_header,&coap_incomingOptions[0], NULL, NULL);\n}\n}\n@@ -661,7 +680,7 @@ coap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, ui\nuint8_t opencoap_options_parse(\nOpenQueueEntry_t* msg,\ncoap_option_iht* options,\n- uint8_t optionsLen\n+ uint8_t* optionsLen\n) {\nuint8_t index;\n@@ -669,16 +688,18 @@ uint8_t opencoap_options_parse(\ncoap_option_t lastOption;\ncoap_option_t optionDelta;\nuint8_t optionLength;\n+ uint8_t numOptions;\nindex = 0;\n+ numOptions = 0;\n// initialize the coap_incomingOptions\n- for (i=0;i<optionsLen;i++) {\n+ for (i=0;i<*optionsLen;i++) {\noptions[i].type = COAP_OPTION_NONE;\n}\nlastOption = COAP_OPTION_NONE;\n- for (i = 0; i < optionsLen; i++) {\n+ for (i = 0; i < *optionsLen; i++) {\n// detect when done parsing options\nif (msg->payload[index]==COAP_PAYLOAD_MARKER) {\n@@ -732,7 +753,9 @@ uint8_t opencoap_options_parse(\noptions[i].pValue = &(msg->payload[index]);\nindex += optionLength;\nlastOption = options[i].type;\n+ numOptions++;\n}\n+ *optionsLen = numOptions;\nreturn index;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "@@ -31,7 +31,7 @@ owerror_t hkdf_derive_parameter(uint8_t* buffer,\nbool is_request(uint8_t code);\n-uint8_t construct_aad(uint8_t* buffer,\n+uint8_t openoscoap_construct_aad(uint8_t* buffer,\nuint8_t version,\nuint8_t code,\nuint8_t* optionsSerialized,\n@@ -52,6 +52,9 @@ void xor_arrays(uint8_t* s1, uint8_t* s2, uint8_t* dst, uint8_t len);\nvoid flip_first_bit(uint8_t* source, uint8_t* dst, uint8_t len);\n+bool replay_window_check(oscoap_security_context_t *context, uint16_t sequenceNumber);\n+\n+uint8_t openoscoap_convert_sequence_number(uint16_t sequenceNumber, uint8_t** buffer);\n//=========================== public ==========================================\n@@ -181,15 +184,8 @@ owerror_t openoscoap_protect_message(\n// convert sequence number to array and strip leading zeros\nmemset(partialIV, 0x00, AES_CCM_16_64_128_IV_LEN);\n- packetfunctions_htons(sequenceNumber, &partialIV[AES_CCM_16_64_128_IV_LEN - 2]);\n- if (partialIV[AES_CCM_16_64_128_IV_LEN - 2] == 0x00) {\n- requestSeq = &partialIV[AES_CCM_16_64_128_IV_LEN - 1];\n- requestSeqLen = 1;\n- }\n- else {\nrequestSeq = &partialIV[AES_CCM_16_64_128_IV_LEN - 2];\n- requestSeqLen = 2;\n- }\n+ requestSeqLen = openoscoap_convert_sequence_number(sequenceNumber, &requestSeq);\nrequestKid = context->senderID;\nrequestKidLen = context->senderIDLen;\n@@ -217,7 +213,7 @@ owerror_t openoscoap_protect_message(\n// update payload pointer but leave length intact\npayload = &msg->payload[0];\n- aadLen = construct_aad(aad,\n+ aadLen = openoscoap_construct_aad(aad,\nversion,\ncode,\nNULL,\n@@ -286,6 +282,101 @@ owerror_t openoscoap_protect_message(\nreturn E_SUCCESS;\n}\n+owerror_t openoscoap_unprotect_message(\n+ oscoap_security_context_t *context,\n+ uint8_t version,\n+ uint8_t code,\n+ coap_option_iht* options,\n+ uint8_t optionsLen,\n+ OpenQueueEntry_t* msg,\n+ uint16_t sequenceNumber) {\n+\n+ uint8_t nonce[AES_CCM_16_64_128_IV_LEN];\n+ uint8_t partialIV[AES_CCM_16_64_128_IV_LEN];\n+ uint8_t* requestSeq;\n+ uint8_t requestSeqLen;\n+ uint8_t aad[AAD_MAX_LEN];\n+ uint8_t aadLen;\n+ coap_option_iht* objectSecurity;\n+ owerror_t decStatus;\n+ uint8_t ciphertextLen;\n+\n+ // find object security option in the list of passed options\n+ objectSecurity = opencoap_find_object_security_option(options, optionsLen);\n+ if (objectSecurity == NULL) { // return FAIL if object security option is not present\n+ return E_FAIL;\n+ }\n+\n+ if (is_request(code)) {\n+ if (replay_window_check(context, sequenceNumber) == FALSE) {\n+ openserial_printError(\n+ COMPONENT_OPENOSCOAP,ERR_REPLAY_FAILED,\n+ (errorparameter_t)0,\n+ (errorparameter_t)0\n+ );\n+ return E_FAIL;\n+ }\n+ }\n+\n+ // convert sequence number to array and strip leading zeros\n+ memset(partialIV, 0x00, AES_CCM_16_64_128_IV_LEN);\n+ requestSeq = &partialIV[AES_CCM_16_64_128_IV_LEN - 2];\n+ requestSeqLen = openoscoap_convert_sequence_number(sequenceNumber, &requestSeq);\n+\n+ aadLen = openoscoap_construct_aad(aad,\n+ version,\n+ code,\n+ NULL,\n+ 0, // do not support Class I options at the moment\n+ AES_CCM_16_64_128,\n+ context->recipientID,\n+ context->recipientIDLen,\n+ requestSeq,\n+ requestSeqLen);\n+\n+ if (aadLen > AAD_MAX_LEN) {\n+ // corruption\n+ openserial_printError(\n+ COMPONENT_OPENOSCOAP,ERR_BUFFER_OVERFLOW,\n+ (errorparameter_t)0,\n+ (errorparameter_t)0\n+ );\n+ return E_FAIL;\n+ }\n+\n+ // construct nonce\n+ if (is_request(code)) {\n+ xor_arrays(context->recipientIV, partialIV, nonce, AES_CCM_16_64_128_IV_LEN);\n+ }\n+ else {\n+ flip_first_bit(context->recipientIV, nonce, AES_CCM_16_64_128_IV_LEN);\n+ xor_arrays(nonce, partialIV, nonce, AES_CCM_16_64_128_IV_LEN);\n+ }\n+\n+ ciphertextLen = msg->length;\n+ decStatus = cryptoengine_aes_ccms_dec(aad,\n+ aadLen,\n+ &msg->payload[0], //FIXME\n+ &ciphertextLen, // FIXME\n+ nonce,\n+ 2,\n+ context->recipientKey,\n+ AES_CCM_16_64_128_TAG_LEN);\n+\n+ if (decStatus != E_SUCCESS) {\n+ openserial_printError(\n+ COMPONENT_OPENOSCOAP,ERR_DECRYPTION_FAILED,\n+ (errorparameter_t)0,\n+ (errorparameter_t)0\n+ );\n+ return E_FAIL;\n+ }\n+\n+ packetfunctions_tossFooter(msg, AES_CCM_16_64_128_TAG_LEN);\n+\n+ return E_SUCCESS;\n+}\n+\nuint16_t openoscoap_get_sequence_number(oscoap_security_context_t *context) {\nif (context->sequenceNumber == 0xffff) {\nopenserial_printError(\n@@ -360,7 +451,7 @@ bool is_request(uint8_t code) {\n}\n}\n-uint8_t construct_aad(uint8_t* buffer,\n+uint8_t openoscoap_construct_aad(uint8_t* buffer,\nuint8_t version,\nuint8_t code,\nuint8_t* optionsSerialized,\n@@ -452,3 +543,18 @@ void flip_first_bit(uint8_t* source, uint8_t* dst, uint8_t len){\nmemcpy(dst, source, len);\ndst[0] = dst[0] ^ 0x80;\n}\n+\n+bool replay_window_check(oscoap_security_context_t *context, uint16_t sequenceNumber) {\n+ return TRUE;\n+}\n+\n+uint8_t openoscoap_convert_sequence_number(uint16_t sequenceNumber, uint8_t** buffer) {\n+ packetfunctions_htons(sequenceNumber, *buffer);\n+ if (**buffer == 0x00) {\n+ (*buffer)++;\n+ return 1;\n+ }\n+ else {\n+ return 2;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.h",
"new_path": "openapps/opencoap/openoscoap.h",
"diff": "@@ -81,7 +81,14 @@ owerror_t openoscoap_protect_message(\nOpenQueueEntry_t* msg,\nuint16_t sequenceNumber);\n-\n+owerror_t openoscoap_unprotect_message(\n+ oscoap_security_context_t *context,\n+ uint8_t version,\n+ uint8_t code,\n+ coap_option_iht* options,\n+ uint8_t optionsLen,\n+ OpenQueueEntry_t* msg,\n+ uint16_t sequenceNumber);\nuint16_t openoscoap_get_sequence_number(oscoap_security_context_t *context);\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -712,8 +712,10 @@ functionsToChange = [\n'openoscoap_find_object_security_option',\n'openoscoap_get_sequence_number',\n'openoscoap_protect_message',\n+ 'openoscoap_unprotect_message',\n'openoscoap_encode_compressed_COSE',\n- 'construct_aad',\n+ 'openoscoap_convert_sequence_number',\n+ 'openoscoap_construct_aad',\n# openudp\n'openudp_init',\n'openudp_send',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Towards OSCOAP verification of a response.
|
491,609
|
26.06.2017 15:32:27
| -7,200
|
ce241b19603d8376ec974b8e15f7e75d49d5f58d
|
Handle zero-length options during parsing.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -696,6 +696,8 @@ uint8_t opencoap_options_parse(\n// initialize the coap_incomingOptions\nfor (i=0;i<*optionsLen;i++) {\noptions[i].type = COAP_OPTION_NONE;\n+ options[i].length = 0;\n+ options[i].pValue = NULL;\n}\nlastOption = COAP_OPTION_NONE;\n@@ -750,7 +752,9 @@ uint8_t opencoap_options_parse(\n// create new option\noptions[i].type = lastOption + optionDelta;\noptions[i].length = optionLength;\n+ if (optionLength) {\noptions[i].pValue = &(msg->payload[index]);\n+ }\nindex += optionLength;\nlastOption = options[i].type;\nnumOptions++;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Handle zero-length options during parsing.
|
491,609
|
26.06.2017 17:26:09
| -7,200
|
bacb6f10837bb93a2770121eed4ce3a8d6af2966
|
Implement compressed COSE decoding.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -63,7 +63,10 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nuint8_t coap_incomingOptionsLen;\nuint8_t coap_outgoingOptionsLen;\nowerror_t decStatus;\n-\n+ coap_option_iht* objectSecurity;\n+ uint16_t rcvdSequenceNumber;\n+ uint8_t* rcvdKid;\n+ uint8_t rcvdKidLen;\n// init options len\ncoap_incomingOptionsLen = MAX_COAP_OPTIONS;\n@@ -109,6 +112,43 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\n// toss options\npacketfunctions_tossHeader(msg,index);\n+ // process handled options\n+\n+ //== Object Security Option\n+ objectSecurity = opencoap_find_object_security_option(coap_incomingOptions, coap_incomingOptionsLen);\n+ if (objectSecurity) {\n+ if ((objectSecurity->length == 0 && msg->length == 0) ||\n+ (objectSecurity->length != 0 && msg->length != 0)) {\n+ // malformated object security message\n+ return;\n+ }\n+\n+ if (objectSecurity->length == 0) {\n+ index = openoscoap_parse_compressed_COSE(&msg->payload[0],\n+ msg->length,\n+ &rcvdSequenceNumber,\n+ &rcvdKid,\n+ &rcvdKidLen);\n+ if (index == 0) {\n+ return;\n+ }\n+ packetfunctions_tossHeader(msg, index);\n+ }\n+ else {\n+ index = openoscoap_parse_compressed_COSE(objectSecurity->pValue,\n+ objectSecurity->length,\n+ &rcvdSequenceNumber,\n+ &rcvdKid,\n+ &rcvdKidLen);\n+\n+ if (index == 0) {\n+ return;\n+ }\n+ objectSecurity->length -= index;\n+ objectSecurity->pValue += index;\n+ }\n+ }\n+\n//=== step 2. find the resource to handle the packet\n// find the resource this applies to\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "@@ -299,7 +299,9 @@ owerror_t openoscoap_unprotect_message(\nuint8_t aadLen;\ncoap_option_iht* objectSecurity;\nowerror_t decStatus;\n+ uint8_t* ciphertext;\nuint8_t ciphertextLen;\n+ bool tossFooter;\n// find object security option in the list of passed options\nobjectSecurity = opencoap_find_object_security_option(options, optionsLen);\n@@ -307,6 +309,15 @@ owerror_t openoscoap_unprotect_message(\nreturn E_FAIL;\n}\n+ if (objectSecurity->length != 0) {\n+ ciphertext = objectSecurity->pValue;\n+ tossFooter = FALSE;\n+ }\n+ else {\n+ ciphertext = &msg->payload[0];\n+ tossFooter = TRUE;\n+ }\n+\nif (is_request(code)) {\nif (replay_window_check(context, sequenceNumber) == FALSE) {\nopenserial_printError(\n@@ -356,8 +367,8 @@ owerror_t openoscoap_unprotect_message(\nciphertextLen = msg->length;\ndecStatus = cryptoengine_aes_ccms_dec(aad,\naadLen,\n- &msg->payload[0], //FIXME\n- &ciphertextLen, // FIXME\n+ ciphertext,\n+ &ciphertextLen,\nnonce,\n2,\ncontext->recipientKey,\n@@ -372,7 +383,9 @@ owerror_t openoscoap_unprotect_message(\nreturn E_FAIL;\n}\n+ if (tossFooter) {\npacketfunctions_tossFooter(msg, AES_CCM_16_64_128_TAG_LEN);\n+ }\nreturn E_SUCCESS;\n}\n@@ -390,6 +403,54 @@ uint16_t openoscoap_get_sequence_number(oscoap_security_context_t *context) {\nreturn context->sequenceNumber;\n}\n+uint8_t openoscoap_parse_compressed_COSE(uint8_t *buffer,\n+ uint8_t bufferLen,\n+ uint16_t* sequenceNumber,\n+ uint8_t** kid,\n+ uint8_t* kidLen\n+ ) {\n+ uint8_t index;\n+ uint8_t pivsz;\n+ uint8_t k;\n+ uint8_t reserved;\n+\n+ index = 0;\n+ pivsz = (buffer[index] >> 0) & 0x07;\n+ k = (buffer[index] >> 3) & 0x01;\n+ reserved = (buffer[index] >> 4) & 0x0f;\n+\n+ if (reserved) {\n+ return 0;\n+ }\n+\n+ index++;\n+\n+ if (pivsz > 2) {\n+ return 0;\n+ }\n+ else if (pivsz == 1) {\n+ *sequenceNumber = buffer[index];\n+ index++;\n+ }\n+ else if (pivsz == 2) {\n+ *sequenceNumber = packetfunctions_ntohs(&buffer[index]);\n+ index += 2;\n+ }\n+\n+ if (k) {\n+ *kidLen = buffer[index];\n+ index++;\n+ *kid = &buffer[index];\n+ index += *kidLen;\n+ }\n+\n+ if (index > bufferLen) {\n+ return 0;\n+ }\n+\n+ return index;\n+}\n+\n//=========================== private =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.h",
"new_path": "openapps/opencoap/openoscoap.h",
"diff": "@@ -92,6 +92,11 @@ owerror_t openoscoap_unprotect_message(\nuint16_t openoscoap_get_sequence_number(oscoap_security_context_t *context);\n+uint8_t openoscoap_parse_compressed_COSE(uint8_t *buffer,\n+ uint8_t bufferLen,\n+ uint16_t* sequenceNumber,\n+ uint8_t** kid,\n+ uint8_t* kidLen);\n/**\n\\}\n\\}\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -714,6 +714,7 @@ functionsToChange = [\n'openoscoap_protect_message',\n'openoscoap_unprotect_message',\n'openoscoap_encode_compressed_COSE',\n+ 'openoscoap_parse_compressed_COSE',\n'openoscoap_convert_sequence_number',\n'openoscoap_construct_aad',\n# openudp\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Implement compressed COSE decoding.
|
491,609
|
26.06.2017 17:59:21
| -7,200
|
ef298fa8d54a5155176257a72c289c3adafc926c
|
Export parse options function.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "opencoap_vars_t opencoap_vars;\n//=========================== prototype =======================================\n-uint8_t opencoap_options_parse(OpenQueueEntry_t* msg,\n- coap_option_iht* options,\n- uint8_t* optionsLen);\n//=========================== public ==========================================\n//===== from stack\n@@ -107,7 +104,7 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\npacketfunctions_tossHeader(msg,index);\n// parse options and toss header\n- index = opencoap_options_parse(msg, coap_incomingOptions, &coap_incomingOptionsLen);\n+ index = opencoap_options_parse(&msg->payload[0], msg->length, coap_incomingOptions, &coap_incomingOptionsLen);\n// toss options\npacketfunctions_tossHeader(msg,index);\n@@ -237,11 +234,12 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\n// resource found, verify if it needs to be decrypted\nif (found==TRUE && temp_desc->callbackRx!=NULL) {\nif (temp_desc->securityContext != NULL) {\n+ coap_incomingOptionsLen = MAX_COAP_OPTIONS;\ndecStatus = openoscoap_unprotect_message(temp_desc->securityContext,\ncoap_header.Ver,\ncoap_header.Code,\ncoap_incomingOptions,\n- coap_incomingOptionsLen,\n+ &coap_incomingOptionsLen,\nmsg,\ntemp_desc->last_request.oscoapSeqNum\n);\n@@ -718,7 +716,8 @@ coap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, ui\n//=========================== private =========================================\nuint8_t opencoap_options_parse(\n- OpenQueueEntry_t* msg,\n+ uint8_t* buffer,\n+ uint8_t bufferLen,\ncoap_option_iht* options,\nuint8_t* optionsLen\n) {\n@@ -744,29 +743,29 @@ uint8_t opencoap_options_parse(\nfor (i = 0; i < *optionsLen; i++) {\n// detect when done parsing options\n- if (msg->payload[index]==COAP_PAYLOAD_MARKER) {\n+ if (buffer[index]==COAP_PAYLOAD_MARKER) {\n// found the payload marker, done parsing options.\nindex++; // skip marker and stop parsing options\nbreak;\n}\n- if (msg->length<=index) {\n+ if (bufferLen<=index) {\n// end of message, no payload\nbreak;\n}\n- optionDelta = ((msg->payload[index] & 0xf0) >> 4);\n- optionLength = (msg->payload[index] & 0x0f);\n+ optionDelta = ((buffer[index] & 0xf0) >> 4);\n+ optionLength = (buffer[index] & 0x0f);\nindex++;\nif (optionDelta <= 12) {\n}\nelse if (optionDelta == 13) {\n- optionDelta = msg->payload[index] + 13;\n+ optionDelta = buffer[index] + 13;\nindex++;\n}\nelse if (optionDelta == 14) {\n- optionDelta = (coap_option_t) (packetfunctions_ntohs(&msg->payload[index]) + 269);\n+ optionDelta = (coap_option_t) (packetfunctions_ntohs(&buffer[index]) + 269);\nindex += 2;\n}\nelse {\n@@ -777,7 +776,7 @@ uint8_t opencoap_options_parse(\n}\nelse if (optionLength == 13) {\n- optionLength = msg->payload[index] + 13;\n+ optionLength = buffer[index] + 13;\nindex++;\n}\nelse {\n@@ -785,7 +784,7 @@ uint8_t opencoap_options_parse(\nbreak;\n}\n- if (msg->length <= index) {\n+ if (bufferLen <= index) {\nbreak;\n}\n@@ -793,7 +792,7 @@ uint8_t opencoap_options_parse(\noptions[i].type = lastOption + optionDelta;\noptions[i].length = optionLength;\nif (optionLength) {\n- options[i].pValue = &(msg->payload[index]);\n+ options[i].pValue = &(buffer[index]);\n}\nindex += optionLength;\nlastOption = options[i].type;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.h",
"new_path": "openapps/opencoap/opencoap.h",
"diff": "@@ -192,6 +192,10 @@ uint8_t opencoap_options_encode(OpenQueueEntry_t* msg,\ncoap_option_iht* options,\nuint8_t optionsLen,\ncoap_option_class_t class);\n+uint8_t opencoap_options_parse(uint8_t* buffer,\n+ uint8_t bufferLen,\n+ coap_option_iht* options,\n+ uint8_t* optionsLen);\ncoap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, uint8_t arrayLen);\n/**\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Export parse options function.
|
491,609
|
26.06.2017 18:00:19
| -7,200
|
80c03c0c60388d3fc1762b7e611486947dba0d79
|
Decode options after decrypting.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "@@ -287,7 +287,7 @@ owerror_t openoscoap_unprotect_message(\nuint8_t version,\nuint8_t code,\ncoap_option_iht* options,\n- uint8_t optionsLen,\n+ uint8_t* optionsLen,\nOpenQueueEntry_t* msg,\nuint16_t sequenceNumber) {\n@@ -301,21 +301,22 @@ owerror_t openoscoap_unprotect_message(\nowerror_t decStatus;\nuint8_t* ciphertext;\nuint8_t ciphertextLen;\n- bool tossFooter;\n+ bool payloadInObjSec;\n+ uint8_t index;\n// find object security option in the list of passed options\n- objectSecurity = opencoap_find_object_security_option(options, optionsLen);\n+ objectSecurity = opencoap_find_object_security_option(options, *optionsLen);\nif (objectSecurity == NULL) { // return FAIL if object security option is not present\nreturn E_FAIL;\n}\nif (objectSecurity->length != 0) {\nciphertext = objectSecurity->pValue;\n- tossFooter = FALSE;\n+ payloadInObjSec = TRUE;\n}\nelse {\nciphertext = &msg->payload[0];\n- tossFooter = TRUE;\n+ payloadInObjSec = FALSE;\n}\nif (is_request(code)) {\n@@ -383,8 +384,13 @@ owerror_t openoscoap_unprotect_message(\nreturn E_FAIL;\n}\n- if (tossFooter) {\n+ if (payloadInObjSec) {\n+ opencoap_options_parse(objectSecurity->pValue, objectSecurity->length, options, optionsLen);\n+ }\n+ else {\npacketfunctions_tossFooter(msg, AES_CCM_16_64_128_TAG_LEN);\n+ index = opencoap_options_parse(&msg->payload[0], msg->length, options, optionsLen);\n+ packetfunctions_tossHeader(msg, index);\n}\nreturn E_SUCCESS;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.h",
"new_path": "openapps/opencoap/openoscoap.h",
"diff": "@@ -86,7 +86,7 @@ owerror_t openoscoap_unprotect_message(\nuint8_t version,\nuint8_t code,\ncoap_option_iht* options,\n- uint8_t optionsLen,\n+ uint8_t* optionsLen,\nOpenQueueEntry_t* msg,\nuint16_t sequenceNumber);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Decode options after decrypting.
|
491,609
|
27.06.2017 14:42:34
| -7,200
|
ad0c016bef7e434964cf1d211a7797fb1a658919
|
Fix broken CoAP option encoding.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -622,6 +622,7 @@ owerror_t opencoap_options_encode(\n) {\nuint8_t i;\n+ uint8_t ii;\nuint32_t delta;\nuint8_t optionDelta;\nuint8_t optionDeltaExt[2];\n@@ -629,24 +630,34 @@ owerror_t opencoap_options_encode(\nuint8_t optionLength;\nuint8_t optionLengthExt[2];\nuint8_t optionLengthExtLen;\n- uint8_t index;\n- coap_option_t lastOptionNum;\n+ coap_option_t previousOptionNum;\n- // encode options\n- i = 0;\n- index = 0;\n- lastOptionNum = COAP_OPTION_NONE;\n- if (options != NULL) {\n- for (i = 0; i < optionsLen; i++) {\n+ // encode options in reversed order\n+ if (options != NULL && optionsLen != 0) {\n+ for (i = optionsLen ; i-- > 0 ; ) {\n+ // skip option if inappropriate class\nif (class != opencoap_get_option_class(options[i].type) &&\nclass != COAP_OPTION_CLASS_ALL) {\ncontinue;\n}\n- if (options[i].type < lastOptionNum) {\n+ // loop to find the previous option to which delta should be calculated\n+ previousOptionNum = COAP_OPTION_NONE;\n+ for (ii = i ; ii-- > 0 ; ) {\n+ if (class != opencoap_get_option_class(options[ii].type) &&\n+ class != COAP_OPTION_CLASS_ALL) {\n+ continue;\n+ }\n+ else {\n+ previousOptionNum = options[ii].type;\n+ break;\n+ }\n+ }\n+\n+ if (previousOptionNum > options[i].type) {\nreturn E_FAIL; // we require the options to be sorted\n}\n- delta = options[i].type - lastOptionNum;\n+ delta = options[i].type - previousOptionNum;\nif (delta <= 12) {\noptionDelta = (uint8_t) delta;\n@@ -691,8 +702,6 @@ owerror_t opencoap_options_encode(\npacketfunctions_reserveHeaderSize(msg, 1);\nmsg->payload[0] = (optionDelta << 4) | optionLength;\n-\n- lastOptionNum = options[i].type;\n}\n}\nreturn E_SUCCESS;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Fix broken CoAP option encoding.
|
491,609
|
27.06.2017 18:37:08
| -7,200
|
fefd06c5d702cb9d99d7f9675096f83ff93367f9
|
Bug fix for verifying responses.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "#include \"opendefs.h\"\n#include \"openserial.h\"\n#include \"packetfunctions.h\"\n-#include \"opencoap.h\"\n+#include \"openoscoap.h\"\n#include \"cborencoder.h\"\n#include \"cryptoengine.h\"\n#include \"sha.h\"\n@@ -312,10 +312,12 @@ owerror_t openoscoap_unprotect_message(\nif (objectSecurity->length != 0) {\nciphertext = objectSecurity->pValue;\n+ ciphertextLen = objectSecurity->length;\npayloadInObjSec = TRUE;\n}\nelse {\nciphertext = &msg->payload[0];\n+ ciphertextLen = msg->length;\npayloadInObjSec = FALSE;\n}\n@@ -365,7 +367,6 @@ owerror_t openoscoap_unprotect_message(\nxor_arrays(nonce, partialIV, nonce, AES_CCM_16_64_128_IV_LEN);\n}\n- ciphertextLen = msg->length;\ndecStatus = cryptoengine_aes_ccms_dec(aad,\naadLen,\nciphertext,\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Bug fix for verifying responses.
|
491,609
|
27.06.2017 18:38:07
| -7,200
|
1ebbfdec148fb6cf1d6ee9c8e10aa9e9eebe00bf
|
Move some defines to opencoap to avoid circular dependency.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.h",
"new_path": "openapps/opencoap/opencoap.h",
"diff": "@@ -38,6 +38,22 @@ static const uint8_t ipAddr_ringmaster[] = {0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00,\n#define COAP_VERSION 1\n+// OSCOAP related defines\n+\n+#define OSCOAP_MAX_ID_LEN 10\n+\n+#define OSCOAP_MASTER_SECRET_LEN 16\n+\n+#define OSCOAP_MAX_MASTER_SALT_LEN 0\n+\n+#define AES_CCM_16_64_128 10 // algorithm value as defined in COSE spec\n+\n+#define AES_CCM_16_64_128_KEY_LEN 16\n+\n+#define AES_CCM_16_64_128_IV_LEN 13\n+\n+#define AES_CCM_16_64_128_TAG_LEN 8\n+\ntypedef enum {\nCOAP_TYPE_CON = 0,\nCOAP_TYPE_NON = 1,\n@@ -132,6 +148,28 @@ typedef struct {\nuint8_t* pValue;\n} coap_option_iht;\n+typedef struct {\n+ uint32_t bitArray;\n+ uint16_t base;\n+} replay_window_t;\n+\n+typedef struct {\n+ // common context\n+ uint8_t aeadAlgorithm;\n+ // sender context\n+ uint8_t senderID[OSCOAP_MAX_ID_LEN];\n+ uint8_t senderIDLen;\n+ uint8_t senderKey[AES_CCM_16_64_128_KEY_LEN];\n+ uint8_t senderIV[AES_CCM_16_64_128_IV_LEN];\n+ uint16_t sequenceNumber;\n+ // recipient context\n+ uint8_t recipientID[OSCOAP_MAX_ID_LEN];\n+ uint8_t recipientIDLen;\n+ uint8_t recipientKey[AES_CCM_16_64_128_KEY_LEN];\n+ uint8_t recipientIV[AES_CCM_16_64_128_IV_LEN];\n+ replay_window_t window;\n+} oscoap_security_context_t;\n+\ntypedef owerror_t (*callbackRx_cbt)(OpenQueueEntry_t* msg,\ncoap_header_iht* coap_header,\ncoap_option_iht* coap_incomingOptions,\n@@ -148,7 +186,7 @@ struct coap_resource_desc_t {\nuint8_t path1len;\nuint8_t* path1val;\nuint8_t componentID;\n- void* securityContext;\n+ oscoap_security_context_t* securityContext;\nbool discoverable;\ncallbackRx_cbt callbackRx;\ncallbackSendDone_cbt callbackSendDone;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.h",
"new_path": "openapps/opencoap/openoscoap.h",
"diff": "//=========================== define ==========================================\n-#define OSCOAP_MAX_ID_LEN 10\n-\n-#define OSCOAP_MASTER_SECRET_LEN 16\n-\n-#define OSCOAP_MAX_MASTER_SALT_LEN 0\n-\n-#define AES_CCM_16_64_128 10 // algorithm value as defined in COSE spec\n-\n-#define AES_CCM_16_64_128_KEY_LEN 16\n-\n-#define AES_CCM_16_64_128_IV_LEN 13\n-\n-#define AES_CCM_16_64_128_TAG_LEN 8\n-\n//=========================== typedef =========================================\ntypedef enum {\nOSCOAP_DERIVATION_TYPE_KEY = 0,\nOSCOAP_DERIVATION_TYPE_IV = 1,\n} oscoap_derivation_t;\n-typedef struct {\n- uint32_t bitArray;\n- uint16_t base;\n-} replay_window_t;\n-\n-typedef struct {\n- // common context\n- uint8_t aeadAlgorithm;\n- // sender context\n- uint8_t senderID[OSCOAP_MAX_ID_LEN];\n- uint8_t senderIDLen;\n- uint8_t senderKey[AES_CCM_16_64_128_KEY_LEN];\n- uint8_t senderIV[AES_CCM_16_64_128_IV_LEN];\n- uint16_t sequenceNumber;\n- // recipient context\n- uint8_t recipientID[OSCOAP_MAX_ID_LEN];\n- uint8_t recipientIDLen;\n- uint8_t recipientKey[AES_CCM_16_64_128_KEY_LEN];\n- uint8_t recipientIV[AES_CCM_16_64_128_IV_LEN];\n- replay_window_t window;\n-} oscoap_security_context_t;\n-\n-\n//=========================== module variables ================================\ntypedef struct {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Move some defines to opencoap to avoid circular dependency.
|
491,609
|
27.06.2017 18:39:38
| -7,200
|
1ce464da9d9f3b99a810c0e874ea58dd465e30fd
|
Towards verification of requests.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "#include \"opendefs.h\"\n#include \"opencoap.h\"\n+#include \"openoscoap.h\"\n#include \"openqueue.h\"\n#include \"openserial.h\"\n#include \"openrandom.h\"\n@@ -64,11 +65,16 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nuint16_t rcvdSequenceNumber;\nuint8_t* rcvdKid;\nuint8_t rcvdKidLen;\n+ oscoap_security_context_t* blindContext;\n+ coap_code_t securityReturnCode;\n// init options len\ncoap_incomingOptionsLen = MAX_COAP_OPTIONS;\ncoap_outgoingOptionsLen = 0;\n+ // init returnCode\n+ securityReturnCode = 0;\n+\n// take ownership over the received packet\nmsg->owner = COMPONENT_OPENCOAP;\n@@ -156,13 +162,53 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\ncoap_header.Code<=COAP_CODE_REQ_DELETE\n) {\n// this is a request: target resource is indicated as COAP_OPTION_LOCATIONPATH option(s)\n+\n+ // first, we need to decrypt the request and to do so find the right security context\n+ if (objectSecurity) {\n+ temp_desc = opencoap_vars.resources;\n+ blindContext = NULL;\n+ // loop through all resources and compare recipient context\n+ do {\n+ if (temp_desc->securityContext != NULL &&\n+ temp_desc->securityContext->recipientIDLen == rcvdKidLen &&\n+ memcmp(rcvdKid, temp_desc->securityContext->recipientID, rcvdKidLen) == 0) {\n+\n+ blindContext = temp_desc->securityContext;\n+ break;\n+ }\n+ temp_desc = temp_desc->next;\n+ }\n+ while (temp_desc->next!=NULL);\n+\n+ if (blindContext) {\n+ coap_incomingOptionsLen = MAX_COAP_OPTIONS;\n+ decStatus = openoscoap_unprotect_message(blindContext,\n+ coap_header.Ver,\n+ coap_header.Code,\n+ coap_incomingOptions,\n+ &coap_incomingOptionsLen,\n+ msg,\n+ rcvdSequenceNumber\n+ );\n+\n+ if (decStatus != E_SUCCESS) {\n+ securityReturnCode = COAP_CODE_RESP_BADREQ;\n+ }\n+\n+ }\n+ else {\n+ securityReturnCode = COAP_CODE_RESP_UNAUTHORIZED;\n+ }\n+ }\n+\n+\n// find the resource which matches\n// start with the first resource in the linked list\ntemp_desc = opencoap_vars.resources;\n// iterate until matching resource found, or no match\n- while (found==FALSE) {\n+ while (found==FALSE && securityReturnCode==0) {\nif (\ncoap_incomingOptions[0].type==COAP_OPTION_NUM_URIPATH &&\ncoap_incomingOptions[1].type==COAP_OPTION_NUM_URIPATH &&\n@@ -179,6 +225,10 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\ncoap_incomingOptions[1].length==temp_desc->path1len &&\nmemcmp(coap_incomingOptions[1].pValue,temp_desc->path1val,temp_desc->path1len)==0\n) {\n+ if (temp_desc->securityContext != NULL &&\n+ blindContext != temp_desc->securityContext) {\n+ securityReturnCode = COAP_CODE_RESP_UNAUTHORIZED;\n+ }\nfound = TRUE;\n};\n@@ -193,6 +243,10 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\ncoap_incomingOptions[0].length==temp_desc->path0len &&\nmemcmp(coap_incomingOptions[0].pValue,temp_desc->path0val,temp_desc->path0len)==0\n) {\n+ if (temp_desc->securityContext != NULL &&\n+ blindContext != temp_desc->securityContext) {\n+ securityReturnCode = COAP_CODE_RESP_UNAUTHORIZED;\n+ }\nfound = TRUE;\n};\n};\n@@ -272,7 +326,7 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\n//=== step 3. ask the resource to prepare response\n- if (found==TRUE) {\n+ if (found==TRUE && securityReturnCode==0) {\n// call the resource's callback\noutcome = temp_desc->callbackRx(msg,&coap_header,&coap_incomingOptions[0], coap_outgoingOptions, &coap_outgoingOptionsLen);\n@@ -283,8 +337,13 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nmsg->length = 0;\n// set the CoAP header\ncoap_header.TKL = 0;\n+ if (securityReturnCode) {\n+ coap_header.Code = securityReturnCode;\n+ }\n+ else {\ncoap_header.Code = COAP_CODE_RESP_NOTFOUND;\n}\n+ }\nif (outcome==E_FAIL) {\n// reset packet payload (DO NOT DELETE, we will reuse same buffer for response)\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Towards verification of requests.
|
491,609
|
27.06.2017 19:35:20
| -7,200
|
7d25fcda8c262309416bfac292cd71c6babf2717
|
Protecting the response.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -67,10 +67,12 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nuint8_t rcvdKidLen;\noscoap_security_context_t* blindContext;\ncoap_code_t securityReturnCode;\n+ coap_option_class_t class;\n// init options len\ncoap_incomingOptionsLen = MAX_COAP_OPTIONS;\ncoap_outgoingOptionsLen = 0;\n+ class = COAP_OPTION_CLASS_ALL;\n// init returnCode\nsecurityReturnCode = 0;\n@@ -330,6 +332,27 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\n// call the resource's callback\noutcome = temp_desc->callbackRx(msg,&coap_header,&coap_incomingOptions[0], coap_outgoingOptions, &coap_outgoingOptionsLen);\n+ if (outcome == E_FAIL) {\n+ securityReturnCode = COAP_CODE_RESP_METHODNOTALLOWED;\n+ }\n+ if (temp_desc->securityContext != NULL) {\n+ coap_outgoingOptions[coap_outgoingOptionsLen++].type = COAP_OPTION_NUM_OBJECTSECURITY;\n+ if (coap_outgoingOptionsLen > MAX_COAP_OPTIONS) {\n+ securityReturnCode = COAP_CODE_RESP_SERVERERROR; // no space for object security option\n+ }\n+ // protect the message in the openqueue buffer\n+ openoscoap_protect_message(\n+ temp_desc->securityContext,\n+ COAP_VERSION,\n+ coap_header.Code,\n+ coap_outgoingOptions,\n+ coap_outgoingOptionsLen,\n+ msg,\n+ rcvdSequenceNumber);\n+ class = COAP_OPTION_CLASS_U;\n+ } else {\n+ class = COAP_OPTION_CLASS_ALL;\n+ }\n} else {\n// reset packet payload (DO NOT DELETE, we will reuse same buffer for response)\n@@ -351,7 +374,7 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nmsg->length = 0;\n// set the CoAP header\ncoap_header.TKL = 0;\n- coap_header.Code = COAP_CODE_RESP_METHODNOTALLOWED;\n+ coap_header.Code = securityReturnCode;\n}\nif (coap_header.T == COAP_TYPE_CON) {\n@@ -368,7 +391,7 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\n}\n// once header is reserved, encode the options to the openqueue payload buffer\n- opencoap_options_encode(msg, coap_outgoingOptions, coap_outgoingOptionsLen, COAP_OPTION_CLASS_ALL);\n+ opencoap_options_encode(msg, coap_outgoingOptions, coap_outgoingOptionsLen, class);\n//=== step 5. send that packet back\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Protecting the response.
|
491,595
|
28.06.2017 10:00:59
| -7,200
|
4e05d8bc54b59632d5da771818bf8b4a05b3ce11
|
Add timer id parameter in opentimer callback.
|
[
{
"change_type": "MODIFY",
"old_path": "drivers/common/openserial.c",
"new_path": "drivers/common/openserial.c",
"diff": "@@ -45,7 +45,7 @@ void openserial_get6pInfo(uint8_t commandId, uint8_t* code,uint8_t* cellOptions,\nvoid openserial_handleCommands(void);\n// misc\n-void openserial_board_reset_cb(void);\n+void openserial_board_reset_cb(opentimers_id_t id);\n// HDLC output\nvoid outputHdlcOpen(void);\n@@ -777,7 +777,7 @@ void openserial_handleCommands(void){\n//===== misc\n-void openserial_board_reset_cb(void) {\n+void openserial_board_reset_cb(opentimers_id_t id) {\nboard_reset();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "drivers/common/opentimers.c",
"new_path": "drivers/common/opentimers.c",
"diff": "@@ -401,7 +401,7 @@ void opentimers_timer_callback(void){\nif (opentimers_vars.timersBuf[j].wraps_remaining==0){\nopentimers_vars.timersBuf[j].isrunning = FALSE;\nopentimers_vars.timersBuf[j].hasExpired = FALSE;\n- opentimers_vars.timersBuf[j].callback();\n+ opentimers_vars.timersBuf[j].callback(j);\nif (opentimers_vars.timersBuf[j].timerType==TIMER_PERIODIC){\nopentimers_scheduleIn(j,\nopentimers_vars.timersBuf[j].totalTimerPeriod,\n"
},
{
"change_type": "MODIFY",
"old_path": "drivers/common/opentimers.h",
"new_path": "drivers/common/opentimers.h",
"diff": "#define MAX_DURATION_ISR 33 // 33@32768Hz = 1ms\n#define opentimers_id_t uint8_t\n-typedef void (*opentimers_cbt)(void);\n+typedef void (*opentimers_cbt)(opentimers_id_t id);\n//=========================== typedef =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cexample/cexample.c",
"new_path": "openapps/cexample/cexample.c",
"diff": "@@ -31,7 +31,7 @@ cexample_vars_t cexample_vars;\nowerror_t cexample_receive(OpenQueueEntry_t* msg,\ncoap_header_iht* coap_header,\ncoap_option_iht* coap_options);\n-void cexample_timer_cb(void);\n+void cexample_timer_cb(opentimers_id_t id);\nvoid cexample_task_cb(void);\nvoid cexample_sendDone(OpenQueueEntry_t* msg,\nowerror_t error);\n@@ -72,7 +72,7 @@ owerror_t cexample_receive(OpenQueueEntry_t* msg,\n//timer fired, but we don't want to execute task in ISR mode\n//instead, push task to scheduler with COAP priority, and let scheduler take care of it\n-void cexample_timer_cb(){\n+void cexample_timer_cb(opentimers_id_t id){\nscheduler_push_task(cexample_task_cb,TASKPRIO_COAP);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/csensors/csensors.c",
"new_path": "openapps/csensors/csensors.c",
"diff": "@@ -45,7 +45,7 @@ owerror_t csensors_receive(\ncoap_option_iht* coap_options\n);\n-void csensors_timer_cb(void);\n+void csensors_timer_cb(opentimers_id_t id);\nvoid csensors_task_cb(void);\n@@ -276,7 +276,7 @@ owerror_t csensors_receive(\n\\param[in] id The opentimer identifier used to resolve the csensor resource associated\nparsed.\n*/\n-void csensors_timer_cb(){\n+void csensors_timer_cb(opentimers_id_t id){\nuint8_t i;\nfor(i=0;i<csensors_vars.numCsensors;i++) {\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/uexpiration/uexpiration.c",
"new_path": "openapps/uexpiration/uexpiration.c",
"diff": "@@ -15,7 +15,7 @@ OpenQueueEntry_t req;\n//=========================== prototypes ======================================\n-void uexpiration_timer_cb(void);\n+void uexpiration_timer_cb(opentimers_id_t id);\nvoid uexpiration_task_cb(void);\n//=========================== public ==========================================\n@@ -80,7 +80,7 @@ void uexpiration_receive(OpenQueueEntry_t* request) {\n);\n}\n-void uexpiration_timer_cb(void){\n+void uexpiration_timer_cb(opentimers_id_t id){\nscheduler_push_task(uexpiration_task_cb,TASKPRIO_COAP);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/uinject/uinject.c",
"new_path": "openapps/uinject/uinject.c",
"diff": "@@ -19,7 +19,7 @@ static const uint8_t uinject_dst_addr[] = {\n//=========================== prototypes ======================================\n-void uinject_timer_cb(void);\n+void uinject_timer_cb(opentimers_id_t id);\nvoid uinject_task_cb(void);\n//=========================== public ==========================================\n@@ -69,7 +69,7 @@ void uinject_receive(OpenQueueEntry_t* pkt) {\n\\note timer fired, but we don't want to execute task in ISR mode instead, push\ntask to scheduler with CoAP priority, and let scheduler take care of it.\n*/\n-void uinject_timer_cb(void){\n+void uinject_timer_cb(opentimers_id_t id){\nscheduler_push_task(uinject_task_cb,TASKPRIO_COAP);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -93,8 +93,8 @@ void endSlot(void);\nbool debugPrint_asn(void);\nbool debugPrint_isSync(void);\n// interrupts\n-void isr_ieee154e_newSlot(void);\n-void isr_ieee154e_timer(void);\n+void isr_ieee154e_newSlot(opentimers_id_t id);\n+void isr_ieee154e_timer(opentimers_id_t id);\n//=========================== admin ===========================================\n@@ -268,7 +268,7 @@ void ieee154e_orderToASNStructure(uint8_t* in,asn_t* val_asn) {\nThis function executes in ISR mode, when the new slot timer fires.\n*/\n-void isr_ieee154e_newSlot() {\n+void isr_ieee154e_newSlot(opentimers_id_t id) {\nieee154e_vars.startOfSlotReference = opentimers_getCurrentTimeout();\nopentimers_scheduleAbsolute(\nieee154e_vars.timerId, // timerId\n@@ -302,7 +302,7 @@ void isr_ieee154e_newSlot() {\nThis function executes in ISR mode, when the FSM timer fires.\n*/\n-void isr_ieee154e_timer() {\n+void isr_ieee154e_timer(opentimers_id_t id) {\nswitch (ieee154e_vars.state) {\ncase S_TXDATAOFFSET:\nactivity_ti2();\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -35,9 +35,9 @@ owerror_t sixtop_send_internal(\n);\n// timer interrupt callbacks\n-void sixtop_maintenance_timer_cb(void);\n-void sixtop_timeout_timer_cb(void);\n-void sixtop_sendingEb_timer_cb(void);\n+void sixtop_maintenance_timer_cb(opentimers_id_t id);\n+void sixtop_timeout_timer_cb(opentimers_id_t id);\n+void sixtop_sendingEb_timer_cb(opentimers_id_t id);\n//=== EB/KA task\n@@ -615,7 +615,7 @@ owerror_t sixtop_send_internal(\n}\n// timer interrupt callbacks\n-void sixtop_sendingEb_timer_cb(void){\n+void sixtop_sendingEb_timer_cb(opentimers_id_t id){\nscheduler_push_task(timer_sixtop_sendEb_fired,TASKPRIO_SIXTOP);\n// update the period\nsixtop_vars.periodMaintenance = 872 +(openrandom_get16b()&0xff);\n@@ -628,11 +628,11 @@ void sixtop_sendingEb_timer_cb(void){\n);\n}\n-void sixtop_maintenance_timer_cb(void) {\n+void sixtop_maintenance_timer_cb(opentimers_id_t id) {\nscheduler_push_task(timer_sixtop_management_fired,TASKPRIO_SIXTOP);\n}\n-void sixtop_timeout_timer_cb(void) {\n+void sixtop_timeout_timer_cb(opentimers_id_t id) {\nscheduler_push_task(timer_sixtop_six2six_timeout_fired,TASKPRIO_SIXTOP_TIMEOUT);\n}\n@@ -903,7 +903,7 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\nSIX2SIX_TIMEOUT_MS,\nopentimers_getValue(),\nTIME_MS,\n- timer_sixtop_six2six_timeout_fired\n+ sixtop_timeout_timer_cb\n);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -18,11 +18,11 @@ icmpv6rpl_vars_t icmpv6rpl_vars;\n//=========================== prototypes ======================================\n// DIO-related\n-void icmpv6rpl_timer_DIO_cb(void);\n+void icmpv6rpl_timer_DIO_cb(opentimers_id_t id);\nvoid icmpv6rpl_timer_DIO_task(void);\nvoid sendDIO(void);\n// DAO-related\n-void icmpv6rpl_timer_DAO_cb(void);\n+void icmpv6rpl_timer_DAO_cb(opentimers_id_t id);\nvoid icmpv6rpl_timer_DAO_task(void);\nvoid sendDAO(void);\n@@ -514,7 +514,7 @@ void icmpv6rpl_killPreferredParent() {\n\\note This function is executed in interrupt context, and should only push a\ntask.\n*/\n-void icmpv6rpl_timer_DIO_cb(void) {\n+void icmpv6rpl_timer_DIO_cb(opentimers_id_t id) {\nscheduler_push_task(icmpv6rpl_timer_DIO_task,TASKPRIO_RPL);\n}\n@@ -617,7 +617,7 @@ void sendDIO() {\n\\note This function is executed in interrupt context, and should only push a\ntask.\n*/\n-void icmpv6rpl_timer_DAO_cb(void) {\n+void icmpv6rpl_timer_DAO_cb(opentimers_id_t id) {\nscheduler_push_task(icmpv6rpl_timer_DAO_task,TASKPRIO_RPL);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp",
"new_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp",
"diff": "<state>$PROJ_DIR$\\..\\..\\..\\openapps\\cstorm\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\rrt\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\uinject\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\openapps\\uexpiration\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\openapps\\uexpiration_monitor\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\userialbridge\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\</state>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_aes.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ana_regs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ana_regs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_cctest.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_cctest.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_flash_ctrl.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ints.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ioc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_memmap.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_ffsm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_sfr.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_sfr.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_xreg.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_xreg.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_smwdthrosc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_soc_adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_soc_adc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ssi.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ssi.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_sys_ctrl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_types.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gptimer.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gptimer.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gptimer.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\i2c_lib.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\pka.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sleepmode.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sleepmode.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sleepmode.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ssi.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\systick.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\uarthal.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\uarthal.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\uarthal.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\udma.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\adc_sensor.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\adc_sensor.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\adc_sensor.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\board.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\openapps\\uecho\\uecho.h</name>\n</file>\n</group>\n+ <group>\n+ <name>uexpiration</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\uexpiration\\uexpiration.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\uexpiration\\uexpiration.h</name>\n+ </file>\n+ </group>\n+ <group>\n+ <name>uexpiration_monitor</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\uexpiration_monitor\\uexpiration_monitor.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\uexpiration_monitor\\uexpiration_monitor.h</name>\n+ </file>\n+ </group>\n<group>\n<name>uinject</name>\n<file>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-660. Add timer id parameter in opentimer callback.
|
491,609
|
28.06.2017 14:18:12
| -7,200
|
9f01cc35b50bf969c642c6d2ff8b07d7975fd965
|
Implement replay protection.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.h",
"new_path": "openapps/opencoap/opencoap.h",
"diff": "@@ -150,7 +150,7 @@ typedef struct {\ntypedef struct {\nuint32_t bitArray;\n- uint16_t base;\n+ uint16_t rightEdge;\n} replay_window_t;\ntypedef struct {\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "@@ -53,6 +53,7 @@ void xor_arrays(uint8_t* s1, uint8_t* s2, uint8_t* dst, uint8_t len);\nvoid flip_first_bit(uint8_t* source, uint8_t* dst, uint8_t len);\nbool replay_window_check(oscoap_security_context_t *context, uint16_t sequenceNumber);\n+void replay_window_update(oscoap_security_context_t *context, uint16_t sequenceNumber);\nuint8_t openoscoap_convert_sequence_number(uint16_t sequenceNumber, uint8_t** buffer);\n//=========================== public ==========================================\n@@ -148,8 +149,8 @@ void openoscoap_init_security_context(oscoap_security_context_t *ctx,\nOSCOAP_DERIVATION_TYPE_IV,\nAES_CCM_16_64_128_IV_LEN);\n- ctx->window.bitArray = 0;\n- ctx->window.base = 0;\n+ ctx->window.bitArray = 0x01; // LSB set\n+ ctx->window.rightEdge = 0;\n}\n@@ -385,6 +386,10 @@ owerror_t openoscoap_unprotect_message(\nreturn E_FAIL;\n}\n+ if (is_request(code)) {\n+ replay_window_update(context, sequenceNumber);\n+ }\n+\nif (payloadInObjSec) {\nopencoap_options_parse(objectSecurity->pValue, objectSecurity->length, options, optionsLen);\n}\n@@ -613,9 +618,53 @@ void flip_first_bit(uint8_t* source, uint8_t* dst, uint8_t len){\n}\nbool replay_window_check(oscoap_security_context_t *context, uint16_t sequenceNumber) {\n+ uint16_t delta;\n+\n+ // packets lower than the left edge are rejected\n+ if ((int)sequenceNumber < (int)(context->window.rightEdge - 31)) {\n+ return FALSE;\n+ }\n+\n+ // packets higher than the right edge are accepted\n+ if (sequenceNumber > context->window.rightEdge) {\nreturn TRUE;\n}\n+ // packet falls within the window, check if appropriate bit is set\n+ delta = context->window.rightEdge - sequenceNumber;\n+ if ((uint32_t)(1 << delta) & context->window.bitArray) {\n+ return FALSE;\n+ }\n+\n+ return TRUE;\n+}\n+\n+void replay_window_update(oscoap_security_context_t *context, uint16_t sequenceNumber) {\n+ uint16_t delta;\n+\n+ if (replay_window_check(context, sequenceNumber) == FALSE) {\n+ return;\n+ }\n+\n+ if (sequenceNumber > context->window.rightEdge) {\n+ delta = sequenceNumber - context->window.rightEdge;\n+ context->window.rightEdge = sequenceNumber;\n+ if (delta < 32) {\n+ context->window.bitArray = context->window.bitArray << delta;\n+ }\n+ else {\n+ context->window.bitArray = 0x00;\n+ }\n+ context->window.bitArray |= 1; // update the right edge bit\n+ }\n+ else {\n+ delta = context->window.rightEdge - sequenceNumber;\n+ if (delta < 32) {\n+ context->window.bitArray |= 1 << delta;\n+ }\n+ }\n+}\n+\nuint8_t openoscoap_convert_sequence_number(uint16_t sequenceNumber, uint8_t** buffer) {\npacketfunctions_htons(sequenceNumber, *buffer);\nif (**buffer == 0x00) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Implement replay protection.
|
491,609
|
28.06.2017 16:32:56
| -7,200
|
7523935b6f5e3bca48978b866ed39e6bfcec9328
|
Implement senderID and recipientID construction as per minimal-security-03 draft.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "#include \"IEEE802154E.h\"\n#include \"icmpv6rpl.h\"\n#include \"cbor.h\"\n+#include \"eui64.h\"\n//=========================== defines =========================================\n@@ -26,6 +27,9 @@ const uint8_t cjoin_path0[] = \"j\";\nstatic const uint8_t ipAddr_jce[] = {0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};\n+static const uint8_t masterSecret[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \\\n+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};\n+\n//=========================== variables =======================================\ncjoin_vars_t cjoin_vars;\n@@ -34,7 +38,10 @@ cjoin_vars_t cjoin_vars;\nowerror_t cjoin_receive(OpenQueueEntry_t* msg,\ncoap_header_iht* coap_header,\n- coap_option_iht* coap_options);\n+ coap_option_iht* coap_incomingOptions,\n+ coap_option_iht* coap_outgoingOptions,\n+ uint8_t* coap_outgoingOptionsLen);\n+\nvoid cjoin_timer_cb(void);\nvoid cjoin_task_cb(void);\nvoid cjoin_sendDone(OpenQueueEntry_t* msg,\n@@ -45,23 +52,19 @@ void cjoin_retransmission_task_cb(void);\nbool cjoin_getIsJoined(void);\nvoid cjoin_setIsJoined(bool newValue);\n//=========================== public ==========================================\n-/* Below is debug functions */\n-void printf_hex(unsigned char *data, unsigned int len){\n- unsigned int i=0;\n- for(i=0; i<len; i++)\n- {\n- printf(\"%02x \",data[i]);\n- }\n- printf(\"\\n\");\n-}\n+\nvoid cjoin_init() {\n+ uint8_t senderID[9]; // needs to hold EUI-64 + 1 byte\n+ uint8_t recipientID[9]; // needs to hold EUI-64 + 1 byte\n+\n// prepare the resource descriptor for the /j path\ncjoin_vars.desc.path0len = sizeof(cjoin_path0)-1;\ncjoin_vars.desc.path0val = (uint8_t*)(&cjoin_path0);\ncjoin_vars.desc.path1len = 0;\ncjoin_vars.desc.path1val = NULL;\ncjoin_vars.desc.componentID = COMPONENT_CJOIN;\n+ cjoin_vars.desc.securityContext = &cjoin_vars.context;\ncjoin_vars.desc.discoverable = TRUE;\ncjoin_vars.desc.callbackRx = &cjoin_receive;\ncjoin_vars.desc.callbackSendDone = &cjoin_sendDone;\n@@ -74,6 +77,20 @@ void cjoin_init() {\ncjoin_vars.timerId = opentimers_create();\n+ eui64_get(senderID);\n+ senderID[8] = 0x00; // construct sender ID according to the minimal-security-03 draft\n+ eui64_get(recipientID);\n+ recipientID[8] = 0x01; // construct recipient ID according to the minimal-security-03 draft\n+\n+ openoscoap_init_security_context(&cjoin_vars.context,\n+ (uint8_t*) senderID,\n+ sizeof(senderID),\n+ (uint8_t*) recipientID,\n+ sizeof(recipientID),\n+ (uint8_t*) masterSecret,\n+ sizeof(masterSecret),\n+ NULL,\n+ 0);\ncjoin_schedule();\n}\n@@ -81,7 +98,6 @@ void cjoin_init() {\nvoid cjoin_setJoinKey(uint8_t *key, uint8_t len) {\nmemcpy(cjoin_vars.joinKey, key, len);\n- printf_hex(cjoin_vars.joinKey, len);\n}\nvoid cjoin_schedule() {\n@@ -103,7 +119,10 @@ void cjoin_schedule() {\n//=========================== private =========================================\nowerror_t cjoin_receive(OpenQueueEntry_t* msg,\ncoap_header_iht* coap_header,\n- coap_option_iht* coap_options) {\n+ coap_option_iht* coap_incomingOptions,\n+ coap_option_iht* coap_outgoingOptions,\n+ uint8_t* coap_outgoingOptionsLen) {\n+\nuint8_t i;\njoin_response_t join_response;\nowerror_t ret;\n@@ -116,9 +135,9 @@ owerror_t cjoin_receive(OpenQueueEntry_t* msg,\n// loop through the options and look for content format\ni = 0;\n- while(coap_options[i].type != COAP_OPTION_NONE) {\n- if (coap_options[i].type == COAP_OPTION_NUM_CONTENTFORMAT &&\n- *(coap_options[i].pValue) == COAP_MEDTYPE_APPCBOR) {\n+ while(coap_incomingOptions[i].type != COAP_OPTION_NONE) {\n+ if (coap_incomingOptions[i].type == COAP_OPTION_NUM_CONTENTFORMAT &&\n+ *(coap_incomingOptions[i].pValue) == COAP_MEDTYPE_APPCBOR) {\nret = cbor_parse_join_response(&join_response, msg->payload, msg->length);\nif (ret == E_FAIL) { return E_FAIL; }\n@@ -183,6 +202,7 @@ void cjoin_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\nowerror_t cjoin_sendJoinRequest(void) {\nOpenQueueEntry_t* pkt;\nowerror_t outcome;\n+ coap_option_iht options[5];\n// immediately arm the retransmission timer\nopentimers_scheduleIn(cjoin_vars.timerId,\n@@ -209,10 +229,13 @@ owerror_t cjoin_sendJoinRequest(void) {\npkt->owner = COMPONENT_CJOIN;\n// location-path option\n- packetfunctions_reserveHeaderSize(pkt,sizeof(cjoin_path0)-1);\n- memcpy(&pkt->payload[0],cjoin_path0,sizeof(cjoin_path0)-1);\n- packetfunctions_reserveHeaderSize(pkt,1);\n- pkt->payload[0] = ((COAP_OPTION_NUM_URIPATH) << 4) | (sizeof(cjoin_path0)-1);\n+ options[0].type = COAP_OPTION_NUM_URIPATH;\n+ options[0].length = sizeof(cjoin_path0)-1;\n+ options[0].pValue = (uint8_t *)cjoin_path0;\n+\n+ // object security option\n+ // length and value are set by the CoAP library\n+ options[1].type = COAP_OPTION_NUM_OBJECTSECURITY;\n// metadata\npkt->l4_destination_port = WKP_UDP_COAP;\n@@ -224,7 +247,9 @@ owerror_t cjoin_sendJoinRequest(void) {\npkt,\nCOAP_TYPE_CON,\nCOAP_CODE_REQ_GET,\n- 1,\n+ 1, // token len\n+ options,\n+ 2, // options len\n&cjoin_vars.desc\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.h",
"new_path": "openapps/cjoin/cjoin.h",
"diff": "*/\n#include \"opendefs.h\"\n#include \"opencoap.h\"\n+#include \"openoscoap.h\"\n//=========================== define ==========================================\n//=========================== typedef =========================================\n@@ -19,6 +20,7 @@ typedef struct {\nbool isJoined;\nasn_t joinAsn;\nuint8_t joinKey[16];\n+ oscoap_security_context_t context;\n} cjoin_vars_t;\n//=========================== variables =======================================\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Implement senderID and recipientID construction as per minimal-security-03 draft.
|
491,609
|
28.06.2017 17:12:36
| -7,200
|
9fd347321a7fbaf3bf236197e6b84becba2d766f
|
Set securityContext pointer to zero for other CoAP apps.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/c6t/c6t.c",
"new_path": "openapps/c6t/c6t.c",
"diff": "@@ -45,6 +45,7 @@ void c6t_init() {\nc6t_vars.desc.path1len = 0;\nc6t_vars.desc.path1val = NULL;\nc6t_vars.desc.componentID = COMPONENT_C6T;\n+ c6t_vars.desc.securityContext = NULL;\nc6t_vars.desc.discoverable = TRUE;\nc6t_vars.desc.callbackRx = &c6t_receive;\nc6t_vars.desc.callbackSendDone = &c6t_sendDone;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cexample/cexample.c",
"new_path": "openapps/cexample/cexample.c",
"diff": "@@ -49,6 +49,7 @@ void cexample_init() {\ncexample_vars.desc.path1len = 0;\ncexample_vars.desc.path1val = NULL;\ncexample_vars.desc.componentID = COMPONENT_CEXAMPLE;\n+ cexample_vars.desc.securityContext = NULL;\ncexample_vars.desc.discoverable = TRUE;\ncexample_vars.desc.callbackRx = &cexample_receive;\ncexample_vars.desc.callbackSendDone = &cexample_sendDone;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cinfo/cinfo.c",
"new_path": "openapps/cinfo/cinfo.c",
"diff": "@@ -49,6 +49,7 @@ void cinfo_init() {\ncinfo_vars.desc.path1len = 0;\ncinfo_vars.desc.path1val = NULL;\ncinfo_vars.desc.componentID = COMPONENT_CINFO;\n+ cinfo_vars.desc.securityContext = NULL;\ncinfo_vars.desc.discoverable = TRUE;\ncinfo_vars.desc.callbackRx = &cinfo_receive;\ncinfo_vars.desc.callbackSendDone = &cinfo_sendDone;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cleds/cleds.c",
"new_path": "openapps/cleds/cleds.c",
"diff": "@@ -39,6 +39,7 @@ void cleds__init() {\ncleds_vars.desc.path1len = 0;\ncleds_vars.desc.path1val = NULL;\ncleds_vars.desc.componentID = COMPONENT_CLEDS;\n+ cleds_vars.desc.securityContext = NULL;\ncleds_vars.desc.discoverable = TRUE;\ncleds_vars.desc.callbackRx = &cleds_receive;\ncleds_vars.desc.callbackSendDone = &cleds_sendDone;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/csensors/csensors.c",
"new_path": "openapps/csensors/csensors.c",
"diff": "@@ -86,6 +86,7 @@ void csensors_init() {\ncsensors_vars.desc.path1len = 0;\ncsensors_vars.desc.path1val = NULL;\ncsensors_vars.desc.componentID = COMPONENT_CSENSORS;\n+ csensors_vars.desc.securityContext = NULL;\ncsensors_vars.desc.discoverable = TRUE;\ncsensors_vars.desc.callbackRx = &csensors_receive;\ncsensors_vars.desc.callbackSendDone = &csensors_sendDone;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cstorm/cstorm.c",
"new_path": "openapps/cstorm/cstorm.c",
"diff": "@@ -46,6 +46,7 @@ void cstorm_init(void) {\ncstorm_vars.desc.path1len = 0;\ncstorm_vars.desc.path1val = NULL;\ncstorm_vars.desc.componentID = COMPONENT_CSTORM;\n+ cstorm_vars.desc.securityContext = NULL;\ncstorm_vars.desc.discoverable = TRUE;\ncstorm_vars.desc.callbackRx = &cstorm_receive;\ncstorm_vars.desc.callbackSendDone = &cstorm_sendDone;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cwellknown/cwellknown.c",
"new_path": "openapps/cwellknown/cwellknown.c",
"diff": "@@ -38,6 +38,7 @@ void cwellknown_init() {\ncwellknown_vars.desc.path1len = sizeof(cwellknown_path1)-1;\ncwellknown_vars.desc.path1val = (uint8_t*)(&cwellknown_path1);\ncwellknown_vars.desc.componentID = COMPONENT_CWELLKNOWN;\n+ cwellknown_vars.desc.securityContext = NULL;\ncwellknown_vars.desc.discoverable = FALSE;\ncwellknown_vars.desc.callbackRx = &cwellknown_receive;\ncwellknown_vars.desc.callbackSendDone = &cwellknown_sendDone;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/rrt/rrt.c",
"new_path": "openapps/rrt/rrt.c",
"diff": "@@ -57,6 +57,7 @@ void rrt_init() {\nrrt_vars.desc.path1len = 0;\nrrt_vars.desc.path1val = NULL;\nrrt_vars.desc.componentID = COMPONENT_RRT;\n+ rrt_vars.desc.securityContext = NULL;\nrrt_vars.desc.discoverable = TRUE;\nrrt_vars.desc.callbackRx = &rrt_receive;\nrrt_vars.desc.callbackSendDone = &rrt_sendDone;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Set securityContext pointer to zero for other CoAP apps.
|
491,609
|
29.06.2017 10:14:31
| -7,200
|
d5fa31102a18b26d5e59c46ae769e33edd943f00
|
Add options to Join Request according to minimal-security-03 draft.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "@@ -30,6 +30,10 @@ static const uint8_t ipAddr_jce[] = {0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0\nstatic const uint8_t masterSecret[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \\\n0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};\n+static const uint8_t jrcHostName[] = \"6tisch.arpa\";\n+\n+static const uint8_t proxyScheme[] = \"coap\";\n+\n//=========================== variables =======================================\ncjoin_vars_t cjoin_vars;\n@@ -228,14 +232,24 @@ owerror_t cjoin_sendJoinRequest(void) {\npkt->creator = COMPONENT_CJOIN;\npkt->owner = COMPONENT_CJOIN;\n+ // uri-host set to 6tisch.arpa\n+ options[0].type = COAP_OPTION_NUM_URIHOST;\n+ options[0].length = sizeof(jrcHostName)-1;\n+ options[0].pValue = (uint8_t *)jrcHostName;\n+\n// location-path option\n- options[0].type = COAP_OPTION_NUM_URIPATH;\n- options[0].length = sizeof(cjoin_path0)-1;\n- options[0].pValue = (uint8_t *)cjoin_path0;\n+ options[1].type = COAP_OPTION_NUM_URIPATH;\n+ options[1].length = sizeof(cjoin_path0)-1;\n+ options[1].pValue = (uint8_t *)cjoin_path0;\n// object security option\n// length and value are set by the CoAP library\n- options[1].type = COAP_OPTION_NUM_OBJECTSECURITY;\n+ options[2].type = COAP_OPTION_NUM_OBJECTSECURITY;\n+\n+ // ProxyScheme set to \"coap\"\n+ options[3].type = COAP_OPTION_NUM_PROXYSCHEME;\n+ options[3].length = sizeof(proxyScheme)-1;\n+ options[3].pValue = (uint8_t *)proxyScheme;\n// metadata\npkt->l4_destination_port = WKP_UDP_COAP;\n@@ -249,7 +263,7 @@ owerror_t cjoin_sendJoinRequest(void) {\nCOAP_CODE_REQ_GET,\n1, // token len\noptions,\n- 2, // options len\n+ 4, // options len\n&cjoin_vars.desc\n);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Add options to Join Request according to minimal-security-03 draft.
|
491,609
|
29.06.2017 10:36:41
| -7,200
|
c88a85d90f20ebc407da7a1f413b9d156d9476df
|
Use the joinKey for initializing OSCOAP security context.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "@@ -39,6 +39,7 @@ static const uint8_t proxyScheme[] = \"coap\";\ncjoin_vars_t cjoin_vars;\n//=========================== prototypes ======================================\n+void cjoin_init_security_context();\nowerror_t cjoin_receive(OpenQueueEntry_t* msg,\ncoap_header_iht* coap_header,\n@@ -58,10 +59,6 @@ void cjoin_setIsJoined(bool newValue);\n//=========================== public ==========================================\nvoid cjoin_init() {\n-\n- uint8_t senderID[9]; // needs to hold EUI-64 + 1 byte\n- uint8_t recipientID[9]; // needs to hold EUI-64 + 1 byte\n-\n// prepare the resource descriptor for the /j path\ncjoin_vars.desc.path0len = sizeof(cjoin_path0)-1;\ncjoin_vars.desc.path0val = (uint8_t*)(&cjoin_path0);\n@@ -81,27 +78,35 @@ void cjoin_init() {\ncjoin_vars.timerId = opentimers_create();\n+ memcpy(cjoin_vars.joinKey, masterSecret, sizeof(cjoin_vars.joinKey));\n+ cjoin_init_security_context();\n+\n+ cjoin_schedule();\n+}\n+\n+void cjoin_init_security_context() {\n+ uint8_t senderID[9]; // needs to hold EUI-64 + 1 byte\n+ uint8_t recipientID[9]; // needs to hold EUI-64 + 1 byte\n+\neui64_get(senderID);\nsenderID[8] = 0x00; // construct sender ID according to the minimal-security-03 draft\neui64_get(recipientID);\nrecipientID[8] = 0x01; // construct recipient ID according to the minimal-security-03 draft\nopenoscoap_init_security_context(&cjoin_vars.context,\n- (uint8_t*) senderID,\n+ senderID,\nsizeof(senderID),\n- (uint8_t*) recipientID,\n+ recipientID,\nsizeof(recipientID),\n- (uint8_t*) masterSecret,\n- sizeof(masterSecret),\n+ cjoin_vars.joinKey,\n+ sizeof(cjoin_vars.joinKey),\nNULL,\n0);\n- cjoin_schedule();\n}\n-\n-\nvoid cjoin_setJoinKey(uint8_t *key, uint8_t len) {\nmemcpy(cjoin_vars.joinKey, key, len);\n+ cjoin_init_security_context();\n}\nvoid cjoin_schedule() {\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -862,6 +862,7 @@ functionsToChange = [\n'rrt_sendCoAPMsg',\n# cjoin\n'cjoin_init',\n+ 'cjoin_init_security_context',\n'cjoin_setJoinKey',\n'cjoin_schedule',\n'cjoin_receive',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Use the joinKey for initializing OSCOAP security context.
|
491,609
|
29.06.2017 11:38:28
| -7,200
|
0a59f5ed4102afab0eb8165b5043edd2fc992f5f
|
Generalize option lookup function.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -120,7 +120,7 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\n// process handled options\n//== Object Security Option\n- objectSecurity = opencoap_find_object_security_option(coap_incomingOptions, coap_incomingOptionsLen);\n+ objectSecurity = opencoap_find_option(coap_incomingOptions, coap_incomingOptionsLen, COAP_OPTION_NUM_OBJECTSECURITY);\nif (objectSecurity) {\nif ((objectSecurity->length == 0 && msg->length == 0) ||\n(objectSecurity->length != 0 && msg->length != 0)) {\n@@ -789,7 +789,7 @@ owerror_t opencoap_options_encode(\nreturn E_SUCCESS;\n}\n-coap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, uint8_t arrayLen) {\n+coap_option_iht* opencoap_find_option(coap_option_iht* array, uint8_t arrayLen, coap_option_t option) {\nuint8_t i;\nif (array == NULL || arrayLen == 0) {\n@@ -797,7 +797,7 @@ coap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, ui\n}\nfor (i = 0; i < arrayLen; i++) {\n- if (array[i].type == COAP_OPTION_NUM_OBJECTSECURITY) {\n+ if (array[i].type == option) {\nreturn &array[i];\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.h",
"new_path": "openapps/opencoap/opencoap.h",
"diff": "@@ -234,7 +234,7 @@ uint8_t opencoap_options_parse(uint8_t* buffer,\nuint8_t bufferLen,\ncoap_option_iht* options,\nuint8_t* optionsLen);\n-coap_option_iht* opencoap_find_object_security_option(coap_option_iht* array, uint8_t arrayLen);\n+coap_option_iht* opencoap_find_option(coap_option_iht* array, uint8_t arrayLen, coap_option_t option);\n/**\n\\}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "@@ -178,7 +178,7 @@ owerror_t openoscoap_protect_message(\nbool payloadPresent;\n// find object security option in the list of passed options\n- objectSecurity = opencoap_find_object_security_option(options, optionsLen);\n+ objectSecurity = opencoap_find_option(options, optionsLen, COAP_OPTION_NUM_OBJECTSECURITY);\nif (objectSecurity == NULL) { // objectSecurity option should be set by the application\nreturn E_FAIL;\n}\n@@ -306,7 +306,7 @@ owerror_t openoscoap_unprotect_message(\nuint8_t index;\n// find object security option in the list of passed options\n- objectSecurity = opencoap_find_object_security_option(options, *optionsLen);\n+ objectSecurity = opencoap_find_option(options, *optionsLen, COAP_OPTION_NUM_OBJECTSECURITY);\nif (objectSecurity == NULL) { // return FAIL if object security option is not present\nreturn E_FAIL;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -709,7 +709,6 @@ functionsToChange = [\n'icmpv6coap_timer_cb',\n# oscoap\n'openoscoap_init_security_context',\n- 'openoscoap_find_object_security_option',\n'openoscoap_get_sequence_number',\n'openoscoap_protect_message',\n'openoscoap_unprotect_message',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Generalize option lookup function.
|
491,609
|
29.06.2017 13:07:46
| -7,200
|
bcddc6b6623df8f1b8e026bdf00f9da6c95ee20c
|
Separate function to encode CoAP header.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "opencoap_vars_t opencoap_vars;\n//=========================== prototype =======================================\n+void opencoap_header_encode(OpenQueueEntry_t *msg,\n+ uint8_t version,\n+ coap_type_t type,\n+ uint8_t TKL,\n+ coap_code_t code,\n+ uint16_t messageID,\n+ uint8_t *token);\n+\n//=========================== public ==========================================\n//===== from stack\n@@ -411,14 +419,13 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nmemcpy(&msg->l3_destinationAdd.addr_128b[0],&msg->l3_sourceAdd.addr_128b[0],LENGTH_ADDR128b);\n// fill in CoAP header\n- packetfunctions_reserveHeaderSize(msg,4+coap_header.TKL);\n- msg->payload[0] = (COAP_VERSION << 6) |\n- (response_type << 4) |\n- (coap_header.TKL << 0);\n- msg->payload[1] = coap_header.Code;\n- msg->payload[2] = coap_header.messageID/256;\n- msg->payload[3] = coap_header.messageID%256;\n- memcpy(&msg->payload[4], &coap_header.token[0], coap_header.TKL);\n+ opencoap_header_encode(msg,\n+ COAP_VERSION,\n+ response_type,\n+ coap_header.TKL,\n+ coap_header.Code,\n+ coap_header.messageID,\n+ &coap_header.token[0]);\nif ((openudp_send(msg))==E_FAIL) {\nopenqueue_freePacketBuffer(msg);\n@@ -646,15 +653,7 @@ owerror_t opencoap_send(\nclass);\n// pre-pend CoAP header (version,type,TKL,code,messageID,Token)\n- packetfunctions_reserveHeaderSize(msg,4+request->TKL);\n- msg->payload[0] = (COAP_VERSION << 6) |\n- (type << 4) |\n- (request->TKL << 0);\n- msg->payload[1] = code;\n- msg->payload[2] = (request->messageID>>8) & 0xff;\n- msg->payload[3] = (request->messageID>>0) & 0xff;\n-\n- memcpy(&msg->payload[4],&token,request->TKL);\n+ opencoap_header_encode(msg, COAP_VERSION, type, request->TKL, code, request->messageID, request->token);\nreturn openudp_send(msg);\n}\n@@ -893,4 +892,22 @@ uint8_t opencoap_options_parse(\nreturn index;\n}\n+void opencoap_header_encode(OpenQueueEntry_t *msg,\n+ uint8_t version,\n+ coap_type_t type,\n+ uint8_t TKL,\n+ coap_code_t code,\n+ uint16_t messageID,\n+ uint8_t *token) {\n+ // pre-pend CoAP header (version,type,TKL,code,messageID,Token)\n+ packetfunctions_reserveHeaderSize(msg,4+TKL);\n+ msg->payload[0] = (version << 6) |\n+ (type << 4) |\n+ (TKL << 0);\n+ msg->payload[1] = code;\n+ msg->payload[2] = (messageID>>8) & 0xff;\n+ msg->payload[3] = (messageID>>0) & 0xff;\n+\n+ memcpy(&msg->payload[4],token,TKL);\n+}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Separate function to encode CoAP header.
|
491,595
|
29.06.2017 13:34:28
| -7,200
|
1dc73617c4bb2aab56a91ced66ad6aaf7ae1bdf9
|
fix the metadata value in packet.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -289,7 +289,8 @@ void sixtop_request(\n// append 6p metadata\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint16_t));\n- *((uint8_t*)(pkt->payload)) = sixtop_vars.cb_sf_getMetadata();\n+ pkt->payload[0] = (uint8_t)( sixtop_vars.cb_sf_getMetadata() & 0x00FF);\n+ pkt->payload[1] = (uint8_t)((sixtop_vars.cb_sf_getMetadata() & 0xFF00)>>8);\nlen += 2;\n// append 6p Seqnum and schedule Generation\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-602. fix the metadata value in packet.
|
491,609
|
29.06.2017 14:24:27
| -7,200
|
25dd80ef188a002416c8948991bdd8a1aa95aef7
|
Handle proxy scheme option in CoAP.
Implementation of proxy scheme in case of "6tisch.arpa" host name.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -24,6 +24,11 @@ void opencoap_header_encode(OpenQueueEntry_t *msg,\nuint16_t messageID,\nuint8_t *token);\n+void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\n+ coap_header_iht* header,\n+ coap_option_iht* incomingOptions,\n+ uint8_t incomingOptionsLen);\n+\n//=========================== public ==========================================\n//===== from stack\n@@ -70,6 +75,7 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nuint8_t coap_outgoingOptionsLen;\nowerror_t decStatus;\ncoap_option_iht* objectSecurity;\n+ coap_option_iht* proxyScheme;\nuint16_t rcvdSequenceNumber;\nuint8_t* rcvdKid;\nuint8_t rcvdKidLen;\n@@ -126,6 +132,13 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\npacketfunctions_tossHeader(msg,index);\n// process handled options\n+ //== Proxy Scheme option\n+ proxyScheme = opencoap_find_option(coap_incomingOptions, coap_incomingOptionsLen, COAP_OPTION_NUM_PROXYSCHEME);\n+ if (proxyScheme) {\n+ opencoap_handle_proxy_scheme(msg, &coap_header, coap_incomingOptions, coap_incomingOptionsLen);\n+ return;\n+ }\n+\n//== Object Security Option\nobjectSecurity = opencoap_find_option(coap_incomingOptions, coap_incomingOptionsLen, COAP_OPTION_NUM_OBJECTSECURITY);\n@@ -892,6 +905,101 @@ uint8_t opencoap_options_parse(\nreturn index;\n}\n+void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\n+ coap_header_iht* header,\n+ coap_option_iht* incomingOptions,\n+ uint8_t incomingOptionsLen) {\n+\n+ uint8_t i;\n+ OpenQueueEntry_t* outgoingPacket;\n+ coap_option_iht outgoingOptions[MAX_COAP_OPTIONS];\n+ uint8_t outgoingOptionsLen;\n+ coap_option_iht *uriHost;\n+ coap_option_iht *proxyScheme;\n+ const uint8_t proxySchemeCoap[] = \"coap\";\n+ const uint8_t uriHost6tisch[] = \"6tisch.arpa\";\n+\n+ // verify that Proxy Scheme is set to coap\n+ proxyScheme = opencoap_find_option(incomingOptions, incomingOptionsLen, COAP_OPTION_NUM_PROXYSCHEME);\n+ if (memcmp(proxySchemeCoap, proxyScheme->pValue, sizeof(proxySchemeCoap)-1) != 0) {\n+ openqueue_freePacketBuffer(msg);\n+ return;\n+ }\n+\n+ // verify that UriHost is set to \"6tisch.arpa\"\n+ uriHost = opencoap_find_option(incomingOptions, incomingOptionsLen, COAP_OPTION_NUM_URIHOST);\n+ if (uriHost) {\n+ if (memcmp(uriHost6tisch, uriHost->pValue, sizeof(uriHost6tisch)-1) != 0) {\n+ openqueue_freePacketBuffer(msg);\n+ return;\n+ }\n+ }\n+ else {\n+ openqueue_freePacketBuffer(msg);\n+ return;\n+ }\n+\n+ outgoingOptionsLen = 0;\n+\n+ outgoingPacket = openqueue_getFreePacketBuffer(COMPONENT_OPENCOAP);\n+ if (outgoingPacket==NULL) {\n+ openserial_printError(\n+ COMPONENT_OPENCOAP,\n+ ERR_NO_FREE_PACKET_BUFFER,\n+ (errorparameter_t)0,\n+ (errorparameter_t)0\n+ );\n+ openqueue_freePacketBuffer(outgoingPacket);\n+ openqueue_freePacketBuffer(msg);\n+ return;\n+ }\n+\n+ // take ownership over that packet and set destination IP and port\n+ outgoingPacket->creator = COMPONENT_OPENCOAP;\n+ outgoingPacket->owner = COMPONENT_OPENCOAP;\n+ outgoingPacket->l4_destination_port = WKP_UDP_COAP;\n+ outgoingPacket->l3_destinationAdd.type = ADDR_128B;\n+ memcpy(&outgoingPacket->l3_destinationAdd.addr_128b[0],ipAddr_jce,16);\n+\n+ // fill in packet metadata\n+ outgoingPacket->l4_sourcePortORicmpv6Type = WKP_UDP_COAP;\n+\n+\n+ // fill payload\n+ packetfunctions_reserveHeaderSize(outgoingPacket,msg->length);\n+ memcpy(outgoingPacket->payload, msg->payload, msg->length);\n+\n+ // process options\n+ for (i = 0; i < incomingOptionsLen; i++) {\n+ if (incomingOptions[i].type == COAP_OPTION_NUM_PROXYSCHEME ||\n+ incomingOptions[i].type == COAP_OPTION_NUM_URIHOST) {\n+ continue;\n+ }\n+ outgoingOptions[outgoingOptionsLen].type = incomingOptions[i].type;\n+ outgoingOptions[outgoingOptionsLen].length = incomingOptions[i].length;\n+ outgoingOptions[outgoingOptionsLen].pValue = incomingOptions[i].pValue;\n+ outgoingOptionsLen++;\n+ }\n+\n+ // encode options\n+ opencoap_options_encode(outgoingPacket, outgoingOptions, outgoingOptionsLen, COAP_OPTION_CLASS_ALL);\n+\n+ // encode CoAP header\n+ opencoap_header_encode(outgoingPacket,\n+ header->Ver,\n+ header->T,\n+ header->TKL,\n+ header->Code,\n+ header->messageID,\n+ header->token);\n+\n+ openqueue_freePacketBuffer(msg);\n+\n+ if ((openudp_send(outgoingPacket))==E_FAIL) {\n+ openqueue_freePacketBuffer(outgoingPacket);\n+ }\n+}\n+\nvoid opencoap_header_encode(OpenQueueEntry_t *msg,\nuint8_t version,\ncoap_type_t type,\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -704,8 +704,10 @@ functionsToChange = [\n'opencoap_writeLinks',\n'opencoap_register',\n'opencoap_send',\n+ 'opencoap_header_encode',\n'opencoap_options_encode',\n'opencoap_options_parse',\n+ 'opencoap_handle_proxy_scheme',\n'icmpv6coap_timer_cb',\n# oscoap\n'openoscoap_init_security_context',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Handle proxy scheme option in CoAP.
Implementation of proxy scheme in case of "6tisch.arpa" host name.
|
491,609
|
29.06.2017 16:17:55
| -7,200
|
aa522a39d62c2fb79955a7e310e6146e6c06946a
|
Implement Stateless-Proxy option encoding.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "#include \"idmanager.h\"\n#include \"opentimers.h\"\n#include \"scheduler.h\"\n+#include \"cryptoengine.h\"\n//=========================== defines =========================================\n@@ -29,6 +30,10 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\ncoap_option_iht* incomingOptions,\nuint8_t incomingOptionsLen);\n+void opencoap_add_stateless_proxy_option(coap_option_iht* option,\n+ uint8_t* address,\n+ uint8_t addressLen,\n+ uint16_t portNumber);\n//=========================== public ==========================================\n//===== from stack\n@@ -37,12 +42,32 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\n\\brief Initialize this module.\n*/\nvoid opencoap_init() {\n+ uint16_t rand;\n+ uint8_t pos;\n+\n+ pos = 0;\n+\n// initialize the resource linked list\nopencoap_vars.resources = NULL;\n// initialize the messageID\nopencoap_vars.messageID = openrandom_get16b();\n+ // initialize the JRC address\n+ opencoap_vars.JRCaddress.type = ADDR_128B;\n+ memcpy(opencoap_vars.JRCaddress.addr_128b, ipAddr_jce, 16);\n+\n+ // stateless proxy vars\n+\n+ //generate a key at random\n+ while (pos<16) {\n+ rand = openrandom_get16b();\n+ memcpy(&opencoap_vars.statelessProxy.key[pos],&rand,2);\n+ pos+=2;\n+ }\n+ // init sequence number to zero\n+ opencoap_vars.statelessProxy.sequenceNumber = 0;\n+\n// register at UDP stack\nopencoap_vars.desc.port = WKP_UDP_COAP;\nopencoap_vars.desc.callbackReceive = &opencoap_receive;\n@@ -959,12 +984,11 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\noutgoingPacket->owner = COMPONENT_OPENCOAP;\noutgoingPacket->l4_destination_port = WKP_UDP_COAP;\noutgoingPacket->l3_destinationAdd.type = ADDR_128B;\n- memcpy(&outgoingPacket->l3_destinationAdd.addr_128b[0],ipAddr_jce,16);\n+ memcpy(outgoingPacket->l3_destinationAdd.addr_128b,opencoap_vars.JRCaddress.addr_128b,16);\n- // fill in packet metadata\n+ // fill in source port number\noutgoingPacket->l4_sourcePortORicmpv6Type = WKP_UDP_COAP;\n-\n// fill payload\npacketfunctions_reserveHeaderSize(outgoingPacket,msg->length);\nmemcpy(outgoingPacket->payload, msg->payload, msg->length);\n@@ -981,6 +1005,11 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\noutgoingOptionsLen++;\n}\n+ opencoap_add_stateless_proxy_option(&outgoingOptions[outgoingOptionsLen++],\n+ msg->l3_sourceAdd.addr_128b,\n+ 16,\n+ msg->l4_sourcePortORicmpv6Type);\n+\n// encode options\nopencoap_options_encode(outgoingPacket, outgoingOptions, outgoingOptionsLen, COAP_OPTION_CLASS_ALL);\n@@ -1019,3 +1048,44 @@ void opencoap_header_encode(OpenQueueEntry_t *msg,\nmemcpy(&msg->payload[4],token,TKL);\n}\n+void opencoap_add_stateless_proxy_option(coap_option_iht* option,\n+ uint8_t* address,\n+ uint8_t addressLen,\n+ uint16_t portNumber) {\n+ uint8_t lenm;\n+ uint8_t nonce[13];\n+ owerror_t outStatus;\n+\n+ lenm = 0;\n+ opencoap_vars.statelessProxy.sequenceNumber++;\n+\n+ // first byte is sequence number, authenticated but not encrypted\n+ opencoap_vars.statelessProxy.buffer[0] = opencoap_vars.statelessProxy.sequenceNumber;\n+\n+ // next bytes are address\n+ memcpy(&opencoap_vars.statelessProxy.buffer[1], address, addressLen);\n+ lenm += addressLen;\n+ memcpy(&opencoap_vars.statelessProxy.buffer[lenm+1], &portNumber, 2);\n+ lenm += 2;\n+\n+ memset(nonce, 0x00, 13);\n+ nonce[12] = opencoap_vars.statelessProxy.sequenceNumber;\n+ outStatus = cryptoengine_aes_ccms_enc(&opencoap_vars.statelessProxy.buffer[0],\n+ 1,\n+ &opencoap_vars.statelessProxy.buffer[1],\n+ &lenm,\n+ nonce,\n+ 2, // L=2 -> 13 byte nonce\n+ opencoap_vars.statelessProxy.key,\n+ STATELESS_PROXY_TAG_LEN);\n+ if (outStatus != E_SUCCESS) {\n+ option->type = COAP_OPTION_NONE;\n+ option->length = 0;\n+ option->pValue = NULL;\n+ return;\n+ }\n+\n+ option->type = COAP_OPTION_NUM_STATELESSPROXY;\n+ option->length = lenm+1; // +1 for sequence number, includes the authentication tag\n+ option->pValue = opencoap_vars.statelessProxy.buffer;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.h",
"new_path": "openapps/opencoap/opencoap.h",
"diff": "@@ -54,6 +54,9 @@ static const uint8_t ipAddr_ringmaster[] = {0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00,\n#define AES_CCM_16_64_128_TAG_LEN 8\n+#define STATELESS_PROXY_STATE_LEN 1 + 16 + 2 // seq no, ipv6 address, port number\n+#define STATELESS_PROXY_TAG_LEN 4\n+\ntypedef enum {\nCOAP_TYPE_CON = 0,\nCOAP_TYPE_NON = 1,\n@@ -111,6 +114,7 @@ typedef enum {\nCOAP_OPTION_NUM_PROXYURI = 35,\nCOAP_OPTION_NUM_PROXYSCHEME = 39,\nCOAP_OPTION_NUM_OBJECTSECURITY = 21,\n+ COAP_OPTION_NUM_STATELESSPROXY = 40,\n} coap_option_t;\ntypedef enum {\n@@ -194,6 +198,12 @@ struct coap_resource_desc_t {\ncoap_resource_desc_t* next;\n};\n+typedef struct {\n+ uint8_t key[16];\n+ uint8_t buffer[STATELESS_PROXY_STATE_LEN + STATELESS_PROXY_TAG_LEN];\n+ uint8_t sequenceNumber;\n+} coap_statelessproxy_vars_t;\n+\n//=========================== module variables ================================\ntypedef struct {\n@@ -202,6 +212,8 @@ typedef struct {\nbool busySending;\nuint8_t delayCounter;\nuint16_t messageID;\n+ open_addr_t JRCaddress;\n+ coap_statelessproxy_vars_t statelessProxy;\n} opencoap_vars_t;\n//=========================== prototypes ======================================\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Implement Stateless-Proxy option encoding.
|
491,609
|
30.06.2017 15:19:27
| -7,200
|
33eb3cf395d80ed79da6dc451d335fd622322555
|
Handle Stateless-Proxy option and forward the Join Response to pledge.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "opencoap_vars_t opencoap_vars;\n+static const uint8_t ipAddr_jce[] = {0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};\n+\n//=========================== prototype =======================================\nvoid opencoap_header_encode(OpenQueueEntry_t *msg,\nuint8_t version,\n@@ -30,6 +33,11 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\ncoap_option_iht* incomingOptions,\nuint8_t incomingOptionsLen);\n+void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\n+ coap_header_iht* header,\n+ coap_option_iht* incomingOptions,\n+ uint8_t incomingOptionsLen);\n+\nvoid opencoap_add_stateless_proxy_option(coap_option_iht* option,\nuint8_t* address,\nuint8_t addressLen,\n@@ -101,6 +109,7 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\nowerror_t decStatus;\ncoap_option_iht* objectSecurity;\ncoap_option_iht* proxyScheme;\n+ coap_option_iht* statelessProxy;\nuint16_t rcvdSequenceNumber;\nuint8_t* rcvdKid;\nuint8_t rcvdKidLen;\n@@ -157,10 +166,19 @@ void opencoap_receive(OpenQueueEntry_t* msg) {\npacketfunctions_tossHeader(msg,index);\n// process handled options\n+ //== Stateless Proxy option\n+ statelessProxy = opencoap_find_option(coap_incomingOptions, coap_incomingOptionsLen, COAP_OPTION_NUM_STATELESSPROXY);\n+ if (statelessProxy) {\n+ opencoap_handle_stateless_proxy(msg, &coap_header, coap_incomingOptions, coap_incomingOptionsLen);\n+ openqueue_freePacketBuffer(msg);\n+ return;\n+ }\n+\n//== Proxy Scheme option\nproxyScheme = opencoap_find_option(coap_incomingOptions, coap_incomingOptionsLen, COAP_OPTION_NUM_PROXYSCHEME);\nif (proxyScheme) {\nopencoap_handle_proxy_scheme(msg, &coap_header, coap_incomingOptions, coap_incomingOptionsLen);\n+ openqueue_freePacketBuffer(msg);\nreturn;\n}\n@@ -947,7 +965,6 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\n// verify that Proxy Scheme is set to coap\nproxyScheme = opencoap_find_option(incomingOptions, incomingOptionsLen, COAP_OPTION_NUM_PROXYSCHEME);\nif (memcmp(proxySchemeCoap, proxyScheme->pValue, sizeof(proxySchemeCoap)-1) != 0) {\n- openqueue_freePacketBuffer(msg);\nreturn;\n}\n@@ -955,12 +972,10 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\nuriHost = opencoap_find_option(incomingOptions, incomingOptionsLen, COAP_OPTION_NUM_URIHOST);\nif (uriHost) {\nif (memcmp(uriHost6tisch, uriHost->pValue, sizeof(uriHost6tisch)-1) != 0) {\n- openqueue_freePacketBuffer(msg);\nreturn;\n}\n}\nelse {\n- openqueue_freePacketBuffer(msg);\nreturn;\n}\n@@ -975,7 +990,6 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\n(errorparameter_t)0\n);\nopenqueue_freePacketBuffer(outgoingPacket);\n- openqueue_freePacketBuffer(msg);\nreturn;\n}\n@@ -990,8 +1004,12 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\noutgoingPacket->l4_sourcePortORicmpv6Type = WKP_UDP_COAP;\n// fill payload\n+ if (msg->length) {\npacketfunctions_reserveHeaderSize(outgoingPacket,msg->length);\nmemcpy(outgoingPacket->payload, msg->payload, msg->length);\n+ packetfunctions_reserveHeaderSize(outgoingPacket, 1);\n+ outgoingPacket->payload[0] = COAP_PAYLOAD_MARKER;\n+ }\n// process options\nfor (i = 0; i < incomingOptionsLen; i++) {\n@@ -1006,8 +1024,8 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\n}\nopencoap_add_stateless_proxy_option(&outgoingOptions[outgoingOptionsLen++],\n- msg->l3_sourceAdd.addr_128b,\n- 16,\n+ &msg->l3_sourceAdd.addr_128b[8],\n+ 8,\nmsg->l4_sourcePortORicmpv6Type);\n// encode options\n@@ -1022,8 +1040,6 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\nheader->messageID,\nheader->token);\n- openqueue_freePacketBuffer(msg);\n-\nif ((openudp_send(outgoingPacket))==E_FAIL) {\nopenqueue_freePacketBuffer(outgoingPacket);\n}\n@@ -1052,40 +1068,123 @@ void opencoap_add_stateless_proxy_option(coap_option_iht* option,\nuint8_t* address,\nuint8_t addressLen,\nuint16_t portNumber) {\n- uint8_t lenm;\n- uint8_t nonce[13];\n- owerror_t outStatus;\n+ uint8_t len;\n- lenm = 0;\n- opencoap_vars.statelessProxy.sequenceNumber++;\n+ // FIXME due to the lack of space in the 802.15.4 frame\n+ // we do not encrypt and authenticate the Stateless-Proxy state\n- // first byte is sequence number, authenticated but not encrypted\n- opencoap_vars.statelessProxy.buffer[0] = opencoap_vars.statelessProxy.sequenceNumber;\n+ len = 0;\n// next bytes are address\n- memcpy(&opencoap_vars.statelessProxy.buffer[1], address, addressLen);\n- lenm += addressLen;\n- memcpy(&opencoap_vars.statelessProxy.buffer[lenm+1], &portNumber, 2);\n- lenm += 2;\n-\n- memset(nonce, 0x00, 13);\n- nonce[12] = opencoap_vars.statelessProxy.sequenceNumber;\n- outStatus = cryptoengine_aes_ccms_enc(&opencoap_vars.statelessProxy.buffer[0],\n- 1,\n- &opencoap_vars.statelessProxy.buffer[1],\n- &lenm,\n- nonce,\n- 2, // L=2 -> 13 byte nonce\n- opencoap_vars.statelessProxy.key,\n- STATELESS_PROXY_TAG_LEN);\n- if (outStatus != E_SUCCESS) {\n- option->type = COAP_OPTION_NONE;\n- option->length = 0;\n- option->pValue = NULL;\n- return;\n+ memcpy(&opencoap_vars.statelessProxy.buffer[len], address, addressLen);\n+ len += addressLen;\n+\n+ if (portNumber != WKP_UDP_COAP) {\n+ packetfunctions_htons(portNumber, &opencoap_vars.statelessProxy.buffer[len]);\n+ len += 2;\n}\noption->type = COAP_OPTION_NUM_STATELESSPROXY;\n- option->length = lenm+1; // +1 for sequence number, includes the authentication tag\n+ option->length = len;\noption->pValue = opencoap_vars.statelessProxy.buffer;\n}\n+\n+void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\n+ coap_header_iht* header,\n+ coap_option_iht* incomingOptions,\n+ uint8_t incomingOptionsLen) {\n+ uint16_t portNumber;\n+ coap_option_iht* statelessProxy;\n+ uint8_t i;\n+ OpenQueueEntry_t* outgoingPacket;\n+ coap_option_iht outgoingOptions[MAX_COAP_OPTIONS];\n+ uint8_t outgoingOptionsLen;\n+ open_addr_t eui64;\n+ open_addr_t destIP;\n+ open_addr_t* prefix;\n+\n+ statelessProxy = opencoap_find_option(incomingOptions, incomingOptionsLen, COAP_OPTION_NUM_STATELESSPROXY);\n+ if (statelessProxy == NULL) {\n+ return;\n+ }\n+ // parse the value of Stateless Proxy\n+ if (statelessProxy->length < 8) {\n+ return;\n+ }\n+ eui64.type = ADDR_64B;\n+ memcpy(eui64.addr_64b, statelessProxy->pValue, 8);\n+\n+ prefix = idmanager_getMyID(ADDR_PREFIX);\n+ packetfunctions_mac64bToIp128b(prefix, &eui64, &destIP);\n+\n+ if (statelessProxy->length == 10) {\n+ portNumber = packetfunctions_ntohs(&statelessProxy->pValue[8]);\n+ }\n+ else if (statelessProxy->length == 8) {\n+ portNumber = WKP_UDP_COAP;\n+ }\n+ else {\n+ // unsupported\n+ return;\n+ }\n+\n+ outgoingOptionsLen = 0;\n+\n+ outgoingPacket = openqueue_getFreePacketBuffer(COMPONENT_OPENCOAP);\n+ if (outgoingPacket==NULL) {\n+ openserial_printError(\n+ COMPONENT_OPENCOAP,\n+ ERR_NO_FREE_PACKET_BUFFER,\n+ (errorparameter_t)0,\n+ (errorparameter_t)0\n+ );\n+ openqueue_freePacketBuffer(outgoingPacket);\n+ return;\n+ }\n+\n+ // take ownership over that packet and set destination IP and port\n+ outgoingPacket->creator = COMPONENT_OPENCOAP;\n+ outgoingPacket->owner = COMPONENT_OPENCOAP;\n+ outgoingPacket->l4_destination_port = portNumber;\n+ outgoingPacket->l3_destinationAdd.type = ADDR_128B;\n+ memcpy(outgoingPacket->l3_destinationAdd.addr_128b,destIP.addr_128b,16);\n+\n+ // fill in source port number\n+ outgoingPacket->l4_sourcePortORicmpv6Type = WKP_UDP_COAP;\n+\n+ // fill payload\n+ if (msg->length) {\n+ packetfunctions_reserveHeaderSize(outgoingPacket,msg->length);\n+ memcpy(outgoingPacket->payload, msg->payload, msg->length);\n+ packetfunctions_reserveHeaderSize(outgoingPacket, 1);\n+ outgoingPacket->payload[0] = COAP_PAYLOAD_MARKER;\n+ }\n+\n+ // process options\n+ for (i = 0; i < incomingOptionsLen; i++) {\n+ if (incomingOptions[i].type == COAP_OPTION_NUM_STATELESSPROXY) {\n+ continue;\n+ }\n+ outgoingOptions[outgoingOptionsLen].type = incomingOptions[i].type;\n+ outgoingOptions[outgoingOptionsLen].length = incomingOptions[i].length;\n+ outgoingOptions[outgoingOptionsLen].pValue = incomingOptions[i].pValue;\n+ outgoingOptionsLen++;\n+ }\n+\n+ // encode options\n+ opencoap_options_encode(outgoingPacket, outgoingOptions, outgoingOptionsLen, COAP_OPTION_CLASS_ALL);\n+\n+ // encode CoAP header\n+ opencoap_header_encode(outgoingPacket,\n+ header->Ver,\n+ header->T,\n+ header->TKL,\n+ header->Code,\n+ header->messageID,\n+ header->token);\n+\n+ if ((openudp_send(outgoingPacket))==E_FAIL) {\n+ openqueue_freePacketBuffer(outgoingPacket);\n+ }\n+}\n+\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Handle Stateless-Proxy option and forward the Join Response to pledge.
|
491,609
|
30.06.2017 16:11:37
| -7,200
|
b75feeed9800bcdbac44cd0e2894d4a6ba6dd155
|
Externalize message forwarding.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -42,6 +42,14 @@ void opencoap_add_stateless_proxy_option(coap_option_iht* option,\nuint8_t* address,\nuint8_t addressLen,\nuint16_t portNumber);\n+\n+void opencoap_forward_message(OpenQueueEntry_t *msg,\n+ coap_header_iht* header,\n+ coap_option_iht* outgoinOptions,\n+ uint8_t outgoingOptionsLen,\n+ open_addr_t* destIP,\n+ uint16_t destPortNumber);\n+\n//=========================== public ==========================================\n//===== from stack\n@@ -954,7 +962,6 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\nuint8_t incomingOptionsLen) {\nuint8_t i;\n- OpenQueueEntry_t* outgoingPacket;\ncoap_option_iht outgoingOptions[MAX_COAP_OPTIONS];\nuint8_t outgoingOptionsLen;\ncoap_option_iht *uriHost;\n@@ -981,36 +988,6 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\noutgoingOptionsLen = 0;\n- outgoingPacket = openqueue_getFreePacketBuffer(COMPONENT_OPENCOAP);\n- if (outgoingPacket==NULL) {\n- openserial_printError(\n- COMPONENT_OPENCOAP,\n- ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0\n- );\n- openqueue_freePacketBuffer(outgoingPacket);\n- return;\n- }\n-\n- // take ownership over that packet and set destination IP and port\n- outgoingPacket->creator = COMPONENT_OPENCOAP;\n- outgoingPacket->owner = COMPONENT_OPENCOAP;\n- outgoingPacket->l4_destination_port = WKP_UDP_COAP;\n- outgoingPacket->l3_destinationAdd.type = ADDR_128B;\n- memcpy(outgoingPacket->l3_destinationAdd.addr_128b,opencoap_vars.JRCaddress.addr_128b,16);\n-\n- // fill in source port number\n- outgoingPacket->l4_sourcePortORicmpv6Type = WKP_UDP_COAP;\n-\n- // fill payload\n- if (msg->length) {\n- packetfunctions_reserveHeaderSize(outgoingPacket,msg->length);\n- memcpy(outgoingPacket->payload, msg->payload, msg->length);\n- packetfunctions_reserveHeaderSize(outgoingPacket, 1);\n- outgoingPacket->payload[0] = COAP_PAYLOAD_MARKER;\n- }\n-\n// process options\nfor (i = 0; i < incomingOptionsLen; i++) {\nif (incomingOptions[i].type == COAP_OPTION_NUM_PROXYSCHEME ||\n@@ -1028,21 +1005,7 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\n8,\nmsg->l4_sourcePortORicmpv6Type);\n- // encode options\n- opencoap_options_encode(outgoingPacket, outgoingOptions, outgoingOptionsLen, COAP_OPTION_CLASS_ALL);\n-\n- // encode CoAP header\n- opencoap_header_encode(outgoingPacket,\n- header->Ver,\n- header->T,\n- header->TKL,\n- header->Code,\n- header->messageID,\n- header->token);\n-\n- if ((openudp_send(outgoingPacket))==E_FAIL) {\n- openqueue_freePacketBuffer(outgoingPacket);\n- }\n+ opencoap_forward_message(msg, header, outgoingOptions, outgoingOptionsLen, &opencoap_vars.JRCaddress, WKP_UDP_COAP);\n}\nvoid opencoap_header_encode(OpenQueueEntry_t *msg,\n@@ -1096,7 +1059,6 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\nuint16_t portNumber;\ncoap_option_iht* statelessProxy;\nuint8_t i;\n- OpenQueueEntry_t* outgoingPacket;\ncoap_option_iht outgoingOptions[MAX_COAP_OPTIONS];\nuint8_t outgoingOptionsLen;\nopen_addr_t eui64;\n@@ -1130,6 +1092,29 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\noutgoingOptionsLen = 0;\n+ // process options\n+ for (i = 0; i < incomingOptionsLen; i++) {\n+ if (incomingOptions[i].type == COAP_OPTION_NUM_STATELESSPROXY) {\n+ continue;\n+ }\n+ outgoingOptions[outgoingOptionsLen].type = incomingOptions[i].type;\n+ outgoingOptions[outgoingOptionsLen].length = incomingOptions[i].length;\n+ outgoingOptions[outgoingOptionsLen].pValue = incomingOptions[i].pValue;\n+ outgoingOptionsLen++;\n+ }\n+\n+ opencoap_forward_message(msg, header, outgoingOptions, outgoingOptionsLen, &destIP, portNumber);\n+}\n+\n+void opencoap_forward_message(OpenQueueEntry_t *msg,\n+ coap_header_iht* header,\n+ coap_option_iht* outgoingOptions,\n+ uint8_t outgoingOptionsLen,\n+ open_addr_t* destIP,\n+ uint16_t destPortNumber) {\n+\n+ OpenQueueEntry_t* outgoingPacket;\n+\noutgoingPacket = openqueue_getFreePacketBuffer(COMPONENT_OPENCOAP);\nif (outgoingPacket==NULL) {\nopenserial_printError(\n@@ -1145,9 +1130,9 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\n// take ownership over that packet and set destination IP and port\noutgoingPacket->creator = COMPONENT_OPENCOAP;\noutgoingPacket->owner = COMPONENT_OPENCOAP;\n- outgoingPacket->l4_destination_port = portNumber;\n+ outgoingPacket->l4_destination_port = destPortNumber;\noutgoingPacket->l3_destinationAdd.type = ADDR_128B;\n- memcpy(outgoingPacket->l3_destinationAdd.addr_128b,destIP.addr_128b,16);\n+ memcpy(outgoingPacket->l3_destinationAdd.addr_128b,destIP->addr_128b,16);\n// fill in source port number\noutgoingPacket->l4_sourcePortORicmpv6Type = WKP_UDP_COAP;\n@@ -1160,17 +1145,6 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\noutgoingPacket->payload[0] = COAP_PAYLOAD_MARKER;\n}\n- // process options\n- for (i = 0; i < incomingOptionsLen; i++) {\n- if (incomingOptions[i].type == COAP_OPTION_NUM_STATELESSPROXY) {\n- continue;\n- }\n- outgoingOptions[outgoingOptionsLen].type = incomingOptions[i].type;\n- outgoingOptions[outgoingOptionsLen].length = incomingOptions[i].length;\n- outgoingOptions[outgoingOptionsLen].pValue = incomingOptions[i].pValue;\n- outgoingOptionsLen++;\n- }\n-\n// encode options\nopencoap_options_encode(outgoingPacket, outgoingOptions, outgoingOptionsLen, COAP_OPTION_CLASS_ALL);\n@@ -1187,4 +1161,3 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\nopenqueue_freePacketBuffer(outgoingPacket);\n}\n}\n-\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -708,6 +708,9 @@ functionsToChange = [\n'opencoap_options_encode',\n'opencoap_options_parse',\n'opencoap_handle_proxy_scheme',\n+ 'opencoap_handle_stateless_proxy',\n+ 'opencoap_add_stateless_proxy_option',\n+ 'opencoap_forward_message',\n'icmpv6coap_timer_cb',\n# oscoap\n'openoscoap_init_security_context',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Externalize message forwarding.
|
491,609
|
30.06.2017 16:17:13
| -7,200
|
6c4ab16ea1f50037dbe0493cf14ba5b133b92518
|
Reorder functions in opencoap.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -1008,50 +1008,6 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\nopencoap_forward_message(msg, header, outgoingOptions, outgoingOptionsLen, &opencoap_vars.JRCaddress, WKP_UDP_COAP);\n}\n-void opencoap_header_encode(OpenQueueEntry_t *msg,\n- uint8_t version,\n- coap_type_t type,\n- uint8_t TKL,\n- coap_code_t code,\n- uint16_t messageID,\n- uint8_t *token) {\n- // pre-pend CoAP header (version,type,TKL,code,messageID,Token)\n- packetfunctions_reserveHeaderSize(msg,4+TKL);\n- msg->payload[0] = (version << 6) |\n- (type << 4) |\n- (TKL << 0);\n- msg->payload[1] = code;\n- msg->payload[2] = (messageID>>8) & 0xff;\n- msg->payload[3] = (messageID>>0) & 0xff;\n-\n- memcpy(&msg->payload[4],token,TKL);\n-}\n-\n-void opencoap_add_stateless_proxy_option(coap_option_iht* option,\n- uint8_t* address,\n- uint8_t addressLen,\n- uint16_t portNumber) {\n- uint8_t len;\n-\n- // FIXME due to the lack of space in the 802.15.4 frame\n- // we do not encrypt and authenticate the Stateless-Proxy state\n-\n- len = 0;\n-\n- // next bytes are address\n- memcpy(&opencoap_vars.statelessProxy.buffer[len], address, addressLen);\n- len += addressLen;\n-\n- if (portNumber != WKP_UDP_COAP) {\n- packetfunctions_htons(portNumber, &opencoap_vars.statelessProxy.buffer[len]);\n- len += 2;\n- }\n-\n- option->type = COAP_OPTION_NUM_STATELESSPROXY;\n- option->length = len;\n- option->pValue = opencoap_vars.statelessProxy.buffer;\n-}\n-\nvoid opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\ncoap_header_iht* header,\ncoap_option_iht* incomingOptions,\n@@ -1106,6 +1062,50 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\nopencoap_forward_message(msg, header, outgoingOptions, outgoingOptionsLen, &destIP, portNumber);\n}\n+void opencoap_header_encode(OpenQueueEntry_t *msg,\n+ uint8_t version,\n+ coap_type_t type,\n+ uint8_t TKL,\n+ coap_code_t code,\n+ uint16_t messageID,\n+ uint8_t *token) {\n+ // pre-pend CoAP header (version,type,TKL,code,messageID,Token)\n+ packetfunctions_reserveHeaderSize(msg,4+TKL);\n+ msg->payload[0] = (version << 6) |\n+ (type << 4) |\n+ (TKL << 0);\n+ msg->payload[1] = code;\n+ msg->payload[2] = (messageID>>8) & 0xff;\n+ msg->payload[3] = (messageID>>0) & 0xff;\n+\n+ memcpy(&msg->payload[4],token,TKL);\n+}\n+\n+void opencoap_add_stateless_proxy_option(coap_option_iht* option,\n+ uint8_t* address,\n+ uint8_t addressLen,\n+ uint16_t portNumber) {\n+ uint8_t len;\n+\n+ // FIXME due to the lack of space in the 802.15.4 frame\n+ // we do not encrypt and authenticate the Stateless-Proxy state\n+\n+ len = 0;\n+\n+ // next bytes are address\n+ memcpy(&opencoap_vars.statelessProxy.buffer[len], address, addressLen);\n+ len += addressLen;\n+\n+ if (portNumber != WKP_UDP_COAP) {\n+ packetfunctions_htons(portNumber, &opencoap_vars.statelessProxy.buffer[len]);\n+ len += 2;\n+ }\n+\n+ option->type = COAP_OPTION_NUM_STATELESSPROXY;\n+ option->length = len;\n+ option->pValue = opencoap_vars.statelessProxy.buffer;\n+}\n+\nvoid opencoap_forward_message(OpenQueueEntry_t *msg,\ncoap_header_iht* header,\ncoap_option_iht* outgoingOptions,\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Reorder functions in opencoap.
|
491,609
|
30.06.2017 16:47:11
| -7,200
|
d16e6765106ce1277fbc2547a6a5761e01d3bd5d
|
Add helper function to recognize link-local IPv6 addresses.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.c",
"new_path": "openstack/cross-layers/packetfunctions.c",
"diff": "@@ -162,6 +162,23 @@ bool packetfunctions_isAllHostsMulticast(open_addr_t* address) {\nreturn FALSE;\n}\n+bool packetfunctions_isLinkLocal(open_addr_t* address) {\n+ if (\n+ address->type == ADDR_128B &&\n+ address->addr_128b[0] == 0xfe &&\n+ address->addr_128b[1] == 0x80 &&\n+ address->addr_128b[2] == 0x00 &&\n+ address->addr_128b[3] == 0x00 &&\n+ address->addr_128b[4] == 0x00 &&\n+ address->addr_128b[5] == 0x00 &&\n+ address->addr_128b[6] == 0x00 &&\n+ address->addr_128b[7] == 0x00\n+ ) {\n+ return TRUE;\n+ }\n+ return FALSE;\n+}\n+\nbool packetfunctions_sameAddress(open_addr_t* address_1, open_addr_t* address_2) {\nuint8_t address_length;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Add helper function to recognize link-local IPv6 addresses.
|
491,595
|
03.07.2017 13:10:59
| -7,200
|
6061c0f719ee761ba656ee6a53a2414e09e3c419
|
dio needs to be generated with randomly period to avoid collision.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -83,9 +83,9 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.timerIdDIO = opentimers_create();\nopentimers_scheduleIn(\nicmpv6rpl_vars.timerIdDIO,\n- icmpv6rpl_vars.dioPeriod,\n+ 872 +(openrandom_get16b()&0xff),\nTIME_MS,\n- TIMER_PERIODIC,\n+ TIMER_ONESHOT,\nicmpv6rpl_timer_DIO_cb\n);\n@@ -132,9 +132,9 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.timerIdDAO = opentimers_create();\nopentimers_scheduleIn(\nicmpv6rpl_vars.timerIdDAO,\n- icmpv6rpl_vars.daoPeriod,\n+ 872 +(openrandom_get16b()&0xff),\nTIME_MS,\n- TIMER_PERIODIC,\n+ TIMER_ONESHOT,\nicmpv6rpl_timer_DAO_cb\n);\n}\n@@ -516,6 +516,14 @@ void icmpv6rpl_killPreferredParent() {\n*/\nvoid icmpv6rpl_timer_DIO_cb(opentimers_id_t id) {\nscheduler_push_task(icmpv6rpl_timer_DIO_task,TASKPRIO_RPL);\n+ // update the period\n+ opentimers_scheduleIn(\n+ icmpv6rpl_vars.timerIdDIO,\n+ 872 +(openrandom_get16b()&0xff),\n+ TIME_MS,\n+ TIMER_ONESHOT,\n+ icmpv6rpl_timer_DIO_cb\n+ );\n}\n/**\n@@ -524,7 +532,15 @@ void icmpv6rpl_timer_DIO_cb(opentimers_id_t id) {\n\\note This function is executed in task context, called by the scheduler.\n*/\nvoid icmpv6rpl_timer_DIO_task() {\n+ icmpv6rpl_vars.dioTimerCounter = (icmpv6rpl_vars.dioTimerCounter+1)%icmpv6rpl_vars.dioPeriod;\n+ switch (icmpv6rpl_vars.dioTimerCounter) {\n+ case 0:\n+ // called every TIMER_DIO_TIMEOUT seconds\nsendDIO();\n+ break;\n+ default:\n+ break;\n+ }\n}\n/**\n@@ -619,6 +635,14 @@ void sendDIO() {\n*/\nvoid icmpv6rpl_timer_DAO_cb(opentimers_id_t id) {\nscheduler_push_task(icmpv6rpl_timer_DAO_task,TASKPRIO_RPL);\n+ // update the period\n+ opentimers_scheduleIn(\n+ icmpv6rpl_vars.timerIdDAO,\n+ 872 +(openrandom_get16b()&0xff),\n+ TIME_MS,\n+ TIMER_ONESHOT,\n+ icmpv6rpl_timer_DAO_cb\n+ );\n}\n/**\n@@ -627,7 +651,15 @@ void icmpv6rpl_timer_DAO_cb(opentimers_id_t id) {\n\\note This function is executed in task context, called by the scheduler.\n*/\nvoid icmpv6rpl_timer_DAO_task() {\n+ icmpv6rpl_vars.daoTimerCounter = (icmpv6rpl_vars.daoTimerCounter+1)%icmpv6rpl_vars.daoPeriod;\n+ switch (icmpv6rpl_vars.daoTimerCounter) {\n+ case 0:\n+ // called every TIMER_DAO_TIMEOUT seconds\nsendDAO();\n+ break;\n+ default:\n+ break;\n+ }\n}\n/**\n@@ -795,11 +827,13 @@ void sendDAO() {\n}\nvoid icmpv6rpl_setDIOPeriod(uint16_t dioPeriod){\n- icmpv6rpl_vars.dioPeriod = dioPeriod;\n+ // convert to seconds\n+ icmpv6rpl_vars.dioPeriod = dioPeriod/1000;\n}\nvoid icmpv6rpl_setDAOPeriod(uint16_t daoPeriod){\n- icmpv6rpl_vars.daoPeriod = daoPeriod;\n+ // convert to seconds\n+ icmpv6rpl_vars.daoPeriod = daoPeriod/1000;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.h",
"new_path": "openstack/03b-IPv6/icmpv6rpl.h",
"diff": "//=========================== define ==========================================\n-#define TIMER_DIO_TIMEOUT 10000 // miliseconds\n-#define TIMER_DAO_TIMEOUT 60000 // miliseconds\n+#define TIMER_DIO_TIMEOUT 10 // seconds\n+#define TIMER_DAO_TIMEOUT 60 // seconds\n// Non-Storing Mode of Operation (1)\n#define MOP_DIO_A 0<<5\n@@ -144,7 +144,7 @@ typedef struct {\n// DIO-related\nicmpv6rpl_dio_ht dio; ///< pre-populated DIO packet.\nopen_addr_t dioDestination; ///< IPv6 destination address for DIOs.\n-// uint16_t dioTimerCounter; ///< counter to determine when to send DIO.\n+ uint16_t dioTimerCounter; ///< counter to determine when to send DIO.\nopentimers_id_t timerIdDIO; ///< ID of the timer used to send DIOs.\nuint16_t dioPeriod; ///< dio period in seconds.\n// DAO-related\n@@ -152,7 +152,7 @@ typedef struct {\nicmpv6rpl_dao_transit_ht dao_transit; ///< pre-populated DAO \"Transit Info\" option header.\nicmpv6rpl_dao_target_ht dao_target; ///< pre-populated DAO \"Transit Info\" option header.\nopentimers_id_t timerIdDAO; ///< ID of the timer used to send DAOs.\n-// uint16_t daoTimerCounter; ///< counter to determine when to send DAO.\n+ uint16_t daoTimerCounter; ///< counter to determine when to send DAO.\nuint16_t daoPeriod; ///< dao period in seconds.\n// routing table\ndagrank_t myDAGrank; ///< rank of this router within DAG.\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-635. dio needs to be generated with randomly period to avoid collision.
|
491,609
|
03.07.2017 18:44:52
| -7,200
|
2c4f88910ebfb2804cf81f31ea73202c8d4130fd
|
Remove the need for explicit setting of JRC address in opencoap.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "#include \"opentimers.h\"\n#include \"scheduler.h\"\n#include \"cryptoengine.h\"\n+#include \"icmpv6rpl.h\"\n//=========================== defines =========================================\nopencoap_vars_t opencoap_vars;\n-static const uint8_t ipAddr_jce[] = {0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};\n-\n//=========================== prototype =======================================\nvoid opencoap_header_encode(OpenQueueEntry_t *msg,\nuint8_t version,\n@@ -69,10 +67,6 @@ void opencoap_init() {\n// initialize the messageID\nopencoap_vars.messageID = openrandom_get16b();\n- // initialize the JRC address\n- opencoap_vars.JRCaddress.type = ADDR_128B;\n- memcpy(opencoap_vars.JRCaddress.addr_128b, ipAddr_jce, 16);\n-\n// stateless proxy vars\n//generate a key at random\n@@ -968,6 +962,7 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\ncoap_option_iht *proxyScheme;\nconst uint8_t proxySchemeCoap[] = \"coap\";\nconst uint8_t uriHost6tisch[] = \"6tisch.arpa\";\n+ open_addr_t JRCaddress;\n// verify that Proxy Scheme is set to coap\nproxyScheme = opencoap_find_option(incomingOptions, incomingOptionsLen, COAP_OPTION_NUM_PROXYSCHEME);\n@@ -1005,7 +1000,12 @@ void opencoap_handle_proxy_scheme(OpenQueueEntry_t *msg,\n8,\nmsg->l4_sourcePortORicmpv6Type);\n- opencoap_forward_message(msg, header, outgoingOptions, outgoingOptionsLen, &opencoap_vars.JRCaddress, WKP_UDP_COAP);\n+ // the JRC is co-located with DAG root, get the address from RPL module\n+ JRCaddress.type = ADDR_128B;\n+ if (icmpv6rpl_getRPLDODAGid(JRCaddress.addr_128b) == E_SUCCESS) {\n+ opencoap_forward_message(msg, header, outgoingOptions, outgoingOptionsLen, &JRCaddress, WKP_UDP_COAP);\n+ }\n+ return;\n}\nvoid opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.h",
"new_path": "openapps/opencoap/opencoap.h",
"diff": "@@ -212,7 +212,6 @@ typedef struct {\nbool busySending;\nuint8_t delayCounter;\nuint16_t messageID;\n- open_addr_t JRCaddress;\ncoap_statelessproxy_vars_t statelessProxy;\n} opencoap_vars_t;\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -162,8 +162,12 @@ uint8_t icmpv6rpl_getRPLIntanceID(){\nreturn icmpv6rpl_vars.dao.rplinstanceId;\n}\n-void icmpv6rpl_getRPLDODAGid(uint8_t* address_128b){\n+owerror_t icmpv6rpl_getRPLDODAGid(uint8_t* address_128b){\n+ if (icmpv6rpl_vars.fDodagidWritten) {\nmemcpy(address_128b,icmpv6rpl_vars.dao.DODAGID,16);\n+ return E_SUCCESS;\n+ }\n+ return E_FAIL;\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.h",
"new_path": "openstack/03b-IPv6/icmpv6rpl.h",
"diff": "@@ -171,7 +171,7 @@ void icmpv6rpl_sendDone(OpenQueueEntry_t* msg, owerror_t error);\nvoid icmpv6rpl_receive(OpenQueueEntry_t* msg);\nvoid icmpv6rpl_writeDODAGid(uint8_t* dodagid);\nuint8_t icmpv6rpl_getRPLIntanceID(void);\n-void icmpv6rpl_getRPLDODAGid(uint8_t* address_128b);\n+owerror_t icmpv6rpl_getRPLDODAGid(uint8_t* address_128b);\nvoid icmpv6rpl_setDIOPeriod(uint16_t dioPeriod);\nvoid icmpv6rpl_setDAOPeriod(uint16_t daoPeriod);\nbool icmpv6rpl_getPreferredParentIndex(uint8_t* indexptr); // new DB\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Remove the need for explicit setting of JRC address in opencoap.
|
491,609
|
04.07.2017 13:46:43
| -7,200
|
afbe7111620d3f0f84449ba16ad4c038e1ff07cf
|
Minimal implementation of 15.4 security processing.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.c",
"new_path": "openstack/02a-MAClow/IEEE802154_security.c",
"diff": "@@ -34,135 +34,18 @@ ieee802154_security_vars_t ieee802154_security_vars;\n//=========================== prototypes ======================================\n-void IEEE802154_security_getFrameCounter(macFrameCounter_t reference,\n- uint8_t* array);\n-uint8_t IEEE802154_security_authLengthChecking(uint8_t securityLevel);\n-\n-uint8_t IEEE802154_security_auxLengthChecking(uint8_t KeyIdMode,\n- uint8_t frameCounterSuppression,\n- uint8_t frameCounterSize);\n-\n-bool IEEE802154_security_incomingKeyUsagePolicyChecking(m_keyDescriptor* keydesc,\n- uint8_t frameType,\n- uint8_t cfi);\n-\n-bool IEEE802154_security_incomingSecurityLevelChecking(m_securityLevelDescriptor* secLevDesc,\n- uint8_t secLevel,\n- bool exempt);\n-\n-m_securityLevelDescriptor* IEEE802154_security_securityLevelDescriptorLookup(uint8_t frameType,\n- uint8_t cfi);\n-\n-m_deviceDescriptor* IEEE802154_security_deviceDescriptorLookup(open_addr_t* address,\n- open_addr_t* PANID,\n- m_keyDescriptor* keyDescriptor);\n-\n-m_keyDescriptor* IEEE802154_security_keyDescriptorLookup(uint8_t KeyIdMode,\n- open_addr_t* keySource,\n- uint8_t KeyIndex,\n- open_addr_t* DeviceAddress,\n- open_addr_t* panID,\n- uint8_t frameType);\n-\n//=========================== admin ===========================================\n/**\n\\brief Initialization of security tables and parameters.\n*/\nvoid IEEE802154_security_init(void) {\n- uint8_t i;\n- //Setting UP Phase\n-\n- // copy key1\n- memset(&ieee802154_security_vars.Key_1[0], 0, 16);\n+ // copy beacon key (key 1)\nmemcpy(&ieee802154_security_vars.Key_1[0], &key1[0], 16);\n- //Initialization of the MAC Security Level Table\n- for (i = 0; i < IEEE154_TYPE_UNDEFINED; i++) { // iterate through all frame types\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].FrameType = i;\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].CommandFrameIdentifier = 0;\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].DeviceOverrideSecurityMinimum = FALSE;\n- //list of allowed security levels\n- if (i == IEEE154_TYPE_BEACON){ // beacons can only be authenticated but not encrypted\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].AllowedSecurityLevels[0] = IEEE154_ASH_SLF_TYPE_MIC_32;\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].AllowedSecurityLevels[1] = IEEE154_ASH_SLF_TYPE_MIC_64;\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].AllowedSecurityLevels[2] = IEEE154_ASH_SLF_TYPE_MIC_128;\n- } else { // all other frame types are encrypted + authenticated\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].AllowedSecurityLevels[0] = IEEE154_ASH_SLF_TYPE_ENC_MIC_32;\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].AllowedSecurityLevels[1] = IEEE154_ASH_SLF_TYPE_ENC_MIC_64;\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].AllowedSecurityLevels[2] = IEEE154_ASH_SLF_TYPE_ENC_MIC_128;\n- }\n- ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].SecurityMinimum = IEEE154_ASH_SLF_TYPE_ENC_MIC_32;\n- }\n-\n- //Initialization of MAC KEY TABLE\n- memset(&ieee802154_security_vars.MacKeyTable,\n- 0,\n- sizeof(m_macKeyTable));\n-\n- //Initialization of MAC DEVICE TABLE\n- memset(&ieee802154_security_vars.MacDeviceTable,\n- 0,\n- sizeof(m_macDeviceTable));\n-\n- //Initialization of Frame Counter\n- ieee802154_security_vars.m_macFrameCounterMode = 0x05; // For TSCH, we use implicit 5 byte Frame Counter (ASN)\n-\n- //macDefaultKeySource - shared\n- ieee802154_security_vars.m_macDefaultKeySource.type = ADDR_64B;\n- ieee802154_security_vars.m_macDefaultKeySource.addr_64b[0] = 0x14;\n- ieee802154_security_vars.m_macDefaultKeySource.addr_64b[1] = 0x15;\n- ieee802154_security_vars.m_macDefaultKeySource.addr_64b[2] = 0x92;\n- ieee802154_security_vars.m_macDefaultKeySource.addr_64b[3] = 0x00;\n- ieee802154_security_vars.m_macDefaultKeySource.addr_64b[4] = 0x00;\n- ieee802154_security_vars.m_macDefaultKeySource.addr_64b[5] = 0x15;\n- ieee802154_security_vars.m_macDefaultKeySource.addr_64b[6] = 0x16;\n- ieee802154_security_vars.m_macDefaultKeySource.addr_64b[7] = 0x5a;\n-\n- //store the key and related attributes\n- //Creation of the KeyDescriptor\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].KeyIdLookupList.KeyIdMode = IEEE154_ASH_KEYIDMODE_DEFAULTKEYSOURCE;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].KeyIdLookupList.KeyIndex = IEEE802154_SECURITY_K1_KEY_INDEX;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].KeyIdLookupList.KeySource.type = ADDR_64B;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].KeyIdLookupList.KeySource = ieee802154_security_vars.m_macDefaultKeySource;\n-\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].KeyIdLookupList.Address = ieee802154_security_vars.m_macDefaultKeySource;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].KeyIdLookupList.PANId = *(idmanager_getMyID(ADDR_PANID));\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].KeyUsageList[0].FrameType = IEEE154_TYPE_BEACON;\n-\n- memcpy(&ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].key[0],\n- &ieee802154_security_vars.Key_1[0],\n- 16);\n-\n- ieee802154_security_vars.MacDeviceTable.DeviceDescriptorEntry[0].deviceAddress = ieee802154_security_vars.m_macDefaultKeySource;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[0].DeviceTable = &ieee802154_security_vars.MacDeviceTable;\n-\n- //copy key2\n- memset(&ieee802154_security_vars.Key_2[0], 0, 16);\n- memset(&ieee802154_security_vars.Key_2[0], &key2[0], 16);\n-\n- //store the key 2 and related attributes\n- //Creation of the KeyDescriptor - Key 2 should be used to encrypt and authenticate data, command and ack frames\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyIdLookupList.KeyIdMode = IEEE154_ASH_KEYIDMODE_DEFAULTKEYSOURCE;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyIdLookupList.KeyIndex = IEEE802154_SECURITY_K2_KEY_INDEX;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyIdLookupList.KeySource.type = ADDR_64B;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyIdLookupList.KeySource = ieee802154_security_vars.m_macDefaultKeySource;\n-\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyIdLookupList.Address = ieee802154_security_vars.m_macDefaultKeySource;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyIdLookupList.PANId = *(idmanager_getMyID(ADDR_PANID));\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyUsageList[0].FrameType = IEEE154_TYPE_DATA;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyUsageList[1].FrameType = IEEE154_TYPE_ACK;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].KeyUsageList[2].FrameType = IEEE154_TYPE_CMD;\n-\n- memcpy(&ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].key[0],\n- &ieee802154_security_vars.Key_2[0],\n- 16);\n-\n- ieee802154_security_vars.MacDeviceTable.DeviceDescriptorEntry[1].deviceAddress = ieee802154_security_vars.m_macDefaultKeySource;\n- ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[1].DeviceTable = &ieee802154_security_vars.MacDeviceTable;\n-\n- ieee802154_security_vars.minimal = IEEE802154_SECURITY_MINIMAL_PROC;\n+ // copy data key (key 2)\n+ memcpy(&ieee802154_security_vars.Key_2[0], &key2[0], 16);\n}\n//=========================== public ==========================================\n@@ -184,8 +67,8 @@ void IEEE802154_security_prependAuxiliarySecurityHeader(OpenQueueEntry_t* msg){\n//length of auxiliary security header\nauxiliaryLength = IEEE802154_security_auxLengthChecking(msg->l2_keyIdMode,\n- frameCounterSuppression,\n- ieee802154_security_vars.m_macFrameCounterMode); //length of Key ID field\n+ frameCounterSuppression, // frame counter suppressed\n+ 0); //length of Key ID field\nif ((msg->length+auxiliaryLength+msg->l2_authenticationLength+2) >= 128 ){ //2 bytes of CRC, 127 MaxPHYPacketSize\n@@ -202,11 +85,7 @@ void IEEE802154_security_prependAuxiliarySecurityHeader(OpenQueueEntry_t* msg){\n//insert the keyIdMode field\nswitch (msg->l2_keyIdMode){\ncase IEEE154_ASH_KEYIDMODE_IMPLICIT: //no KeyIDMode field - implicit\n- temp_keySource = &ieee802154_security_vars.m_macDefaultKeySource;\n- memcpy(&(msg->l2_keySource), temp_keySource, sizeof(open_addr_t));\n- break;\ncase IEEE154_ASH_KEYIDMODE_DEFAULTKEYSOURCE:// macDefaultKeySource\n- msg->l2_keySource = ieee802154_security_vars.m_macDefaultKeySource;\nbreak;\ncase IEEE154_ASH_KEYIDMODE_EXPLICIT_16: //keySource with 16b address\ntemp_keySource = &msg->l2_keySource;\n@@ -226,20 +105,6 @@ void IEEE802154_security_prependAuxiliarySecurityHeader(OpenQueueEntry_t* msg){\nreturn;\n}\n- //Frame Counter\n- if (frameCounterSuppression == IEEE154_ASH_FRAMECOUNTER_PRESENT){\n- //here I have to insert the ASN: I can only reserve the space and\n- //save the pointer. The ASN will be added by IEEE802.15.4e\n-\n- // reserve space\n- packetfunctions_reserveHeaderSize(msg,sizeof(macFrameCounter_t));\n-\n- // Keep a pointer to where the ASN will be\n- // Note: the actual value of the current ASN will be written by the\n- // IEEE802.15.4e when transmitting\n- msg->l2_FrameCounter = msg->payload;\n- }\n-\n//security control field\npacketfunctions_reserveHeaderSize(msg, sizeof(uint8_t));\n@@ -248,11 +113,7 @@ void IEEE802154_security_prependAuxiliarySecurityHeader(OpenQueueEntry_t* msg){\ntemp8b |= msg->l2_keyIdMode << IEEE154_ASH_SCF_KEY_IDENTIFIER_MODE;//2b\ntemp8b |= frameCounterSuppression << IEEE154_ASH_SCF_FRAME_CNT_MODE; //1b\n- if (ieee802154_security_vars.m_macFrameCounterMode == 0x04) { // 4 byte Frame Counter\n- temp8b |= 0 << IEEE154_ASH_SCF_FRAME_CNT_SIZE; //1b\n- } else { // 5 byte Frame Counter\ntemp8b |= 1 << IEEE154_ASH_SCF_FRAME_CNT_SIZE; //1b\n- }\ntemp8b |= 0 << 1;//1b reserved\n*((uint8_t*)(msg->payload)) = temp8b;\n@@ -262,8 +123,6 @@ void IEEE802154_security_prependAuxiliarySecurityHeader(OpenQueueEntry_t* msg){\n\\brief Key searching and encryption/authentication operations.\n*/\nowerror_t IEEE802154_security_outgoingFrameSecurity(OpenQueueEntry_t* msg){\n- uint8_t frameCounterSuppression;\n- m_keyDescriptor* keyDescriptor;\nuint8_t nonce[13];\nuint8_t *key;\nowerror_t outStatus;\n@@ -271,43 +130,8 @@ owerror_t IEEE802154_security_outgoingFrameSecurity(OpenQueueEntry_t* msg){\nuint8_t len_a;\nuint8_t* m;\nuint8_t len_m;\n- uint8_t vectASN[5];\n- macFrameCounter_t l2_frameCounter;\n-\n- if (ieee802154_security_vars.minimal == 0) {\n- //the frame counter is carried in the frame, otherwise 1;\n- frameCounterSuppression = IEEE154_ASH_FRAMECOUNTER_SUPPRESSED;\n-\n- //search for a key\n- keyDescriptor = IEEE802154_security_keyDescriptorLookup(msg->l2_keyIdMode,\n- &msg->l2_keySource,\n- msg->l2_keyIndex,\n- &msg->l2_keySource,\n- (idmanager_getMyID(ADDR_PANID)),\n- msg->l2_frameType);\n-\n- if (keyDescriptor==NULL){ //key not found\n- openserial_printError(COMPONENT_SECURITY,ERR_SECURITY,\n- (errorparameter_t)msg->l2_frameType,\n- (errorparameter_t)1);\n- return E_FAIL;\n- }\n- key = keyDescriptor->key;\n-\n- if (frameCounterSuppression == IEEE154_ASH_FRAMECOUNTER_PRESENT){//the frame Counter is carried in the frame\n- ieee154e_getAsn(vectASN);//gets asn from mac layer.\n- // save the frame counter of the current frame\n- l2_frameCounter.bytes0and1 = vectASN[0]+256*vectASN[1];\n- l2_frameCounter.bytes2and3 = vectASN[2]+256*vectASN[3];\n- l2_frameCounter.byte4 = vectASN[4];\n-\n- IEEE802154_security_getFrameCounter(l2_frameCounter,\n- msg->l2_FrameCounter);\n- } //otherwise the frame counter is not in the frame\n- } else { // minimal processing for efficiency\nkey = msg->l2_frameType == IEEE154_TYPE_BEACON ? ieee802154_security_vars.Key_1 : ieee802154_security_vars.Key_2;\n- }\n// First 8 bytes of the nonce are always the source address of the frame\nmemcpy(&nonce[0],idmanager_getMyID(ADDR_64B)->addr_64b,8);\n@@ -387,7 +211,7 @@ void IEEE802154_security_retrieveAuxiliarySecurityHeader(OpenQueueEntry_t*\nuint8_t temp8b;\nuint8_t i;\nuint8_t receivedASN[5];\n- open_addr_t* temp_addr;\n+ macFrameCounter_t l2_frameCounter;\n//Retrieve the Security Control field\n//1byte, Security Control Field\n@@ -414,7 +238,6 @@ void IEEE802154_security_retrieveAuxiliarySecurityHeader(OpenQueueEntry_t*\ntempheader->headerLength++;\n//Frame Counter field\n- macFrameCounter_t l2_frameCounter;\nif (frameCnt_Suppression == IEEE154_ASH_FRAMECOUNTER_PRESENT) { //the frame counter is here\n//the frame counter size can be 4 or 5 bytes\nfor (i=0;i<frameCnt_Size;i++){\n@@ -440,12 +263,9 @@ void IEEE802154_security_retrieveAuxiliarySecurityHeader(OpenQueueEntry_t*\n//retrieve the Key Identifier field\nswitch (msg->l2_keyIdMode){\ncase IEEE154_ASH_KEYIDMODE_IMPLICIT:\n- //key is derived implicitly\n- temp_addr = &ieee802154_security_vars.m_macDefaultKeySource;\n- memcpy(&(msg->l2_keySource), temp_addr, sizeof(open_addr_t));\n- break;\ncase IEEE154_ASH_KEYIDMODE_DEFAULTKEYSOURCE:\n- msg->l2_keySource = ieee802154_security_vars.m_macDefaultKeySource;\n+ //key is derived implicitly\n+ memcpy(&(msg->l2_keySource), &tempheader->src, sizeof(open_addr_t));\nbreak;\ncase IEEE154_ASH_KEYIDMODE_EXPLICIT_16:\npacketfunctions_readAddress(((uint8_t*)(msg->payload)+tempheader->headerLength),\n@@ -477,17 +297,12 @@ void IEEE802154_security_retrieveAuxiliarySecurityHeader(OpenQueueEntry_t*\n//key is derived implicitly\nmsg->l2_keyIndex = 1;\n}\n-\n}\n/**\n\\brief Identification of the key used to protect the frame and unsecuring operations.\n*/\nowerror_t IEEE802154_security_incomingFrame(OpenQueueEntry_t* msg){\n-\n- m_deviceDescriptor* deviceDescriptor;\n- m_keyDescriptor* keyDescriptor;\n- m_securityLevelDescriptor* securityLevelDescriptor;\nuint8_t nonce[13];\nowerror_t outStatus;\nuint8_t* a;\n@@ -496,72 +311,7 @@ owerror_t IEEE802154_security_incomingFrame(OpenQueueEntry_t* msg){\nuint8_t len_c;\nuint8_t *key;\n- if (ieee802154_security_vars.minimal == 0) {\n- //key descriptor lookup procedure\n- keyDescriptor = IEEE802154_security_keyDescriptorLookup(msg->l2_keyIdMode,\n- &msg->l2_keySource,\n- msg->l2_keyIndex,\n- &msg->l2_keySource,\n- idmanager_getMyID(ADDR_PANID),\n- msg->l2_frameType);\n-\n- if (keyDescriptor==NULL){ // can't find the key\n- openserial_printError(COMPONENT_SECURITY,ERR_SECURITY,\n- (errorparameter_t)msg->l2_frameType,\n- (errorparameter_t)6);\n- return E_FAIL;\n- }\n-\n- // device descriptor lookup\n- deviceDescriptor = IEEE802154_security_deviceDescriptorLookup(&msg->l2_keySource,\n- idmanager_getMyID(ADDR_PANID),\n- keyDescriptor);\n-\n- if (deviceDescriptor==NULL){ // can't find the device in the list of authorized neighbors\n- openserial_printError(COMPONENT_SECURITY,ERR_SECURITY,\n- (errorparameter_t)msg->l2_frameType,\n- (errorparameter_t)7);\n- return E_FAIL;\n- }\n-\n- // Security Level Descriptorlookup\n- securityLevelDescriptor = IEEE802154_security_securityLevelDescriptorLookup(msg->l2_frameType,\n- msg->commandFrameIdentifier);\n-\n- if (securityLevelDescriptor == NULL){ // can't find the frame type in the list of allowed frame types\n- openserial_printError(COMPONENT_SECURITY,ERR_SECURITY,\n- (errorparameter_t)msg->l2_frameType,\n- (errorparameter_t)8);\n- return E_FAIL;\n- }\n-\n- // incoming security level checking\n- outStatus = IEEE802154_security_incomingSecurityLevelChecking(securityLevelDescriptor,\n- msg->l2_securityLevel,\n- deviceDescriptor->Exempt);\n-\n- if(outStatus == FALSE) { // security level not allowed according to local security policies\n- openserial_printError(COMPONENT_SECURITY,ERR_SECURITY,\n- (errorparameter_t)msg->l2_frameType,\n- (errorparameter_t)9);\n- return E_FAIL;\n- }\n-\n- // incoming key usage policy checking\n- outStatus = IEEE802154_security_incomingKeyUsagePolicyChecking(keyDescriptor,\n- msg->l2_frameType,\n- 0);\n- if(outStatus == FALSE){ // improper use of the key, according to local security policies\n- openserial_printError(COMPONENT_SECURITY,ERR_SECURITY,\n- (errorparameter_t)msg->l2_frameType,\n- (errorparameter_t)10);\n- return E_FAIL;\n- }\n-\n- key = keyDescriptor->key;\n- } else { // minimal processing for efficiency\nkey = msg->l2_frameType == IEEE154_TYPE_BEACON ? ieee802154_security_vars.Key_1 : ieee802154_security_vars.Key_2;\n- }\n// First 8 bytes of the nonce are always the source address of the frame\nmemcpy(&nonce[0],msg->l2_nextORpreviousHop.addr_64b, 8);\n@@ -625,8 +375,6 @@ owerror_t IEEE802154_security_incomingFrame(OpenQueueEntry_t* msg){\nreturn outStatus;\n}\n-//=========================== private =========================================\n-\n/**\n\\brief Identification of the length of the MIC based on the security Level in the frame\n*/\n@@ -663,6 +411,9 @@ uint8_t IEEE802154_security_auxLengthChecking(uint8_t KeyIdMode,\nuint8_t frameCounterSize){\nuint8_t auxilary_len;\nuint8_t frameCntLength;\n+\n+ auxilary_len = 0;\n+\nif (frameCounterSuppression == IEEE154_ASH_FRAMECOUNTER_PRESENT){\nif (frameCounterSize == 4){\nframeCntLength = 4;\n@@ -693,206 +444,6 @@ uint8_t IEEE802154_security_auxLengthChecking(uint8_t KeyIdMode,\nreturn auxilary_len;\n}\n-/**\n-\\brief Verify if the key used to protect the frame has been used properly.\n- Each key can be used to secure a particular frame type, according to\n- security policies defined in the initialization phase and stored in the\n- Mac Key Table.\n- The procedure verifies if the frame type parameter associated to the key\n- is the same than the packet for which the key has been used and returns\n- TRUE if the check is verified, FALSE otherwise.\n-*/\n-bool IEEE802154_security_incomingKeyUsagePolicyChecking(m_keyDescriptor* keyDescriptor,\n- uint8_t frameType,\n- uint8_t cfi){\n- uint8_t i;\n- INTERRUPT_DECLARATION();\n- DISABLE_INTERRUPTS();\n- for (i=0; i<MAXNUMNEIGHBORS; i++){\n- if (frameType != IEEE154_TYPE_CMD && frameType == keyDescriptor->KeyUsageList[i].FrameType){\n- ENABLE_INTERRUPTS();\n- return TRUE;\n- }\n-\n- if (frameType == IEEE154_TYPE_CMD && frameType == keyDescriptor->KeyUsageList[i].FrameType &&\n- cfi == keyDescriptor->KeyUsageList[i].CommandFrameIdentifier){\n- ENABLE_INTERRUPTS();\n- return TRUE;\n- }\n- }\n-\n- ENABLE_INTERRUPTS();\n- return FALSE;\n-}\n-\n-/**\n-\\brief Verify if the Security Level of the incoming Frame conforms to local\n- security policies, i.e., it is between the allowed security levels.\n-*/\n-bool IEEE802154_security_incomingSecurityLevelChecking(m_securityLevelDescriptor* seclevdesc,\n- uint8_t seclevel,\n- bool exempt){\n-\n- uint8_t i;\n- if (seclevdesc->AllowedSecurityLevels == 0){\n- if (seclevel <= seclevdesc->SecurityMinimum){\n- return TRUE;\n- } else {\n- return FALSE;\n- }\n- }\n-\n- for (i=0;i<7;i++){\n- if (seclevel == seclevdesc->AllowedSecurityLevels[i]){\n- return TRUE;\n- }\n- }\n-\n- if (seclevel == 0 && seclevdesc->DeviceOverrideSecurityMinimum ==TRUE ){\n- if (exempt == FALSE){\n- return FALSE;\n- }\n- return TRUE;\n- }\n-\n- return FALSE;\n-}\n-\n-/**\n-\\brief Searching for the Security Level Descriptor.\n-*/\n-m_securityLevelDescriptor* IEEE802154_security_securityLevelDescriptorLookup(uint8_t frameType,\n- uint8_t cfi){\n- uint8_t i;\n- INTERRUPT_DECLARATION();\n- DISABLE_INTERRUPTS();\n- for (i=0; i<4; i++){\n- if (ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].FrameType != IEEE154_TYPE_CMD\n- && frameType == ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].FrameType){\n-\n- ENABLE_INTERRUPTS();\n- return &ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i];\n- }\n-\n- if (ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].FrameType == IEEE154_TYPE_CMD\n- && frameType == ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].FrameType\n- && cfi == ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i].CommandFrameIdentifier){\n-\n- ENABLE_INTERRUPTS();\n- return &ieee802154_security_vars.MacSecurityLevelTable.SecurityDescriptorEntry[i];\n- }\n- }\n-\n- ENABLE_INTERRUPTS();\n- return NULL;\n-}\n-\n-/**\n-\\brief Searching for the Device Descriptor.\n-*/\n-m_deviceDescriptor* IEEE802154_security_deviceDescriptorLookup(open_addr_t* Address,\n- open_addr_t* PANId,\n- m_keyDescriptor* keyDescriptor){\n- uint8_t i;\n- INTERRUPT_DECLARATION();\n- DISABLE_INTERRUPTS();\n-\n- for (i=0; i<MAXNUMNEIGHBORS; i++){\n- if ((packetfunctions_sameAddress(Address,\n- &keyDescriptor->DeviceTable->DeviceDescriptorEntry[i].deviceAddress)== TRUE)\n- &&(packetfunctions_sameAddress(PANId,\n- &ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.PANId))\n- ){\n- ENABLE_INTERRUPTS();\n- return &keyDescriptor->DeviceTable->DeviceDescriptorEntry[i];\n- }\n- }\n-\n- ENABLE_INTERRUPTS();\n- return NULL;\n-}\n-\n-/**\n-\\brief Searching for the Key Descriptor.\n-*/\n-m_keyDescriptor* IEEE802154_security_keyDescriptorLookup(uint8_t KeyIdMode,\n- open_addr_t* keySource,\n- uint8_t KeyIndex,\n- open_addr_t* DeviceAddress,\n- open_addr_t* panID,\n- uint8_t frameType){\n- uint8_t i;\n- INTERRUPT_DECLARATION();\n- DISABLE_INTERRUPTS();\n-\n- if (KeyIdMode == IEEE154_ASH_KEYIDMODE_IMPLICIT){\n- for (i=0; i<MAXNUMKEYS; i++ ){\n- if (ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.Address.type == ADDR_64B){\n- if (packetfunctions_sameAddress(DeviceAddress,&ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.Address)\n- &&packetfunctions_sameAddress(panID,\n- &ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.PANId)){\n- ENABLE_INTERRUPTS();\n- return &ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i];\n- }\n- }\n- }\n- }\n-\n- if (KeyIdMode == IEEE154_ASH_KEYIDMODE_DEFAULTKEYSOURCE){\n- for (i=0; i<MAXNUMKEYS; i++ ){\n- if (KeyIndex == ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.KeyIndex\n- && packetfunctions_sameAddress(keySource,&ieee802154_security_vars.m_macDefaultKeySource)){\n- ENABLE_INTERRUPTS();\n- return &ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i];\n- }\n- }\n- }\n-\n- if (KeyIdMode == IEEE154_ASH_KEYIDMODE_EXPLICIT_16){\n- for (i=0; i<MAXNUMKEYS; i++ ){\n- if (KeyIndex == ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.KeyIndex){\n- if (keySource->addr_16b[0] == ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.KeySource.addr_16b[0] &&\n- keySource->addr_16b[1] == ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.KeySource.addr_16b[1]\n- && packetfunctions_sameAddress(panID, &ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.PANId)\n- ){\n- ENABLE_INTERRUPTS();\n- return &ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i];\n- }\n- }\n- }\n- }\n-\n- if (KeyIdMode == IEEE154_ASH_KEYIDMODE_EXPLICIT_64){\n- for (i=0; i<MAXNUMKEYS; i++ ){\n- if (KeyIndex == ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.KeyIndex){\n- if (packetfunctions_sameAddress(keySource,&ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.KeySource)\n- && packetfunctions_sameAddress(panID, &ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i].KeyIdLookupList.PANId)\n- ){\n- ENABLE_INTERRUPTS();\n- return &ieee802154_security_vars.MacKeyTable.KeyDescriptorElement[i];\n- }\n- }\n- }\n- }\n-\n- //no matches\n- ENABLE_INTERRUPTS();\n- return NULL;\n-}\n-\n-/*\n- * Store in the array the reference value\n- */\n-void IEEE802154_security_getFrameCounter(macFrameCounter_t reference,\n- uint8_t* array) {\n-\n- array[0] = (reference.bytes0and1 & 0xff);\n- array[1] = (reference.bytes0and1/256 & 0xff);\n- array[2] = (reference.bytes2and3 & 0xff);\n- array[3] = (reference.bytes2and3/256 & 0xff);\n- array[4] = reference.byte4;\n-}\n-\n#else /* L2_SECURITY_ACTIVE */\nvoid IEEE802154_security_init(void) {\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.h",
"new_path": "openstack/02a-MAClow/IEEE802154_security.h",
"diff": "*/\n#include \"opendefs.h\"\n-#include \"neighbors.h\"\n#include \"IEEE802154.h\"\n//=========================== define ==========================================\n-#define MAXNUMKEYS MAXNUMNEIGHBORS+1\n-\n#ifdef L2_SECURITY_ACTIVE // Configuring security levels\n#define IEEE802154_SECURITY_SUPPORTED 1\n#define IEEE802154_SECURITY_LEVEL IEEE154_ASH_SLF_TYPE_ENC_MIC_32 // encryption + 4 byte authentication tag\n#define IEEE802154_SECURITY_K1_KEY_INDEX 1\n#define IEEE802154_SECURITY_K2_KEY_INDEX 2\n#define IEEE802154_SECURITY_TAG_LEN IEEE802154_security_authLengthChecking(IEEE802154_SECURITY_LEVEL)\n-#define IEEE802154_SECURITY_HEADER_LEN IEEE802154_security_auxLengthChecking(IEEE802154_SECURITY_KEYIDMODE, IEEE154_ASH_FRAMECOUNTER_SUPPRESSED, 5) // For TSCH we always use implicit 5 byte ASN as Frame Counter\n+#define IEEE802154_SECURITY_HEADER_LEN IEEE802154_security_auxLengthChecking(IEEE802154_SECURITY_KEYIDMODE, IEEE154_ASH_FRAMECOUNTER_SUPPRESSED, 0) // For TSCH we always use implicit 5 byte ASN as Frame Counter\n#define IEEE802154_SECURITY_TOTAL_OVERHEAD IEEE802154_SECURITY_TAG_LEN + IEEE802154_SECURITY_HEADER_LEN\n-#define IEEE802154_SECURITY_MINIMAL_PROC 0 // minimal processing for efficiency\n#else /* L2_SECURITY_ACTIVE */\n#define IEEE802154_SECURITY_SUPPORTED 0\n#define IEEE802154_SECURITY_LEVEL IEEE154_ASH_SLF_TYPE_NOSEC\n#define IEEE802154_SECURITY_TAG_LEN 0\n#define IEEE802154_SECURITY_HEADER_LEN 0\n#define IEEE802154_SECURITY_TOTAL_OVERHEAD 0\n-#define IEEE802154_SECURITY_MINIMAL_PROC 0\n#endif /* L2_SECURITY_ACTIVE */\n//=========================== typedef =========================================\n-typedef struct{//identifier of the device which is using the key\n- open_addr_t deviceAddress;\n- macFrameCounter_t FrameCounter;\n- bool Exempt;\n-} m_deviceDescriptor;\n-\n-typedef struct{//descriptor of the key we are looking for\n- uint8_t KeyIdMode;\n- uint8_t KeyIndex;\n- open_addr_t KeySource;\n- open_addr_t PANId;\n- open_addr_t Address;\n-} m_keyIdLookupDescriptor;\n-\n-typedef struct{//descriptor of the Security Level for this type of communication\n- uint8_t FrameType;\n- uint8_t CommandFrameIdentifier; //if the FrameType is a command, this specify what kind of command is\n- uint8_t SecurityMinimum; //minimum required\n- bool DeviceOverrideSecurityMinimum; //if true, this indicate that the minimum can be overridden\n- uint8_t AllowedSecurityLevels[7]; //set of Security Levels Allowed for incoming MAC frames\n-} m_securityLevelDescriptor;\n-\n-typedef struct{//defines what kind of frame the key is intended\n- uint8_t FrameType;\n- uint8_t CommandFrameIdentifier;\n-} m_keyUsageDescriptor;\n-\n-typedef struct{//Table which contains the device that are currently using this key\n- m_deviceDescriptor DeviceDescriptorEntry[MAXNUMNEIGHBORS-1];\n-} m_macDeviceTable;\n-\n-\n-typedef struct{//descriptor of the key\n- m_keyIdLookupDescriptor KeyIdLookupList;\n- m_macDeviceTable* DeviceTable;\n- m_keyUsageDescriptor KeyUsageList[3];\n- uint8_t key[16];\n-} m_keyDescriptor;\n-\n-typedef struct{\n- m_keyDescriptor KeyDescriptorElement[MAXNUMKEYS-1];\n-} m_macKeyTable;\n-\n-typedef struct{\n- m_securityLevelDescriptor SecurityDescriptorEntry[5];\n-} m_macSecurityLevelTable;\n-\n//=========================== variables =======================================\ntypedef struct{\n- macFrameCounter_t m_macFrameCounter;\n- uint8_t m_macFrameCounterMode;\n- uint8_t m_macAutoRequestKeyIdMode;\n- uint8_t m_macAutoRequestSecurityLevel;\n- uint8_t m_macAutoReququestKeyIndex;\n- open_addr_t m_macDefaultKeySource;\n- m_macKeyTable MacKeyTable;\n- m_macDeviceTable MacDeviceTable;\n- m_macSecurityLevelTable MacSecurityLevelTable;\nuint8_t Key_1[16];\nuint8_t Key_2[16];\n- uint8_t minimal;\n} ieee802154_security_vars_t;\n//=========================== prototypes ======================================\n@@ -128,7 +66,7 @@ owerror_t IEEE802154_security_outgoingFrameSecurity(OpenQueueEntry_t* msg);\nowerror_t IEEE802154_security_incomingFrame(OpenQueueEntry_t* msg);\n-uint8_t IEEE802154_security_authLengthChecking(uint8_t);\n+uint8_t IEEE802154_security_authLengthChecking(uint8_t securityLevel);\nuint8_t IEEE802154_security_auxLengthChecking(uint8_t keyIdMode, uint8_t frameCounterSuppression, uint8_t frameCounterSize);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Minimal implementation of 15.4 security processing.
|
491,609
|
04.07.2017 15:11:06
| -7,200
|
69dfc4a771b9f47d34be5f47fbc883bf7d2a4ba4
|
Add function in neighbors module to select Join Proxy.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/neighbors.c",
"new_path": "openstack/02b-MAChigh/neighbors.c",
"diff": "@@ -94,6 +94,31 @@ open_addr_t* neighbors_getKANeighbor(uint16_t kaPeriod) {\nreturn NULL;\n}\n+/**\n+\\brief Find neighbor which should act as a Join Proxy during the join process.\n+\n+This function iterates through the neighbor table and identifies the neighbor\n+with lowest join priority metric to send join traffic through.\n+\n+\\returns A pointer to the neighbor's address, or NULL if no join proxy is found.\n+*/\n+open_addr_t* neighbors_getJoinProxy() {\n+ uint8_t i;\n+ uint8_t joinPrioMinimum;\n+ open_addr_t* joinProxy;\n+\n+ joinPrioMinimum = 0xff;\n+ joinProxy = NULL;\n+ for (i=0;i<MAXNUMNEIGHBORS;i++) {\n+ if (neighbors_vars.neighbors[i].used==TRUE &&\n+ neighbors_vars.neighbors[i].joinPrio <= joinPrioMinimum) {\n+ joinProxy = &(neighbors_vars.neighbors[i].addr_64b);\n+ joinPrioMinimum = neighbors_vars.neighbors[i].joinPrio;\n+ }\n+ }\n+ return joinProxy;\n+}\n+\nbool neighbors_getNeighborNoResource(uint8_t index){\nreturn neighbors_vars.neighbors[index].f6PNORES;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/neighbors.h",
"new_path": "openstack/02b-MAChigh/neighbors.h",
"diff": "@@ -59,6 +59,7 @@ dagrank_t neighbors_getNeighborRank(uint8_t index);\nuint8_t neighbors_getNumNeighbors(void);\nuint16_t neighbors_getLinkMetric(uint8_t index);\nopen_addr_t* neighbors_getKANeighbor(uint16_t kaPeriod);\n+open_addr_t* neighbors_getJoinProxy(void);\nbool neighbors_getNeighborNoResource(uint8_t index);\nuint8_t neighbors_getGeneration(open_addr_t* address);\nuint8_t neighbors_getSequenceNumber(open_addr_t* address);\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -536,6 +536,7 @@ functionsToChange = [\n'neighbors_getNumNeighbors',\n'neighbors_getLinkMetric',\n'neighbors_getKANeighbor',\n+ 'neighbors_getJoinProxy',\n'neighbors_getGeneration',\n'neighbors_getSequenceNumber',\n'neighbors_setNeighborRank',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Add function in neighbors module to select Join Proxy.
|
491,609
|
04.07.2017 16:13:44
| -7,200
|
9d5bda45fe4fb32b0720d11ca233d2e12d804d56
|
Make L2 security key configuration dynamic.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.c",
"new_path": "openstack/02a-MAClow/IEEE802154_security.c",
"diff": "#ifdef L2_SECURITY_ACTIVE\n//=========================== variables =======================================\n-static const uint8_t key1[] = {\n- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,\n- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11\n-};\n-\n-static const uint8_t key2[] = {\n- 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,\n- 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22\n-};\n-\nieee802154_security_vars_t ieee802154_security_vars;\n//=========================== prototypes ======================================\n@@ -41,11 +31,13 @@ ieee802154_security_vars_t ieee802154_security_vars;\n*/\nvoid IEEE802154_security_init(void) {\n- // copy beacon key (key 1)\n- memcpy(&ieee802154_security_vars.Key_1[0], &key1[0], 16);\n+ // invalidate beacon key (key 1)\n+ ieee802154_security_vars.k1.index = IEEE802154_SECURITY_KEYINDEX_INVALID;\n+ memset(&ieee802154_security_vars.k1.value[0], 0x00, 16);\n- // copy data key (key 2)\n- memcpy(&ieee802154_security_vars.Key_2[0], &key2[0], 16);\n+ // invalidate data key (key 2)\n+ ieee802154_security_vars.k2.index = IEEE802154_SECURITY_KEYINDEX_INVALID;\n+ memset(&ieee802154_security_vars.k2.value[0], 0x00, 16);\n}\n//=========================== public ==========================================\n@@ -131,7 +123,7 @@ owerror_t IEEE802154_security_outgoingFrameSecurity(OpenQueueEntry_t* msg){\nuint8_t* m;\nuint8_t len_m;\n- key = msg->l2_frameType == IEEE154_TYPE_BEACON ? ieee802154_security_vars.Key_1 : ieee802154_security_vars.Key_2;\n+ key = msg->l2_frameType == IEEE154_TYPE_BEACON ? ieee802154_security_vars.k1.value : ieee802154_security_vars.k2.value;\n// First 8 bytes of the nonce are always the source address of the frame\nmemcpy(&nonce[0],idmanager_getMyID(ADDR_64B)->addr_64b,8);\n@@ -311,7 +303,7 @@ owerror_t IEEE802154_security_incomingFrame(OpenQueueEntry_t* msg){\nuint8_t len_c;\nuint8_t *key;\n- key = msg->l2_frameType == IEEE154_TYPE_BEACON ? ieee802154_security_vars.Key_1 : ieee802154_security_vars.Key_2;\n+ key = msg->l2_frameType == IEEE154_TYPE_BEACON ? ieee802154_security_vars.k1.value : ieee802154_security_vars.k2.value;\n// First 8 bytes of the nonce are always the source address of the frame\nmemcpy(&nonce[0],msg->l2_nextORpreviousHop.addr_64b, 8);\n@@ -444,6 +436,31 @@ uint8_t IEEE802154_security_auxLengthChecking(uint8_t KeyIdMode,\nreturn auxilary_len;\n}\n+uint8_t IEEE802154_security_getBeaconKeyIndex(void) {\n+ return ieee802154_security_vars.k1.index;\n+}\n+uint8_t IEEE802154_security_getDataKeyIndex(void) {\n+ return ieee802154_security_vars.k2.index;\n+}\n+\n+void IEEE802154_security_setBeaconKey(uint8_t index, uint8_t* value) {\n+ ieee802154_security_vars.k1.index = index;\n+ memcpy(ieee802154_security_vars.k1.value, value, 16);\n+}\n+\n+void IEEE802154_security_setDataKey(uint8_t index, uint8_t* value) {\n+ ieee802154_security_vars.k2.index = index;\n+ memcpy(ieee802154_security_vars.k2.value, value, 16);\n+}\n+\n+bool IEEE802154_security_isConfigured() {\n+ if (ieee802154_security_vars.k1.index != IEEE802154_SECURITY_KEYINDEX_INVALID &&\n+ ieee802154_security_vars.k2.index != IEEE802154_SECURITY_KEYINDEX_INVALID) {\n+ return TRUE;\n+ }\n+ return FALSE;\n+}\n+\n#else /* L2_SECURITY_ACTIVE */\nvoid IEEE802154_security_init(void) {\n@@ -474,5 +491,25 @@ uint8_t IEEE802154_security_auxLengthChecking(uint8_t kid, uint8_t sup, uint8_t\nreturn (uint8_t) 0;\n}\n+uint8_t IEEE802154_security_getBeaconKeyIndex(void) {\n+ return (uint8_t) 0;\n+}\n+uint8_t IEEE802154_security_getDataKeyIndex(void) {\n+ return (uint8_t) 0;\n+}\n+\n+void IEEE802154_security_setBeaconKey(uint8_t index, uint8_t* value) {\n+ return;\n+}\n+\n+void IEEE802154_security_setDataKey(uint8_t index, uint8_t* value) {\n+ return;\n+}\n+\n+bool IEEE802154_security_isConfigured() {\n+ return TRUE;\n+}\n+\n+\n#endif /* L2_SECURITY_ACTIVE */\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.h",
"new_path": "openstack/02a-MAClow/IEEE802154_security.h",
"diff": "#define IEEE802154_SECURITY_LEVEL IEEE154_ASH_SLF_TYPE_ENC_MIC_32 // encryption + 4 byte authentication tag\n#define IEEE802154_SECURITY_LEVEL_BEACON IEEE154_ASH_SLF_TYPE_MIC_32 // authentication tag len used for beacons must match the tag len of other frames\n#define IEEE802154_SECURITY_KEYIDMODE IEEE154_ASH_KEYIDMODE_DEFAULTKEYSOURCE\n-#define IEEE802154_SECURITY_K1_KEY_INDEX 1\n-#define IEEE802154_SECURITY_K2_KEY_INDEX 2\n#define IEEE802154_SECURITY_TAG_LEN IEEE802154_security_authLengthChecking(IEEE802154_SECURITY_LEVEL)\n#define IEEE802154_SECURITY_HEADER_LEN IEEE802154_security_auxLengthChecking(IEEE802154_SECURITY_KEYIDMODE, IEEE154_ASH_FRAMECOUNTER_SUPPRESSED, 0) // For TSCH we always use implicit 5 byte ASN as Frame Counter\n#define IEEE802154_SECURITY_TOTAL_OVERHEAD IEEE802154_SECURITY_TAG_LEN + IEEE802154_SECURITY_HEADER_LEN\n#define IEEE802154_SECURITY_LEVEL IEEE154_ASH_SLF_TYPE_NOSEC\n#define IEEE802154_SECURITY_LEVEL_BEACON IEEE154_ASH_SLF_TYPE_NOSEC\n#define IEEE802154_SECURITY_KEYIDMODE 0\n-#define IEEE802154_SECURITY_K1_KEY_INDEX 0\n-#define IEEE802154_SECURITY_K2_KEY_INDEX 0\n#define IEEE802154_SECURITY_TAG_LEN 0\n#define IEEE802154_SECURITY_HEADER_LEN 0\n#define IEEE802154_SECURITY_TOTAL_OVERHEAD 0\n#endif /* L2_SECURITY_ACTIVE */\n+#define IEEE802154_SECURITY_KEYINDEX_INVALID 0\n//=========================== typedef =========================================\n+typedef struct{\n+ uint8_t index;\n+ uint8_t value[16];\n+} key_t;\n+\n//=========================== variables =======================================\ntypedef struct {\n- uint8_t Key_1[16];\n- uint8_t Key_2[16];\n+ key_t k1;\n+ key_t k2;\n} ieee802154_security_vars_t;\n//=========================== prototypes ======================================\nvoid IEEE802154_security_init(void);\n-\nvoid IEEE802154_security_prependAuxiliarySecurityHeader(OpenQueueEntry_t* msg);\n-\nvoid IEEE802154_security_retrieveAuxiliarySecurityHeader(OpenQueueEntry_t* msg, ieee802154_header_iht* tempheader);\n-\nowerror_t IEEE802154_security_outgoingFrameSecurity(OpenQueueEntry_t* msg);\n-\nowerror_t IEEE802154_security_incomingFrame(OpenQueueEntry_t* msg);\n-\nuint8_t IEEE802154_security_authLengthChecking(uint8_t securityLevel);\n-\nuint8_t IEEE802154_security_auxLengthChecking(uint8_t keyIdMode, uint8_t frameCounterSuppression, uint8_t frameCounterSize);\n+uint8_t IEEE802154_security_getBeaconKeyIndex(void);\n+uint8_t IEEE802154_security_getDataKeyIndex(void);\n+void IEEE802154_security_setBeaconKey(uint8_t index, uint8_t* value);\n+void IEEE802154_security_setDataKey(uint8_t index, uint8_t* value);\n+bool IEEE802154_security_isConfigured(void);\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -372,7 +372,7 @@ owerror_t sixtop_send(OpenQueueEntry_t *msg) {\n// set l2-security attributes\nmsg->l2_securityLevel = IEEE802154_SECURITY_LEVEL;\nmsg->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\n- msg->l2_keyIndex = IEEE802154_SECURITY_K2_KEY_INDEX;\n+ msg->l2_keyIndex = IEEE802154_security_getDataKeyIndex();\nif (msg->l2_payloadIEpresent == FALSE) {\nreturn sixtop_send_internal(\n@@ -746,7 +746,7 @@ port_INLINE void sixtop_sendEB() {\n// set l2-security attributes\neb->l2_securityLevel = IEEE802154_SECURITY_LEVEL_BEACON;\neb->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\n- eb->l2_keyIndex = IEEE802154_SECURITY_K1_KEY_INDEX;\n+ eb->l2_keyIndex = IEEE802154_security_getBeaconKeyIndex();\n// put in queue for MAC to handle\nsixtop_send_internal(eb,eb->l2_payloadIEpresent);\n@@ -816,7 +816,7 @@ port_INLINE void sixtop_sendKA() {\n// set l2-security attributes\nkaPkt->l2_securityLevel = IEEE802154_SECURITY_LEVEL;\nkaPkt->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\n- kaPkt->l2_keyIndex = IEEE802154_SECURITY_K2_KEY_INDEX;\n+ kaPkt->l2_keyIndex = IEEE802154_security_getDataKeyIndex();\n// put in queue for MAC to handle\nsixtop_send_internal(kaPkt,FALSE);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/idmanager.c",
"new_path": "openstack/cross-layers/idmanager.c",
"diff": "@@ -193,9 +193,11 @@ bool idmanager_isMyAddress(open_addr_t* addr) {\nvoid idmanager_triggerAboutRoot() {\nuint8_t number_bytes_from_input_buffer;\n- uint8_t input_buffer[9];\n+ uint8_t input_buffer[1+8+1+16];\nopen_addr_t myPrefix;\nuint8_t dodagid[16];\n+ uint8_t keyIndex;\n+ uint8_t* keyValue;\n//=== get command from OpenSerial\nnumber_bytes_from_input_buffer = openserial_getInputBuffer(input_buffer,sizeof(input_buffer));\n@@ -243,6 +245,13 @@ void idmanager_triggerAboutRoot() {\nmemcpy(&dodagid[8],idmanager_vars.my64bID.addr_64b,8); // eui64\nicmpv6rpl_writeDODAGid(dodagid);\n+ // store L2 security key index and key value\n+ // for the moment, keys K1 and K2 are the same\n+ keyIndex = input_buffer[9];\n+ keyValue = &input_buffer[10];\n+ IEEE802154_security_setBeaconKey(keyIndex, keyValue);\n+ IEEE802154_security_setDataKey(keyIndex, keyValue);\n+\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -453,6 +453,11 @@ functionsToChange = [\n'IEEE802154_security_securityLevelDescriptorLookup',\n'IEEE802154_security_deviceDescriptorLookup',\n'IEEE802154_security_keyDescriptorLookup',\n+ 'IEEE802154_security_getBeaconKeyIndex',\n+ 'IEEE802154_security_getDataKeyIndex',\n+ 'IEEE802154_security_setBeaconKey',\n+ 'IEEE802154_security_setDataKey',\n+ 'IEEE802154_security_isConfigured',\n# IEEE802154\n'ieee802154_prependHeader',\n'ieee802154_retrieveHeader',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Make L2 security key configuration dynamic.
|
491,595
|
05.07.2017 10:54:25
| -7,200
|
20702d4f9a183cf8ebdc451c41e15034d1582322
|
Use 10milisecond slotduration for openmote-cc2538 by default.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/board_info.h",
"new_path": "bsp/boards/openmote-cc2538/board_info.h",
"diff": "#define PORT_PIN_RADIO_RESET_LOW() // nothing\n//===== IEEE802154E timing\n+\n+#define SLOTDURATION_10MS // by default, we use 10ms time slot\n+\n#ifdef SLOTDURATION_10MS\n// time-slot related\n#define PORT_TsSlotDuration 328 // counter counts one extra count, see datasheet\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
Use 10milisecond slotduration for openmote-cc2538 by default.
|
491,609
|
05.07.2017 16:08:50
| -7,200
|
ed8e44ffc76ba6d421a89e85cd687d2f56d707dd
|
Add function to get current security level.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.c",
"new_path": "openstack/02a-MAClow/IEEE802154_security.c",
"diff": "@@ -461,6 +461,13 @@ bool IEEE802154_security_isConfigured() {\nreturn FALSE;\n}\n+uint8_t IEEE802154_security_getSecurityLevel() {\n+ if (IEEE802154_security_isConfigured()) {\n+ return IEEE802154_SECURITY_LEVEL;\n+ }\n+ return IEEE154_ASH_SLF_TYPE_NOSEC;\n+}\n+\n#else /* L2_SECURITY_ACTIVE */\nvoid IEEE802154_security_init(void) {\n@@ -510,6 +517,8 @@ bool IEEE802154_security_isConfigured() {\nreturn TRUE;\n}\n-\n+uint8_t IEEE802154_security_getSecurityLevel() {\n+ return IEEE154_ASH_SLF_TYPE_NOSEC;\n+}\n#endif /* L2_SECURITY_ACTIVE */\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.h",
"new_path": "openstack/02a-MAClow/IEEE802154_security.h",
"diff": "@@ -69,6 +69,7 @@ uint8_t IEEE802154_security_getBeaconKeyIndex(void);\nuint8_t IEEE802154_security_getDataKeyIndex(void);\nvoid IEEE802154_security_setBeaconKey(uint8_t index, uint8_t* value);\nvoid IEEE802154_security_setDataKey(uint8_t index, uint8_t* value);\n+uint8_t IEEE802154_security_getSecurityLevel(void);\nbool IEEE802154_security_isConfigured(void);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -370,7 +370,7 @@ owerror_t sixtop_send(OpenQueueEntry_t *msg) {\nmsg->l2_frameType = IEEE154_TYPE_DATA;\n// set l2-security attributes\n- msg->l2_securityLevel = IEEE802154_SECURITY_LEVEL;\n+ msg->l2_securityLevel = IEEE802154_security_getSecurityLevel();\nmsg->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\nmsg->l2_keyIndex = IEEE802154_security_getDataKeyIndex();\n@@ -814,7 +814,7 @@ port_INLINE void sixtop_sendKA() {\nmemcpy(&(kaPkt->l2_nextORpreviousHop),kaNeighAddr,sizeof(open_addr_t));\n// set l2-security attributes\n- kaPkt->l2_securityLevel = IEEE802154_SECURITY_LEVEL;\n+ kaPkt->l2_securityLevel = IEEE802154_security_getSecurityLevel();\nkaPkt->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\nkaPkt->l2_keyIndex = IEEE802154_security_getDataKeyIndex();\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.h",
"new_path": "openstack/cross-layers/packetfunctions.h",
"diff": "@@ -29,6 +29,7 @@ bool packetfunctions_isBroadcastMulticast(open_addr_t* address);\nbool packetfunctions_isAllRoutersMulticast(open_addr_t* address);\nbool packetfunctions_isAllHostsMulticast(open_addr_t* address);\nbool packetfunctions_sameAddress(open_addr_t* address_1, open_addr_t* address_2);\n+bool packetfunctions_isLinkLocal(open_addr_t* address);\n// read/write addresses to/from packets\nvoid packetfunctions_readAddress(uint8_t* payload, uint8_t type, open_addr_t* writeToAddress, bool littleEndian);\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -457,6 +457,7 @@ functionsToChange = [\n'IEEE802154_security_getDataKeyIndex',\n'IEEE802154_security_setBeaconKey',\n'IEEE802154_security_setDataKey',\n+ 'IEEE802154_security_getSecurityLevel',\n'IEEE802154_security_isConfigured',\n# IEEE802154\n'ieee802154_prependHeader',\n@@ -778,6 +779,7 @@ functionsToChange = [\n'packetfunctions_isBroadcastMulticast',\n'packetfunctions_isAllRoutersMulticast',\n'packetfunctions_isAllHostsMulticast',\n+ 'packetfunctions_isLinkLocal',\n'packetfunctions_sameAddress',\n'packetfunctions_readAddress',\n'packetfunctions_writeAddress',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Add function to get current security level.
|
491,609
|
05.07.2017 16:10:46
| -7,200
|
09b208f97735649adee008a107bfdcee877baef8
|
Init the prefix to link-local and send with link-local prefix to link-local addresses.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/forwarding.c",
"new_path": "openstack/03b-IPv6/forwarding.c",
"diff": "@@ -60,6 +60,7 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\nipv6_header_iht ipv6_outer_header;\nipv6_header_iht ipv6_inner_header;\nrpl_option_ht rpl_option;\n+ open_addr_t link_local_prefix;\nopen_addr_t* myprefix;\nopen_addr_t* myadd64;\nuint32_t flow_label = 0;\n@@ -81,11 +82,21 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\nm = IPHC_M_NO;\n// retrieve my prefix and EUI64\n- myprefix = idmanager_getMyID(ADDR_PREFIX);\nmyadd64 = idmanager_getMyID(ADDR_64B);\n// set source address (me)\nmsg->l3_sourceAdd.type=ADDR_128B;\n+\n+ // if we are sending to a link-local address set the source prefix to link-local\n+ if (packetfunctions_isLinkLocal(&msg->l3_destinationAdd)) {\n+ memset(&link_local_prefix, 0x00, sizeof(open_addr_t));\n+ link_local_prefix.type = ADDR_PREFIX;\n+ link_local_prefix.prefix[0] = 0xfe;\n+ link_local_prefix.prefix[1] = 0x80;\n+ myprefix = &link_local_prefix;\n+ } else {\n+ myprefix = idmanager_getMyID(ADDR_PREFIX);\n+ }\nmemcpy(&(msg->l3_sourceAdd.addr_128b[0]),myprefix->prefix,8);\nmemcpy(&(msg->l3_sourceAdd.addr_128b[8]),myadd64->addr_64b,8);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/idmanager.c",
"new_path": "openstack/cross-layers/idmanager.c",
"diff": "@@ -50,7 +50,15 @@ void idmanager_init() {\nidmanager_vars.myPrefix.prefix[6] = 0x00;\nidmanager_vars.myPrefix.prefix[7] = 0x00;\n#else\n- memset(&idmanager_vars.myPrefix.prefix[0], 0x00, sizeof(idmanager_vars.myPrefix.prefix));\n+ // set prefix to link-local\n+ idmanager_vars.myPrefix.prefix[0] = 0xfe;\n+ idmanager_vars.myPrefix.prefix[1] = 0x80;\n+ idmanager_vars.myPrefix.prefix[2] = 0x00;\n+ idmanager_vars.myPrefix.prefix[3] = 0x00;\n+ idmanager_vars.myPrefix.prefix[4] = 0x00;\n+ idmanager_vars.myPrefix.prefix[5] = 0x00;\n+ idmanager_vars.myPrefix.prefix[6] = 0x00;\n+ idmanager_vars.myPrefix.prefix[7] = 0x00;\n#endif\n// my64bID\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Init the prefix to link-local and send with link-local prefix to link-local addresses.
|
491,609
|
05.07.2017 18:23:27
| -7,200
|
34c39a34d3db1f545cbbac0618beb20fcdf2128f
|
Add functinality to neighbors module to check whether a neighbor is secure or not.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/neighbors.c",
"new_path": "openstack/02b-MAChigh/neighbors.c",
"diff": "@@ -17,7 +17,8 @@ void registerNewNeighbor(\nint8_t rssi,\nasn_t* asnTimestamp,\nbool joinPrioPresent,\n- uint8_t joinPrio\n+ uint8_t joinPrio,\n+ bool insecure\n);\nbool isNeighbor(open_addr_t* neighbor);\nvoid removeNeighbor(uint8_t neighborIndex);\n@@ -197,6 +198,41 @@ bool neighbors_isStableNeighborByIndex(uint8_t index) {\nneighbors_vars.neighbors[index].used);\n}\n+/**\n+\\brief Indicate whether some neighbor is an insecure neighbor\n+\n+\\param[in] address The address of the neighbor, a 64-bit address.\n+\n+\\returns TRUE if that neighbor is insecure, FALSE otherwise.\n+*/\n+bool neighbors_isInsecureNeighbor(open_addr_t* address) {\n+ uint8_t i;\n+ bool returnVal;\n+\n+ // if not found, not insecure\n+ returnVal = FALSE;\n+\n+ switch (address->type) {\n+ case ADDR_64B:\n+ break;\n+ default:\n+ openserial_printCritical(COMPONENT_NEIGHBORS,ERR_WRONG_ADDR_TYPE,\n+ (errorparameter_t)address->type,\n+ (errorparameter_t)0);\n+ return returnVal;\n+ }\n+\n+ // iterate through neighbor table\n+ for (i=0;i<MAXNUMNEIGHBORS;i++) {\n+ if (isThisRowMatching(address,i) && neighbors_vars.neighbors[i].insecure==TRUE) {\n+ returnVal = TRUE;\n+ break;\n+ }\n+ }\n+\n+ return returnVal;\n+}\n+\n/**\n\\brief Indicate whether some neighbor has a lower DAG rank that me.\n@@ -265,7 +301,8 @@ void neighbors_indicateRx(open_addr_t* l2_src,\nint8_t rssi,\nasn_t* asnTs,\nbool joinPrioPresent,\n- uint8_t joinPrio) {\n+ uint8_t joinPrio,\n+ bool insecure) {\nuint8_t i;\nbool newNeighbor;\n@@ -277,6 +314,9 @@ void neighbors_indicateRx(open_addr_t* l2_src,\n// this is not a new neighbor\nnewNeighbor = FALSE;\n+ // whether the neighbor is considered as secure or not\n+ neighbors_vars.neighbors[i].insecure = insecure;\n+\n// update numRx, rssi, asn\nneighbors_vars.neighbors[i].numRx++;\nneighbors_vars.neighbors[i].rssi=rssi;\n@@ -316,7 +356,7 @@ void neighbors_indicateRx(open_addr_t* l2_src,\n// register new neighbor\nif (newNeighbor==TRUE) {\n- registerNewNeighbor(l2_src, rssi, asnTs, joinPrioPresent,joinPrio);\n+ registerNewNeighbor(l2_src, rssi, asnTs, joinPrioPresent, joinPrio, insecure);\n}\n}\n@@ -620,7 +660,8 @@ void registerNewNeighbor(open_addr_t* address,\nint8_t rssi,\nasn_t* asnTimestamp,\nbool joinPrioPresent,\n- uint8_t joinPrio) {\n+ uint8_t joinPrio,\n+ bool insecure) {\nuint8_t i;\n// filter errors\nif (address->type!=ADDR_64B) {\n@@ -636,6 +677,7 @@ void registerNewNeighbor(open_addr_t* address,\nif (neighbors_vars.neighbors[i].used==FALSE) {\n// add this neighbor\nneighbors_vars.neighbors[i].used = TRUE;\n+ neighbors_vars.neighbors[i].insecure = insecure;\n// neighbors_vars.neighbors[i].stableNeighbor = FALSE;\n// Note: all new neighbors are consider stable\nneighbors_vars.neighbors[i].stableNeighbor = TRUE;\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/neighbors.h",
"new_path": "openstack/02b-MAChigh/neighbors.h",
"diff": "@@ -70,6 +70,7 @@ void neighbors_setPreferredParent(uint8_t index, bool isPreferred);\n// interrogators\nbool neighbors_isStableNeighbor(open_addr_t* address);\nbool neighbors_isStableNeighborByIndex(uint8_t index);\n+bool neighbors_isInsecureNeighbor(open_addr_t* address);\nbool neighbors_isNeighborWithLowerDAGrank(uint8_t index);\nbool neighbors_isNeighborWithHigherDAGrank(uint8_t index);\n@@ -79,7 +80,8 @@ void neighbors_indicateRx(\nint8_t rssi,\nasn_t* asnTimestamp,\nbool joinPrioPresent,\n- uint8_t joinPrio\n+ uint8_t joinPrio,\n+ bool insecure\n);\nvoid neighbors_indicateTx(\nopen_addr_t* dest,\n@@ -103,4 +105,6 @@ bool debugPrint_neighbors(void);\n\\}\n*/\n+\n+\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -549,6 +549,7 @@ functionsToChange = [\n'neighbors_setPreferredParent',\n'neighbors_isStableNeighbor',\n'neighbors_isStableNeighborByIndex',\n+ 'neighbors_isInsecureNeighbor',\n'neighbors_isNeighborWithLowerDAGrank',\n'neighbors_isNeighborWithHigherDAGrank',\n'neighbors_indicateRx',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Add functinality to neighbors module to check whether a neighbor is secure or not.
|
491,609
|
05.07.2017 18:24:53
| -7,200
|
5a8afc633594b1bafaaaa32f246d7fa9058ed1b7
|
Modify getSecurityLevel to query whether a neighbor is secure or not.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.c",
"new_path": "openstack/02a-MAClow/IEEE802154_security.c",
"diff": "#include \"IEEE802154E.h\"\n#include \"idmanager.h\"\n#include \"openserial.h\"\n+#include \"neighbors.h\"\n#include \"IEEE802154_security.h\"\n//=============================define==========================================\n@@ -461,10 +462,15 @@ bool IEEE802154_security_isConfigured() {\nreturn FALSE;\n}\n-uint8_t IEEE802154_security_getSecurityLevel() {\n+uint8_t IEEE802154_security_getSecurityLevel(OpenQueueEntry_t *msg) {\nif (IEEE802154_security_isConfigured()) {\n+ if(neighbors_isInsecureNeighbor(&msg->l2_nextORpreviousHop)) {\n+ return IEEE154_ASH_SLF_TYPE_NOSEC;\n+ }\n+ else {\nreturn IEEE802154_SECURITY_LEVEL;\n}\n+ }\nreturn IEEE154_ASH_SLF_TYPE_NOSEC;\n}\n@@ -517,7 +523,7 @@ bool IEEE802154_security_isConfigured() {\nreturn TRUE;\n}\n-uint8_t IEEE802154_security_getSecurityLevel() {\n+uint8_t IEEE802154_security_getSecurityLevel(OpenQueueEntry_t *msg) {\nreturn IEEE154_ASH_SLF_TYPE_NOSEC;\n}\n#endif /* L2_SECURITY_ACTIVE */\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.h",
"new_path": "openstack/02a-MAClow/IEEE802154_security.h",
"diff": "@@ -69,7 +69,7 @@ uint8_t IEEE802154_security_getBeaconKeyIndex(void);\nuint8_t IEEE802154_security_getDataKeyIndex(void);\nvoid IEEE802154_security_setBeaconKey(uint8_t index, uint8_t* value);\nvoid IEEE802154_security_setDataKey(uint8_t index, uint8_t* value);\n-uint8_t IEEE802154_security_getSecurityLevel(void);\n+uint8_t IEEE802154_security_getSecurityLevel(OpenQueueEntry_t *msg);\nbool IEEE802154_security_isConfigured(void);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -370,7 +370,7 @@ owerror_t sixtop_send(OpenQueueEntry_t *msg) {\nmsg->l2_frameType = IEEE154_TYPE_DATA;\n// set l2-security attributes\n- msg->l2_securityLevel = IEEE802154_security_getSecurityLevel();\n+ msg->l2_securityLevel = IEEE802154_security_getSecurityLevel(msg);\nmsg->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\nmsg->l2_keyIndex = IEEE802154_security_getDataKeyIndex();\n@@ -475,7 +475,8 @@ void task_sixtopNotifReceive() {\nmsg->l1_rssi,\n&msg->l2_asn,\nmsg->l2_joinPriorityPresent,\n- msg->l2_joinPriority\n+ msg->l2_joinPriority,\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_NOSEC ? TRUE : FALSE\n);\n// process the header IEs\n@@ -814,7 +815,7 @@ port_INLINE void sixtop_sendKA() {\nmemcpy(&(kaPkt->l2_nextORpreviousHop),kaNeighAddr,sizeof(open_addr_t));\n// set l2-security attributes\n- kaPkt->l2_securityLevel = IEEE802154_security_getSecurityLevel();\n+ kaPkt->l2_securityLevel = IEEE802154_SECURITY_LEVEL; // do not exchange KAs with\nkaPkt->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\nkaPkt->l2_keyIndex = IEEE802154_security_getDataKeyIndex();\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Modify getSecurityLevel to query whether a neighbor is secure or not.
|
491,609
|
05.07.2017 18:26:19
| -7,200
|
d7497bf790dc26b58eeef310f37389917d8b3a09
|
When sending, use proper SAC and DAC flags from RFC6282.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/forwarding.c",
"new_path": "openstack/03b-IPv6/forwarding.c",
"diff": "@@ -71,8 +71,10 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\nopen_addr_t* p_src;\nopen_addr_t temp_src_prefix;\nopen_addr_t temp_src_mac64b;\n+ bool sac;\nuint8_t sam;\nuint8_t m;\n+ bool dac;\nuint8_t dam;\nuint8_t next_header;\n@@ -94,8 +96,12 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\nlink_local_prefix.prefix[0] = 0xfe;\nlink_local_prefix.prefix[1] = 0x80;\nmyprefix = &link_local_prefix;\n+ sac = IPHC_SAC_STATELESS;\n+ dac = IPHC_DAC_STATELESS;\n} else {\nmyprefix = idmanager_getMyID(ADDR_PREFIX);\n+ sac = IPHC_SAC_STATEFUL;\n+ dac = IPHC_DAC_STATEFUL;\n}\nmemcpy(&(msg->l3_sourceAdd.addr_128b[0]),myprefix->prefix,8);\nmemcpy(&(msg->l3_sourceAdd.addr_128b[8]),myadd64->addr_64b,8);\n@@ -163,10 +169,10 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\nIPHC_HLIM_64,\nipv6_outer_header.hop_limit,\nIPHC_CID_NO,\n- IPHC_SAC_STATELESS,\n+ sac,\nsam,\nm,\n- IPHC_DAC_STATELESS,\n+ dac,\ndam,\np_dest,\np_src,\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. When sending, use proper SAC and DAC flags from RFC6282.
|
491,609
|
05.07.2017 18:32:53
| -7,200
|
5f14b85eb304e4cd490361458456c865e536b971
|
Get the join proxy from neighbors module and send join request according to minimal-security-03 draft.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "#include \"scheduler.h\"\n#include \"idmanager.h\"\n#include \"IEEE802154E.h\"\n+#include \"IEEE802154_security.h\"\n#include \"icmpv6rpl.h\"\n#include \"cbor.h\"\n#include \"eui64.h\"\n+#include \"neighbors.h\"\n//=========================== defines =========================================\nconst uint8_t cjoin_path0[] = \"j\";\n-static const uint8_t ipAddr_jce[] = {0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};\n-\nstatic const uint8_t masterSecret[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \\\n0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};\n@@ -51,7 +50,7 @@ void cjoin_timer_cb(void);\nvoid cjoin_task_cb(void);\nvoid cjoin_sendDone(OpenQueueEntry_t* msg,\nowerror_t error);\n-owerror_t cjoin_sendJoinRequest(void);\n+owerror_t cjoin_sendJoinRequest(open_addr_t *joinProxy);\nvoid cjoin_retransmission_cb(void);\nvoid cjoin_retransmission_task_cb(void);\nbool cjoin_getIsJoined(void);\n@@ -132,7 +131,6 @@ owerror_t cjoin_receive(OpenQueueEntry_t* msg,\ncoap_option_iht* coap_outgoingOptions,\nuint8_t* coap_outgoingOptionsLen) {\n- uint8_t i;\njoin_response_t join_response;\nowerror_t ret;\n@@ -142,20 +140,14 @@ owerror_t cjoin_receive(OpenQueueEntry_t* msg,\nreturn E_FAIL;\n}\n- // loop through the options and look for content format\n- i = 0;\n- while(coap_incomingOptions[i].type != COAP_OPTION_NONE) {\n- if (coap_incomingOptions[i].type == COAP_OPTION_NUM_CONTENTFORMAT &&\n- *(coap_incomingOptions[i].pValue) == COAP_MEDTYPE_APPCBOR) {\nret = cbor_parse_join_response(&join_response, msg->payload, msg->length);\nif (ret == E_FAIL) { return E_FAIL; }\n- // set the internal keys as per the parsed values\n+ // set the L2 keys as per the parsed value\n+ IEEE802154_security_setBeaconKey(join_response.keyset.key[0].kid[0], join_response.keyset.key[0].k);\n+ IEEE802154_security_setDataKey(join_response.keyset.key[0].kid[0], join_response.keyset.key[0].k);\n+\ncjoin_setIsJoined(TRUE); // declare join is over\n- break;\n- }\n- i++;\n- }\nreturn E_SUCCESS;\n}\n@@ -172,11 +164,24 @@ void cjoin_retransmission_cb(void) {\n}\nvoid cjoin_retransmission_task_cb() {\n- cjoin_sendJoinRequest();\n+ open_addr_t* joinProxy;\n+\n+ joinProxy = neighbors_getJoinProxy();\n+ if(joinProxy == NULL) {\n+ openserial_printError(\n+ COMPONENT_CJOIN,\n+ ERR_ABORT_JOIN_PROCESS,\n+ (errorparameter_t)0,\n+ (errorparameter_t)0\n+ );\n+ return;\n+ }\n+\n+ cjoin_sendJoinRequest(joinProxy);\n}\nvoid cjoin_task_cb() {\n- uint8_t temp;\n+ open_addr_t *joinProxy;\n// don't run if not synch\nif (ieee154e_isSynch() == FALSE) return;\n@@ -187,19 +192,15 @@ void cjoin_task_cb() {\nreturn;\n}\n- // don't run if no route to DAG root\n- if (icmpv6rpl_getPreferredParentIndex(&temp) == FALSE) {\n- return;\n- }\n-\n- if (icmpv6rpl_daoSent() == FALSE) {\n+ joinProxy = neighbors_getJoinProxy();\n+ if(joinProxy == NULL) {\nreturn;\n}\n// cancel the startup timer but do not destroy it as we reuse it for retransmissions\nopentimers_cancel(cjoin_vars.timerId);\n- cjoin_sendJoinRequest();\n+ cjoin_sendJoinRequest(joinProxy);\nreturn;\n}\n@@ -208,8 +209,9 @@ void cjoin_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\nopenqueue_freePacketBuffer(msg);\n}\n-owerror_t cjoin_sendJoinRequest(void) {\n+owerror_t cjoin_sendJoinRequest(open_addr_t* joinProxy) {\nOpenQueueEntry_t* pkt;\n+ open_addr_t* prefix;\nowerror_t outcome;\ncoap_option_iht options[5];\n@@ -259,14 +261,16 @@ owerror_t cjoin_sendJoinRequest(void) {\n// metadata\npkt->l4_destination_port = WKP_UDP_COAP;\npkt->l3_destinationAdd.type = ADDR_128B;\n- memcpy(&pkt->l3_destinationAdd.addr_128b[0],&ipAddr_jce,16);\n+ prefix = idmanager_getMyID(ADDR_PREFIX); // at this point, this is link-local prefix\n+ memcpy(&pkt->l3_destinationAdd.addr_128b[0],prefix->prefix,8);\n+ memcpy(&pkt->l3_destinationAdd.addr_128b[8],joinProxy->addr_64b,8); // set host to eui-64 of the join proxy\n// send\noutcome = opencoap_send(\npkt,\nCOAP_TYPE_CON,\nCOAP_CODE_REQ_GET,\n- 1, // token len\n+ 0, // token len\noptions,\n4, // options len\n&cjoin_vars.desc\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Get the join proxy from neighbors module and send join request according to minimal-security-03 draft.
|
491,609
|
05.07.2017 18:33:39
| -7,200
|
d112098d66ee26edeaed0225d50d5c6bd137cbd3
|
Add missing error code for join process and insecure variable to neighbors.
|
[
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "@@ -259,6 +259,7 @@ enum {\nERR_BUFFER_OVERFLOW = 0x44, // OSCOAP buffer overflow detected {code location {0}}\nERR_REPLAY_FAILED = 0x45, // OSCOAP replay protection failed\nERR_DECRYPTION_FAILED = 0x46, // OSCOAP decryption and tag verification failed\n+ ERR_ABORT_JOIN_PROCESS = 0x47, // Aborted join process {code location {0}}\n};\n//=========================== typedef =========================================\n@@ -358,6 +359,7 @@ typedef struct {\nBEGIN_PACK\ntypedef struct {\nbool used;\n+ bool insecure;\nuint8_t parentPreference;\nbool stableNeighbor;\nuint8_t switchStabilityCounter;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Add missing error code for join process and insecure variable to neighbors.
|
491,609
|
06.07.2017 10:25:57
| -7,200
|
4b56ccb30567160151a6900209f5ec1f4379dc63
|
Send EBs only once joined and DAO was sent.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -688,8 +688,13 @@ port_INLINE void sixtop_sendEB() {\nOpenQueueEntry_t* eb;\nuint8_t i;\n- if ((ieee154e_isSynch()==FALSE) || (icmpv6rpl_getMyDAGrank()==DEFAULTDAGRANK) || (cjoin_getIsJoined()==FALSE)){\n- // I'm not sync'ed or I did not acquire a DAGrank or I did not join yet\n+ if ((ieee154e_isSynch()==FALSE) ||\n+ (IEEE802154_security_isConfigured()==FALSE) ||\n+ (icmpv6rpl_getMyDAGrank()==DEFAULTDAGRANK) ||\n+ icmpv6rpl_daoSent()==FALSE) {\n+ // I'm not sync'ed, or did not join, or did not acquire a DAGrank or did not send out a DAO\n+ // before starting to advertize the network, we need to make sure that we are reachable downwards,\n+ // thus, the condition if DAO was sent\n// delete packets genereted by this module (EB and KA) from openqueue\nopenqueue_removeAllCreatedBy(COMPONENT_SIXTOP);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -809,6 +809,9 @@ void icmpv6rpl_setDAOPeriod(uint16_t daoPeriod){\n}\nbool icmpv6rpl_daoSent(void) {\n+ if (idmanager_getIsDAGroot()==TRUE) {\n+ return TRUE;\n+ }\nreturn icmpv6rpl_vars.daoSent;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Send EBs only once joined and DAO was sent.
|
491,609
|
06.07.2017 13:32:54
| -7,200
|
e7f1a1aa76f84f96ce260ee26b15d7b5dd03699b
|
Allow network to form by accepting unsecured L2 frames from pledges.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154.c",
"new_path": "openstack/02a-MAClow/IEEE802154.c",
"diff": "@@ -328,14 +328,13 @@ void ieee802154_retrieveHeader(OpenQueueEntry_t* msg,\nreturn; //invalid packet accordint to p.64 IEEE15.4e\n}\n- // security decision tree.\n- // pass header parsing iff:\n- // - received unsecured frame and security disabled locally\n- // - received secured frame and security is enabled locally\n+ // parse security header if security is supported locally\nif (ieee802514_header->securityEnabled && IEEE802154_SECURITY_SUPPORTED) {\nIEEE802154_security_retrieveAuxiliarySecurityHeader(msg,ieee802514_header);\n}\n- else if (ieee802514_header->securityEnabled != IEEE802154_SECURITY_SUPPORTED) { return; }\n+ else if (ieee802514_header->securityEnabled && IEEE802154_SECURITY_SUPPORTED==0) {\n+ return; // security not supported\n+ }\n// remove termination IE accordingly\nif (ieee802514_header->ieListPresent == TRUE) {\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -613,6 +613,11 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\nieee154e_vars.dataReceived->l2_dsn = ieee802514_header.dsn;\nmemcpy(&(ieee154e_vars.dataReceived->l2_nextORpreviousHop),&(ieee802514_header.src),sizeof(open_addr_t));\n+ // verify that incoming security level is acceptable\n+ if (IEEE802154_security_acceptableLevel(ieee154e_vars.dataReceived, &ieee802514_header) == FALSE) {\n+ break;\n+ }\n+\nif (ieee154e_vars.dataReceived->l2_securityLevel != IEEE154_ASH_SLF_TYPE_NOSEC) {\n// If we are not synced, we need to parse IEs and retrieve the ASN\n// before authenticating the beacon, because nonce is created from the ASN\n@@ -624,7 +629,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\nelse { // discard other frames as we cannot decrypt without being synced\nbreak;\n}\n- } // checked if unsecured frame should pass during header retrieval\n+ }\n// toss the IEEE802.15.4 header -- this does not include IEs as they are processed\n// next.\n@@ -1451,12 +1456,17 @@ port_INLINE void activity_ti9(PORT_TIMER_WIDTH capturedTime) {\nieee154e_vars.ackReceived->l2_dsn = ieee802514_header.dsn;\nmemcpy(&(ieee154e_vars.ackReceived->l2_nextORpreviousHop),&(ieee802514_header.src),sizeof(open_addr_t));\n+ // verify that incoming security level is acceptable\n+ if (IEEE802154_security_acceptableLevel(ieee154e_vars.ackReceived, &ieee802514_header) == FALSE) {\n+ break;\n+ }\n+\n// check the security level of the ACK frame and decrypt/authenticate\nif (ieee154e_vars.ackReceived->l2_securityLevel != IEEE154_ASH_SLF_TYPE_NOSEC) {\nif (IEEE802154_security_incomingFrame(ieee154e_vars.ackReceived) != E_SUCCESS) {\nbreak;\n}\n- } // checked if unsecured frame should pass during header retrieval\n+ }\n// toss the IEEE802.15.4 header\npacketfunctions_tossHeader(ieee154e_vars.ackReceived,ieee802514_header.headerLength);\n@@ -1705,12 +1715,26 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nieee154e_vars.dataReceived->l2_IEListPresent = ieee802514_header.ieListPresent;\nmemcpy(&(ieee154e_vars.dataReceived->l2_nextORpreviousHop),&(ieee802514_header.src),sizeof(open_addr_t));\n- // if security is enabled, decrypt/authenticate the frame.\n+ // verify that incoming security level is acceptable\n+ if (IEEE802154_security_acceptableLevel(ieee154e_vars.dataReceived, &ieee802514_header) == FALSE) {\n+ break;\n+ }\n+\n+ // if security is active and configured need to decrypt the frame\nif (ieee154e_vars.dataReceived->l2_securityLevel != IEEE154_ASH_SLF_TYPE_NOSEC) {\n+ if (IEEE802154_security_isConfigured()) {\nif (IEEE802154_security_incomingFrame(ieee154e_vars.dataReceived) != E_SUCCESS) {\nbreak;\n}\n- } // checked if unsecured frame should pass during header retrieval\n+ }\n+ // bypass authentication of beacons during join process\n+ else if(ieee154e_vars.dataReceived->l2_frameType == IEEE154_TYPE_BEACON) { // not joined yet\n+ packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.dataReceived->l2_authenticationLength);\n+ }\n+ else {\n+ break;\n+ }\n+ }\n// toss the IEEE802.15.4 header\npacketfunctions_tossHeader(ieee154e_vars.dataReceived,ieee802514_header.headerLength);\n@@ -1819,7 +1843,10 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\n#endif\n} else {\n// synchronize to the received packet if I'm not a DAGroot and this is my preferred parent\n- if (idmanager_getIsDAGroot()==FALSE && icmpv6rpl_isPreferredParent(&(ieee154e_vars.dataReceived->l2_nextORpreviousHop))) {\n+ // or in case I'm in the middle of the join process when parent is not yet selected\n+ if (idmanager_getIsDAGroot()==FALSE &&\n+ (icmpv6rpl_isPreferredParent(&(ieee154e_vars.dataReceived->l2_nextORpreviousHop)) ||\n+ IEEE802154_security_isConfigured() == FALSE)) {\nsynchronizePacket(ieee154e_vars.syncCapturedTime);\n}\n// indicate reception to upper layer (no ACK asked)\n@@ -2203,10 +2230,17 @@ bool isValidJoin(OpenQueueEntry_t* eb, ieee802154_header_iht *parsedHeader) {\n// correct frame length and correct pointers (first byte of the frame)\npacketfunctions_reserveHeaderSize(eb, parsedHeader->headerLength);\n- // verify EB's authentication tag\n+ // verify EB's authentication tag if keys are configured\n+ if (IEEE802154_security_isConfigured()) {\nif (IEEE802154_security_incomingFrame(eb) == E_SUCCESS) {\nreturn TRUE;\n}\n+ }\n+ else {\n+ // bypass authentication check for beacons if security is not configured\n+ packetfunctions_tossFooter(eb,eb->l2_authenticationLength);\n+ return TRUE;\n+ }\nreturn FALSE;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.c",
"new_path": "openstack/02a-MAClow/IEEE802154_security.c",
"diff": "@@ -32,6 +32,10 @@ ieee802154_security_vars_t ieee802154_security_vars;\n*/\nvoid IEEE802154_security_init(void) {\n+ // TODO joinPermitted flag should be set dynamically upon a button press\n+ // and propagated through the network via EBs\n+ ieee802154_security_vars.joinPermitted = TRUE;\n+\n// invalidate beacon key (key 1)\nieee802154_security_vars.k1.index = IEEE802154_SECURITY_KEYINDEX_INVALID;\nmemset(&ieee802154_security_vars.k1.value[0], 0x00, 16);\n@@ -463,17 +467,63 @@ bool IEEE802154_security_isConfigured() {\n}\nuint8_t IEEE802154_security_getSecurityLevel(OpenQueueEntry_t *msg) {\n- if (IEEE802154_security_isConfigured()) {\n- if(neighbors_isInsecureNeighbor(&msg->l2_nextORpreviousHop)) {\n+ if (IEEE802154_security_isConfigured() == FALSE) {\nreturn IEEE154_ASH_SLF_TYPE_NOSEC;\n}\n- else {\n+\n+ if (packetfunctions_isBroadcastMulticast(&msg->l2_nextORpreviousHop)) {\nreturn IEEE802154_SECURITY_LEVEL;\n}\n- }\n+\n+ if(neighbors_isInsecureNeighbor(&msg->l2_nextORpreviousHop) &&\n+ ieee802154_security_vars.joinPermitted == TRUE) {\nreturn IEEE154_ASH_SLF_TYPE_NOSEC;\n}\n+ return IEEE802154_SECURITY_LEVEL;\n+}\n+\n+bool IEEE802154_security_acceptableLevel(OpenQueueEntry_t* msg, ieee802154_header_iht* parsedHeader) {\n+ if (IEEE802154_security_isConfigured() == FALSE &&\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_NOSEC) {\n+ return TRUE;\n+ }\n+\n+ if (IEEE802154_security_isConfigured() == FALSE &&\n+ msg->l2_frameType == IEEE154_TYPE_BEACON &&\n+ (msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_MIC_32 ||\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_MIC_64 ||\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_MIC_128)) {\n+ return TRUE;\n+ }\n+\n+ if (IEEE802154_security_isConfigured() == TRUE &&\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_NOSEC &&\n+ ieee802154_security_vars.joinPermitted == TRUE &&\n+ neighbors_isInsecureNeighbor(&parsedHeader->src) == TRUE) {\n+ return TRUE;\n+ }\n+\n+ if (IEEE802154_security_isConfigured() == TRUE &&\n+ msg->l2_frameType == IEEE154_TYPE_BEACON &&\n+ (msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_MIC_32 ||\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_MIC_64 ||\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_MIC_128)) {\n+ return TRUE;\n+ }\n+\n+ if (IEEE802154_security_isConfigured() == TRUE &&\n+ (msg->l2_frameType == IEEE154_TYPE_DATA ||\n+ msg->l2_frameType == IEEE154_TYPE_ACK ||\n+ msg->l2_frameType == IEEE154_TYPE_CMD) &&\n+ (msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_ENC_MIC_32 ||\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_ENC_MIC_64 ||\n+ msg->l2_securityLevel == IEEE154_ASH_SLF_TYPE_ENC_MIC_128)) {\n+ return TRUE;\n+ }\n+ return FALSE;\n+}\n+\n#else /* L2_SECURITY_ACTIVE */\nvoid IEEE802154_security_init(void) {\n@@ -526,5 +576,10 @@ bool IEEE802154_security_isConfigured() {\nuint8_t IEEE802154_security_getSecurityLevel(OpenQueueEntry_t *msg) {\nreturn IEEE154_ASH_SLF_TYPE_NOSEC;\n}\n+\n+bool IEEE802154_security_acceptableLevel(OpenQueueEntry_t* msg, ieee802154_header_iht* parsedheader) {\n+ return TRUE;\n+}\n+\n#endif /* L2_SECURITY_ACTIVE */\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.h",
"new_path": "openstack/02a-MAClow/IEEE802154_security.h",
"diff": "@@ -52,6 +52,7 @@ typedef struct{\n//=========================== variables =======================================\ntypedef struct {\n+ bool joinPermitted;\nkey_t k1;\nkey_t k2;\n} ieee802154_security_vars_t;\n@@ -70,6 +71,7 @@ uint8_t IEEE802154_security_getDataKeyIndex(void);\nvoid IEEE802154_security_setBeaconKey(uint8_t index, uint8_t* value);\nvoid IEEE802154_security_setDataKey(uint8_t index, uint8_t* value);\nuint8_t IEEE802154_security_getSecurityLevel(OpenQueueEntry_t *msg);\n+bool IEEE802154_security_acceptableLevel(OpenQueueEntry_t* msg, ieee802154_header_iht* parsedHeader);\nbool IEEE802154_security_isConfigured(void);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/neighbors.c",
"new_path": "openstack/02b-MAChigh/neighbors.c",
"diff": "@@ -209,8 +209,8 @@ bool neighbors_isInsecureNeighbor(open_addr_t* address) {\nuint8_t i;\nbool returnVal;\n- // if not found, not insecure\n- returnVal = FALSE;\n+ // if not found, insecure\n+ returnVal = TRUE;\nswitch (address->type) {\ncase ADDR_64B:\n@@ -224,8 +224,8 @@ bool neighbors_isInsecureNeighbor(open_addr_t* address) {\n// iterate through neighbor table\nfor (i=0;i<MAXNUMNEIGHBORS;i++) {\n- if (isThisRowMatching(address,i) && neighbors_vars.neighbors[i].insecure==TRUE) {\n- returnVal = TRUE;\n+ if (isThisRowMatching(address,i)) {\n+ returnVal = neighbors_vars.neighbors[i].insecure;\nbreak;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -458,6 +458,7 @@ functionsToChange = [\n'IEEE802154_security_setBeaconKey',\n'IEEE802154_security_setDataKey',\n'IEEE802154_security_getSecurityLevel',\n+ 'IEEE802154_security_acceptableLevel',\n'IEEE802154_security_isConfigured',\n# IEEE802154\n'ieee802154_prependHeader',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Allow network to form by accepting unsecured L2 frames from pledges.
|
491,609
|
06.07.2017 15:26:02
| -7,200
|
88ec0a086a0a170e96f0546b41cb419188f0805b
|
Update cjoin timer callbacks and fix indent.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "@@ -45,13 +45,12 @@ owerror_t cjoin_receive(OpenQueueEntry_t* msg,\ncoap_option_iht* coap_incomingOptions,\ncoap_option_iht* coap_outgoingOptions,\nuint8_t* coap_outgoingOptionsLen);\n-\n-void cjoin_timer_cb(void);\n+void cjoin_timer_cb(opentimers_id_t id);\nvoid cjoin_task_cb(void);\nvoid cjoin_sendDone(OpenQueueEntry_t* msg,\nowerror_t error);\nowerror_t cjoin_sendJoinRequest(open_addr_t *joinProxy);\n-void cjoin_retransmission_cb(void);\n+void cjoin_retransmission_cb(opentimers_id_t id);\nvoid cjoin_retransmission_task_cb(void);\nbool cjoin_getIsJoined(void);\nvoid cjoin_setIsJoined(bool newValue);\n@@ -154,12 +153,11 @@ owerror_t cjoin_receive(OpenQueueEntry_t* msg,\n//timer fired, but we don't want to execute task in ISR mode\n//instead, push task to scheduler with COAP priority, and let scheduler take care of it\n-void cjoin_timer_cb(void){\n+void cjoin_timer_cb(opentimers_id_t id){\nscheduler_push_task(cjoin_task_cb,TASKPRIO_COAP);\n}\n-void cjoin_retransmission_cb(void) {\n-\n+void cjoin_retransmission_cb(opentimers_id_t id) {\nscheduler_push_task(cjoin_retransmission_task_cb, TASKPRIO_COAP);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.h",
"new_path": "openapps/cjoin/cjoin.h",
"diff": "@@ -34,8 +34,6 @@ void cjoin_setIsJoined(bool newValue);\nvoid cjoin_setJoinKey(uint8_t *key, uint8_t len);\nbool debugPrint_joined(void);\n-\n-\n/**\n\\}\n\\}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Update cjoin timer callbacks and fix indent.
|
491,609
|
06.07.2017 16:58:49
| -7,200
|
0143eadbc2a8bb128a56f7e2679c797c23470433
|
Remove SHA-related warnings.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/usha.c",
"new_path": "openstack/cross-layers/usha.c",
"diff": "@@ -67,21 +67,9 @@ int USHAInput(USHAContext *context,\n{\nif (!context) return shaNull;\nswitch (context->whichSha) {\n- /* case SHA1:\n- return SHA1Input((SHA1Context*)&context->ctx, bytes,\n- bytecount);\n- case SHA224:\n- return SHA224Input((SHA224Context*)&context->ctx, bytes,\n- bytecount); */\ncase SHA256:\nreturn SHA256Input((SHA256Context*)&context->ctx, bytes,\nbytecount);\n- /* case SHA384:\n- return SHA384Input((SHA384Context*)&context->ctx, bytes,\n- bytecount);\n- case SHA512:\n- return SHA512Input((SHA512Context*)&context->ctx, bytes,\n- bytecount); */\ndefault: return shaBadParam;\n}\n}\n@@ -110,21 +98,9 @@ int USHAFinalBits(USHAContext *context,\n{\nif (!context) return shaNull;\nswitch (context->whichSha) {\n- /* case SHA1:\n- return SHA1FinalBits((SHA1Context*)&context->ctx, bits,\n- bit_count);\n- case SHA224:\n- return SHA224FinalBits((SHA224Context*)&context->ctx, bits,\n- bit_count); */\ncase SHA256:\nreturn SHA256FinalBits((SHA256Context*)&context->ctx, bits,\nbit_count);\n- /* case SHA384:\n- return SHA384FinalBits((SHA384Context*)&context->ctx, bits,\n- bit_count);\n- case SHA512:\n- return SHA512FinalBits((SHA512Context*)&context->ctx, bits,\n- bit_count); */\ndefault: return shaBadParam;\n}\n}\n@@ -153,20 +129,9 @@ int USHAResult(USHAContext *context,\n{\nif (!context) return shaNull;\nswitch (context->whichSha) {\n-/* case SHA1:\n- return SHA1Result((SHA1Context*)&context->ctx, Message_Digest);\n- case SHA224:\n- return SHA224Result((SHA224Context*)&context->ctx,\n- Message_Digest); */\ncase SHA256:\nreturn SHA256Result((SHA256Context*)&context->ctx,\nMessage_Digest);\n- /* case SHA384:\n- return SHA384Result((SHA384Context*)&context->ctx,\n- Message_Digest);\n- case SHA512:\n- return SHA512Result((SHA512Context*)&context->ctx,\n- Message_Digest); */\ndefault: return shaBadParam;\n}\n}\n@@ -189,12 +154,8 @@ int USHAResult(USHAContext *context,\nint USHABlockSize(enum SHAversion whichSha)\n{\nswitch (whichSha) {\n-/* case SHA1: return SHA1_Message_Block_Size;\n- case SHA224: return SHA224_Message_Block_Size; */\ncase SHA256: return SHA256_Message_Block_Size;\n-/* case SHA384: return SHA384_Message_Block_Size;\n- default:\n- case SHA512: return SHA512_Message_Block_Size; */\n+ default: return 0;\n}\n}\n@@ -216,12 +177,8 @@ int USHABlockSize(enum SHAversion whichSha)\nint USHAHashSize(enum SHAversion whichSha)\n{\nswitch (whichSha) {\n- /* case SHA1: return SHA1HashSize;\n- case SHA224: return SHA224HashSize; */\ncase SHA256: return SHA256HashSize;\n- /* case SHA384: return SHA384HashSize;\n- default:\n- case SHA512: return SHA512HashSize; */\n+ default: return 0;\n}\n}\n@@ -243,12 +200,8 @@ int USHAHashSize(enum SHAversion whichSha)\nint USHAHashSizeBits(enum SHAversion whichSha)\n{\nswitch (whichSha) {\n- /* case SHA1: return SHA1HashSizeBits;\n- case SHA224: return SHA224HashSizeBits; */\ncase SHA256: return SHA256HashSizeBits;\n- /* case SHA384: return SHA384HashSizeBits;\n- default:\n- case SHA512: return SHA512HashSizeBits; */\n+ default: return 0;\n}\n}\n@@ -270,12 +223,8 @@ int USHAHashSizeBits(enum SHAversion whichSha)\nconst char *USHAHashName(enum SHAversion whichSha)\n{\nswitch (whichSha) {\n- /* case SHA1: return \"SHA1\";\n- case SHA224: return \"SHA224\"; */\ncase SHA256: return \"SHA256\";\n- /* case SHA384: return \"SHA384\";\n- default:\n- case SHA512: return \"SHA512\"; */\n+ default: return 0;\n}\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Remove SHA-related warnings.
|
491,609
|
06.07.2017 17:10:11
| -7,200
|
3df17972bb2ba48374f7cdb52090dc211bd7b63e
|
Rename 802154 key struct.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.h",
"new_path": "openstack/02a-MAClow/IEEE802154_security.h",
"diff": "typedef struct{\nuint8_t index;\nuint8_t value[16];\n-} key_t;\n+} symmetric_key_802154_t;\n//=========================== variables =======================================\ntypedef struct {\nbool joinPermitted;\n- key_t k1;\n- key_t k2;\n+ symmetric_key_802154_t k1;\n+ symmetric_key_802154_t k2;\n} ieee802154_security_vars_t;\n//=========================== prototypes ======================================\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Rename 802154 key struct.
|
491,595
|
06.07.2017 17:18:50
| -7,200
|
eb54a73103134a0f731301d45f2769ab1471216e
|
copy the key rather than set.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154_security.c",
"new_path": "openstack/02a-MAClow/IEEE802154_security.c",
"diff": "@@ -140,7 +140,7 @@ void IEEE802154_security_init(void) {\n//copy key2\nmemset(&ieee802154_security_vars.Key_2[0], 0, 16);\n- memset(&ieee802154_security_vars.Key_2[0], &key2[0], 16);\n+ memcpy(&ieee802154_security_vars.Key_2[0], &key2[0], 16);\n//store the key 2 and related attributes\n//Creation of the KeyDescriptor - Key 2 should be used to encrypt and authenticate data, command and ack frames\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
copy the key rather than set.
|
491,609
|
06.07.2017 19:01:00
| -7,200
|
2d66b2de589a107e0516fe06f53e76fb1ae7c5ec
|
Remove dependency on cjoin in openserial and move info to idmanager.
|
[
{
"change_type": "MODIFY",
"old_path": "drivers/common/openserial.c",
"new_path": "drivers/common/openserial.c",
"diff": "#include \"icmpv6rpl.h\"\n#include \"icmpv6echo.h\"\n#include \"sf0.h\"\n-#include \"cjoin.h\"\n//=========================== variables =======================================\n@@ -775,7 +774,8 @@ void openserial_handleCommands(void){\n}\nbreak;\ncase COMMAND_SET_JOIN_KEY:\n- cjoin_setJoinKey(&openserial_vars.inputBuf[ptr], commandLen);\n+ if (commandLen != 16) { break; }\n+ idmanager_setJoinKey(&openserial_vars.inputBuf[ptr]);\nbreak;\ndefault:\n// wrong command ID\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "@@ -70,13 +70,11 @@ void cjoin_init() {\ncjoin_vars.isJoined = FALSE;\n- memset(&cjoin_vars.joinAsn, 0x00, sizeof(asn_t));\n-\nopencoap_register(&cjoin_vars.desc);\ncjoin_vars.timerId = opentimers_create();\n- memcpy(cjoin_vars.joinKey, masterSecret, sizeof(cjoin_vars.joinKey));\n+ idmanager_setJoinKey(masterSecret);\ncjoin_init_security_context();\ncjoin_schedule();\n@@ -85,28 +83,25 @@ void cjoin_init() {\nvoid cjoin_init_security_context() {\nuint8_t senderID[9]; // needs to hold EUI-64 + 1 byte\nuint8_t recipientID[9]; // needs to hold EUI-64 + 1 byte\n-\n+ uint8_t* joinKey;\neui64_get(senderID);\nsenderID[8] = 0x00; // construct sender ID according to the minimal-security-03 draft\neui64_get(recipientID);\nrecipientID[8] = 0x01; // construct recipient ID according to the minimal-security-03 draft\n+ idmanager_getJoinKey(&joinKey);\n+\nopenoscoap_init_security_context(&cjoin_vars.context,\nsenderID,\nsizeof(senderID),\nrecipientID,\nsizeof(recipientID),\n- cjoin_vars.joinKey,\n- sizeof(cjoin_vars.joinKey),\n+ joinKey,\n+ 16,\nNULL,\n0);\n}\n-void cjoin_setJoinKey(uint8_t *key, uint8_t len) {\n- memcpy(cjoin_vars.joinKey, key, len);\n- cjoin_init_security_context();\n-}\n-\nvoid cjoin_schedule() {\nuint16_t delay;\n@@ -296,27 +291,17 @@ bool cjoin_getIsJoined() {\nvoid cjoin_setIsJoined(bool newValue) {\nuint8_t array[5];\n- INTERRUPT_DECLARATION();\n- DISABLE_INTERRUPTS();\n-\n- if (cjoin_vars.isJoined == newValue) {\n- ENABLE_INTERRUPTS();\n- return;\n- }\n+ asn_t joinAsn;\ncjoin_vars.isJoined = newValue;\n// Update Join ASN value\n- if (idmanager_getIsDAGroot() == FALSE) {\nieee154e_getAsn(array);\n- cjoin_vars.joinAsn.bytes0and1 = ((uint16_t) array[1] << 8) | ((uint16_t) array[0]);\n- cjoin_vars.joinAsn.bytes2and3 = ((uint16_t) array[3] << 8) | ((uint16_t) array[2]);\n- cjoin_vars.joinAsn.byte4 = array[4];\n- } else {\n- // Dag root resets the ASN value to zero\n- memset(&cjoin_vars.joinAsn, 0x00, sizeof(asn_t));\n- }\n- ENABLE_INTERRUPTS();\n+ joinAsn.bytes0and1 = ((uint16_t) array[1] << 8) | ((uint16_t) array[0]);\n+ joinAsn.bytes2and3 = ((uint16_t) array[3] << 8) | ((uint16_t) array[2]);\n+ joinAsn.byte4 = array[4];\n+\n+ idmanager_setJoinAsn(&joinAsn);\nif (newValue == TRUE) {\n// log the info\n@@ -326,21 +311,3 @@ void cjoin_setIsJoined(bool newValue) {\n}\n}\n-/**\n-\\brief Trigger this module to print status information, over serial.\n-\n-debugPrint_* functions are used by the openserial module to continuously print\n-status information about several modules in the OpenWSN stack.\n-\n-\\returns TRUE if this function printed something, FALSE otherwise.\n-*/\n-bool debugPrint_joined() {\n- asn_t output;\n- output.byte4 = cjoin_vars.joinAsn.byte4;\n- output.bytes2and3 = cjoin_vars.joinAsn.bytes2and3;\n- output.bytes0and1 = cjoin_vars.joinAsn.bytes0and1;\n- openserial_printStatus(STATUS_JOINED,(uint8_t*)&output,sizeof(output));\n- return TRUE;\n-}\n-\n-\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.h",
"new_path": "openapps/cjoin/cjoin.h",
"diff": "@@ -18,8 +18,6 @@ typedef struct {\ncoap_resource_desc_t desc;\nopentimers_id_t timerId;\nbool isJoined;\n- asn_t joinAsn;\n- uint8_t joinKey[16];\noscoap_security_context_t context;\n} cjoin_vars_t;\n@@ -32,7 +30,6 @@ void cjoin_schedule(void);\nbool cjoin_getIsJoined(void);\nvoid cjoin_setIsJoined(bool newValue);\nvoid cjoin_setJoinKey(uint8_t *key, uint8_t len);\n-bool debugPrint_joined(void);\n/**\n\\}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/idmanager.c",
"new_path": "openstack/cross-layers/idmanager.c",
"diff": "@@ -261,6 +261,19 @@ void idmanager_triggerAboutRoot() {\nreturn;\n}\n+void idmanager_setJoinKey(uint8_t *key) {\n+ memcpy(idmanager_vars.joinKey, key, 16);\n+}\n+\n+void idmanager_getJoinKey(uint8_t **pKey) {\n+ *pKey = idmanager_vars.joinKey;\n+ return;\n+}\n+\n+void idmanager_setJoinAsn(asn_t* asn) {\n+ memcpy(&idmanager_vars.joinAsn, asn, sizeof(asn_t));\n+}\n+\n/**\n\\brief Trigger this module to print status information, over serial.\n@@ -282,5 +295,13 @@ bool debugPrint_id() {\nreturn TRUE;\n}\n+bool debugPrint_joined() {\n+ asn_t output;\n+ output.byte4 = idmanager_vars.joinAsn.byte4;\n+ output.bytes2and3 = idmanager_vars.joinAsn.bytes2and3;\n+ output.bytes0and1 = idmanager_vars.joinAsn.bytes0and1;\n+ openserial_printStatus(STATUS_JOINED,(uint8_t*)&output,sizeof(output));\n+ return TRUE;\n+}\n//=========================== private =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/idmanager.h",
"new_path": "openstack/cross-layers/idmanager.h",
"diff": "@@ -39,6 +39,8 @@ typedef struct {\nopen_addr_t my64bID;\nopen_addr_t myPrefix;\nbool slotSkip;\n+ uint8_t joinKey[16];\n+ asn_t joinAsn;\n} idmanager_vars_t;\n//=========================== prototypes ======================================\n@@ -51,9 +53,12 @@ open_addr_t* idmanager_getMyID(uint8_t type);\nowerror_t idmanager_setMyID(open_addr_t* newID);\nbool idmanager_isMyAddress(open_addr_t* addr);\nvoid idmanager_triggerAboutRoot(void);\n+void idmanager_setJoinKey(uint8_t *key);\n+void idmanager_setJoinAsn(asn_t *asn);\n+void idmanager_getJoinKey(uint8_t **pKey);\nbool debugPrint_id(void);\n-\n+bool debugPrint_joined(void);\n/**\n\\}\n\\}\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -765,7 +765,11 @@ functionsToChange = [\n'idmanager_isMyAddress',\n'idmanager_triggerAboutRoot',\n'idmanager_triggerAboutBridge',\n+ 'idmanager_setJoinKey',\n+ 'idmanager_setJoinAsn',\n+ 'idmanager_getJoinKey',\n'debugPrint_id',\n+ 'debugPrint_joined',\n# openqueue\n'openqueue_init',\n'debugPrint_queue',\n@@ -898,7 +902,6 @@ functionsToChange = [\n# cjoin\n'cjoin_init',\n'cjoin_init_security_context',\n- 'cjoin_setJoinKey',\n'cjoin_schedule',\n'cjoin_receive',\n'cjoin_timer_cb',\n@@ -909,7 +912,6 @@ functionsToChange = [\n'cjoin_retransmission_task_cb',\n'cjoin_getIsJoined',\n'cjoin_setIsJoined',\n- 'debugPrint_joined',\n]\nheaderFiles = [\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Remove dependency on cjoin in openserial and move info to idmanager.
|
491,609
|
07.07.2017 10:30:35
| -7,200
|
3eec023c59974a4ea2f07f7fd79996dcf661cd59
|
Add missing function to macpong.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_macpong/03oos_macpong.c",
"new_path": "projects/common/03oos_macpong/03oos_macpong.c",
"diff": "@@ -168,6 +168,9 @@ bool icmpv6rpl_isPreferredParent(open_addr_t* address) {\ndagrank_t icmpv6rpl_getMyDAGrank(void) {\nreturn 0;\n}\n+bool icmpv6rpl_daoSent(void) {\n+ return TRUE;\n+}\nvoid icmpv6rpl_setMyDAGrank(dagrank_t rank) { return; }\nvoid icmpv6rpl_killPreferredParent(void) { return; }\nvoid icmpv6rpl_updateMyDAGrankAndParentSelection(void) { return; }\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Add missing function to macpong.
|
491,609
|
07.07.2017 11:27:55
| -7,200
|
25e451325c6024710dc8b158a8ff08076dadaac1
|
Init coap only if there are some apps to initialize.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/SConscript",
"new_path": "openapps/SConscript",
"diff": "@@ -47,8 +47,11 @@ else:\n# union of default and additional apps (without duplicates)\napps = ['opencoap']\napps += sorted(list(set(defaultApps+userApps)))\n+if userApps:\nappsInit = ['opencoap'] # make sure opencoap is initialized first\nappsInit += sorted(list(set(userApps)))\n+else:\n+ appsInit = []\n#===== rule to create a (temporary) openapps_dyn.c file\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Init coap only if there are some apps to initialize.
|
491,595
|
09.07.2017 11:15:42
| -7,200
|
07b3a3dbd012c9886232e2e97def8e2ed13ff86b
|
format the function.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -1653,7 +1653,6 @@ port_INLINE void activity_ri4(PORT_TIMER_WIDTH capturedTime) {\n}\nport_INLINE void activity_rie3() {\n-\n// log the error\nopenserial_printError(COMPONENT_IEEE802154E,ERR_WDDATADURATION_OVERFLOWS,\n(errorparameter_t)ieee154e_vars.state,\n@@ -1716,12 +1715,14 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\n// retrieve the received data frame from the radio's Rx buffer\nieee154e_vars.dataReceived->payload = &(ieee154e_vars.dataReceived->packet[FIRST_FRAME_BYTE]);\n- radio_getReceivedFrame( ieee154e_vars.dataReceived->payload,\n+ radio_getReceivedFrame(\n+ ieee154e_vars.dataReceived->payload,\n&ieee154e_vars.dataReceived->length,\nsizeof(ieee154e_vars.dataReceived->packet),\n&ieee154e_vars.dataReceived->l1_rssi,\n&ieee154e_vars.dataReceived->l1_lqi,\n- &ieee154e_vars.dataReceived->l1_crc);\n+ &ieee154e_vars.dataReceived->l1_crc\n+ );\n// break if wrong length\nif (ieee154e_vars.dataReceived->length<LENGTH_CRC || ieee154e_vars.dataReceived->length>LENGTH_IEEE154_MAX ) {\n@@ -1766,19 +1767,17 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\n// toss the IEEE802.15.4 header\npacketfunctions_tossHeader(ieee154e_vars.dataReceived,ieee802514_header.headerLength);\n- // handle IEs xv poipoi\n- // reset join priority\n- // retrieve IE in sixtop\n+\nif (\n- (ieee802514_header.valid==TRUE &&\n- ieee802514_header.ieListPresent==TRUE &&\nieee802514_header.frameType == IEEE154_TYPE_BEACON && // if it is not a beacon and have ie, the ie will be processed in sixtop\n- packetfunctions_sameAddress(&ieee802514_header.panid,idmanager_getMyID(ADDR_PANID)) &&\n- ieee154e_processIEs(ieee154e_vars.dataReceived,&lenIE))==FALSE\n+ ieee802514_header.ieListPresent == TRUE &&\n+ packetfunctions_sameAddress(&ieee802514_header.panid,idmanager_getMyID(ADDR_PANID))\n) {\n- //log that the packet is not carrying IEs\n+ if (ieee154e_processIEs(ieee154e_vars.dataReceived,&lenIE)==FALSE){\n+ // retrieve EB IE failed, break the do-while loop and execute the clean up code below\nbreak;\n}\n+ }\n// toss the IEs including Synch\npacketfunctions_tossHeader(ieee154e_vars.dataReceived,lenIE);\n@@ -1804,9 +1803,11 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nieee154e_vars.ackToSend = openqueue_getFreePacketBuffer(COMPONENT_IEEE802154E);\nif (ieee154e_vars.ackToSend==NULL) {\n// log the error\n- openserial_printError(COMPONENT_IEEE802154E,ERR_NO_FREE_PACKET_BUFFER,\n+ openserial_printError(\n+ COMPONENT_IEEE802154E,ERR_NO_FREE_PACKET_BUFFER,\n(errorparameter_t)0,\n- (errorparameter_t)0);\n+ (errorparameter_t)0\n+ );\n// indicate we received a packet anyway (we don't want to loose any)\nnotif_receive(ieee154e_vars.dataReceived);\n// free local variable\n@@ -1834,7 +1835,8 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nieee154e_vars.ackToSend->l2_keyIdMode = ieee154e_vars.dataReceived->l2_keyIdMode;\nieee154e_vars.ackToSend->l2_keyIndex = ieee154e_vars.dataReceived->l2_keyIndex;\n- ieee802154_prependHeader(ieee154e_vars.ackToSend,\n+ ieee802154_prependHeader(\n+ ieee154e_vars.ackToSend,\nieee154e_vars.ackToSend->l2_frameType,\nFALSE,//no payloadIE in ack\nieee154e_vars.dataReceived->l2_dsn,\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-661. format the function.
|
491,609
|
10.07.2017 11:10:03
| -7,200
|
b35eab3d42b3a74617a8ae47f443da6aee1654d8
|
Use stateless compression mode for DIOs.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/forwarding.c",
"new_path": "openstack/03b-IPv6/forwarding.c",
"diff": "@@ -104,7 +104,9 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\nmsg->l3_sourceAdd.type=ADDR_128B;\n// if we are sending to a link-local address set the source prefix to link-local\n- if (packetfunctions_isLinkLocal(&msg->l3_destinationAdd)) {\n+ if (packetfunctions_isLinkLocal(&msg->l3_destinationAdd) ||\n+ packetfunctions_isAllRoutersMulticast(&msg->l3_destinationAdd) ||\n+ packetfunctions_isAllHostsMulticast(&msg->l3_destinationAdd)) {\nmemset(&link_local_prefix, 0x00, sizeof(open_addr_t));\nlink_local_prefix.type = ADDR_PREFIX;\nlink_local_prefix.prefix[0] = 0xfe;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Use stateless compression mode for DIOs.
|
491,595
|
10.07.2017 14:28:43
| -7,200
|
e3b7d4ff1de02d19f61d3c8514f19433fcd09e56
|
6TOP should filter the to be added cells with slotOffset larger than slotframe length.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/schedule.c",
"new_path": "openstack/02b-MAChigh/schedule.c",
"diff": "@@ -455,6 +455,11 @@ bool schedule_isSlotOffsetAvailable(uint16_t slotOffset){\nINTERRUPT_DECLARATION();\nDISABLE_INTERRUPTS();\n+ if (slotOffset>=schedule_vars.frameLength){\n+ ENABLE_INTERRUPTS();\n+ return FALSE;\n+ }\n+\nscheduleWalker = schedule_vars.currentScheduleEntry;\ndo {\nif(slotOffset == scheduleWalker->slotOffset){\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-662. 6TOP should filter the to be added cells with slotOffset larger than slotframe length.
|
491,595
|
10.07.2017 18:18:02
| -7,200
|
67ceefe831ffc1380596312585ede58e90b07045
|
check tobedelete celllist in sixtop request; remove schedule housekeeping function.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/schedule.c",
"new_path": "openstack/02b-MAChigh/schedule.c",
"diff": "@@ -825,44 +825,6 @@ void schedule_indicateTx(asn_t* asnTimestamp, bool succesfullTx) {\nENABLE_INTERRUPTS();\n}\n-\n-void schedule_housekeeping(){\n- uint8_t i;\n- open_addr_t neighbor;\n-\n-\n- INTERRUPT_DECLARATION();\n- DISABLE_INTERRUPTS();\n-\n- for(i=0;i<MAXACTIVESLOTS;i++) {\n- if(schedule_vars.scheduleBuf[i].type == CELLTYPE_TX){\n- // remove Tx cell if it's scheduled to non-preferred parent\n- if (icmpv6rpl_getPreferredParentEui64(&neighbor)==TRUE) {\n- if(packetfunctions_sameAddress(&neighbor,&(schedule_vars.scheduleBuf[i].neighbor))==FALSE){\n- if (sixtop_setHandler(SIX_HANDLER_SF0)==FALSE){\n- // one sixtop transcation is happening, only one instance at one time\n- continue;\n- }\n- sixtop_request(\n- IANA_6TOP_CMD_CLEAR, // code\n- &(schedule_vars.scheduleBuf[i].neighbor), // neighbor\n- 0, // numCells (not used)\n- LINKOPTIONS_TX, // cellOptions\n- NULL, // celllist to add (not used)\n- NULL, // celllist to add (not used)\n- sf0_getsfid(), // sfid\n- 0, // list command offset (not used)\n- 0 // list command maximum list of cells(not used)\n- );\n- break;\n- }\n- }\n- }\n- }\n-\n- ENABLE_INTERRUPTS();\n-}\n-\nbool schedule_getOneCellAfterOffset(uint8_t metadata,uint8_t offset,open_addr_t* neighbor, uint8_t cellOptions, uint16_t* slotoffset, uint16_t* channeloffset){\nbool returnVal;\nscheduleEntry_t* scheduleWalker;\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/schedule.h",
"new_path": "openstack/02b-MAChigh/schedule.h",
"diff": "@@ -211,7 +211,6 @@ void schedule_indicateTx(\nbool succesfullTx\n);\n// from sixtop\n-void schedule_housekeeping(void);\nbool schedule_getOneCellAfterOffset(\nuint8_t metadata,\nuint8_t offset,\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -225,7 +225,9 @@ void sixtop_request(\npkt->owner = COMPONENT_SIXTOP_RES;\nmemcpy(&(pkt->l2_nextORpreviousHop),neighbor,sizeof(open_addr_t));\n+ if (celllist_toBeDeleted != NULL){\nmemcpy(sixtop_vars.celllist_toDelete,celllist_toBeDeleted,CELLLIST_MAX_LEN*sizeof(cellInfo_ht));\n+ }\nsixtop_vars.cellOptions = cellOptions;\nlen = 0;\n@@ -667,7 +669,6 @@ void timer_sixtop_management_fired(void) {\ncase 0:\n// called every MAINTENANCE_PERIOD seconds\nneighbors_removeOld();\n- schedule_housekeeping();\nbreak;\ndefault:\n// called every second, except once every MAINTENANCE_PERIOD seconds\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -584,7 +584,6 @@ functionsToChange = [\n'schedule_resetEntry',\n'schedule_getNumOfSlotsByType',\n'schedule_getNumberOfFreeEntries',\n- 'schedule_housekeeping',\n'schedule_getOneCellAfterOffset',\n# sf0\n'sf0_init',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-663. check tobedelete celllist in sixtop request; remove schedule housekeeping function.
|
491,595
|
10.07.2017 18:35:19
| -7,200
|
b192e426984a8f68482ed43382be2a20d0aef614
|
update source code version.
|
[
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "static const uint8_t infoStackName[] = \"OpenWSN \";\n#define OPENWSN_VERSION_MAJOR 1\n-#define OPENWSN_VERSION_MINOR 9\n+#define OPENWSN_VERSION_MINOR 11\n#define OPENWSN_VERSION_PATCH 0\n#ifndef TRUE\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-664. update source code version.
|
491,595
|
10.07.2017 19:46:14
| -7,200
|
da5d854338da7086f812b61b379b961887689c89
|
remove the comments.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/schedule.c",
"new_path": "openstack/02b-MAChigh/schedule.c",
"diff": "@@ -64,7 +64,6 @@ void schedule_startDAGroot() {\nmemset(&temp_neighbor,0,sizeof(temp_neighbor));\ntemp_neighbor.type = ADDR_ANYCAST;\nfor (running_slotOffset=start_slotOffset;running_slotOffset<start_slotOffset+SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS;running_slotOffset++) {\n- /* pendulum\nschedule_addActiveSlot(\nrunning_slotOffset, // slot offset\nCELLTYPE_TXRX, // type of slot\n@@ -72,7 +71,6 @@ void schedule_startDAGroot() {\nSCHEDULE_MINIMAL_6TISCH_CHANNELOFFSET, // channel offset\n&temp_neighbor // neighbor\n);\n- */\n}\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-540. remove the comments.
|
491,595
|
11.07.2017 09:52:31
| -7,200
|
1ddfef23f2ba35cddf8bb793e81bdf8b5b2872fe
|
remove opentcp files.
|
[
{
"change_type": "DELETE",
"old_path": "openstack/04-TRAN/opentcp.c",
"new_path": null,
"diff": "-#include \"opendefs.h\"\n-#include \"opentcp.h\"\n-#include \"openserial.h\"\n-#include \"openqueue.h\"\n-#include \"forwarding.h\"\n-#include \"packetfunctions.h\"\n-#include \"scheduler.h\"\n-// applications\n-#include \"techo.h\"\n-\n-//=========================== variables =======================================\n-\n-tcp_vars_t tcp_vars;\n-\n-//=========================== prototypes ======================================\n-\n-void prependTCPHeader(OpenQueueEntry_t* msg, bool ack, bool push, bool rst, bool syn, bool fin);\n-bool containsControlBits(OpenQueueEntry_t* msg, uint8_t ack, uint8_t rst, uint8_t syn, uint8_t fin);\n-void tcp_change_state(uint8_t new_state);\n-void opentcp_reset(void);\n-void opentcp_timer_cb(void);\n-\n-//=========================== public ==========================================\n-\n-void opentcp_init() {\n- // reset local variables\n- memset(&tcp_vars,0,sizeof(tcp_vars_t));\n- // reset state machine\n- opentcp_reset();\n-}\n-\n-owerror_t opentcp_connect(open_addr_t* dest, uint16_t param_tcp_hisPort, uint16_t param_tcp_myPort) {\n- //[command] establishment\n- OpenQueueEntry_t* tempPkt;\n- if (tcp_vars.state!=TCP_STATE_CLOSED) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_WRONG_TCP_STATE,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)0);\n- return E_FAIL;\n- }\n- tcp_vars.myPort = param_tcp_myPort;\n- tcp_vars.hisPort = param_tcp_hisPort;\n- memcpy(&tcp_vars.hisIPv6Address,dest,sizeof(open_addr_t));\n- //I receive command 'connect', I send SYNC\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- return E_FAIL;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- tcp_vars.mySeqNum = TCP_INITIAL_SEQNUM;\n- prependTCPHeader(tempPkt,\n- TCP_ACK_NO,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_YES,\n- TCP_FIN_NO);\n- tcp_change_state(TCP_STATE_ALMOST_SYN_SENT);\n- return forwarding_send(tempPkt);\n-}\n-\n-owerror_t opentcp_send(OpenQueueEntry_t* msg) { //[command] data\n- msg->owner = COMPONENT_OPENTCP;\n- if (tcp_vars.state!=TCP_STATE_ESTABLISHED) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_WRONG_TCP_STATE,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)2);\n- return E_FAIL;\n- }\n- if (tcp_vars.dataToSend!=NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_BUSY_SENDING,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- return E_FAIL;\n- }\n- //I receive command 'send', I send data\n- msg->l4_protocol = IANA_TCP;\n- msg->l4_sourcePortORicmpv6Type = tcp_vars.myPort;\n- msg->l4_destination_port = tcp_vars.hisPort;\n- msg->l4_payload = msg->payload;\n- msg->l4_length = msg->length;\n- memcpy(&(msg->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- tcp_vars.dataToSend = msg;\n- prependTCPHeader(tcp_vars.dataToSend,\n- TCP_ACK_YES,\n- TCP_PSH_YES,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_NO);\n- tcp_vars.mySeqNum += tcp_vars.dataToSend->l4_length;\n- tcp_change_state(TCP_STATE_ALMOST_DATA_SENT);\n- return forwarding_send(tcp_vars.dataToSend);\n-}\n-\n-void opentcp_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\n- OpenQueueEntry_t* tempPkt;\n- msg->owner = COMPONENT_OPENTCP;\n- switch (tcp_vars.state) {\n- case TCP_STATE_ALMOST_SYN_SENT: //[sendDone] establishement\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_SYN_SENT);\n- break;\n-\n- case TCP_STATE_ALMOST_SYN_RECEIVED: //[sendDone] establishement\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_SYN_RECEIVED);\n- break;\n-\n- case TCP_STATE_ALMOST_ESTABLISHED: //[sendDone] establishement\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_ESTABLISHED);\n- switch(tcp_vars.myPort) {\n- case WKP_TCP_ECHO:\n- techo_connectDone(E_SUCCESS);\n- break;\n- default:\n- openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,\n- (errorparameter_t)tcp_vars.myPort,\n- (errorparameter_t)0);\n- break;\n- }\n- break;\n-\n- case TCP_STATE_ALMOST_DATA_SENT: //[sendDone] data\n- tcp_change_state(TCP_STATE_DATA_SENT);\n- break;\n-\n- case TCP_STATE_ALMOST_DATA_RECEIVED: //[sendDone] data\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_ESTABLISHED);\n- switch(tcp_vars.myPort) {\n- case WKP_TCP_ECHO:\n- techo_receive(tcp_vars.dataReceived);\n- break;\n- default:\n- openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,\n- (errorparameter_t)tcp_vars.myPort,\n- (errorparameter_t)1);\n- openqueue_freePacketBuffer(msg);\n- tcp_vars.dataReceived = NULL;\n- break;\n- }\n- break;\n-\n- case TCP_STATE_ALMOST_FIN_WAIT_1: //[sendDone] teardown\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_FIN_WAIT_1);\n- break;\n-\n- case TCP_STATE_ALMOST_CLOSING: //[sendDone] teardown\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_CLOSING);\n- break;\n-\n- case TCP_STATE_ALMOST_TIME_WAIT: //[sendDone] teardown\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_TIME_WAIT);\n- //TODO implement waiting timer\n- opentcp_reset();\n- break;\n-\n- case TCP_STATE_ALMOST_CLOSE_WAIT: //[sendDone] teardown\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_CLOSE_WAIT);\n- //I send FIN+ACK\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_YES);\n- forwarding_send(tempPkt);\n- tcp_change_state(TCP_STATE_ALMOST_LAST_ACK);\n- break;\n-\n- case TCP_STATE_ALMOST_LAST_ACK: //[sendDone] teardown\n- openqueue_freePacketBuffer(msg);\n- tcp_change_state(TCP_STATE_LAST_ACK);\n- break;\n-\n- default:\n- openserial_printError(COMPONENT_OPENTCP,ERR_WRONG_TCP_STATE,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)3);\n- break;\n- }\n-}\n-\n-void opentcp_receive(OpenQueueEntry_t* msg) {\n- OpenQueueEntry_t* tempPkt;\n- bool shouldIlisten;\n- msg->owner = COMPONENT_OPENTCP;\n- msg->l4_protocol = IANA_TCP;\n- msg->l4_payload = msg->payload;\n- msg->l4_length = msg->length;\n- msg->l4_sourcePortORicmpv6Type = packetfunctions_ntohs((uint8_t*)&(((tcp_ht*)msg->payload)->source_port));\n- msg->l4_destination_port = packetfunctions_ntohs((uint8_t*)&(((tcp_ht*)msg->payload)->destination_port));\n- if (\n- tcp_vars.state!=TCP_STATE_CLOSED &&\n- (\n- msg->l4_destination_port != tcp_vars.myPort ||\n- msg->l4_sourcePortORicmpv6Type != tcp_vars.hisPort ||\n- packetfunctions_sameAddress(&(msg->l3_destinationAdd),&tcp_vars.hisIPv6Address)==FALSE\n- )\n- ) {\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- if (containsControlBits(msg,TCP_ACK_WHATEVER,TCP_RST_YES,TCP_SYN_WHATEVER,TCP_FIN_WHATEVER)) {\n- //I receive RST[+*], I reset\n- opentcp_reset();\n- openqueue_freePacketBuffer(msg);\n- }\n- switch (tcp_vars.state) {\n- case TCP_STATE_CLOSED: //[receive] establishement\n- switch(msg->l4_destination_port) {\n- case WKP_TCP_ECHO:\n- shouldIlisten = techo_shouldIlisten();\n- break;\n- default:\n- openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,\n- (errorparameter_t)msg->l4_sourcePortORicmpv6Type,\n- (errorparameter_t)2);\n- shouldIlisten = FALSE;\n- break;\n- }\n- if ( containsControlBits(msg,TCP_ACK_NO,TCP_RST_NO,TCP_SYN_YES,TCP_FIN_NO) && shouldIlisten==TRUE ) {\n- tcp_vars.myPort = msg->l4_destination_port;\n- //I receive SYN, I send SYN+ACK\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+1;\n- tcp_vars.hisPort = msg->l4_sourcePortORicmpv6Type;\n- memcpy(&tcp_vars.hisIPv6Address,&(msg->l3_destinationAdd),sizeof(open_addr_t));\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_YES,\n- TCP_FIN_NO);\n- tcp_vars.mySeqNum++;\n- tcp_change_state(TCP_STATE_ALMOST_SYN_RECEIVED);\n- forwarding_send(tempPkt);\n- } else {\n- opentcp_reset();\n- openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)0);\n- }\n- openqueue_freePacketBuffer(msg);\n- break;\n-\n- case TCP_STATE_SYN_SENT: //[receive] establishement\n- if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_YES,TCP_FIN_NO)) {\n- //I receive SYN+ACK, I send ACK\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+1;\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_NO);\n- tcp_change_state(TCP_STATE_ALMOST_ESTABLISHED);\n- forwarding_send(tempPkt);\n- } else if (containsControlBits(msg,TCP_ACK_NO,TCP_RST_NO,TCP_SYN_YES,TCP_FIN_NO)) {\n- //I receive SYN, I send SYN+ACK\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+1;\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_YES,\n- TCP_FIN_NO);\n- tcp_vars.mySeqNum++;\n- tcp_change_state(TCP_STATE_ALMOST_SYN_RECEIVED);\n- forwarding_send(tempPkt);\n- } else {\n- opentcp_reset();\n- openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)1);\n- }\n- openqueue_freePacketBuffer(msg);\n- break;\n-\n- case TCP_STATE_SYN_RECEIVED: //[receive] establishement\n- if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_NO)) {\n- //I receive ACK, the virtual circuit is established\n- tcp_change_state(TCP_STATE_ESTABLISHED);\n- } else {\n- opentcp_reset();\n- openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)2);\n- }\n- openqueue_freePacketBuffer(msg);\n- break;\n-\n- case TCP_STATE_ESTABLISHED: //[receive] data/teardown\n- if (containsControlBits(msg,TCP_ACK_WHATEVER,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_YES)) {\n- //I receive FIN[+ACK], I send ACK\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+msg->length-sizeof(tcp_ht)+1;\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_NO);\n- forwarding_send(tempPkt);\n- tcp_change_state(TCP_STATE_ALMOST_CLOSE_WAIT);\n- } else if (containsControlBits(msg,TCP_ACK_WHATEVER,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_NO)) {\n- //I receive data, I send ACK\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+msg->length-sizeof(tcp_ht);\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_NO);\n- forwarding_send(tempPkt);\n- packetfunctions_tossHeader(msg,sizeof(tcp_ht));\n- tcp_vars.dataReceived = msg;\n- tcp_change_state(TCP_STATE_ALMOST_DATA_RECEIVED);\n- } else {\n- opentcp_reset();\n- openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)3);\n- openqueue_freePacketBuffer(msg);\n- }\n- break;\n-\n- case TCP_STATE_DATA_SENT: //[receive] data\n- if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_NO)) {\n- //I receive ACK, data message sent\n- switch(tcp_vars.myPort) {\n- case WKP_TCP_ECHO:\n- techo_sendDone(tcp_vars.dataToSend,E_SUCCESS);\n- break;\n- default:\n- openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,\n- (errorparameter_t)tcp_vars.myPort,\n- (errorparameter_t)3);\n- break;\n- }\n- tcp_vars.dataToSend = NULL;\n- tcp_change_state(TCP_STATE_ESTABLISHED);\n- } else if (containsControlBits(msg,TCP_ACK_WHATEVER,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_YES)) {\n- //I receive FIN[+ACK], I send ACK\n- switch(tcp_vars.myPort) {\n- case WKP_TCP_ECHO:\n- techo_sendDone(tcp_vars.dataToSend,E_SUCCESS);\n- break;\n- default:\n- openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,\n- (errorparameter_t)tcp_vars.myPort,\n- (errorparameter_t)4);\n- break;\n- }\n- tcp_vars.dataToSend = NULL;\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+msg->length-sizeof(tcp_ht)+1;\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_NO);\n- forwarding_send(tempPkt);\n- tcp_change_state(TCP_STATE_ALMOST_CLOSE_WAIT);\n- } else {\n- opentcp_reset();\n- openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)4);\n- }\n- openqueue_freePacketBuffer(msg);\n- break;\n-\n- case TCP_STATE_FIN_WAIT_1: //[receive] teardown\n- if (containsControlBits(msg,TCP_ACK_NO,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_YES)) {\n- //I receive FIN, I send ACK\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+1;\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_NO);\n- forwarding_send(tempPkt);\n- tcp_change_state(TCP_STATE_ALMOST_CLOSING);\n- } else if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_YES)) {\n- //I receive FIN+ACK, I send ACK\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+1;\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_NO);\n- forwarding_send(tempPkt);\n- tcp_change_state(TCP_STATE_ALMOST_TIME_WAIT);\n- } else if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_NO)) {\n- //I receive ACK, I will receive FIN later\n- tcp_change_state(TCP_STATE_FIN_WAIT_2);\n- } else {\n- opentcp_reset();\n- openserial_printError(COMPONENT_OPENTCP,ERR_TCP_RESET,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)5);\n- }\n- openqueue_freePacketBuffer(msg);\n- break;\n-\n- case TCP_STATE_FIN_WAIT_2: //[receive] teardown\n- if (containsControlBits(msg,TCP_ACK_WHATEVER,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_YES)) {\n- //I receive FIN[+ACK], I send ACK\n- tcp_vars.hisNextSeqNum = (packetfunctions_ntohl((uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number)))+1;\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- openqueue_freePacketBuffer(msg);\n- return;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_NO);\n- forwarding_send(tempPkt);\n- tcp_change_state(TCP_STATE_ALMOST_TIME_WAIT);\n- }\n- openqueue_freePacketBuffer(msg);\n- break;\n-\n- case TCP_STATE_CLOSING: //[receive] teardown\n- if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_NO)) {\n- //I receive ACK, I do nothing\n- tcp_change_state(TCP_STATE_TIME_WAIT);\n- //TODO implement waiting timer\n- opentcp_reset();\n- }\n- openqueue_freePacketBuffer(msg);\n- break;\n-\n- case TCP_STATE_LAST_ACK: //[receive] teardown\n- if (containsControlBits(msg,TCP_ACK_YES,TCP_RST_NO,TCP_SYN_NO,TCP_FIN_NO)) {\n- //I receive ACK, I reset\n- opentcp_reset();\n- }\n- openqueue_freePacketBuffer(msg);\n- break;\n-\n- default:\n- openserial_printError(COMPONENT_OPENTCP,ERR_WRONG_TCP_STATE,\n- (errorparameter_t)tcp_vars.state,\n- (errorparameter_t)4);\n- break;\n- }\n-}\n-\n-owerror_t opentcp_close() { //[command] teardown\n- OpenQueueEntry_t* tempPkt;\n- if ( tcp_vars.state==TCP_STATE_ALMOST_CLOSE_WAIT ||\n- tcp_vars.state==TCP_STATE_CLOSE_WAIT ||\n- tcp_vars.state==TCP_STATE_ALMOST_LAST_ACK ||\n- tcp_vars.state==TCP_STATE_LAST_ACK ||\n- tcp_vars.state==TCP_STATE_CLOSED) {\n- //not an error, can happen when distant node has already started tearing down\n- return E_SUCCESS;\n- }\n- //I receive command 'close', I send FIN+ACK\n- tempPkt = openqueue_getFreePacketBuffer(COMPONENT_OPENTCP);\n- if (tempPkt==NULL) {\n- openserial_printError(COMPONENT_OPENTCP,ERR_NO_FREE_PACKET_BUFFER,\n- (errorparameter_t)0,\n- (errorparameter_t)0);\n- return E_FAIL;\n- }\n- tempPkt->creator = COMPONENT_OPENTCP;\n- tempPkt->owner = COMPONENT_OPENTCP;\n- memcpy(&(tempPkt->l3_destinationAdd),&tcp_vars.hisIPv6Address,sizeof(open_addr_t));\n- prependTCPHeader(tempPkt,\n- TCP_ACK_YES,\n- TCP_PSH_NO,\n- TCP_RST_NO,\n- TCP_SYN_NO,\n- TCP_FIN_YES);\n- tcp_vars.mySeqNum++;\n- tcp_change_state(TCP_STATE_ALMOST_FIN_WAIT_1);\n- return forwarding_send(tempPkt);\n-}\n-\n-bool tcp_debugPrint(void) {\n- return FALSE;\n-}\n-\n-//======= timer\n-\n-//timer used to reset state when TCP state machine is stuck\n-void timers_tcp_fired(void) {\n- opentcp_reset();\n- opentimers_scheduleIn(\n- tcp_vars.timerId,\n- TCP_TIMEOUT,\n- TIME_MS,\n- TIMER_PERIODIC,\n- opentcp_timer_cb\n- );\n-}\n-\n-//=========================== private =========================================\n-\n-void prependTCPHeader(OpenQueueEntry_t* msg,\n- bool ack,\n- bool push,\n- bool rst,\n- bool syn,\n- bool fin) {\n- msg->l4_protocol = IANA_TCP;\n- packetfunctions_reserveHeaderSize(msg,sizeof(tcp_ht));\n- packetfunctions_htons(tcp_vars.myPort ,(uint8_t*)&(((tcp_ht*)msg->payload)->source_port));\n- packetfunctions_htons(tcp_vars.hisPort ,(uint8_t*)&(((tcp_ht*)msg->payload)->destination_port));\n- packetfunctions_htonl(tcp_vars.mySeqNum ,(uint8_t*)&(((tcp_ht*)msg->payload)->sequence_number));\n- packetfunctions_htonl(tcp_vars.hisNextSeqNum ,(uint8_t*)&(((tcp_ht*)msg->payload)->ack_number));\n- ((tcp_ht*)msg->payload)->data_offset = TCP_DEFAULT_DATA_OFFSET;\n- ((tcp_ht*)msg->payload)->control_bits = 0;\n- if (ack==TCP_ACK_YES) {\n- ((tcp_ht*)msg->payload)->control_bits |= 1 << TCP_ACK;\n- } else {\n- packetfunctions_htonl(0,(uint8_t*)&(((tcp_ht*)msg->payload)->ack_number));\n- }\n- if (push==TCP_PSH_YES) {\n- ((tcp_ht*)msg->payload)->control_bits |= 1 << TCP_PSH;\n- }\n- if (rst==TCP_RST_YES) {\n- ((tcp_ht*)msg->payload)->control_bits |= 1 << TCP_RST;\n- }\n- if (syn==TCP_SYN_YES) {\n- ((tcp_ht*)msg->payload)->control_bits |= 1 << TCP_SYN;\n- }\n- if (fin==TCP_FIN_YES) {\n- ((tcp_ht*)msg->payload)->control_bits |= 1 << TCP_FIN;\n- }\n- packetfunctions_htons(TCP_DEFAULT_WINDOW_SIZE ,(uint8_t*)&(((tcp_ht*)msg->payload)->window_size));\n- packetfunctions_htons(TCP_DEFAULT_URGENT_POINTER ,(uint8_t*)&(((tcp_ht*)msg->payload)->urgent_pointer));\n- //calculate checksum last to take all header fields into account\n- packetfunctions_calculateChecksum(msg,(uint8_t*)&(((tcp_ht*)msg->payload)->checksum));\n-}\n-\n-bool containsControlBits(OpenQueueEntry_t* msg, uint8_t ack, uint8_t rst, uint8_t syn, uint8_t fin) {\n- bool return_value = TRUE;\n- if (ack!=TCP_ACK_WHATEVER){\n- return_value = return_value && ((bool)( (((tcp_ht*)msg->payload)->control_bits >> TCP_ACK) & 0x01) == ack);\n- }\n- if (rst!=TCP_RST_WHATEVER){\n- return_value = return_value && ((bool)( (((tcp_ht*)msg->payload)->control_bits >> TCP_RST) & 0x01) == rst);\n- }\n- if (syn!=TCP_SYN_WHATEVER){\n- return_value = return_value && ((bool)( (((tcp_ht*)msg->payload)->control_bits >> TCP_SYN) & 0x01) == syn);\n- }\n- if (fin!=TCP_FIN_WHATEVER){\n- return_value = return_value && ((bool)( (((tcp_ht*)msg->payload)->control_bits >> TCP_FIN) & 0x01) == fin);\n- }\n- return return_value;\n-}\n-\n-void opentcp_reset() {\n- tcp_change_state(TCP_STATE_CLOSED);\n- tcp_vars.mySeqNum = TCP_INITIAL_SEQNUM;\n- tcp_vars.hisNextSeqNum = 0;\n- tcp_vars.hisPort = 0;\n- tcp_vars.hisIPv6Address.type = ADDR_NONE;\n- tcp_vars.dataToSend = NULL;\n- tcp_vars.dataReceived = NULL;\n- openqueue_removeAllOwnedBy(COMPONENT_OPENTCP);\n-}\n-\n-void tcp_change_state(uint8_t new_tcp_state) {\n- tcp_vars.state = new_tcp_state;\n- if (tcp_vars.state==TCP_STATE_CLOSED) {\n- if (tcp_vars.timerStarted==TRUE) {\n- opentimers_cancel(tcp_vars.timerId);\n- }\n- } else {\n- if (tcp_vars.timerStarted==FALSE) {\n- tcp_vars.timerId = opentimers_create();\n- opentimers_scheduleAbsolute(\n- tcp_vars.timerId,\n- TCP_TIMEOUT,\n- opentimers_getValue(),\n- TIME_MS,\n- opentcp_timer_cb\n- );\n- tcp_vars.timerStarted=TRUE;\n- }\n-\n- }\n-}\n-\n-void opentcp_timer_cb(void) {\n- scheduler_push_task(timers_tcp_fired,TASKPRIO_TCP_TIMEOUT);\n-}\n-\n-\n-\n"
},
{
"change_type": "DELETE",
"old_path": "openstack/04-TRAN/opentcp.dox",
"new_path": null,
"diff": "-/**\n-\\defgroup OpenTcp OpenTcp\n-\n-\\brief TCP implementation.\n-\n-This implementation follows http://tools.ietf.org/html/rfc793.\n-\n-See http://openwsn.berkeley.edu/wiki/OpenTcp for state machine and documentation.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, August 2010\n-*/\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "openstack/04-TRAN/opentcp.h",
"new_path": null,
"diff": "-#ifndef __OPENTCP_H\n-#define __OPENTCP_H\n-\n-/**\n-\\addtogroup Transport\n-\\{\n-\\addtogroup OpenTcp\n-\\{\n-*/\n-\n-#include \"opentimers.h\"\n-\n-//=========================== define ==========================================\n-\n-enum {\n- TCP_INITIAL_SEQNUM = 100,\n- TCP_TIMEOUT = 1500, //in ms\n-};\n-\n-enum TCP_STATE_enums {\n- //listen state is not declared but emulated by a closed state with shouldIlisten==TRUE\n- TCP_STATE_CLOSED = 0,\n- TCP_STATE_ALMOST_SYN_RECEIVED = 1,\n- TCP_STATE_SYN_RECEIVED = 2,\n- TCP_STATE_ALMOST_SYN_SENT = 3,\n- TCP_STATE_SYN_SENT = 4,\n- TCP_STATE_ALMOST_ESTABLISHED = 5,\n- TCP_STATE_ESTABLISHED = 6,\n- TCP_STATE_ALMOST_DATA_SENT = 7,\n- TCP_STATE_DATA_SENT = 8,\n- TCP_STATE_ALMOST_DATA_RECEIVED = 9,\n- TCP_STATE_ALMOST_FIN_WAIT_1 = 10,\n- TCP_STATE_FIN_WAIT_1 = 11,\n- TCP_STATE_ALMOST_CLOSING = 12,\n- TCP_STATE_CLOSING = 13,\n- TCP_STATE_FIN_WAIT_2 = 14,\n- TCP_STATE_ALMOST_TIME_WAIT = 15,\n- TCP_STATE_TIME_WAIT = 16,\n- TCP_STATE_ALMOST_CLOSE_WAIT = 17,\n- TCP_STATE_CLOSE_WAIT = 18,\n- TCP_STATE_ALMOST_LAST_ACK = 19,\n- TCP_STATE_LAST_ACK = 20,\n-};\n-\n-enum TCP_DEFAULTS_enum{\n- TCP_DEFAULT_DATA_OFFSET = 0x50,\n- TCP_DEFAULT_WINDOW_SIZE = 48,\n- TCP_DEFAULT_URGENT_POINTER = 0x0000,\n-};\n-\n-enum TCP_ACK_FLAG_enum {\n- TCP_ACK_WHATEVER = 2,\n- TCP_ACK_YES = 1,\n- TCP_ACK_NO = 0,\n-};\n-\n-enum TCP_PSH_FLAG_enum {\n- TCP_PSH_WHATEVER = 2,\n- TCP_PSH_YES = 1,\n- TCP_PSH_NO = 0,\n-};\n-\n-enum TCP_RST_FLAG_enum {\n- TCP_RST_WHATEVER = 2,\n- TCP_RST_YES = 1,\n- TCP_RST_NO = 0,\n-};\n-\n-enum TCP_SYN_FLAG_enum {\n- TCP_SYN_WHATEVER = 2,\n- TCP_SYN_YES = 1,\n- TCP_SYN_NO = 0,\n-};\n-\n-enum TCP_FIN_FLAG_enum {\n- TCP_FIN_WHATEVER = 2,\n- TCP_FIN_YES = 1,\n- TCP_FIN_NO = 0,\n-};\n-\n-enum TCP_FLAG_POSITIONS_enum {\n- TCP_ACK = 4,\n- TCP_PSH = 3,\n- TCP_RST = 2,\n- TCP_SYN = 1,\n- TCP_FIN = 0,\n-};\n-\n-//=========================== typedef =========================================\n-\n-typedef struct {\n- uint16_t source_port;\n- uint16_t destination_port;\n- uint32_t sequence_number;\n- uint32_t ack_number;\n- uint8_t data_offset;\n- uint8_t control_bits;\n- uint16_t window_size;\n- uint16_t checksum;\n- uint16_t urgent_pointer;\n-} tcp_ht;\n-\n-//=========================== module variables ================================\n-\n-typedef struct {\n- uint8_t state;\n- uint32_t mySeqNum;\n- uint16_t myPort;\n- uint32_t hisNextSeqNum;\n- uint16_t hisPort;\n- open_addr_t hisIPv6Address;\n- OpenQueueEntry_t* dataToSend;\n- OpenQueueEntry_t* dataReceived;\n- bool timerStarted;\n- opentimers_id_t timerId;\n-} tcp_vars_t;\n-\n-//=========================== prototypes ======================================\n-\n-void opentcp_init(void);\n-owerror_t opentcp_connect(open_addr_t* dest, uint16_t param_hisPort, uint16_t param_myPort);\n-owerror_t opentcp_send(OpenQueueEntry_t* msg);\n-void opentcp_sendDone(OpenQueueEntry_t* msg, owerror_t error);\n-void opentcp_receive(OpenQueueEntry_t* msg);\n-owerror_t opentcp_close(void);\n-bool opentcp_debugPrint(void);\n-\n-/**\n-\\}\n-\\}\n-*/\n-\n-#endif\n-\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-631. remove opentcp files.
|
491,609
|
11.07.2017 10:56:54
| -7,200
|
46a4bda461edc7f2bf1dbe1c65a095168605ac14
|
Move libs to opencoap and aes/ccm to boards/common.
|
[
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/openaes.c",
"new_path": "bsp/boards/common/openaes.c",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/openaes.h",
"new_path": "bsp/boards/common/openaes.h",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/openccms.c",
"new_path": "bsp/boards/common/openccms.c",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/openccms.h",
"new_path": "bsp/boards/common/openccms.h",
"diff": ""
},
{
"change_type": "MODIFY",
"old_path": "openapps/SConscript",
"new_path": "openapps/SConscript",
"diff": "@@ -28,6 +28,11 @@ if localEnv['board']=='python':\n# those with default application name (application.c)\nadditionalSourceFiles = [\nos.path.join('opencoap','openoscoap.c'),\n+ os.path.join('opencoap','usha.c'),\n+ os.path.join('opencoap','hkdf.c'),\n+ os.path.join('opencoap','hmac.c'),\n+ os.path.join('opencoap','sha224-256.c'),\n+ os.path.join('opencoap','cborencoder.c'),\nos.path.join('cjoin','cbor.c'),\n]\n@@ -35,6 +40,8 @@ additionalSourceFiles = [\n# those with default application name (application.h)\nadditionalHeaderFiles = [\nos.path.join('opencoap','openoscoap.h'),\n+ os.path.join('opencoap','sha.h'),\n+ os.path.join('opencoap','cborencoder.h'),\nos.path.join('cjoin','cbor.h'),\n]\n"
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/cborencoder.c",
"new_path": "openapps/opencoap/cborencoder.c",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/cborencoder.h",
"new_path": "openapps/opencoap/cborencoder.h",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/hkdf.c",
"new_path": "openapps/opencoap/hkdf.c",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/hmac.c",
"new_path": "openapps/opencoap/hmac.c",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/sha-private.h",
"new_path": "openapps/opencoap/sha-private.h",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/sha.h",
"new_path": "openapps/opencoap/sha.h",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/sha224-256.c",
"new_path": "openapps/opencoap/sha224-256.c",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "openstack/cross-layers/usha.c",
"new_path": "openapps/opencoap/usha.c",
"diff": ""
},
{
"change_type": "MODIFY",
"old_path": "openstack/SConscript",
"new_path": "openstack/SConscript",
"diff": "@@ -33,13 +33,6 @@ sources_c = [\nos.path.join('cross-layers','openqueue.c'),\nos.path.join('cross-layers','openrandom.c'),\nos.path.join('cross-layers','packetfunctions.c'),\n- os.path.join('cross-layers','openaes.c'),\n- os.path.join('cross-layers','openccms.c'),\n- os.path.join('cross-layers','usha.c'),\n- os.path.join('cross-layers','hkdf.c'),\n- os.path.join('cross-layers','hmac.c'),\n- os.path.join('cross-layers','sha224-256.c'),\n- os.path.join('cross-layers','cborencoder.c'),\n]\nsources_h = [\n'openstack.h',\n@@ -69,10 +62,6 @@ sources_h = [\nos.path.join('cross-layers','openqueue.h'),\nos.path.join('cross-layers','openrandom.h'),\nos.path.join('cross-layers','packetfunctions.h'),\n- os.path.join('cross-layers','openaes.h'),\n- os.path.join('cross-layers','openccms.h'),\n- os.path.join('cross-layers','sha.h'),\n- os.path.join('cross-layers','cborencoder.h'),\n#=== apps\nos.path.join('#','openapps','userialbridge','userialbridge.h'),\n]\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -58,6 +58,7 @@ buildEnv.Append(\nos.path.join('#','build','python_gcc','inc'),\n# bsp\nos.path.join('#','build','python_gcc','bsp','boards'),\n+ os.path.join('#','build','python_gcc','bsp','boards','common'),\nos.path.join('#','build','python_gcc','bsp','boards','python'),\n# drivers\nos.path.join('#','build','python_gcc','drivers','common'),\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Move libs to opencoap and aes/ccm to boards/common.
|
491,609
|
11.07.2017 11:39:25
| -7,200
|
d9ecaf50fc6f06e605afe7abadeb487d26a59d9f
|
Build openaes and openccm as part of boards/common.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/SConscript",
"new_path": "bsp/boards/SConscript",
"diff": "@@ -14,15 +14,24 @@ sources_h = [\n'radio.h',\n'uart.h',\n'sctimer.h',\n+ os.path.join('common', 'openccms.h'),\n+ os.path.join('common', 'openaes.h'),\n]\n+sources_c = [\n+ os.path.join('common', 'openccms.c'),\n+ os.path.join('common', 'openaes.c'),\n+]\n+\n+target = 'libbsp'\n+\n#============================ SCons targets ===================================\nif localEnv['board']=='python':\nactions = []\n- for s in sources_h:\n+ for s in sources_c+sources_h:\naction = localEnv.Objectify(\ntarget = localEnv.ObjectifiedFilename(s),\nsource = s,\n@@ -31,6 +40,13 @@ if localEnv['board']=='python':\nAlias('objectifybspheaders', actions)\n+ common = [localEnv.ObjectifiedFilename(s) for s in sources_c]\n+\n+else:\n+ common = sources_c\n+\n+common = localEnv.Object(source=common)\n+\nif env['toolchain']!='iar-proj':\nboard = localEnv.SConscript(\n@@ -39,17 +55,8 @@ if env['toolchain']!='iar-proj':\nexports = {'env': env},\n)\n- common = localEnv.SConscript(\n- os.path.join('#','bsp','boards','common','SConscript'),\n- variant_dir = 'common',\n- exports = {'env': env},\n- )\n-\n- source = [board, common]\n- target = 'libbsp'\n-\nlibbsp = localEnv.Library(\ntarget = target,\n- source=source,\n+ source = [board,common],\n)\n- Alias('libbsp', libbsp)\n+ Alias(target, libbsp)\n"
},
{
"change_type": "DELETE",
"old_path": "bsp/boards/common/SConscript",
"new_path": null,
"diff": "-import os\n-\n-Import('env')\n-\n-localEnv = env.Clone()\n-\n-source = [\n-]\n-\n-localEnv.Append(\n- CPPPATH = [\n- ],\n-)\n-\n-common = localEnv.Object(source=source)\n-\n-Return('common')\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Build openaes and openccm as part of boards/common.
|
491,595
|
11.07.2017 14:07:32
| -7,200
|
9b3030c114c7456bfd0782df16ca05c4369aee68
|
Using opentimers_scheduleIn rather than opentimers_scheduleAbsolute for sixtop timeout timer.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -900,11 +900,11 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\nbreak;\n}\n// start timeout timer if I am waiting for a response\n- opentimers_scheduleAbsolute(\n+ opentimers_scheduleIn(\nsixtop_vars.timeoutTimerId,\nSIX2SIX_TIMEOUT_MS,\n- opentimers_getValue(),\nTIME_MS,\n+ TIMER_ONESHOT,\nsixtop_timeout_timer_cb\n);\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
Using opentimers_scheduleIn rather than opentimers_scheduleAbsolute for sixtop timeout timer.
|
491,609
|
11.07.2017 15:39:23
| -7,200
|
2366f1faa8e5e6d133ca0c26d21a13f5e36f42b7
|
Skip set join if already set.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "@@ -292,6 +292,10 @@ void cjoin_setIsJoined(bool newValue) {\nuint8_t array[5];\nasn_t joinAsn;\n+ if (cjoin_vars.isJoined == newValue) {\n+ return;\n+ }\n+\ncjoin_vars.isJoined = newValue;\n// Update Join ASN value\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Skip set join if already set.
|
491,595
|
12.07.2017 08:56:17
| -7,200
|
77b95556b48862de04cde5925eef390b269025bc
|
use another timer for serial inhibit activity.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -156,6 +156,7 @@ void ieee154e_init() {\n// radiotimer_start(ieee154e_vars.slotDuration);\n//\nIEEE802154_security_init();\n+ ieee154e_vars.serialInhibitTimerId = opentimers_create();\n}\n//=========================== public ==========================================\n@@ -2868,7 +2869,7 @@ void endSlot() {\n// arm serialInhibit timer (if we are still BEFORE DURATION_si)\nif (ieee154e_vars.isSync==TRUE) {\nopentimers_scheduleAbsolute(\n- ieee154e_vars.timerId, // timerId\n+ ieee154e_vars.serialInhibitTimerId, // timerId\nDURATION_si, // duration\nieee154e_vars.startOfSlotReference, // reference\nTIME_TICS, // timetype\n@@ -2877,7 +2878,7 @@ void endSlot() {\n}\n// resume serial activity (if we are still BEFORE DURATION_si)\n- if (opentimers_getValue()<DURATION_si) {\n+ if (DURATION_si+ieee154e_vars.startOfSlotReference-opentimers_getValue()<ieee154e_vars.slotDuration) {\nopenserial_inhibitStop(); // end of slot\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.h",
"new_path": "openstack/02a-MAClow/IEEE802154E.h",
"diff": "@@ -268,6 +268,7 @@ typedef struct {\nuint16_t slotDuration; // duration of slot\nopentimers_id_t timerId; // id of timer used for implementing TSCH slot FSM\nuint32_t startOfSlotReference; // the time refer to the beginning of slot\n+ opentimers_id_t serialInhibitTimerId; // id of serial inhibit timer used for scheduling serial output\n} ieee154e_vars_t;\nBEGIN_PACK\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-540. use another timer for serial inhibit activity.
|
491,592
|
12.07.2017 15:47:33
| -7,200
|
3f6c13e1f325894c9e5b3209728a84c8979a6ae3
|
Adding right Flash page for Revision A of OPenMote. Implementing also some led functionalities.
|
[
{
"change_type": "MODIFY",
"old_path": "SConscript",
"new_path": "SConscript",
"diff": "@@ -201,6 +201,7 @@ elif env['toolchain']=='armgcc':\nif env['board']=='openmote-cc2538':\nif env['revision'] == \"A1\":\nlinker_file = 'cc2538sf23.lds'\n+ print \"*** OPENMOTE CC2538 REV. A1 ***\\n\"\nelse:\nlinker_file = 'cc2538sf53.lds'\n@@ -215,9 +216,15 @@ elif env['toolchain']=='armgcc':\nenv.Append(CCFLAGS = '-mthumb')\nenv.Append(CCFLAGS = '-g3')\nenv.Append(CCFLAGS = '-Wstrict-prototypes')\n+ if env['revision'] == \"A1\":\n+ env.Append(CCFLAGS = '-DREVA1=1')\n+\n# assembler\nenv.Replace(AS = 'arm-none-eabi-as')\nenv.Append(ASFLAGS = '-ggdb -g3 -mcpu=cortex-m3 -mlittle-endian')\n+ if env['revision'] == \"A1\":\n+ env.Append(ASFLAGS = '-DREVA1=1')\n+\n# linker\nenv.Append(LINKFLAGS = '-Tbsp/boards/openmote-cc2538/' + linker_file)\nenv.Append(LINKFLAGS = '-nostartfiles')\n@@ -225,6 +232,9 @@ elif env['toolchain']=='armgcc':\nenv.Append(LINKFLAGS = '-mcpu=cortex-m3')\nenv.Append(LINKFLAGS = '-mthumb')\nenv.Append(LINKFLAGS = '-g3')\n+ if env['revision'] == \"A1\":\n+ env.Append(LINKFLAGS = '-DREVA1=1')\n+\n# object manipulation\nenv.Replace(OBJCOPY = 'arm-none-eabi-objcopy')\nenv.Replace(OBJDUMP = 'arm-none-eabi-objdump')\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/board.c",
"new_path": "bsp/boards/openmote-cc2538/board.c",
"diff": "#define BSP_BUTTON_BASE ( GPIO_C_BASE )\n#define BSP_BUTTON_USER ( GPIO_PIN_3 )\n+#ifdef REVA1 //Rev.A1 uses SF23 cc2538 which start at diffferent location\n+ #define CC2538_FLASH_ADDRESS ( 0x0023F800 )\n+#else\n#define CC2538_FLASH_ADDRESS ( 0x0027F800 )\n-\n+#endif\n//=========================== prototypes ======================================\nvoid board_timer_init(void);\n@@ -65,9 +68,7 @@ int main(void) {\nvoid board_init(void) {\ngpio_init();\nclock_init();\n-\nboard_timer_init();\n-\nleds_init();\ndebugpins_init();\nbutton_init();\n@@ -293,10 +294,13 @@ static void SysCtrlWakeupSetting(void) {\nstatic void GPIO_C_Handler(void) {\n/* Disable the interrupts */\nIntMasterDisable();\n+ leds_all_off();\n/* Eras the CCA flash page */\nFlashMainPageErase(CC2538_FLASH_ADDRESS);\n+ leds_circular_shift();\n+\n/* Reset the board */\nSysCtrlReset();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/leds.c",
"new_path": "bsp/boards/openmote-cc2538/leds.c",
"diff": "@@ -131,9 +131,48 @@ void leds_error_blink() {\n}\nvoid leds_circular_shift() {\n+ uint8_t i;\n+ volatile uint16_t delay;\n+\n+ // turn all LEDs off\n+ bspLedClear(BSP_LED_ALL);\n+\n+ // incrementally turn LED on\n+ for (i=0;i<10;i++) {\n+ bspLedSet(BSP_LED_1);\n+ for (delay=0xffff;delay>0;delay--);\n+ bspLedClear(BSP_LED_1);\n+ bspLedSet(BSP_LED_2);\n+ for (delay=0xffff;delay>0;delay--);\n+ bspLedClear(BSP_LED_2);\n+ bspLedSet(BSP_LED_3);\n+ for (delay=0xffff;delay>0;delay--);\n+ bspLedClear(BSP_LED_3);\n+ bspLedSet(BSP_LED_4);\n+ for (delay=0xffff;delay>0;delay--);\n+ bspLedClear(BSP_LED_ALL);\n+ }\n}\nvoid leds_increment() {\n+ uint8_t i;\n+ volatile uint16_t delay;\n+\n+ // turn all LEDs off\n+ bspLedClear(BSP_LED_ALL);\n+\n+ // incrementally turn LED on\n+ for (i=0;i<10;i++) {\n+ bspLedSet(BSP_LED_1);\n+ for (delay=0xffff;delay>0;delay--);\n+ bspLedSet(BSP_LED_2);\n+ for (delay=0xffff;delay>0;delay--);\n+ bspLedSet(BSP_LED_3);\n+ for (delay=0xffff;delay>0;delay--);\n+ bspLedSet(BSP_LED_4);\n+ for (delay=0xffff;delay>0;delay--);\n+ bspLedClear(BSP_LED_ALL);\n+ }\n}\n//=========================== private =========================================\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-665 Adding right Flash page for Revision A of OPenMote. Implementing also some led functionalities.
|
491,592
|
12.07.2017 16:11:43
| -7,200
|
22525df55911be2227d0c89de4b7f0e56e8377a9
|
preventing undesired interrupts from non initialized button in OM-cc2538 boot
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/board.c",
"new_path": "bsp/boards/openmote-cc2538/board.c",
"diff": "@@ -55,6 +55,8 @@ static void SysCtrlWakeupSetting(void);\nstatic void GPIO_C_Handler(void);\n+bool user_button_initialized;\n+\n//=========================== main ============================================\nextern int mote_main(void);\n@@ -66,6 +68,8 @@ int main(void) {\n//=========================== public ==========================================\nvoid board_init(void) {\n+ user_button_initialized = FALSE;\n+\ngpio_init();\nclock_init();\nboard_timer_init();\n@@ -198,6 +202,9 @@ static void button_init(void) {\n/* Delay to avoid pin floating problems */\nfor (i = 0xFFFF; i != 0; i--);\n+ GPIOPinIntDisable(BSP_BUTTON_BASE, BSP_BUTTON_USER);\n+ GPIOPinIntClear(BSP_BUTTON_BASE, BSP_BUTTON_USER);\n+\n/* The button is an input GPIO on falling edge */\nGPIOPinTypeGPIOInput(BSP_BUTTON_BASE, BSP_BUTTON_USER);\nGPIOIntTypeSet(BSP_BUTTON_BASE, BSP_BUTTON_USER, GPIO_FALLING_EDGE);\n@@ -208,6 +215,7 @@ static void button_init(void) {\n/* Clear and enable the interrupt */\nGPIOPinIntClear(BSP_BUTTON_BASE, BSP_BUTTON_USER);\nGPIOPinIntEnable(BSP_BUTTON_BASE, BSP_BUTTON_USER);\n+ user_button_initialized = TRUE;\n}\nstatic void SysCtrlRunSetting(void) {\n@@ -292,6 +300,7 @@ static void SysCtrlWakeupSetting(void) {\n* Erases a Flash sector to trigger the bootloader backdoor\n*/\nstatic void GPIO_C_Handler(void) {\n+ if (!user_button_initialized) return;\n/* Disable the interrupts */\nIntMasterDisable();\nleds_all_off();\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-665 preventing undesired interrupts from non initialized button in OM-cc2538 boot
|
491,609
|
12.07.2017 16:23:45
| -7,200
|
90415f7b8ff25ce6cd8f0ee4c28ad27261552f1d
|
Use link-local prefix to forward the response to the pledge.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/opencoap.c",
"new_path": "openapps/opencoap/opencoap.c",
"diff": "@@ -1019,7 +1019,7 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\nuint8_t outgoingOptionsLen;\nopen_addr_t eui64;\nopen_addr_t destIP;\n- open_addr_t* prefix;\n+ open_addr_t link_local_prefix;\nstatelessProxy = opencoap_find_option(incomingOptions, incomingOptionsLen, COAP_OPTION_NUM_STATELESSPROXY);\nif (statelessProxy == NULL) {\n@@ -1032,8 +1032,13 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg,\neui64.type = ADDR_64B;\nmemcpy(eui64.addr_64b, statelessProxy->pValue, 8);\n- prefix = idmanager_getMyID(ADDR_PREFIX);\n- packetfunctions_mac64bToIp128b(prefix, &eui64, &destIP);\n+ // use link-local prefix to forward the response\n+ memset(&link_local_prefix, 0x00, sizeof(open_addr_t));\n+ link_local_prefix.type = ADDR_PREFIX;\n+ link_local_prefix.prefix[0] = 0xfe;\n+ link_local_prefix.prefix[1] = 0x80;\n+\n+ packetfunctions_mac64bToIp128b(&link_local_prefix, &eui64, &destIP);\nif (statelessProxy->length == 10) {\nportNumber = packetfunctions_ntohs(&statelessProxy->pValue[8]);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-651. Use link-local prefix to forward the response to the pledge.
|
491,595
|
12.07.2017 18:51:41
| -7,200
|
34b4db5641a146fcd86fd8bb74732891f91ddf2d
|
no CTS setting for simulation.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/python/uart_obj.c",
"new_path": "bsp/boards/python/uart_obj.c",
"diff": "@@ -287,10 +287,10 @@ uint8_t uart_readByte(OpenMote* self) {\n#ifdef FASTSIM\nvoid uart_setCTS(OpenMote* self, bool state) {\n- printf(\"[CRITICAL] uart_writeByte() should not be called\\r\\n\");\n+ printf(\"[CRITICAL] uart_setCTS() should not be called\\r\\n\");\n}\n#else\n-void uart_writeByte(OpenMote* self, bool state) {\n+void uart_setCTS(OpenMote* self, bool state) {\nPyObject* result;\nPyObject* arglist;\n@@ -299,7 +299,7 @@ void uart_writeByte(OpenMote* self, bool state) {\n#endif\n// forward to Python\n- arglist = Py_BuildValue(\"(i)\",byteToWrite);\n+ arglist = Py_BuildValue(\"(i)\",state);\nresult = PyObject_CallObject(self->callback[MOTE_NOTIF_uart_setCTS],arglist);\nif (result == NULL) {\nprintf(\"[CRITICAL] uart_setCTS() returned NULL\\r\\n\");\n"
},
{
"change_type": "MODIFY",
"old_path": "drivers/common/openserial.c",
"new_path": "drivers/common/openserial.c",
"diff": "@@ -374,19 +374,20 @@ void openserial_flush(void) {\nif (openserial_vars.fBusyFlushing==FALSE) {\nif (openserial_vars.ctsStateChanged==TRUE) {\n// send CTS\n-\n+#ifdef FASTSIM\n+#else\nif (openserial_vars.fInhibited==TRUE) {\nuart_setCTS(FALSE);\n} else {\nuart_setCTS(TRUE);\n}\n+#endif\nopenserial_vars.ctsStateChanged = FALSE;\n- } else if (openserial_vars.fInhibited==TRUE) {\n+ } else {\n+ if (openserial_vars.fInhibited==TRUE) {\n// currently inhibited\n-\n} else {\n// not inhibited\n-\nif (openserial_vars.outputBufIdxW!=openserial_vars.outputBufIdxR) {\n// I have some bytes to transmit\n@@ -403,6 +404,7 @@ void openserial_flush(void) {\n}\n}\n}\n+ }\nENABLE_INTERRUPTS();\n//>>>>>>>>>>>>>>>>>>>>>>>\n}\n@@ -413,7 +415,10 @@ void openserial_inhibitStart(void) {\n//<<<<<<<<<<<<<<<<<<<<<<<\nDISABLE_INTERRUPTS();\nopenserial_vars.fInhibited = TRUE;\n+#ifdef FASTSIM\n+#else\nopenserial_vars.ctsStateChanged = TRUE;\n+#endif\nENABLE_INTERRUPTS();\n//>>>>>>>>>>>>>>>>>>>>>>>\n@@ -427,7 +432,10 @@ void openserial_inhibitStop(void) {\n//<<<<<<<<<<<<<<<<<<<<<<<\nDISABLE_INTERRUPTS();\nopenserial_vars.fInhibited = FALSE;\n+#ifdef FASTSIM\n+#else\nopenserial_vars.ctsStateChanged = TRUE;\n+#endif\nENABLE_INTERRUPTS();\n//>>>>>>>>>>>>>>>>>>>>>>>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-540. no CTS setting for simulation.
|
491,595
|
13.07.2017 15:21:56
| -7,200
|
6ccc7cbe0e718ce2be3a770c879aa88ebb9c1a86
|
port on msp430 platform.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/gina/uart.c",
"new_path": "bsp/boards/gina/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\n} uart_vars_t;\nuart_vars_t uart_vars;\n@@ -61,9 +63,23 @@ void uart_clearTxInterrupts(){\nUC1IFG &= ~(UCA1TXIFG);\n}\n+void uart_setCTS(bool state) {\n+ if (state==0x01) {\n+ UCA1TXBUF = XON;\n+ } else {\n+ UCA1TXBUF = XOFF;\n+ }\n+}\n+\nvoid uart_writeByte(uint8_t byteToWrite){\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ UCA1TXBUF = XONXOFF_ESCAPE;\n+ } else {\nUCA1TXBUF = byteToWrite;\n}\n+}\nuint8_t uart_readByte(){\nreturn UCA1RXBUF;\n@@ -74,6 +90,12 @@ uint8_t uart_readByte(){\nkick_scheduler_t uart_tx_isr() {\nuart_clearTxInterrupts(); // TODO: do not clear, but disable when done\nuart_vars.txCb();\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ UCA1TXBUF = uart_vars.xonXoffEscapedByte^XONXOFF_MASK;\n+ } else {\n+ uart_vars.txCb();\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/wsn430v13b/uart.c",
"new_path": "bsp/boards/wsn430v13b/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\n} uart_vars_t;\nuart_vars_t uart_vars;\n@@ -71,9 +73,23 @@ void uart_clearTxInterrupts(){\nIFG2 &= ~UTXIFG1;\n}\n+void uart_setCTS(bool state) {\n+ if (state==0x01) {\n+ U1TXBUF = XON;\n+ } else {\n+ U1TXBUF = XOFF;\n+ }\n+}\n+\nvoid uart_writeByte(uint8_t byteToWrite){\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ U1TXBUF = XONXOFF_ESCAPE;\n+ } else {\nU1TXBUF = byteToWrite;\n}\n+}\nuint8_t uart_readByte(){\nreturn U1RXBUF;\n@@ -85,7 +101,12 @@ uint8_t uart_readByte(){\nkick_scheduler_t uart_tx_isr() {\nuart_clearTxInterrupts(); // TODO: do not clear, but disable when done\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ U1TXBUF = uart_vars.xonXoffEscapedByte^XONXOFF_MASK;\n+ } else {\nuart_vars.txCb();\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/wsn430v14/uart.c",
"new_path": "bsp/boards/wsn430v14/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\n} uart_vars_t;\nuart_vars_t uart_vars;\n@@ -60,9 +62,23 @@ void uart_clearTxInterrupts(void){\nIFG1 &= ~UTXIFG0;\n}\n+void uart_setCTS(bool state) {\n+ if (state==0x01) {\n+ U0TXBUF = XON;\n+ } else {\n+ U0TXBUF = XOFF;\n+ }\n+}\n+\nvoid uart_writeByte(uint8_t byteToWrite){\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ U0TXBUF = XONXOFF_ESCAPE;\n+ } else {\nU0TXBUF = byteToWrite;\n}\n+}\nuint8_t uart_readByte(void){\nreturn U0RXBUF;\n@@ -74,7 +90,12 @@ uint8_t uart_readByte(void){\nkick_scheduler_t uart_tx_isr(void) {\nuart_clearTxInterrupts(); // TODO: do not clear, but disable when done\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ U0TXBUF = uart_vars.xonXoffEscapedByte^XONXOFF_MASK;\n+ } else {\nuart_vars.txCb();\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/z1/uart.c",
"new_path": "bsp/boards/z1/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\n} uart_vars_t;\nuart_vars_t uart_vars;\n@@ -63,9 +65,23 @@ void uart_clearTxInterrupts(){\nUC0IFG &= ~(UCA0TXIFG);\n}\n+void uart_setCTS(bool state) {\n+ if (state==0x01) {\n+ UCA0TXBUF = XON;\n+ } else {\n+ UCA0TXBUF = XOFF;\n+ }\n+}\n+\nvoid uart_writeByte(uint8_t byteToWrite){\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ UCA0TXBUF = XONXOFF_ESCAPE;\n+ } else {\nUCA0TXBUF = byteToWrite;\n}\n+}\nuint8_t uart_readByte(){\nreturn UCA0RXBUF;\n@@ -76,6 +92,12 @@ uint8_t uart_readByte(){\nkick_scheduler_t uart_tx_isr() {\nuart_clearTxInterrupts(); // TODO: do not clear, but disable when done\nuart_vars.txCb();\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ UCA0TXBUF = uart_vars.xonXoffEscapedByte^XONXOFF_MASK;\n+ } else {\n+ uart_vars.txCb();\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-540. port on msp430 platform.
|
491,595
|
13.07.2017 16:10:47
| -7,200
|
233f5e788d873d99bd59b2e0438ec5d6bfc16812
|
port to stm32 platform.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_A8-M3/uart.c",
"new_path": "bsp/boards/iot-lab_A8-M3/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\n} uart_vars_t;\nuart_vars_t uart_vars;\n@@ -95,9 +97,24 @@ void uart_clearTxInterrupts() {\nUSART_ClearFlag(USART1, USART_FLAG_TC);\n}\n+void uart_setCTS(bool state) {\n+\n+ if (state==0x01) {\n+ USART_SendData(USART1,(uint16_t)XON);\n+ } else {\n+ USART_SendData(USART1,(uint16_t)XOFF);\n+ }\n+}\n+\nvoid uart_writeByte(uint8_t byteToWrite) {\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ USART_SendData(USART1,(uint16_t)XONXOFF_ESCAPE);\n+ } else {\nUSART_SendData(USART1,(uint16_t)byteToWrite);\n}\n+}\nuint8_t uart_readByte() {\nuint16_t temp;\n@@ -110,7 +127,12 @@ uint8_t uart_readByte() {\nkick_scheduler_t uart_tx_isr() {\nuart_clearTxInterrupts();\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ USART_SendData(USART1,(uint16_t)uart_vars.xonXoffEscapedByte^XONXOFF_MASK);\n+ } else {\nuart_vars.txCb();\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_M3/uart.c",
"new_path": "bsp/boards/iot-lab_M3/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\n} uart_vars_t;\nuart_vars_t uart_vars;\n@@ -92,9 +94,24 @@ void uart_clearTxInterrupts() {\nUSART_ClearFlag(USART1, USART_FLAG_TC);\n}\n+void uart_setCTS(bool state) {\n+\n+ if (state==0x01) {\n+ USART_SendData(USART1,(uint16_t)XON);\n+ } else {\n+ USART_SendData(USART1,(uint16_t)XOFF);\n+ }\n+}\n+\nvoid uart_writeByte(uint8_t byteToWrite) {\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ USART_SendData(USART1,(uint16_t)XONXOFF_ESCAPE);\n+ } else {\nUSART_SendData(USART1,(uint16_t)byteToWrite);\n}\n+}\nuint8_t uart_readByte() {\nreturn (uint8_t)USART_ReceiveData(USART1);\n@@ -104,7 +121,12 @@ uint8_t uart_readByte() {\nkick_scheduler_t uart_tx_isr() {\nuart_clearTxInterrupts();\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ USART_SendData(USART1,(uint16_t)uart_vars.xonXoffEscapedByte^XONXOFF_MASK);\n+ } else {\nuart_vars.txCb();\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmotestm/uart.c",
"new_path": "bsp/boards/openmotestm/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\nuint8_t startOrend;\nuint8_t flagByte;\nbool flag;\n@@ -104,10 +106,27 @@ void uart_clearTxInterrupts(){\nUSART_ClearFlag(USART1,USART_FLAG_TXE);\n}\n+void uart_setCTS(bool state) {\n+\n+ if (state==0x01) {\n+ USART_SendData(USART1,(uint16_t)XON);\n+ } else {\n+ USART_SendData(USART1,(uint16_t)XOFF);\n+ }\n+ while(USART_GetFlagStatus(USART1,USART_FLAG_TXE) == RESET);\n+}\n+\nvoid uart_writeByte(uint8_t byteToWrite) {\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ USART_SendData(USART1,(uint16_t)XONXOFF_ESCAPE);\n+ } else {\nUSART_SendData(USART1,(uint16_t)byteToWrite);\n+ }\nwhile(USART_GetFlagStatus(USART1,USART_FLAG_TXE) == RESET);\n+\n//start or end byte?\nif(byteToWrite == uart_vars.flagByte){\nuart_vars.startOrend = (uart_vars.startOrend == 0)?1:0;\n@@ -132,6 +151,13 @@ uint8_t uart_readByte() {\nkick_scheduler_t uart_tx_isr() {\nuart_vars.txCb();\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ USART_SendData(USART1,(uint16_t)uart_vars.xonXoffEscapedByte^XONXOFF_MASK);\n+ while(USART_GetFlagStatus(USART1,USART_FLAG_TXE) == RESET);\n+ } else {\n+ uart_vars.txCb();\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-540. port to stm32 platform.
|
491,595
|
13.07.2017 16:17:30
| -7,200
|
6409d5b02c36df17458fab0d2d2e0f9e6412c1c2
|
port to samr21_xpro.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/samr21_xpro/uart.c",
"new_path": "bsp/boards/samr21_xpro/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\nuint8_t startOrend;\nuint8_t flagByte;\n} uart_vars_t;\n@@ -62,8 +64,7 @@ void usart_read_callback(void);\n* @param None\n*\n*/\n-void uart_init(void)\n-{\n+void uart_init(void){\nusart_init(USART_HOST_BAUDRATE);\n}\n@@ -74,8 +75,7 @@ void uart_init(void)\n*\n*\n*/\n-void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb)\n-{\n+void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb){\n/* Register Callbacks */\nuart_vars.txCb = txCb;\nuart_vars.rxCb = rxCb;\n@@ -89,8 +89,7 @@ void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb)\n* @param None\n*\n*/\n-void usart_write_callback(void)\n-{\n+void usart_write_callback(void){\nuart_tx_isr();\n}\n@@ -101,8 +100,7 @@ void usart_write_callback(void)\n* @param None\n*\n*/\n-void usart_read_callback(void)\n-{\n+void usart_read_callback(void){\nuart_rx_isr();\n}\n@@ -113,8 +111,7 @@ void usart_read_callback(void)\n* @param None\n*\n*/\n-void uart_enableInterrupts(void)\n-{\n+void uart_enableInterrupts(void){\nusart_enable_txrx_isr();\n}\n@@ -125,11 +122,19 @@ void uart_enableInterrupts(void)\n* @param None\n*\n*/\n-void uart_disableInterrupts(void)\n-{\n+void uart_disableInterrupts(void){\nusart_disable_txrx_isr();\n}\n+void uart_setCTS(bool state) {\n+\n+ if (state==0x01) {\n+ uart_write_byte(XON);\n+ } else {\n+ uart_write_byte(XOFF);\n+ }\n+}\n+\n/*\n* @brief uart_writeByte This function will write the\n* one byte to usart Data Register\n@@ -137,10 +142,15 @@ void uart_disableInterrupts(void)\n* @param None\n*\n*/\n-void uart_writeByte(uint8_t byteToWrite)\n-{\n+void uart_writeByte(uint8_t byteToWrite){\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ uart_write_byte(XONXOFF_ESCAPE);\n+ } else {\nuart_write_byte(byteToWrite);\n}\n+}\n/*\n* @brief uart_readByte This function will read\n@@ -162,8 +172,7 @@ uint8_t uart_readByte(void)\n* @param None\n*\n*/\n-void uart_clearTxInterrupts(void)\n-{\n+void uart_clearTxInterrupts(void){\nuart_clear_tx_flag();\n}\n@@ -174,8 +183,7 @@ void uart_clearTxInterrupts(void)\n* @param None\n*\n*/\n-void uart_clearRxInterrupts(void)\n-{\n+void uart_clearRxInterrupts(void){\nuart_clear_rx_flag();\n}\n@@ -186,13 +194,16 @@ void uart_clearRxInterrupts(void)\n* @param return kick_scheduler_t\n*\n*/\n-kick_scheduler_t uart_tx_isr(void)\n-{\n+kick_scheduler_t uart_tx_isr(void) {\nuart_clearTxInterrupts();\n- if(uart_vars.txCb != NULL)\n- {\n+ if(uart_vars.txCb != NULL){\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ uart_write_byte(uart_vars.xonXoffEscapedByte^XONXOFF_MASK);\n+ } else {\nuart_vars.txCb();\n}\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n@@ -203,11 +214,9 @@ kick_scheduler_t uart_tx_isr(void)\n* @param return kick_scheduler_t\n*\n*/\n-kick_scheduler_t uart_rx_isr(void)\n-{\n+kick_scheduler_t uart_rx_isr(void){\nuart_clearRxInterrupts();\n- if (uart_vars.rxCb != NULL)\n- {\n+ if (uart_vars.rxCb != NULL){\nuart_vars.rxCb();\n}\nreturn DO_NOT_KICK_SCHEDULER;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-540. port to samr21_xpro.
|
491,595
|
13.07.2017 16:23:06
| -7,200
|
220a7f7e303c98387d91a3415be2b71c83de1487
|
port to agilefox.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/agilefox/uart.c",
"new_path": "bsp/boards/agilefox/uart.c",
"diff": "typedef struct {\nuart_tx_cbt txCb;\nuart_rx_cbt rxCb;\n+ bool fXonXoffEscaping;\n+ uint8_t xonXoffEscapedByte;\nuint8_t startOrend;\nuint8_t flagByte;\n} uart_vars_t;\n@@ -32,8 +34,7 @@ uart_vars_t uart_vars;\n//=========================== public ==========================================\n-void uart_init()\n-{\n+void uart_init() {\n// reset local variables\nmemset(&uart_vars,0,sizeof(uart_vars_t));\n@@ -72,8 +73,7 @@ void uart_init()\nUSART_Cmd(USART2, ENABLE); // enable USART2\n}\n-void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb)\n-{\n+void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb) {\nuart_vars.txCb = txCb;\nuart_vars.rxCb = rxCb;\n@@ -81,30 +81,43 @@ void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb)\nNVIC_uart();\n}\n-void uart_enableInterrupts()\n-{\n+void uart_enableInterrupts(){\nUSART_ITConfig(USART2, USART_IT_RXNE, ENABLE);\n}\n-void uart_disableInterrupts()\n-{\n+void uart_disableInterrupts(){\nUSART_ITConfig(USART2, USART_IT_TXE, DISABLE);\nUSART_ITConfig(USART2, USART_IT_RXNE, DISABLE);\n}\n-void uart_clearRxInterrupts()\n-{\n+void uart_clearRxInterrupts(){\nUSART_ClearFlag(USART2, USART_FLAG_RXNE);\n}\n-void uart_clearTxInterrupts()\n-{\n+void uart_clearTxInterrupts(){\nUSART_ClearFlag(USART2, USART_FLAG_TXE);\n}\n-void uart_writeByte(uint8_t byteToWrite)\n-{\n- USART_SendData(USART2, byteToWrite);\n+\n+void uart_setCTS(bool state) {\n+\n+ if (state==0x01) {\n+ USART_SendData(USART2,(uint16_t)XON);\n+ } else {\n+ USART_SendData(USART2,(uint16_t)XOFF);\n+ }\n+ while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET);\n+}\n+\n+void uart_writeByte(uint8_t byteToWrite){\n+\n+ if (byteToWrite==XON || byteToWrite==XOFF || byteToWrite==XONXOFF_ESCAPE) {\n+ uart_vars.fXonXoffEscaping = 0x01;\n+ uart_vars.xonXoffEscapedByte = byteToWrite;\n+ USART_SendData(USART2,(uint16_t)XONXOFF_ESCAPE);\n+ } else {\n+ USART_SendData(USART2,(uint16_t)byteToWrite);\n+ }\nwhile(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET);\n//start or end byte?\n@@ -119,8 +132,7 @@ void uart_writeByte(uint8_t byteToWrite)\n}\n}\n-uint8_t uart_readByte()\n-{\n+uint8_t uart_readByte(){\nuint16_t temp;\ntemp = USART_ReceiveData(USART2);\nreturn (uint8_t)temp;\n@@ -128,15 +140,18 @@ uint8_t uart_readByte()\n//=========================== interrupt handlers ==============================\n-kick_scheduler_t uart_tx_isr()\n-{\n+kick_scheduler_t uart_tx_isr() {\n+ if (uart_vars.fXonXoffEscaping==0x01) {\n+ uart_vars.fXonXoffEscaping = 0x00;\n+ USART_SendData(USART2,(uint16_t)uart_vars.xonXoffEscapedByte^XONXOFF_MASK);\n+ while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET);\n+ } else {\nuart_vars.txCb();\n+ }\nreturn DO_NOT_KICK_SCHEDULER;\n}\n-kick_scheduler_t uart_rx_isr()\n-{\n+kick_scheduler_t uart_rx_isr() {\nuart_vars.rxCb();\nreturn DO_NOT_KICK_SCHEDULER;\n}\n\\ No newline at end of file\n-\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-540. port to agilefox.
|
491,595
|
13.07.2017 16:48:44
| -7,200
|
1f22e79efb75478f62b00987d56e762ed43083d3
|
fix scons docs warning
|
[
{
"change_type": "MODIFY",
"old_path": "docs/Doxyfile",
"new_path": "docs/Doxyfile",
"diff": "@@ -749,12 +749,10 @@ INPUT = . \\\n../kernel/openos \\\n../drivers/common \\\n../bsp/boards/board.h \\\n- ../bsp/boards/bsp_timer.h \\\n../bsp/boards/debugpins.h \\\n../bsp/boards/eui64.h \\\n../bsp/boards/leds.h \\\n../bsp/boards/radio.h \\\n- ../bsp/boards/radiotimer.h \\\n../bsp/boards/sctimer.h \\\n../bsp/boards/uart.h \\\n"
},
{
"change_type": "MODIFY",
"old_path": "drivers/common/opentimers.c",
"new_path": "drivers/common/opentimers.c",
"diff": "@@ -170,6 +170,7 @@ All timers use this function are ONE_SHOT type timer.\n\\param[in] id indicates the timer id\n\\param[in] duration indicates the period asked for schedule after a given time indicated by reference parameter.\n+\\param[in] reference indicates the reference for duration. The timer will be fired at reference+duration.\n\\param[in] uint_type indicates the unit type of this schedule: ticks or ms\n\\param[in] cb indicates when this scheduled timer fired, call this callback function.\n*/\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-540. fix scons docs warning
|
491,595
|
13.07.2017 21:51:28
| -7,200
|
61890e2f4073c972c33768dd312cf0893b359e9b
|
update the ASN and counter payload position.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/uinject/uinject.py",
"new_path": "openapps/uinject/uinject.py",
"diff": "@@ -13,8 +13,8 @@ while True:\nhisAddress = dist_addr[0]\nhisPort = dist_addr[1]\n- asn = struct.unpack('<HHB',request[:5])\n- counter = struct.unpack('<h',request[-2:])[0]\n+ asn = struct.unpack('<HHB',request[-14:-9])\n+ counter = struct.unpack('<h',request[-9:-7])\nprint 'received \"{0}\" from [{1}]:{2}'.format(counter,hisAddress,hisPort)\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
update the ASN and counter payload position.
|
491,600
|
14.07.2017 15:13:08
| -7,200
|
23963bde3431d272d46dc8e64bc3b383bc6235d9
|
hotfix to fix IAR build
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/csensors/csensors.c",
"new_path": "openapps/csensors/csensors.c",
"diff": "@@ -216,7 +216,7 @@ owerror_t csensors_receive(\n}\ncsensors_fillpayload(msg,id);\n// add return option\n- csensor_vars.medType = COAP_MEDTYPE_APPOCTETSTREM;\n+ csensors_vars.medType = COAP_MEDTYPE_APPOCTETSTREAM;\ncoap_outgoingOptions[0].type = COAP_OPTION_NUM_CONTENTFORMAT;\ncoap_outgoingOptions[0].length = 1;\ncoap_outgoingOptions[0].pValue = &csensors_vars.medType;\n@@ -336,7 +336,7 @@ void csensors_task_cb() {\n// location-path0 option\noptions[0].type = COAP_OPTION_NUM_URIPATH;\noptions[0].length = sizeof(csensors_path0) - 1;\n- options[0].pValue = csensors_path0;\n+ options[0].pValue = (uint8_t*)csensors_path0;\n// location-path1 option\noptions[1].type = COAP_OPTION_NUM_URIPATH;\n@@ -344,7 +344,7 @@ void csensors_task_cb() {\noptions[1].pValue = csensors_vars.csensors_resource[id].desc.path1val;\n// content format option\n- csensors_vars.medType = COAP_MEDTYPE_APPOCTETSTREM;\n+ csensors_vars.medType = COAP_MEDTYPE_APPOCTETSTREAM;\noptions[2].type = COAP_OPTION_NUM_CONTENTFORMAT;\noptions[2].length = 1;\noptions[2].pValue = &csensors_vars.medType;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.h",
"new_path": "openapps/opencoap/openoscoap.h",
"diff": "@@ -21,6 +21,7 @@ typedef enum {\n//=========================== module variables ================================\ntypedef struct {\n+ uint8_t dummy; // needed for compilation, not used\n} openoscoap_vars_t;\n//=========================== prototypes ======================================\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp",
"new_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp",
"diff": "<state>$PROJ_DIR$\\..\\..\\..\\openapps\\c6t\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\cexample\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\cinfo\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\openapps\\cjoin\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\cleds\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\csensors\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\cwellknown\\</state>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_smwdthrosc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_soc_adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_soc_adc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ssi.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\openapps\\cinfo\\cinfo.h</name>\n</file>\n</group>\n+ <group>\n+ <name>cjoin</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\cjoin\\cbor.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\cjoin\\cbor.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\cjoin\\cjoin.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\cjoin\\cjoin.h</name>\n+ </file>\n+ </group>\n<group>\n<name>cleds</name>\n<file>\n</group>\n<group>\n<name>opencoap</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\cborencoder.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\cborencoder.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\hkdf.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\hmac.c</name>\n+ </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\opencoap.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\opencoap.h</name>\n</file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\openoscoap.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\openoscoap.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\sha-private.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\sha.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\sha224-256.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\opencoap\\usha.c</name>\n+ </file>\n</group>\n<group>\n<name>rrt</name>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
hotfix to fix IAR build
|
491,600
|
14.07.2017 15:16:37
| -7,200
|
98c0666caaddefd35f123138e0a1946947ff86f6
|
HOTFIX: remove most apps by default
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/openapps.c",
"new_path": "openapps/openapps.c",
"diff": "@@ -34,17 +34,17 @@ void openapps_init(void) {\nopencoap_init(); // initialize before any of the CoAP applications\n// CoAP\n- c6t_init();\n+ //c6t_init();\ncinfo_init();\ncleds__init();\n- cjoin_init();\n+ //cjoin_init();\ncwellknown_init();\n- rrt_init();\n+ //rrt_init();\n// UDP\n- uecho_init();\n- uinject_init();\n- userialbridge_init();\n- uexpiration_init();\n- umonitor_init();\n+ //uecho_init();\n+ //uinject_init();\n+ //userialbridge_init();\n+ //uexpiration_init();\n+ //umonitor_init();\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
HOTFIX: remove most apps by default
|
491,609
|
14.07.2017 18:30:19
| -7,200
|
715f5e111e76d0d95454033cd26d86675317a320
|
Fix key identifier passed in AAD of OSCOAP.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/opencoap/openoscoap.c",
"new_path": "openapps/opencoap/openoscoap.c",
"diff": "@@ -188,8 +188,14 @@ owerror_t openoscoap_protect_message(\nrequestSeq = &partialIV[AES_CCM_16_64_128_IV_LEN - 2];\nrequestSeqLen = openoscoap_convert_sequence_number(sequenceNumber, &requestSeq);\n+ if (is_request(code)) {\nrequestKid = context->senderID;\nrequestKidLen = context->senderIDLen;\n+ }\n+ else {\n+ requestKid = context->recipientID;\n+ requestKidLen = context->recipientIDLen;\n+ }\nif (msg->length > 0 ) { // contains payload, add payload marker\npayloadPresent = TRUE;\n@@ -294,6 +300,8 @@ owerror_t openoscoap_unprotect_message(\nuint8_t nonce[AES_CCM_16_64_128_IV_LEN];\nuint8_t partialIV[AES_CCM_16_64_128_IV_LEN];\n+ uint8_t *requestKid;\n+ uint8_t requestKidLen;\nuint8_t* requestSeq;\nuint8_t requestSeqLen;\nuint8_t aad[AAD_MAX_LEN];\n@@ -331,6 +339,12 @@ owerror_t openoscoap_unprotect_message(\n);\nreturn E_FAIL;\n}\n+ requestKid = context->recipientID;\n+ requestKidLen = context->recipientIDLen;\n+ }\n+ else {\n+ requestKid = context->senderID;\n+ requestKidLen = context->senderIDLen;\n}\n// convert sequence number to array and strip leading zeros\n@@ -344,8 +358,8 @@ owerror_t openoscoap_unprotect_message(\nNULL,\n0, // do not support Class I options at the moment\nAES_CCM_16_64_128,\n- context->recipientID,\n- context->recipientIDLen,\n+ requestKid,\n+ requestKidLen,\nrequestSeq,\nrequestSeqLen);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-667. Fix key identifier passed in AAD of OSCOAP.
|
491,595
|
14.07.2017 19:07:48
| -7,200
|
acc0267aac2580bd1aa61685354189ae718f7314
|
6pList fixed.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -270,11 +270,13 @@ void sixtop_request(\nif (code == IANA_6TOP_CMD_LIST){\n// append 6p max number of cells\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint16_t));\n- *((uint8_t*)(pkt->payload)) = listingMaxNumCells;\n+ *((uint8_t*)(pkt->payload)) = (uint8_t)(listingMaxNumCells & 0x00FF);\n+ *((uint8_t*)(pkt->payload+1)) = (uint8_t)(listingMaxNumCells & 0xFF00)>>8;\nlen +=2;\n// append 6p listing offset\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint16_t));\n- *((uint8_t*)(pkt->payload)) = listingOffset;\n+ *((uint8_t*)(pkt->payload)) = (uint8_t)(listingOffset & 0x00FF);\n+ *((uint8_t*)(pkt->payload+1)) = (uint8_t)(listingOffset & 0xFF00)>>8;\nlen +=2;\n// append 6p Reserved field\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint8_t));\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
6pList fixed.
|
491,592
|
15.07.2017 09:12:37
| -7,200
|
ae89980c56e387c6ef79679a58c2cdbc8b9ec44b
|
pio struct (WIP)
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -82,6 +82,20 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.dioPeriod = TIMER_DIO_TIMEOUT;\nicmpv6rpl_vars.timerIdDIO = opentimers_create();\n+\n+ //initialize PIO -> move this to dagroot code\n+ icmpv6rpl_vars.pio.type = 0x08;\n+ icmpv6rpl_vars.pio.optLen = 30;\n+ icmpv6rpl_vars.pio.prefLen = 64;\n+ icmpv6rpl_vars.pio.flags = 96;\n+ icmpv6rpl_vars.pio.plifetime = 0xFFFFFFFF;\n+ icmpv6rpl_vars.pio.vlifetime = 0xFFFFFFFF;\n+ memcpy(\n+ &(icmpv6rpl_vars.pio.prefix[0]),\n+ idmanager_getMyID(ADDR_128B)->addr_128b,\n+ sizeof(icmpv6rpl_vars.pio.prefix)\n+ );\n+\nopentimers_scheduleIn(\nicmpv6rpl_vars.timerIdDIO,\n872 +(openrandom_get16b()&0xff),\n@@ -234,6 +248,7 @@ void icmpv6rpl_receive(OpenQueueEntry_t* msg) {\nsizeof(icmpv6rpl_dio_ht)\n);\n+\n// write DODAGID in DIO and DAO\nicmpv6rpl_writeDODAGid(&(((icmpv6rpl_dio_ht*)(msg->payload))->DODAGID[0]));\n@@ -472,6 +487,11 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\n// save pointer to incoming DIO header in global structure for simplfying debug.\nicmpv6rpl_vars.incomingDio = (icmpv6rpl_dio_ht*)(msg->payload);\n+ icmpv6rpl_vars.incomingPio = (icmpv6rpl_pio_t*) (msg->payload + sizeof(icmpv6rpl_dio_ht));\n+\n+ // update pio with the received one.\n+ memcpy(&icmpv6rpl_vars.pio,icmpv6rpl_vars.incomingPio, sizeof(icmpv6rpl_pio_t));\n+\n// quick fix: rank is two bytes in network order: need to swap bytes\ntemp_8b = *(msg->payload+2);\nicmpv6rpl_vars.incomingDio->rank = (temp_8b << 8) + *(msg->payload+3);\n@@ -602,6 +622,24 @@ void sendDIO() {\n// set DIO destination\nmemcpy(&(msg->l3_destinationAdd),&icmpv6rpl_vars.dioDestination,sizeof(open_addr_t));\n+ //===== PIO payload\n+\n+ packetfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_pio_t));\n+\n+ // copy my prefix into the PIO\n+ memcpy(\n+ &(icmpv6rpl_vars.pio.prefix[0]),\n+ idmanager_getMyID(ADDR_128B)->addr_128b,\n+ sizeof(icmpv6rpl_vars.pio.prefix)\n+ );\n+ //copy the PIO in the packet\n+ memcpy(\n+ ((icmpv6rpl_pio_t*)(msg->payload)),\n+ &(icmpv6rpl_vars.pio),\n+ sizeof(icmpv6rpl_pio_t)\n+ );\n+\n+\n//===== DIO payload\n// note: DIO is already mostly populated\nicmpv6rpl_vars.dio.rank = icmpv6rpl_getMyDAGrank();\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.h",
"new_path": "openstack/03b-IPv6/icmpv6rpl.h",
"diff": "@@ -135,6 +135,18 @@ typedef struct {\nEND_PACK\n//=========================== module variables ================================\n+BEGIN_PACK\n+typedef struct {\n+ uint8_t type; // 0x08\n+ uint8_t optLen; // 30d\n+ uint8_t prefLen;//64\n+ uint8_t flags; //96 L=0,A=1,R=1,00000\n+ uint32_t vlifetime; //0xFFFFFFFF infinity\n+ uint32_t plifetime; //0xFFFFFFFF infinity\n+ uint32_t reserved;\n+ uint8_t prefix[16]; // myaddress\n+}icmpv6rpl_pio_t;\n+END_PACK\ntypedef struct {\n// admin\n@@ -143,6 +155,7 @@ typedef struct {\nuint8_t fDodagidWritten; ///< is DODAGID already written to DIO/DAO?\n// DIO-related\nicmpv6rpl_dio_ht dio; ///< pre-populated DIO packet.\n+ icmpv6rpl_pio_t pio; ///< pre-populated PIO com\nopen_addr_t dioDestination; ///< IPv6 destination address for DIOs.\nuint16_t dioTimerCounter; ///< counter to determine when to send DIO.\nopentimers_id_t timerIdDIO; ///< ID of the timer used to send DIOs.\n@@ -161,9 +174,12 @@ typedef struct {\nuint8_t ParentIndex; ///< index of Parent in neighbor table (iff haveParent==TRUE)\n// actually only here for debug\nicmpv6rpl_dio_ht* incomingDio; //keep it global to be able to debug correctly.\n+ icmpv6rpl_pio_t* incomingPio; //pio structure incoming\nbool daoSent;\n} icmpv6rpl_vars_t;\n+\n+\n//=========================== prototypes ======================================\nvoid icmpv6rpl_init(void);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-668 pio struct (WIP)
|
491,592
|
15.07.2017 10:38:13
| -7,200
|
dcf22df6866a687272ab2baf1302ee043209e300
|
PIO integration in the DIO
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -90,11 +90,20 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.pio.flags = 96;\nicmpv6rpl_vars.pio.plifetime = 0xFFFFFFFF;\nicmpv6rpl_vars.pio.vlifetime = 0xFFFFFFFF;\n+ // if not dagroot then do not initialize, will receive PIO and update fields\n+ // later\n+ if (idmanager_getIsDAGroot()){\nmemcpy(\n&(icmpv6rpl_vars.pio.prefix[0]),\n- idmanager_getMyID(ADDR_128B)->addr_128b,\n- sizeof(icmpv6rpl_vars.pio.prefix)\n+ idmanager_getMyID(ADDR_PREFIX)->prefix,\n+ sizeof(idmanager_getMyID(ADDR_PREFIX)->prefix)\n);\n+ memcpy(\n+ &(icmpv6rpl_vars.pio.prefix[8]),\n+ idmanager_getMyID(ADDR_64B)->addr_64b,\n+ sizeof(idmanager_getMyID(ADDR_64B)->addr_64b)\n+ );\n+ }\nopentimers_scheduleIn(\nicmpv6rpl_vars.timerIdDIO,\n@@ -627,11 +636,18 @@ void sendDIO() {\npacketfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_pio_t));\n// copy my prefix into the PIO\n+\nmemcpy(\n&(icmpv6rpl_vars.pio.prefix[0]),\n- idmanager_getMyID(ADDR_128B)->addr_128b,\n- sizeof(icmpv6rpl_vars.pio.prefix)\n+ idmanager_getMyID(ADDR_PREFIX)->prefix,\n+ sizeof(idmanager_getMyID(ADDR_PREFIX)->prefix)\n);\n+ memcpy(\n+ &(icmpv6rpl_vars.pio.prefix[8]),\n+ idmanager_getMyID(ADDR_64B)->addr_64b,\n+ sizeof(idmanager_getMyID(ADDR_64B)->addr_64b)\n+ );\n+\n//copy the PIO in the packet\nmemcpy(\n((icmpv6rpl_pio_t*)(msg->payload)),\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-668 PIO integration in the DIO
|
491,592
|
15.07.2017 11:25:50
| -7,200
|
96cf5e382404697141a099940022c576726604d8
|
getting prefix from PIO and not from DODAGID
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -229,7 +229,6 @@ void icmpv6rpl_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\n*/\nvoid icmpv6rpl_receive(OpenQueueEntry_t* msg) {\nuint8_t icmpv6code;\n- open_addr_t myPrefix;\n// take ownership\nmsg->owner = COMPONENT_ICMPv6RPL;\n@@ -250,26 +249,6 @@ void icmpv6rpl_receive(OpenQueueEntry_t* msg) {\n// stop here if I'm in the DAG root\nbreak; // break, don't return\n}\n-\n- memcpy(\n- &(icmpv6rpl_vars.dio),\n- (icmpv6rpl_dio_ht*)(msg->payload),\n- sizeof(icmpv6rpl_dio_ht)\n- );\n-\n-\n- // write DODAGID in DIO and DAO\n- icmpv6rpl_writeDODAGid(&(((icmpv6rpl_dio_ht*)(msg->payload))->DODAGID[0]));\n-\n- // update my prefix // looks like we adopt the prefix from any DIO without a question about this node being our parent??\n- myPrefix.type = ADDR_PREFIX;\n- memcpy(\n- myPrefix.prefix,\n- &((icmpv6rpl_dio_ht*)(msg->payload))->DODAGID[0],\n- sizeof(myPrefix.prefix)\n- );\n- idmanager_setMyID(&myPrefix);\n-\n// update routing info for that neighbor\nicmpv6rpl_indicateRxDIO(msg);\n@@ -490,17 +469,38 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\nuint8_t temp_8b;\ndagrank_t neighborRank;\nopen_addr_t NeighborAddress;\n+ open_addr_t myPrefix;\n// take ownership over the packet\nmsg->owner = COMPONENT_NEIGHBORS;\n+ // copy to our DIO\n+ memcpy(\n+ &(icmpv6rpl_vars.dio),\n+ (icmpv6rpl_dio_ht*)(msg->payload),\n+ sizeof(icmpv6rpl_dio_ht)\n+ );\n+\n+ // write DODAGID in DIO and DAO\n+ icmpv6rpl_writeDODAGid(&(((icmpv6rpl_dio_ht*)(msg->payload))->DODAGID[0]));\n+\n// save pointer to incoming DIO header in global structure for simplfying debug.\nicmpv6rpl_vars.incomingDio = (icmpv6rpl_dio_ht*)(msg->payload);\nicmpv6rpl_vars.incomingPio = (icmpv6rpl_pio_t*) (msg->payload + sizeof(icmpv6rpl_dio_ht));\n- // update pio with the received one.\n+ // update PIO with the received one.\nmemcpy(&icmpv6rpl_vars.pio,icmpv6rpl_vars.incomingPio, sizeof(icmpv6rpl_pio_t));\n+ // update my prefix from PIO\n+ // looks like we adopt the prefix from any PIO without a question about this node being our parent??\n+ myPrefix.type = ADDR_PREFIX;\n+ memcpy(\n+ myPrefix.prefix,\n+ icmpv6rpl_vars.incomingPio->prefix,\n+ sizeof(myPrefix.prefix)\n+ );\n+ idmanager_setMyID(&myPrefix);\n+\n// quick fix: rank is two bytes in network order: need to swap bytes\ntemp_8b = *(msg->payload+2);\nicmpv6rpl_vars.incomingDio->rank = (temp_8b << 8) + *(msg->payload+3);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-668 getting prefix from PIO and not from DODAGID
|
491,595
|
15.07.2017 19:14:40
| -7,200
|
40f5ec98f33fcde17c6aa5e3f1ef1ab2eee3bbb9
|
6P LIST command should return EOL when the last cell is presented in the request command.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -1203,6 +1203,18 @@ void sixtop_six2six_notifyReceive(\nbreak;\n}\n}\n+ if (\n+ schedule_getOneCellAfterOffset(\n+ metadata,\n+ startingOffset,\n+ &(pkt->l2_nextORpreviousHop),\n+ cellOptions_transformed,\n+ &slotoffset,\n+ &channeloffset) == FALSE\n+ ){\n+ returnCode = IANA_6TOP_RC_EOL;\n+ }\n+\nbreak;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-670. 6P LIST command should return EOL when the last cell is presented in the request command.
|
491,600
|
16.07.2017 11:06:01
| -7,200
|
e372467f89dcd4f44435e6cf6b38a1b2de0e83fc
|
Fixing OpenMote IAR builds (WIP).
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "bsp/boards/common/README.md",
"diff": "+Software implementation of AES and CCM*.\n+\n+Not used if the board have hardware-based security.\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/openmote-cc2538/01bsp_sctimer/01bsp_sctimer.ewp",
"new_path": "projects/openmote-cc2538/01bsp_sctimer/01bsp_sctimer.ewp",
"diff": "<group>\n<name>common</name>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_cbc.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\openaes.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_cbc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\openaes.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ccms.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\openccms.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ccms.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ctr.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ctr.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ecb.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ecb.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\dummy_crypto_engine.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\dummy_crypto_engine.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\firmware_crypto_engine.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\firmware_crypto_engine.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\openccms.h</name>\n</file>\n</group>\n<group>\n<group>\n<name>headers</name>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_aes.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_aes.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ana_regs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ana_regs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_cctest.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_cctest.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_flash_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_flash_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_gpio.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_gptimer.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_gptimer.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_i2cm.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_i2cm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_i2cs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_i2cs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ints.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ints.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ioc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_memmap.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_memmap.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_nvic.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_nvic.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_pka.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_pka.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_ffsm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_sfr.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_sfr.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_xreg.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_xreg.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_smwdthrosc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_smwdthrosc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_soc_adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_soc_adc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ssi.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ssi.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_sys_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_types.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_types.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_uart.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_uart.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_udma.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_udma.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_udmachctl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_udmachctl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_usb.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\adc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\adc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\aes.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\cpu.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\cpu.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\cpu.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\debug.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gpio.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gptimer.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ioc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\pka.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sys_ctrl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\systick.c</name>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-672. Fixing OpenMote IAR builds (WIP).
|
491,592
|
16.07.2017 12:03:48
| -7,200
|
7d2ef547c5559e431e54f2423f421c77aa8483d8
|
fixing rank in dio
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -367,7 +367,6 @@ void icmpv6rpl_updateMyDAGrankAndParentSelection() {\nreturn;\n}\n}\n-\n// prep for loop, remember state before neighbor table scanning\nprevParentIndex = icmpv6rpl_vars.ParentIndex;\nprevHadParent = icmpv6rpl_vars.haveParent;\n@@ -470,11 +469,12 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\ndagrank_t neighborRank;\nopen_addr_t NeighborAddress;\nopen_addr_t myPrefix;\n+ uint8_t tempRank[2];\n// take ownership over the packet\nmsg->owner = COMPONENT_NEIGHBORS;\n- // copy to our DIO\n+ // update some fields of our DIO\nmemcpy(\n&(icmpv6rpl_vars.dio),\n(icmpv6rpl_dio_ht*)(msg->payload),\n@@ -504,6 +504,10 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\n// quick fix: rank is two bytes in network order: need to swap bytes\ntemp_8b = *(msg->payload+2);\nicmpv6rpl_vars.incomingDio->rank = (temp_8b << 8) + *(msg->payload+3);\n+\n+ //update rank in DIO as well (which will be overwritten with my rank when send).\n+ icmpv6rpl_vars.dio.rank = icmpv6rpl_vars.incomingDio->rank;\n+\n// update rank of that neighbor in table\nfor (i=0;i<MAXNUMNEIGHBORS;i++) {\nif (neighbors_getNeighborEui64(&NeighborAddress, ADDR_64B, i)) { // this neighbor entry is in use\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-669 fixing rank in dio
|
491,600
|
16.07.2017 16:54:18
| -7,200
|
b658c7a17f18be0938c006f42fd1173eb41bcc65
|
radio_rx project.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_radio_rx/01bsp_radio_rx.c",
"new_path": "projects/common/01bsp_radio_rx/01bsp_radio_rx.c",
"diff": "@@ -68,6 +68,7 @@ len=17 num=84 rssi=-81 lqi=108 crc=1\n#include \"radio.h\"\n#include \"leds.h\"\n#include \"uart.h\"\n+#include \"sctimer.h\"\n//=========================== defines =========================================\n@@ -78,7 +79,6 @@ len=17 num=84 rssi=-81 lqi=108 crc=1\n//=========================== variables =======================================\ntypedef struct {\n- uint8_t num_radioTimerOverflows;\nuint8_t num_radioTimerCompare;\nuint8_t num_startFrame;\nuint8_t num_endFrame;\n@@ -107,7 +107,6 @@ app_vars_t app_vars;\n// radiotimer\nvoid cb_radioTimerOverflows(void);\n-void cb_radioTimerCompare(void);\n// radio\nvoid cb_startFrame(PORT_TIMER_WIDTH timestamp);\nvoid cb_endFrame(PORT_TIMER_WIDTH timestamp);\n@@ -129,10 +128,8 @@ int mote_main(void) {\nboard_init();\n// add callback functions radio\n- radio_setOverflowCb(cb_radioTimerOverflows);\n- radio_setCompareCb(cb_radioTimerCompare);\n- radio_setStartFrameCb(cb_startFrame);\n- radio_setEndFrameCb(cb_endFrame);\n+ sctimer_setStartFrameCb(cb_startFrame);\n+ sctimer_setEndFrameCb(cb_endFrame);\n// setup UART\nuart_setCallbacks(cb_uartTxDone,cb_uartRxCb);\n@@ -187,20 +184,6 @@ int mote_main(void) {\n//=========================== callbacks =======================================\n-//===== radiotimer\n-\n-void cb_radioTimerOverflows(void) {\n-\n- // update debug stats\n- app_dbg.num_radioTimerOverflows++;\n-}\n-\n-void cb_radioTimerCompare(void) {\n-\n- // update debug stats\n- app_dbg.num_radioTimerCompare++;\n-}\n-\n//===== radio\nvoid cb_startFrame(PORT_TIMER_WIDTH timestamp) {\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/telosb/01bsp_radio_rx/01bsp_radio_rx.ewp",
"new_path": "projects/telosb/01bsp_radio_rx/01bsp_radio_rx.ewp",
"diff": "<name>bsp</name>\n<group>\n<name>boards</name>\n- <group>\n- <name>common</name>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\abstimer.c</name>\n- <excluded>\n- <configuration>Debug</configuration>\n- </excluded>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\abstimers2.c</name>\n- <excluded>\n- <configuration>Debug</configuration>\n- </excluded>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_cbc.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_cbc.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ccms.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ccms.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ctr.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ctr.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ecb.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ecb.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\dummy_crypto_engine.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\dummy_crypto_engine.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\firmware_crypto_engine.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\firmware_crypto_engine.h</name>\n- </file>\n- </group>\n<group>\n<name>telosb</name>\n<file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board.c</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_crypto_engine.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_crypto_engine.h</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_info.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\bsp_timer.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\cryptoengine.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\debugpins.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\leds.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\radiotimer.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\sctimer.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\sensors.c</name>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420_crypto.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420_crypto.h</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\radio.c</name>\n</file>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-678. radio_rx project.
|
491,600
|
16.07.2017 16:58:58
| -7,200
|
8195dadb98dbee65e4b34c4e6fa7dc78b7b652d7
|
radio_tx project
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_radio_tx/01bsp_radio_tx.c",
"new_path": "projects/common/01bsp_radio_tx/01bsp_radio_tx.c",
"diff": "@@ -17,7 +17,7 @@ remainder of the packet contains an incrementing bytes.\n#include \"board.h\"\n#include \"radio.h\"\n#include \"leds.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n//=========================== defines =========================================\n@@ -67,10 +67,9 @@ int mote_main(void) {\nboard_init();\n// add radio callback functions\n- radio_setOverflowCb(cb_radioTimerOverflows);\n- radio_setCompareCb(cb_radioTimerCompare);\n- radio_setStartFrameCb(cb_startFrame);\n- radio_setEndFrameCb(cb_endFrame);\n+ sctimer_set_callback(cb_radioTimerOverflows);\n+ sctimer_setStartFrameCb(cb_startFrame);\n+ sctimer_setEndFrameCb(cb_endFrame);\n// prepare radio\nradio_rfOn();\n@@ -78,7 +77,8 @@ int mote_main(void) {\nradio_rfOff();\n// start periodic overflow\n- radiotimer_start(TIMER_PERIOD);\n+ sctimer_setCompare(TIMER_PERIOD);\n+ sctimer_enable();\nwhile(1) {\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/telosb/01bsp_radio_tx/01bsp_radio_tx.ewp",
"new_path": "projects/telosb/01bsp_radio_tx/01bsp_radio_tx.ewp",
"diff": "<name>bsp</name>\n<group>\n<name>boards</name>\n- <group>\n- <name>common</name>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\abstimer.c</name>\n- <excluded>\n- <configuration>Debug</configuration>\n- </excluded>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\abstimers2.c</name>\n- <excluded>\n- <configuration>Debug</configuration>\n- </excluded>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_cbc.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_cbc.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ccms.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ccms.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ctr.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ctr.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ecb.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ecb.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\dummy_crypto_engine.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\dummy_crypto_engine.h</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\firmware_crypto_engine.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\firmware_crypto_engine.h</name>\n- </file>\n- </group>\n<group>\n<name>telosb</name>\n<file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board.c</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_crypto_engine.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_crypto_engine.h</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_info.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\bsp_timer.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\cryptoengine.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\debugpins.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\leds.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\radiotimer.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\sctimer.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\sensors.c</name>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420_crypto.c</name>\n- </file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420_crypto.h</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\radio.c</name>\n</file>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-678. radio_tx project
|
491,592
|
16.07.2017 17:27:44
| -7,200
|
0852f1f989bb887e0b01dbe04be6c87fcde05714
|
adding configuration option
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -84,7 +84,7 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.timerIdDIO = opentimers_create();\n//initialize PIO -> move this to dagroot code\n- icmpv6rpl_vars.pio.type = 0x08;\n+ icmpv6rpl_vars.pio.type = RPL_OPTION_PIO;\nicmpv6rpl_vars.pio.optLen = 30;\nicmpv6rpl_vars.pio.prefLen = 64;\nicmpv6rpl_vars.pio.flags = 96;\n@@ -104,6 +104,19 @@ void icmpv6rpl_init() {\nsizeof(idmanager_getMyID(ADDR_64B)->addr_64b)\n);\n}\n+ //configuration option\n+ icmpv6rpl_vars.conf.type = RPL_OPTION_CONFIG;\n+ icmpv6rpl_vars.conf.optLen = 14;\n+ icmpv6rpl_vars.conf.flagsAPCS = DEFAULT_PATH_CONTROL_SIZE; //DEFAULT_PATH_CONTROL_SIZE = 0\n+ icmpv6rpl_vars.conf.DIOIntDoubl = 8; //8 -> trickle period - max times it will double ~20min\n+ icmpv6rpl_vars.conf.DIOIntMin = 12 ; // 12 -> min trickle period -> 16s\n+ icmpv6rpl_vars.conf.DIORedun = 0 ; // 0\n+ icmpv6rpl_vars.conf.maxRankIncrease = 2048; // 2048\n+ icmpv6rpl_vars.conf.minHopRankIncrease = 256 ; //256\n+ icmpv6rpl_vars.conf.OCP = 0; // 0 OF0\n+ icmpv6rpl_vars.conf.reserved = 0;\n+ icmpv6rpl_vars.conf.defLifetime = 0xff; //infinite - limit for DAO period -> 0xff\n+ icmpv6rpl_vars.conf.lifetimeUnit = 0xffff; // 0xffff\nopentimers_scheduleIn(\nicmpv6rpl_vars.timerIdDIO,\n@@ -469,8 +482,8 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\ndagrank_t neighborRank;\nopen_addr_t NeighborAddress;\nopen_addr_t myPrefix;\n- uint8_t tempRank[2];\n-\n+ uint8_t* current;\n+ uint8_t optionsLen;\n// take ownership over the packet\nmsg->owner = COMPONENT_NEIGHBORS;\n@@ -486,11 +499,24 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\n// save pointer to incoming DIO header in global structure for simplfying debug.\nicmpv6rpl_vars.incomingDio = (icmpv6rpl_dio_ht*)(msg->payload);\n- icmpv6rpl_vars.incomingPio = (icmpv6rpl_pio_t*) (msg->payload + sizeof(icmpv6rpl_dio_ht));\n-\n+ current = msg->payload + sizeof(icmpv6rpl_dio_ht);\n+ optionsLen = msg->length - sizeof(icmpv6rpl_dio_ht);\n+\n+ while (optionsLen>0){\n+ switch (current[0]){\n+ case RPL_OPTION_CONFIG:\n+ // configuration option\n+ icmpv6rpl_vars.incomingConf = (icmpv6rpl_config_ht*)(current);\n+ memcpy(&icmpv6rpl_vars.conf,icmpv6rpl_vars.incomingConf, sizeof(icmpv6rpl_config_ht));\n+ // do whatever needs to be done with the configuration option of RPL\n+ optionsLen = optionsLen - current[1] - 2;\n+ current = current + current[1] + 2;\n+ break;\n+ case RPL_OPTION_PIO:\n+ // pio\n+ icmpv6rpl_vars.incomingPio = (icmpv6rpl_pio_t*)(current);\n// update PIO with the received one.\nmemcpy(&icmpv6rpl_vars.pio,icmpv6rpl_vars.incomingPio, sizeof(icmpv6rpl_pio_t));\n-\n// update my prefix from PIO\n// looks like we adopt the prefix from any PIO without a question about this node being our parent??\nmyPrefix.type = ADDR_PREFIX;\n@@ -500,6 +526,16 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\nsizeof(myPrefix.prefix)\n);\nidmanager_setMyID(&myPrefix);\n+ optionsLen = optionsLen - current[1] - 2;\n+ current = current + current[1] + 2;\n+ break;\n+ default:\n+ //option not supported, just jump the len;\n+ optionsLen = optionsLen - current[1] - 2;\n+ current = current + current[1] + 2;\n+ break;\n+ }\n+ }\n// quick fix: rank is two bytes in network order: need to swap bytes\ntemp_8b = *(msg->payload+2);\n@@ -635,6 +671,16 @@ void sendDIO() {\n// set DIO destination\nmemcpy(&(msg->l3_destinationAdd),&icmpv6rpl_vars.dioDestination,sizeof(open_addr_t));\n+ //===== Configuration option\n+ packetfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_config_ht));\n+\n+ //copy the PIO in the packet\n+ memcpy(\n+ ((icmpv6rpl_pio_t*)(msg->payload)),\n+ &(icmpv6rpl_vars.conf),\n+ sizeof(icmpv6rpl_config_ht)\n+ );\n+\n//===== PIO payload\npacketfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_pio_t));\n@@ -646,11 +692,12 @@ void sendDIO() {\nidmanager_getMyID(ADDR_PREFIX)->prefix,\nsizeof(idmanager_getMyID(ADDR_PREFIX)->prefix)\n);\n- memcpy(\n+ // host address is not needed. Only prefix.\n+ /* memcpy(\n&(icmpv6rpl_vars.pio.prefix[8]),\nidmanager_getMyID(ADDR_64B)->addr_64b,\nsizeof(idmanager_getMyID(ADDR_64B)->addr_64b)\n- );\n+ );*/\n//copy the PIO in the packet\nmemcpy(\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.h",
"new_path": "openstack/03b-IPv6/icmpv6rpl.h",
"diff": "#define Prf_A_dio_options 0<<4\n#define Prf_B_dio_options 0<<3\n+#define DEFAULT_PATH_CONTROL_SIZE 0\n+\n+#define RPL_OPTION_PIO 0x8\n+#define RPL_OPTION_CONFIG 0x4\n+\n// max number of parents and children to send in DAO\n//section 8.2.1 pag 67 RFC6550 -- using a subset\n#define MAX_TARGET_PARENTS 0x01\n@@ -93,6 +98,37 @@ typedef struct {\n} icmpv6rpl_dio_ht;\nEND_PACK\n+\n+BEGIN_PACK\n+typedef struct {\n+ uint8_t type; // 0x08\n+ uint8_t optLen; // 30d\n+ uint8_t prefLen;//64\n+ uint8_t flags; //96 L=0,A=1,R=1,00000\n+ uint32_t vlifetime; //0xFFFFFFFF infinity\n+ uint32_t plifetime; //0xFFFFFFFF infinity\n+ uint32_t reserved;\n+ uint8_t prefix[16]; // myaddress\n+}icmpv6rpl_pio_t;\n+END_PACK\n+\n+BEGIN_PACK\n+typedef struct {\n+ uint8_t type; // 0x04\n+ uint8_t optLen; // 14d\n+ uint8_t flagsAPCS;\n+ uint8_t DIOIntDoubl; //8 -> trickle period - max times it will double ~20min\n+ uint8_t DIOIntMin; // 12 -> min trickle period -> 16s\n+ uint8_t DIORedun; // 0\n+ uint16_t maxRankIncrease; // 2048\n+ uint16_t minHopRankIncrease; //256\n+ uint16_t OCP; // 0 OF0\n+ uint8_t reserved;\n+ uint8_t defLifetime; // limit for DAO period -> 0xff\n+ uint16_t lifetimeUnit; // 0xffff\n+}icmpv6rpl_config_ht;\n+END_PACK\n+\n//===== DAO\n/**\n@@ -135,18 +171,8 @@ typedef struct {\nEND_PACK\n//=========================== module variables ================================\n-BEGIN_PACK\n-typedef struct {\n- uint8_t type; // 0x08\n- uint8_t optLen; // 30d\n- uint8_t prefLen;//64\n- uint8_t flags; //96 L=0,A=1,R=1,00000\n- uint32_t vlifetime; //0xFFFFFFFF infinity\n- uint32_t plifetime; //0xFFFFFFFF infinity\n- uint32_t reserved;\n- uint8_t prefix[16]; // myaddress\n-}icmpv6rpl_pio_t;\n-END_PACK\n+\n+\ntypedef struct {\n// admin\n@@ -156,6 +182,7 @@ typedef struct {\n// DIO-related\nicmpv6rpl_dio_ht dio; ///< pre-populated DIO packet.\nicmpv6rpl_pio_t pio; ///< pre-populated PIO com\n+ icmpv6rpl_config_ht conf;\nopen_addr_t dioDestination; ///< IPv6 destination address for DIOs.\nuint16_t dioTimerCounter; ///< counter to determine when to send DIO.\nopentimers_id_t timerIdDIO; ///< ID of the timer used to send DIOs.\n@@ -175,6 +202,7 @@ typedef struct {\n// actually only here for debug\nicmpv6rpl_dio_ht* incomingDio; //keep it global to be able to debug correctly.\nicmpv6rpl_pio_t* incomingPio; //pio structure incoming\n+ icmpv6rpl_config_ht* incomingConf; //configuration incoming\nbool daoSent;\n} icmpv6rpl_vars_t;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-679 adding configuration option
|
491,597
|
17.07.2017 14:53:46
| -28,800
|
1060f9b7155cb7871ded0d48e5578b32c07bf393
|
Easy channel hopping template modify
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -772,7 +772,7 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) {\ninfer the asnOffset based on the fact that\nieee154e_vars.freq = 11 + (asnOffset + channelOffset)%16\n*/\n- for (i=0;i<16;i++){\n+ for (i=0;i<TOTAL_CHANNEL_USED;i++){\nif ((ieee154e_vars.freq - 11)==ieee154e_vars.chTemplate[i]){\nbreak;\n}\n@@ -2456,7 +2456,7 @@ port_INLINE void ieee154e_syncSlotOffset() {\ninfer the asnOffset based on the fact that\nieee154e_vars.freq = 11 + (asnOffset + channelOffset)%16\n*/\n- for (i=0;i<16;i++){\n+ for (i=0;i<TOTAL_CHANNEL_USED;i++){\nif ((ieee154e_vars.freq - 11)==ieee154e_vars.chTemplate[i]){\nbreak;\n}\n@@ -2706,7 +2706,7 @@ port_INLINE uint8_t calculateFrequency(uint8_t channelOffset) {\nreturn ieee154e_vars.singleChannel; // single channel\n} else {\n// channel hopping enabled, use the channel depending on hopping template\n- return 11 + ieee154e_vars.chTemplate[(ieee154e_vars.asnOffset+channelOffset)%16];\n+ return 11 + ieee154e_vars.chTemplate[(ieee154e_vars.asnOffset+channelOffset)%TOTAL_CHANNEL_USED];\n}\n//return 11+(ieee154e_vars.asnOffset+channelOffset)%16; //channel hopping\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.h",
"new_path": "openstack/02a-MAClow/IEEE802154E.h",
"diff": "@@ -37,7 +37,8 @@ static const uint8_t ebIEsBytestream[] = {\n#define EB_IE_LEN 28\n-#define SYNCHRONIZING_CHANNEL 26 // channel the mote listens on to synchronize\n+#define TOTAL_CHANNEL_USED 16 // How much channel used in chTemplate_default\n+#define SYNCHRONIZING_CHANNEL 26 // channel the mote listens on to synchronize (physical channel)\n#define TXRETRIES 3 // number of MAC retries before declaring failed\n#define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value)\n#define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to successfully synchronize\n@@ -247,7 +248,7 @@ typedef struct {\nuint8_t asnOffset; // offset inside the frame\nuint8_t singleChannel; // the single channel used for transmission\nbool singleChannelChanged; // detect id singleChannelChanged\n- uint8_t chTemplate[16]; // storing the template of hopping sequence\n+ uint8_t chTemplate[TOTAL_CHANNEL_USED]; // storing the template of hopping sequence\n// template ID\nuint8_t tsTemplateId; // timeslot template id\nuint8_t chTemplateId; // channel hopping tempalte id\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-666 Easy channel hopping template modify
|
491,595
|
17.07.2017 15:58:10
| -7,200
|
9dae5fd7789418a0af48d5d499845fc0ee697383
|
Using link local address when destination is broadcast or multicast. Flip the pin when ipv6 address coming from eui64.
|
[
{
"change_type": "DELETE",
"old_path": "openstack/02b-MAChigh/processIE.h",
"new_path": null,
"diff": "-#ifndef __PROCESSIE_H\n-#define __PROCESSIE_H\n-\n-#include \"opendefs.h\"\n-\n-//=========================== define ==========================================\n-\n-// maximum of cells in a Schedule IE\n-#define SCHEDULEIEMAXNUMCELLS 3\n-\n-// subIE shift\n-#define MLME_IE_SUBID_SHIFT 8\n-\n-// subIEs identifier\n-#define MLME_IE_SUBID_SYNC 0x1A\n-#define MLME_IE_SUBID_SLOTFRAME_LINK 0x1B\n-#define MLME_IE_SUBID_TIMESLOT 0x1c\n-#define MLME_IE_SUBID_CHANNELHOPPING 0x09\n-#define MLME_IE_SUBID_LINKTYPE 0x40\n-#define MLME_IE_SUBID_OPCODE 0x41\n-#define MLME_IE_SUBID_BANDWIDTH 0x42\n-#define MLME_IE_SUBID_TRACKID 0x43\n-#define MLME_IE_SUBID_SCHEDULE 0x44\n-\n-// 0xc9 = 201 is the first available subIE ID for experimental use:\n-// https://tools.ietf.org/html/draft-kivinen-802-15-ie-06#section-7\n-#define IANA_6TOP_SUBIE_ID 0xC9\n-#define SIXTOP_IE_GROUPID 0x05\n-\n-// ========================== typedef =========================================\n-\n-BEGIN_PACK\n-\n-typedef struct {\n- uint16_t tsNum;\n- uint16_t choffset;\n- uint8_t linkoptions;\n-} cellInfo_ht;\n-\n-\n-/**\n-\\brief Header of header IEs.\n-*/\n-typedef struct{\n- uint16_t length_elementid_type;\n-} header_IE_ht;\n-\n-/**\n-\\brief Header of payload IEs.\n-*/\n-typedef struct{\n- uint16_t length_groupid_type;\n-} payload_IE_ht;\n-\n-//======= header IEs\n-\n-/**\n-\\brief TSCH ACK/NACK TimeCorrection IE\n-\n-IEEE802.15.4e-2012, Section 5.2.4.11, p. 88.\n-*/\n-typedef struct {\n- int16_t timesync_info;\n-} timecorrection_IE_ht;\n-\n-//======= payload IEs\n-\n-/**\n-\\brief MLME IE common header\n-\n-IEEE802.15.4e-2012, Section 5.2.4.5, p. 82.\n-*/\n-typedef struct{\n- uint16_t length_subID_type;\n-} mlme_IE_ht;\n-\n-/**\n-\\brief TSCH Synchronization IE\n-\n-http://tools.ietf.org/html/draft-wang-6tisch-6top-sublayer-01#section-4.1.1.1\n-*/\n-typedef struct {\n- uint8_t asn[5];\n- uint8_t join_priority;\n-} sync_IE_ht;\n-\n-/**\n-\\brief TSCH Slotframe and Link IE\n-\n-http://tools.ietf.org/html/draft-wang-6tisch-6top-sublayer-01#section-4.1.1.2\n-*/\n-typedef struct {\n- uint8_t slotframehandle;\n- uint16_t slotframesize;\n- uint8_t numlinks;\n-} slotframeLink_IE_ht;\n-\n-/**\n-\\brief 6top Opcode IE\n-\n-http://tools.ietf.org/html/draft-wang-6tisch-6top-sublayer-01#section-4.1.1.5\n-*/\n-typedef struct {\n- uint8_t opcode;\n-} opcode_IE_ht;\n-\n-/**\n-\\brief 6top Bandwidth IE\n-\n-http://tools.ietf.org/html/draft-wang-6tisch-6top-sublayer-01#section-4.1.1.6\n-*/\n-typedef struct{\n- uint8_t slotframeID;\n- uint8_t numOfLinks;\n-} bandwidth_IE_ht;\n-\n-/**\n-\\brief 6top Generic Schedule IE\n-\n-http://tools.ietf.org/html/draft-wang-6tisch-6top-sublayer-01#section-4.1.1.8\n-*/\n-typedef struct{\n- uint8_t type;\n- uint8_t length;\n- uint8_t frameID;\n- uint8_t numberOfcells;\n- bool flag;\n- cellInfo_ht cellList[SCHEDULEIEMAXNUMCELLS];\n-} schedule_IE_ht;\n-\n-END_PACK\n-\n-//=========================== variables =======================================\n-\n-//=========================== prototypes ======================================\n-\n-void processIE_prependMLMEIE(\n- OpenQueueEntry_t* pkt,\n- uint8_t len\n-);\n-void processIE_prepend_sixtopIE(\n- OpenQueueEntry_t* pkt,\n- uint8_t len\n-);\n-//===== prepend IEs\n-\n-uint8_t processIE_prependSyncIE(\n- OpenQueueEntry_t* pkt\n-);\n-uint8_t processIE_prependSlotframeLinkIE(\n- OpenQueueEntry_t* pkt\n-);\n-uint8_t processIE_prependTSCHTimeslotIE(\n- OpenQueueEntry_t* pkt\n-);\n-uint8_t processIE_prependChannelHoppingIE(\n- OpenQueueEntry_t* pkt\n-);\n-uint8_t processIE_prepend_sixSubIEHeader(\n- OpenQueueEntry_t* pkt,\n- uint8_t len\n-);\n-uint8_t processIE_prepend_sixGeneralMessage(\n- OpenQueueEntry_t* pkt,\n- uint8_t code\n-);\n-uint8_t processIE_prepend_sixSubID(\n- OpenQueueEntry_t* pkt\n-);\n-uint8_t processIE_prepend_sixCelllist(\n- OpenQueueEntry_t* pkt,\n- cellInfo_ht* cellList\n-);\n-\n-//===== retrieve IEs\n-\n-void processIE_retrieveSlotframeLinkIE(\n- OpenQueueEntry_t* pkt,\n- uint8_t * ptr\n-);\n-void processIE_retrieve_sixCelllist(\n- OpenQueueEntry_t* pkt,\n- uint8_t ptr,\n- uint8_t length,\n- cellInfo_ht* cellList\n-);\n-\n-#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.c",
"new_path": "openstack/cross-layers/packetfunctions.c",
"diff": "@@ -43,6 +43,7 @@ void packetfunctions_mac64bToIp128b(\nip128bToWrite->type=ADDR_128B;\nmemcpy(&(ip128bToWrite->addr_128b[0]), &(prefix64b->prefix[0]), 8);\nmemcpy(&(ip128bToWrite->addr_128b[8]), &(mac64b->addr_64b[0]), 8);\n+ ip128bToWrite->addr_128b[8] ^= 0x02;\n}\n//assuming an mac16b is lower 2B of mac64b\n@@ -398,6 +399,12 @@ bool packetfunctions_checkCRC(OpenQueueEntry_t* msg) {\nvoid packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_ptr) {\nuint8_t temp_checksum[2];\nuint8_t little_helper[2];\n+ open_addr_t linklocalPrefix;\n+ open_addr_t sourceAddr;\n+ linklocalPrefix.type = ADDR_PREFIX;\n+ uint8_t linklocal_addr[8] = {0xfe,0x80,0x0,0x0,0x0,0x0,0x0,0x0};\n+\n+ memcpy(linklocalPrefix.addr_64b,linklocal_addr,8);\n// initialize running checksum\ntemp_checksum[0] = 0;\n@@ -405,9 +412,15 @@ void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_\n//===== IPv6 pseudo header\n+ packetfunctions_mac64bToIp128b(&linklocalPrefix, idmanager_getMyID(ADDR_64B), &sourceAddr);\n+\n// source address (prefix and EUI64)\n+ if (packetfunctions_isBroadcastMulticast(&(msg->l3_destinationAdd))){\n+ onesComplementSum(temp_checksum, sourceAddr.addr_128b,16);\n+ } else {\nonesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_PREFIX))->prefix,8);\nonesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_64B))->addr_64b,8);\n+ }\n// destination address\nonesComplementSum(temp_checksum,msg->l3_destinationAdd.addr_128b,16);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-680. Using link local address when destination is broadcast or multicast. Flip the pin when ipv6 address coming from eui64.
|
491,595
|
18.07.2017 16:22:31
| -7,200
|
c58a14320cbf4cd6a5a05000512bb6547b16bd04
|
fix bsp_radio project.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_radio/01bsp_radio.c",
"new_path": "projects/common/01bsp_radio/01bsp_radio.c",
"diff": "@@ -43,8 +43,6 @@ typedef enum {\n} app_state_t;\ntypedef struct {\n- uint8_t num_radioTimerOverflows;\n- uint8_t num_radioTimerCompare;\nuint8_t num_startFrame;\nuint8_t num_endFrame;\nuint8_t num_timer;\n@@ -66,8 +64,6 @@ app_vars_t app_vars;\n//=========================== prototypes ======================================\n-void cb_radioTimerOverflows(void);\n-void cb_radioTimerCompare(void);\nvoid cb_startFrame(PORT_TIMER_WIDTH timestamp);\nvoid cb_endFrame(PORT_TIMER_WIDTH timestamp);\nvoid cb_timer(void);\n@@ -87,7 +83,6 @@ int mote_main(void) {\nboard_init();\n// add callback functions radio\n- sctimer_set_callback(cb_radioTimerOverflows);\nradio_setStartFrameCb(cb_startFrame);\nradio_setEndFrameCb(cb_endFrame);\n@@ -99,7 +94,7 @@ int mote_main(void) {\n// start bsp timer\nsctimer_set_callback(cb_timer);\n- sctimer_setCompare(TIMER_PERIOD);\n+ sctimer_setCompare(sctimer_readCounter()+TIMER_PERIOD);\nsctimer_enable();\n// prepare radio\n@@ -222,16 +217,6 @@ int mote_main(void) {\n//=========================== callbacks =======================================\n-void cb_radioTimerOverflows(void) {\n- // update debug stats\n- app_dbg.num_radioTimerOverflows++;\n-}\n-\n-void cb_radioTimerCompare(void) {\n- // update debug stats\n- app_dbg.num_radioTimerCompare++;\n-}\n-\nvoid cb_startFrame(PORT_TIMER_WIDTH timestamp) {\n// set flag\napp_vars.flags |= APP_FLAG_START_FRAME;\n@@ -254,4 +239,6 @@ void cb_timer(void) {\n// update debug stats\napp_dbg.num_timer++;\n+\n+ sctimer_setCompare(sctimer_readCounter()+TIMER_PERIOD);\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-682. fix bsp_radio project.
|
491,595
|
19.07.2017 11:34:36
| -7,200
|
47f7a0b8b4e154e2bf6ffd0c8379588d211d8408
|
revert checksum commits. fix the ping command.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.c",
"new_path": "openstack/cross-layers/packetfunctions.c",
"diff": "@@ -43,7 +43,6 @@ void packetfunctions_mac64bToIp128b(\nip128bToWrite->type=ADDR_128B;\nmemcpy(&(ip128bToWrite->addr_128b[0]), &(prefix64b->prefix[0]), 8);\nmemcpy(&(ip128bToWrite->addr_128b[8]), &(mac64b->addr_64b[0]), 8);\n- ip128bToWrite->addr_128b[8] ^= 0x02;\n}\n//assuming an mac16b is lower 2B of mac64b\n@@ -399,12 +398,6 @@ bool packetfunctions_checkCRC(OpenQueueEntry_t* msg) {\nvoid packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_ptr) {\nuint8_t temp_checksum[2];\nuint8_t little_helper[2];\n- open_addr_t linklocalPrefix;\n- open_addr_t sourceAddr;\n- linklocalPrefix.type = ADDR_PREFIX;\n- uint8_t linklocal_addr[8] = {0xfe,0x80,0x0,0x0,0x0,0x0,0x0,0x0};\n-\n- memcpy(linklocalPrefix.addr_64b,linklocal_addr,8);\n// initialize running checksum\ntemp_checksum[0] = 0;\n@@ -412,15 +405,9 @@ void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_\n//===== IPv6 pseudo header\n- packetfunctions_mac64bToIp128b(&linklocalPrefix, idmanager_getMyID(ADDR_64B), &sourceAddr);\n-\n// source address (prefix and EUI64)\n- if (packetfunctions_isBroadcastMulticast(&(msg->l3_destinationAdd))){\n- onesComplementSum(temp_checksum, sourceAddr.addr_128b,16);\n- } else {\nonesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_PREFIX))->prefix,8);\nonesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_64B))->addr_64b,8);\n- }\n// destination address\nonesComplementSum(temp_checksum,msg->l3_destinationAdd.addr_128b,16);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-685. revert checksum commits. fix the ping command.
|
491,595
|
19.07.2017 19:45:16
| -7,200
|
41aa706d324311c88fc16ed10b2d6d9a7a45234a
|
add .gitattributes file.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": ".gitattributes",
"diff": "+# Set the default behavior, in case people don't have core.autocrlf set.\n+* text=auto\n+\n+# Explicitly declare text files you want to always be normalized and converted\n+# to native line endings on checkout.\n+*.c text\n+*.h text\n+*.md text\n+*.dox text\n+\n+\n+# Declare files that will always have CRLF line endings on checkout.\n+*.sln text eol=crlf\n\\ No newline at end of file\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-684. add .gitattributes file.
|
491,597
|
20.07.2017 15:37:14
| -28,800
|
3a53287079ad7ddd9a03b54d061cd361fa14cac0
|
fix naming and indentation based on reviewer
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -772,7 +772,7 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) {\ninfer the asnOffset based on the fact that\nieee154e_vars.freq = 11 + (asnOffset + channelOffset)%16\n*/\n- for (i=0;i<TOTAL_CHANNEL_USED;i++){\n+ for (i=0;i<NUM_CHANNELS;i++){\nif ((ieee154e_vars.freq - 11)==ieee154e_vars.chTemplate[i]){\nbreak;\n}\n@@ -2456,7 +2456,7 @@ port_INLINE void ieee154e_syncSlotOffset() {\ninfer the asnOffset based on the fact that\nieee154e_vars.freq = 11 + (asnOffset + channelOffset)%16\n*/\n- for (i=0;i<TOTAL_CHANNEL_USED;i++){\n+ for (i=0;i<NUM_CHANNELS;i++){\nif ((ieee154e_vars.freq - 11)==ieee154e_vars.chTemplate[i]){\nbreak;\n}\n@@ -2706,7 +2706,7 @@ port_INLINE uint8_t calculateFrequency(uint8_t channelOffset) {\nreturn ieee154e_vars.singleChannel; // single channel\n} else {\n// channel hopping enabled, use the channel depending on hopping template\n- return 11 + ieee154e_vars.chTemplate[(ieee154e_vars.asnOffset+channelOffset)%TOTAL_CHANNEL_USED];\n+ return 11 + ieee154e_vars.chTemplate[(ieee154e_vars.asnOffset+channelOffset)%NUM_CHANNELS];\n}\n//return 11+(ieee154e_vars.asnOffset+channelOffset)%16; //channel hopping\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.h",
"new_path": "openstack/02a-MAClow/IEEE802154E.h",
"diff": "@@ -37,7 +37,7 @@ static const uint8_t ebIEsBytestream[] = {\n#define EB_IE_LEN 28\n-#define TOTAL_CHANNEL_USED 16 // How much channel used in chTemplate_default\n+#define NUM_CHANNELS 16 // number of channels to channel hop on\n#define SYNCHRONIZING_CHANNEL 26 // channel the mote listens on to synchronize (physical channel)\n#define TXRETRIES 3 // number of MAC retries before declaring failed\n#define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value)\n@@ -248,7 +248,7 @@ typedef struct {\nuint8_t asnOffset; // offset inside the frame\nuint8_t singleChannel; // the single channel used for transmission\nbool singleChannelChanged; // detect id singleChannelChanged\n- uint8_t chTemplate[TOTAL_CHANNEL_USED]; // storing the template of hopping sequence\n+ uint8_t chTemplate[NUM_CHANNELS];// storing the template of hopping sequence\n// template ID\nuint8_t tsTemplateId; // timeslot template id\nuint8_t chTemplateId; // channel hopping tempalte id\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-666 fix naming and indentation based on reviewer
|
491,595
|
02.08.2017 10:25:47
| -7,200
|
3d6f6af3d52eb1e6dfe705f808cc4e4fb66e1bd7
|
update CMD_SET_DAGROOT serial raw bytes.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/uinject/uinject_dagroot.py",
"new_path": "openapps/uinject/uinject_dagroot.py",
"diff": "@@ -118,7 +118,7 @@ class OpenHdlc(object):\nclass moteProbe(threading.Thread):\n- CMD_SET_DAGROOT = '7e5259bbbb0000000000000c347e'\n+ CMD_SET_DAGROOT = '7e5259bbbb00000000000001deadbeefcafedeadbeefcafedeadbeefa7d97e' # prefix: bbbb000000000000 keyindex : 01 keyvalue: deadbeefcafedeadbeefcafedeadbeef\nCMD_SEND_DATA = '7e44141592000012e63b78001180bbbb0000000000000000000000000001bbbb000000000000141592000012e63b07d007d0000ea30d706f69706f697a837e'\nSLOT_DURATION = 0.015\nUINJECT_MASK = 'uinject'\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-689. update CMD_SET_DAGROOT serial raw bytes.
|
491,595
|
02.08.2017 10:32:24
| -7,200
|
07036099c5af4b965e9f6c1499babb9febffdbb4
|
remove .gitattributes temporally, added it back when cleaning PRs.
|
[
{
"change_type": "DELETE",
"old_path": ".gitattributes",
"new_path": null,
"diff": "-# Set the default behavior, in case people don't have core.autocrlf set.\n-* text=auto\n-\n-# Explicitly declare text files you want to always be normalized and converted\n-# to native line endings on checkout.\n-*.c text\n-*.h text\n-*.md text\n-*.dox text\n-\n-\n-# Declare files that will always have CRLF line endings on checkout.\n-*.sln text eol=crlf\n\\ No newline at end of file\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-684. remove .gitattributes temporally, added it back when cleaning PRs.
|
491,595
|
03.08.2017 00:06:04
| -7,200
|
2c9a443e906bd6854d9cc8ba790f54aba6cf2940
|
Fix the checksum calculation.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/idmanager.h",
"new_path": "openstack/cross-layers/idmanager.h",
"diff": "#define ACTION_NO 'N'\n#define ACTION_TOGGLE 'T'\n+static const uint8_t linklocalprefix[] = {\n+ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n+};\n+\n//=========================== typedef =========================================\nBEGIN_PACK\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.c",
"new_path": "openstack/cross-layers/packetfunctions.c",
"diff": "@@ -398,6 +398,9 @@ bool packetfunctions_checkCRC(OpenQueueEntry_t* msg) {\nvoid packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_ptr) {\nuint8_t temp_checksum[2];\nuint8_t little_helper[2];\n+ open_addr_t prefix64btoWrite;\n+ open_addr_t mac64btoWrite;\n+ open_addr_t localscopeAddress;\n// initialize running checksum\ntemp_checksum[0] = 0;\n@@ -405,12 +408,39 @@ void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_\n//===== IPv6 pseudo header\n- // source address (prefix and EUI64)\n- onesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_PREFIX))->prefix,8);\n+ // determine the source and destination address format\n+ if (packetfunctions_isBroadcastMulticast(&msg->l3_destinationAdd)==TRUE){\n+ // use link local address for source address (prefix and EUI64)\n+\n+ // source address\n+ onesComplementSum(temp_checksum,(uint8_t*)linklocalprefix,8);\n+ memcpy(&localscopeAddress,idmanager_getMyID(ADDR_64B),sizeof(open_addr_t));\n+ // invert 'u' bit (section 2.5.1 at https://www.ietf.org/rfc/rfc2373.txt)\n+ localscopeAddress.addr_64b[0] ^= 0x02;\n+ onesComplementSum(temp_checksum,localscopeAddress.addr_64b,8);\n+\n+ // destination address\n+ onesComplementSum(temp_checksum,msg->l3_destinationAdd.addr_128b,16);\n+ } else {\n+ packetfunctions_ip128bToMac64b(\n+ &msg->l3_destinationAdd,\n+ &prefix64btoWrite,\n+ &mac64btoWrite\n+ );\n+ if (packetfunctions_sameAddress(&prefix64btoWrite,(idmanager_getMyID(ADDR_PREFIX)))==TRUE){\n+ // use 64-bit ipv6 address for source address and destination address\nonesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_64B))->addr_64b,8);\n+ onesComplementSum(temp_checksum,mac64btoWrite.addr_64b,8);\n+ } else {\n+ // use 128-bit ipv6 address for source address and destination address\n+ // source address\n+ onesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_PREFIX))->prefix,8);\n+ onesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_64B))->addr_64b,8);\n// destination address\nonesComplementSum(temp_checksum,msg->l3_destinationAdd.addr_128b,16);\n+ }\n+ }\n// length\nlittle_helper[0] = 0;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-680. Fix the checksum calculation.
|
491,595
|
03.08.2017 13:07:21
| -7,200
|
b220ee2d423cdd90c21f7d74ba91b9884323298d
|
use global address calculating checksum when destination is not multi-cast address.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.c",
"new_path": "openstack/cross-layers/packetfunctions.c",
"diff": "@@ -398,8 +398,6 @@ bool packetfunctions_checkCRC(OpenQueueEntry_t* msg) {\nvoid packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_ptr) {\nuint8_t temp_checksum[2];\nuint8_t little_helper[2];\n- open_addr_t prefix64btoWrite;\n- open_addr_t mac64btoWrite;\nopen_addr_t localscopeAddress;\n// initialize running checksum\n@@ -419,18 +417,8 @@ void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_\nlocalscopeAddress.addr_64b[0] ^= 0x02;\nonesComplementSum(temp_checksum,localscopeAddress.addr_64b,8);\n- // destination address\n+ // boardcast destination address\nonesComplementSum(temp_checksum,msg->l3_destinationAdd.addr_128b,16);\n- } else {\n- packetfunctions_ip128bToMac64b(\n- &msg->l3_destinationAdd,\n- &prefix64btoWrite,\n- &mac64btoWrite\n- );\n- if (packetfunctions_sameAddress(&prefix64btoWrite,(idmanager_getMyID(ADDR_PREFIX)))==TRUE){\n- // use 64-bit ipv6 address for source address and destination address\n- onesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_64B))->addr_64b,8);\n- onesComplementSum(temp_checksum,mac64btoWrite.addr_64b,8);\n} else {\n// use 128-bit ipv6 address for source address and destination address\n@@ -440,7 +428,6 @@ void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_\n// destination address\nonesComplementSum(temp_checksum,msg->l3_destinationAdd.addr_128b,16);\n}\n- }\n// length\nlittle_helper[0] = 0;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-680. use global address calculating checksum when destination is not multi-cast address.
|
491,595
|
10.08.2017 16:08:39
| -7,200
|
0f78d43546be2df2673ffaea6cc5612fa28d096f
|
fix bsp_uart, drv_openserial and oos_mercator projects error.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_uart/01bsp_uart.c",
"new_path": "projects/common/01bsp_uart/01bsp_uart.c",
"diff": "@@ -20,12 +20,12 @@ TeraTerm):\n// bsp modules required\n#include \"board.h\"\n#include \"uart.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n#include \"leds.h\"\n//=========================== defines =========================================\n-#define BSP_TIMER_PERIOD 0xffff // 0xffff@32kHz = 2s\n+#define SCTIMER_PERIOD 0xffff // 0xffff@32kHz = 2s\nuint8_t stringToSend[] = \"Hello, World!\\r\\n\";\n//=========================== variables =======================================\n@@ -63,9 +63,9 @@ int mote_main(void) {\nuart_setCallbacks(cb_uartTxDone,cb_uartRxCb);\nuart_enableInterrupts();\n- // setup BSP timer\n- bsp_timer_set_callback(cb_compare);\n- bsp_timer_scheduleIn(BSP_TIMER_PERIOD);\n+ // setup sctimer\n+ sctimer_set_callback(cb_compare);\n+ sctimer_setCompare(sctimer_readCounter()+SCTIMER_PERIOD);\nwhile(1) {\n@@ -89,7 +89,7 @@ void cb_compare(void) {\napp_vars.uartSendNow = 1;\n// schedule again\n- bsp_timer_scheduleIn(BSP_TIMER_PERIOD);\n+ sctimer_setCompare(sctimer_readCounter()+SCTIMER_PERIOD);\n}\nvoid cb_uartTxDone(void) {\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/common/02drv_openserial/02drv_openserial.c",
"new_path": "projects/common/02drv_openserial/02drv_openserial.c",
"diff": "@@ -20,14 +20,14 @@ sure all is well.\n#include \"debugpins.h\"\n#include \"leds.h\"\n#include \"uart.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n// driver modules required\n#include \"openserial.h\"\n//=========================== defines =========================================\n-#define BSP_TIMER_PERIOD 328 // 328@32kHz ~ 10ms\n+#define SCTIMER_PERIOD 328 // 328@32kHz ~ 10ms\n//=========================== variables =======================================\n@@ -55,8 +55,8 @@ int mote_main(void) {\nboard_init();\nopenserial_init();\n- bsp_timer_set_callback(cb_compare);\n- bsp_timer_scheduleIn(BSP_TIMER_PERIOD);\n+ sctimer_set_callback(cb_compare);\n+ sctimer_setCompare(sctimer_readCounter()+SCTIMER_PERIOD);\nwhile(1) {\nboard_sleep();\n@@ -78,7 +78,7 @@ int mote_main(void) {\nvoid cb_compare(void) {\napp_vars.timerFired = 1;\n- bsp_timer_scheduleIn(BSP_TIMER_PERIOD);\n+ sctimer_setCompare(sctimer_readCounter()+SCTIMER_PERIOD);\n}\n//=========================== stub functions ==================================\n@@ -95,6 +95,7 @@ void ieee154e_getAsn(uint8_t* array) {\narray[4] = 0x04;\n}\n+void idmanager_setJoinKey(void) {}\nvoid idmanager_triggerAboutRoot(void) {}\nvoid openbridge_triggerData(void) {}\nvoid tcpinject_trigger(void) {}\n@@ -118,6 +119,7 @@ void ieee154e_setIsAckEnabled(void){}\nvoid ieee154e_setSingleChannel(void){}\nvoid sniffer_setListeningChannel(void){}\nvoid sf0_appPktPeriod(void){}\n+uint8_t sf0_getsfid(void) {return 0;}\nbool debugPrint_isSync(void) {\nreturn FALSE;\n@@ -149,3 +151,6 @@ bool debugPrint_queue(void) {\nbool debugPrint_neighbors(void) {\nreturn FALSE;\n}\n+bool debugPrint_joined(void) {\n+ return FALSE;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -18,10 +18,9 @@ int mote_main(void) {\nboard_init();\nscheduler_init();\nopentimers_init();\n+ mercator_vars.sendTimerId = opentimers_create();\nleds_all_off();\n- radiotimer_start(0xffff);\n- radiotimer_cancel();\n// get mac\neui64_get(mercator_vars.mac);\n@@ -134,7 +133,7 @@ void serial_rx_REQ_IDLE(void) {\nreturn;\n}\nif (mercator_vars.status == ST_TX){\n- opentimers_stop(mercator_vars.sendTimerId);\n+ opentimers_cancel(mercator_vars.sendTimerId);\n} else if (mercator_vars.status == ST_RX){\nleds_radio_off();\n}\n@@ -183,7 +182,8 @@ void serial_rx_REQ_TX(void) {\n// TODO set TX Power\n// init opentimers to send packets periodically\n- mercator_vars.sendTimerId = opentimers_start(\n+ opentimers_scheduleIn(\n+ mercator_vars.sendTimerId,\nhtons(req->txifdur),\nTIMER_PERIODIC,\nTIME_MS,\n@@ -462,7 +462,7 @@ void cb_endFrame(uint16_t timestamp) {\n}\n}\n-void cb_sendPacket(opentimer_id_t id){\n+void cb_sendPacket(opentimers_id_t id){\nIND_TXDONE_ht* resp;\nuint16_t pkctr;\nuint8_t pkctr_offset = 10; // srcmac[8] + transctr[2]\n@@ -477,7 +477,7 @@ void cb_sendPacket(opentimer_id_t id){\nleds_error_off();\nif (mercator_vars.txpk_numpk == mercator_vars.txpk_totalnumpk) {\n- opentimers_stop(mercator_vars.sendTimerId);\n+ opentimers_cancel(mercator_vars.sendTimerId);\n// finishing TX\nradio_rfOff();\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.h",
"new_path": "projects/common/03oos_mercator/03oos_mercator.h",
"diff": "@@ -112,7 +112,7 @@ END_PACK\n//=========================== variables =======================================\ntypedef struct {\n- opentimer_id_t sendTimerId; ///< Each time expires, a packet is sent.\n+ opentimers_id_t sendTimerId; ///< Each time expires, a packet is sent.\n//=== state machine\nuint8_t status;\n@@ -186,5 +186,5 @@ uint16_t htons(uint16_t val);\n// initial radio\nvoid cb_startFrame(uint16_t timestamp);\nvoid cb_endFrame(uint16_t timestamp);\n-void cb_sendPacket(opentimer_id_t id);\n+void cb_sendPacket(opentimers_id_t id);\nvoid cb_finishTx(void);\n\\ No newline at end of file\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-690. fix bsp_uart, drv_openserial and oos_mercator projects error.
|
491,595
|
14.08.2017 10:40:18
| -7,200
|
552f9950bbb935e8b3943c9034b9ba5b8d886e3a
|
return success or failure of sixtop_request and remove sixtop handle/handler.
|
[
{
"change_type": "MODIFY",
"old_path": "drivers/common/openserial.c",
"new_path": "drivers/common/openserial.c",
"diff": "@@ -720,10 +720,6 @@ void openserial_handleCommands(void){\nif (foundNeighbor==FALSE) {\nbreak;\n}\n- if (sixtop_setHandler(SIX_HANDLER_SF0)==FALSE){\n- // one sixtop transcation is happening, only one instance at one time\n- return;\n- }\n// the following sequence of bytes are, slotframe, cellOption, numCell, celllist\nopenserial_get6pInfo(commandId,&code,&cellOptions,&numCell,celllist_add,celllist_delete,&listOffset,&maxListLen,ptr,commandLen);\nsixtop_request(\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/c6t/c6t.c",
"new_path": "openapps/c6t/c6t.c",
"diff": "@@ -94,14 +94,6 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,\nbreak;\n}\n- if (sixtop_setHandler(SIX_HANDLER_SF0)==FALSE){\n- // one sixtop transcation is happening, only one instance at one time\n-\n- // set the CoAP header\n- outcome = E_FAIL;\n- coap_header->Code = COAP_CODE_RESP_CHANGED;\n- break;\n- }\nif (sf0_candidateAddCellList(celllist_add,1)==FALSE){\n// set the CoAP header\noutcome = E_FAIL;\n@@ -109,7 +101,7 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,\nbreak;\n}\n// call sixtop\n- sixtop_request(\n+ outcome = sixtop_request(\nIANA_6TOP_CMD_ADD, // code\n&neighbor, // neighbor\n1, // number cells\n@@ -124,7 +116,6 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,\n// set the CoAP header\ncoap_header->Code = COAP_CODE_RESP_CHANGED;\n- outcome = E_SUCCESS;\nbreak;\ncase COAP_CODE_REQ_DELETE:\n@@ -142,15 +133,6 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,\nbreak;\n}\n- if (sixtop_setHandler(SIX_HANDLER_SF0)==FALSE){\n- // one sixtop transcation is happening, only one instance at one time\n-\n- // set the CoAP header\n- coap_header->Code = COAP_CODE_RESP_CHANGED;\n-\n- outcome = E_FAIL;\n- break;\n- }\n// call sixtop\nif (sf0_candidateRemoveCellList(celllist_delete,&neighbor,1)==FALSE){\n// set the CoAP header\n@@ -159,7 +141,7 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,\nbreak;\n}\n// call sixtop\n- sixtop_request(\n+ outcome = sixtop_request(\nIANA_6TOP_CMD_ADD, // code\n&neighbor, // neighbor\n1, // number cells\n@@ -173,8 +155,6 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,\n// set the CoAP header\ncoap_header->Code = COAP_CODE_RESP_CHANGED;\n-\n- outcome = E_SUCCESS;\nbreak;\ndefault:\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sf0.c",
"new_path": "openstack/02b-MAChigh/sf0.c",
"diff": "@@ -90,6 +90,8 @@ void sf0_bandwidthEstimate_task(void){\nint8_t bw_self;\ncellInfo_ht celllist_add[CELLLIST_MAX_LEN];\ncellInfo_ht celllist_delete[CELLLIST_MAX_LEN];\n+ owerror_t outcome;\n+\n// do not reserve cells if I'm a DAGroot\nif (idmanager_getIsDAGroot()){\nreturn;\n@@ -125,15 +127,11 @@ void sf0_bandwidthEstimate_task(void){\n// when scheduledCells<requiredCells, add one or more cell\nif (bw_outgoing <= bw_incoming+bw_self){\n- if (sixtop_setHandler(SIX_HANDLER_SF0)==FALSE){\n- // one sixtop transcation is happening, only one instance at one time\n- return;\n- }\nif (sf0_candidateAddCellList(celllist_add,bw_incoming+bw_self-bw_outgoing+1)==FALSE){\n// failed to get cell list to add\nreturn;\n}\n- sixtop_request(\n+ outcome = sixtop_request(\nIANA_6TOP_CMD_ADD, // code\n&neighbor, // neighbor\nbw_incoming+bw_self-bw_outgoing+1, // number cells\n@@ -144,18 +142,16 @@ void sf0_bandwidthEstimate_task(void){\n0, // list command offset (not used)\n0 // list command maximum celllist (not used)\n);\n+ // post action depending outcome\n+ // to do\n} else {\n// remove cell(s)\nif ( (bw_incoming+bw_self) < (bw_outgoing-SF0THRESHOLD)) {\n- if (sixtop_setHandler(SIX_HANDLER_SF0)==FALSE){\n- // one sixtop transcation is happening, only one instance at one time\n- return;\n- }\nif (sf0_candidateRemoveCellList(celllist_delete,&neighbor,SF0THRESHOLD)==FALSE){\n// failed to get cell list to delete\nreturn;\n}\n- sixtop_request(\n+ outcome = sixtop_request(\nIANA_6TOP_CMD_DELETE, // code\n&neighbor, // neighbor\nSF0THRESHOLD, // number cells\n@@ -166,6 +162,8 @@ void sf0_bandwidthEstimate_task(void){\n0, // list command offset (not used)\n0 // list command maximum celllist (not used)\n);\n+ // post action depending outcome\n+ // to do\n} else {\n// nothing to do\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -108,7 +108,6 @@ void sixtop_init() {\nsixtop_vars.kaPeriod = MAXKAPERIOD;\nsixtop_vars.ebPeriod = EBPERIOD;\nsixtop_vars.isResponseEnabled = TRUE;\n- sixtop_vars.handler = SIX_HANDLER_NONE;\nsixtop_vars.six2six_state = SIX_STATE_IDLE;\nsixtop_vars.ebSendingTimerId = opentimers_create();\n@@ -147,20 +146,6 @@ void sixtop_setEBPeriod(uint8_t ebPeriod) {\n}\n}\n-bool sixtop_setHandler(six2six_handler_t handler) {\n- if (\n- sixtop_vars.handler == SIX_HANDLER_NONE &&\n- sixtop_vars.six2six_state == SIX_STATE_IDLE\n- ){\n- sixtop_vars.handler = handler;\n- return TRUE;\n- } else {\n- // another handler is using sixtop\n- return FALSE;\n-\n- }\n-}\n-\nvoid sixtop_setSFcallback(\nsixtop_sf_getsfid cb0,\nsixtop_sf_getmetadata cb1,\n@@ -175,7 +160,7 @@ void sixtop_setSFcallback(\n//======= scheduling\n-void sixtop_request(\n+owerror_t sixtop_request(\nuint8_t code,\nopen_addr_t* neighbor,\nuint8_t numCells,\n@@ -192,34 +177,29 @@ void sixtop_request(\nuint16_t length_groupid_type;\nuint8_t scheduleGeneration;\nuint8_t sequenceNumber;\n+ owerror_t outcome;\n// filter parameters: handler, status and neighbor\nif(\n- sixtop_vars.handler == SIX_HANDLER_NONE ||\nsixtop_vars.six2six_state != SIX_STATE_IDLE ||\nneighbor == NULL\n){\n- // parameters are wrong\n- // DONOT change sixtop status for the new transaction\n- return;\n+ // neighbor can't be none or previous transcation doesn't finishe yet\n+ return E_FAIL;\n}\n// get a free packet buffer\npkt = openqueue_getFreePacketBuffer(COMPONENT_SIXTOP_RES);\nif (pkt==NULL) {\n- sixtop_vars.handler = SIX_HANDLER_NONE;\nopenserial_printError(\nCOMPONENT_SIXTOP_RES,\nERR_NO_FREE_PACKET_BUFFER,\n(errorparameter_t)0,\n(errorparameter_t)0\n);\n- return;\n+ return E_FAIL;\n}\n- // update state\n- sixtop_vars.six2six_state = SIX_STATE_SENDING_REQUEST;\n-\n// take ownership\npkt->creator = COMPONENT_SIXTOP_RES;\npkt->owner = COMPONENT_SIXTOP_RES;\n@@ -339,9 +319,10 @@ void sixtop_request(\npkt->l2_sixtop_messageType = SIXTOP_CELL_REQUEST;\n// send packet\n- sixtop_send(pkt);\n- neighbors_updateSequenceNumber(neighbor);\n+ outcome = sixtop_send(pkt);\n+ if (outcome == E_SUCCESS){\n+ neighbors_updateSequenceNumber(neighbor);\n//update states\nswitch(code){\ncase IANA_6TOP_CMD_ADD:\n@@ -363,6 +344,10 @@ void sixtop_request(\nsixtop_vars.six2six_state = SIX_STATE_WAIT_CLEARREQUEST_SENDDONE;\nbreak;\n}\n+ } else {\n+ openqueue_freePacketBuffer(pkt);\n+ }\n+ return outcome;\n}\n//======= from upper layer\n@@ -867,7 +852,6 @@ port_INLINE void sixtop_sendKA() {\nvoid timer_sixtop_six2six_timeout_fired(void) {\n// timeout timer fired, reset the state of sixtop to idle\nsixtop_vars.six2six_state = SIX_STATE_IDLE;\n- sixtop_vars.handler = SIX_HANDLER_NONE;\nopentimers_cancel(sixtop_vars.timeoutTimerId);\n}\n@@ -881,7 +865,6 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\nif(error == E_FAIL) {\n// reset handler and state if the request is failed to send out\nsixtop_vars.six2six_state = SIX_STATE_IDLE;\n- sixtop_vars.handler = SIX_HANDLER_NONE;\n} else {\n// the packet has been sent out successfully\nswitch (sixtop_vars.six2six_state) {\n@@ -1562,7 +1545,6 @@ void sixtop_six2six_notifyReceive(\n(errorparameter_t)sixtop_vars.six2six_state\n);\nsixtop_vars.six2six_state = SIX_STATE_IDLE;\n- sixtop_vars.handler = SIX_HANDLER_NONE;\nopentimers_cancel(sixtop_vars.timeoutTimerId);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.h",
"new_path": "openstack/02b-MAChigh/sixtop.h",
"diff": "@@ -61,31 +61,22 @@ typedef enum {\ntypedef enum {\n// ready for next event\nSIX_STATE_IDLE = 0x00,\n- // sending\n- SIX_STATE_SENDING_REQUEST = 0x01,\n// waiting for SendDone confirmation\n- SIX_STATE_WAIT_ADDREQUEST_SENDDONE = 0x02,\n- SIX_STATE_WAIT_DELETEREQUEST_SENDDONE = 0x03,\n- SIX_STATE_WAIT_RELOCATEREQUEST_SENDDONE = 0x04,\n- SIX_STATE_WAIT_COUNTREQUEST_SENDDONE = 0x05,\n- SIX_STATE_WAIT_LISTREQUEST_SENDDONE = 0x06,\n- SIX_STATE_WAIT_CLEARREQUEST_SENDDONE = 0x07,\n+ SIX_STATE_WAIT_ADDREQUEST_SENDDONE = 0x01,\n+ SIX_STATE_WAIT_DELETEREQUEST_SENDDONE = 0x02,\n+ SIX_STATE_WAIT_RELOCATEREQUEST_SENDDONE = 0x03,\n+ SIX_STATE_WAIT_COUNTREQUEST_SENDDONE = 0x04,\n+ SIX_STATE_WAIT_LISTREQUEST_SENDDONE = 0x05,\n+ SIX_STATE_WAIT_CLEARREQUEST_SENDDONE = 0x06,\n// waiting for response from the neighbor\n- SIX_STATE_WAIT_ADDRESPONSE = 0x08,\n- SIX_STATE_WAIT_DELETERESPONSE = 0x09,\n- SIX_STATE_WAIT_RELOCATERESPONSE = 0x0a,\n- SIX_STATE_WAIT_COUNTRESPONSE = 0x0b,\n- SIX_STATE_WAIT_LISTRESPONSE = 0x0c,\n- SIX_STATE_WAIT_CLEARRESPONSE = 0x0d,\n+ SIX_STATE_WAIT_ADDRESPONSE = 0x07,\n+ SIX_STATE_WAIT_DELETERESPONSE = 0x08,\n+ SIX_STATE_WAIT_RELOCATERESPONSE = 0x09,\n+ SIX_STATE_WAIT_COUNTRESPONSE = 0x0a,\n+ SIX_STATE_WAIT_LISTRESPONSE = 0x0b,\n+ SIX_STATE_WAIT_CLEARRESPONSE = 0x0c,\n} six2six_state_t;\n-// before sixtop protocol is called, sixtop handler must be set\n-typedef enum {\n- SIX_HANDLER_NONE = 0x00, // when complete reservation, handler must be set to none\n- SIX_HANDLER_MAINTAIN = 0x01, // the handler is maintenance process\n- SIX_HANDLER_SF0 = 0x02 // the handler is otf\n-} six2six_handler_t;\n-\ntypedef enum {\nMETADATA_TYPE_FRAMEID = 0\n}metadata_t;\n@@ -113,7 +104,6 @@ typedef struct {\nuint16_t ebPeriod; // period of sending EB\nsix2six_state_t six2six_state;\nuint8_t commandID;\n- six2six_handler_t handler;\nbool isResponseEnabled;\nuint8_t cellOptions;\ncellInfo_ht celllist_toDelete[CELLLIST_MAX_LEN];\n@@ -129,7 +119,6 @@ typedef struct {\nvoid sixtop_init(void);\nvoid sixtop_setKaPeriod(uint16_t kaPeriod);\nvoid sixtop_setEBPeriod(uint8_t ebPeriod);\n-bool sixtop_setHandler(six2six_handler_t handler);\nvoid sixtop_setSFcallback(\nsixtop_sf_getsfid cb0,\nsixtop_sf_getmetadata cb1,\n@@ -137,7 +126,7 @@ void sixtop_setSFcallback(\nsixtop_sf_handle_callback cb3\n);\n// scheduling\n-void sixtop_request(\n+owerror_t sixtop_request(\nuint8_t code,\nopen_addr_t* neighbor,\nuint8_t numCells,\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -624,7 +624,6 @@ functionsToChange = [\n'sixtop_init',\n'sixtop_setKaPeriod',\n'sixtop_setEBPeriod',\n- 'sixtop_setHandler',\n'sixtop_setSFcallback',\n'sixtop_request',\n'sixtop_send',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-691. return success or failure of sixtop_request and remove sixtop handle/handler.
|
491,595
|
14.08.2017 10:58:47
| -7,200
|
7c1763b81ff062304b50a4de356a3f7ee4230640
|
fix warning in oos_sniffer project.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_sniffer/03oos_sniffer.c",
"new_path": "projects/common/03oos_sniffer/03oos_sniffer.c",
"diff": "@@ -201,8 +201,7 @@ owerror_t sixtop_request(\nuint8_t sfid,\nuint16_t listingOffset,\nuint16_t listingMaxNumCells\n-) {return;}\n-bool sixtop_setHandler(six2six_handler_t handler) {return TRUE;}\n+) {return E_FAIL;}\nvoid sixtop_setIsResponseEnabled(bool isEnabled) {return;}\nvoid sixtop_setKaPeriod(uint16_t kaPeriod) {return;}\nvoid sf0_appPktPeriod(uint8_t numAppPacketsPerSlotFrame) {return;}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-691. fix warning in oos_sniffer project.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.