mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 05:53:49 +01:00
Merge pull request #1814 from authmillenon/auto-init-addr-fix
auto_init: use full hash to configure radio address
This commit is contained in:
commit
1a7aee711a
@ -91,7 +91,6 @@
|
||||
#ifdef MODULE_NET_IF
|
||||
void auto_init_net_if(void)
|
||||
{
|
||||
int iface;
|
||||
transceiver_type_t transceivers = 0;
|
||||
#ifdef MODULE_AT86RF231
|
||||
transceivers |= TRANSCEIVER_AT86RF231;
|
||||
@ -114,6 +113,7 @@ void auto_init_net_if(void)
|
||||
net_if_init();
|
||||
|
||||
if (transceivers != 0) {
|
||||
int iface;
|
||||
#if CPUID_ID_LEN && defined(MODULE_HASHES)
|
||||
uint8_t cpuid[CPUID_ID_LEN];
|
||||
|
||||
@ -149,7 +149,7 @@ void auto_init_net_if(void)
|
||||
#endif /* DEBUG_ENABLED */
|
||||
|
||||
#undef CONF_RADIO_ADDR
|
||||
uint16_t hwaddr = HTONS((uint16_t)hash_l);
|
||||
uint16_t hwaddr = HTONS((uint16_t)((hash_l ^ hash_h) ^ ((hash_l ^ hash_h) >> 16)));
|
||||
net_if_set_hardware_address(iface, hwaddr);
|
||||
DEBUG("Auto init radio address on interface %d to 0x%04x\n", iface, hwaddr);
|
||||
#else /* CPUID_ID_LEN && defined(MODULE_HASHES) */
|
||||
@ -169,6 +169,7 @@ void auto_init_net_if(void)
|
||||
DEBUG("Change this value at compile time with macro CONF_RADIO_ADDR\n");
|
||||
net_if_set_hardware_address(iface, CONF_RADIO_ADDR);
|
||||
}
|
||||
|
||||
#endif /* CPUID_ID_LEN && defined(MODULE_HASHES) */
|
||||
|
||||
if (net_if_get_pan_id(iface) <= 0) {
|
||||
@ -181,9 +182,6 @@ void auto_init_net_if(void)
|
||||
DEBUG("Auto init interface %d\n", iface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
iface = -1;
|
||||
}
|
||||
}
|
||||
#endif /* MODULE_NET_IF */
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user