Fixes for possible ARM issues, cleanup, fix for spurious meaningless exceptions on NETWORK_CONFIG_REQUEST
This commit is contained in:
parent
0daff26fba
commit
c6a39ed927
6 changed files with 99 additions and 41 deletions
|
@ -61,15 +61,23 @@ public:
|
|||
|
||||
Dictionary(const char *s)
|
||||
{
|
||||
Utils::scopy(_d,sizeof(_d),s);
|
||||
if (s) {
|
||||
Utils::scopy(_d,sizeof(_d),s);
|
||||
} else {
|
||||
_d[0] = (char)0;
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary(const char *s,unsigned int len)
|
||||
{
|
||||
if (len > (C-1))
|
||||
len = C-1;
|
||||
memcpy(_d,s,len);
|
||||
_d[len] = (char)0;
|
||||
if (s) {
|
||||
if (len > (C-1))
|
||||
len = C-1;
|
||||
memcpy(_d,s,len);
|
||||
_d[len] = (char)0;
|
||||
} else {
|
||||
_d[0] = (char)0;
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary(const Dictionary &d)
|
||||
|
@ -91,7 +99,12 @@ public:
|
|||
*/
|
||||
inline bool load(const char *s)
|
||||
{
|
||||
return Utils::scopy(_d,sizeof(_d),s);
|
||||
if (s) {
|
||||
return Utils::scopy(_d,sizeof(_d),s);
|
||||
} else {
|
||||
_d[0] = (char)0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -836,7 +836,7 @@ bool IncomingPacket::_doNETWORK_CREDENTIALS(const RuntimeEnvironment *RR,const S
|
|||
bool trustEstablished = false;
|
||||
|
||||
unsigned int p = ZT_PACKET_IDX_PAYLOAD;
|
||||
while ((p < size())&&((*this)[p])) {
|
||||
while ((p < size())&&((*this)[p] != 0)) {
|
||||
p += com.deserialize(*this,p);
|
||||
if (com) {
|
||||
const SharedPtr<Network> network(RR->node->network(com.networkId()));
|
||||
|
@ -953,8 +953,8 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
|
|||
const uint64_t requestPacketId = packetId();
|
||||
|
||||
if (RR->localNetworkController) {
|
||||
const unsigned int metaDataLength = at<uint16_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT_LEN);
|
||||
const char *metaDataBytes = (const char *)field(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT,metaDataLength);
|
||||
const unsigned int metaDataLength = (ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT_LEN <= size()) ? at<uint16_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT_LEN) : 0;
|
||||
const char *metaDataBytes = (metaDataLength != 0) ? (const char *)field(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT,metaDataLength) : (const char *)0;
|
||||
const Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> metaData(metaDataBytes,metaDataLength);
|
||||
RR->localNetworkController->request(nwid,(hopCount > 0) ? InetAddress() : _path->address(),requestPacketId,peer->identity(),metaData);
|
||||
} else {
|
||||
|
|
|
@ -1517,6 +1517,10 @@ void Network::_sendUpdatesToMembers(const MulticastGroup *const newMulticastGrou
|
|||
Packet outp(*a,RR->identity.address(),Packet::VERB_NETWORK_CREDENTIALS);
|
||||
_config.com.serialize(outp);
|
||||
outp.append((uint8_t)0x00);
|
||||
outp.append((uint16_t)0); // no capabilities
|
||||
outp.append((uint16_t)0); // no tags
|
||||
outp.append((uint16_t)0); // no revocations
|
||||
outp.append((uint16_t)0); // no certificates of ownership
|
||||
RR->sw->send(outp,true);
|
||||
}
|
||||
_announceMulticastGroupsTo(*a,groups);
|
||||
|
@ -1529,6 +1533,10 @@ void Network::_sendUpdatesToMembers(const MulticastGroup *const newMulticastGrou
|
|||
Packet outp(c,RR->identity.address(),Packet::VERB_NETWORK_CREDENTIALS);
|
||||
_config.com.serialize(outp);
|
||||
outp.append((uint8_t)0x00);
|
||||
outp.append((uint16_t)0); // no capabilities
|
||||
outp.append((uint16_t)0); // no tags
|
||||
outp.append((uint16_t)0); // no revocations
|
||||
outp.append((uint16_t)0); // no certificates of ownership
|
||||
RR->sw->send(outp,true);
|
||||
}
|
||||
_announceMulticastGroupsTo(c,groups);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue