[Contiki-developers] Contiki MAC-Address

109 views
Skip to first unread message

Jonas Hartwig

unread,
Sep 30, 2011, 2:24:12 PM9/30/11
to Contiki developer mailing list
Hi,

how can i set contikis mac address manually?

regards
Jonas

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Contiki-developers mailing list
Contiki-d...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/contiki-developers

David Kopf

unread,
Sep 30, 2011, 3:58:34 PM9/30/11
to Contiki developer mailing list
The default EUI-48 is set in /core/net/uip6.c
#if UIP_CONF_LL_802154
uip_lladdr_t uip_lladdr;
#else /*UIP_CONF_LL_802154*/
uip_lladdr_t uip_lladdr = {{0x00,0x06,0x98,0x00,0x02,0x32}};
#endif /*UIP_CONF_LL_802154*/

You can change that, or overwrite it at startup before initializing tcp,
e.g. /platform/minimal-net/contiki-main.c
//#define HARD_CODED_ADDRESS "bbbb::20"
#ifdef HARD_CODED_ADDRESS
{
uip_ipaddr_t ipaddr;
uiplib_ipaddrconv(HARD_CODED_ADDRESS, &ipaddr);
if ((ipaddr.u8[13]!=0) || (ipaddr.u8[14]!=0) || (ipaddr.u8[15]!=0)) {
if (sizeof(uip_lladdr)==6) { //Minimal-net uses ethernet MAC
uip_lladdr.addr[0]=0x02;uip_lladdr.addr[1]=0;uip_lladdr.addr[2]=0;
uip_lladdr.addr[3]=ipaddr.u8[13];;
uip_lladdr.addr[4]=ipaddr.u8[14];
uip_lladdr.addr[5]=ipaddr.u8[15];
}
}
}

Or define UIP_CONF_LL_802154 1 and memcpy your own EUI-64 at startup to
uip_lladdr, which is what most platforms do, e.g.
/platform/avr-ravenusb/contiki-raven-main.c:
/* Set addresses BEFORE starting tcpip process */

memset(&tmp_addr, 0, sizeof(rimeaddr_t));
if(get_eui64_from_eeprom(tmp_addr.u8));
#if UIP_CONF_IPV6
memcpy(&uip_lladdr.addr, &tmp_addr.u8, 8);
#end

-----Original Message-----
From: Jonas Hartwig
Sent: Friday, September 30, 2011 2:24 PM
To: Contiki developer mailing list
Subject: [Contiki-developers] Contiki MAC-Address

Hi,

how can i set contikis mac address manually?

Jonas Hartwig

unread,
Oct 2, 2011, 5:55:33 AM10/2/11
to Contiki developer mailing list
Thanks very much!
You wrote it has to be done BEFORE the node initializes the TCP/IP
process. How is this done in COOJA then? Initialise once for every node
and save the memory or just set the address again every time you "switch
the context" to another node?

regards

> memcpy(&uip_lladdr.addr,&tmp_addr.u8, 8);

David Kopf

unread,
Oct 2, 2011, 4:05:43 PM10/2/11
to Contiki developer mailing list
I don't know much about COOJA but should think it would want a separately
compiled elf file for each node instance. I supposed it could use the same
elf file, if there were some way of changing the mac address at startup.
:-P
Reply all
Reply to author
Forward
0 new messages