Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
e3da-public
contiki-ng
Commits
38caaeb9
Commit
38caaeb9
authored
Feb 23, 2018
by
Simon Duquennoy
Browse files
Platform native: make MAC address configurable
parent
296f7efc
Changes
1
Hide whitespace changes
Inline
Side-by-side
arch/platform/native/platform.c
View file @
38caaeb9
...
...
@@ -111,7 +111,12 @@
static
const
struct
select_callback
*
select_callback
[
SELECT_MAX
];
static
int
select_max
=
0
;
static
uint8_t
serial_id
[]
=
{
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
};
#ifdef PLATFORM_CONF_MAC_ADDR
static
uint8_t
mac_addr
[]
=
PLATFORM_CONF_MAC_ADDR
;
#else
/* PLATFORM_CONF_MAC_ADDR */
static
uint8_t
mac_addr
[]
=
{
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
};
#endif
/* PLATFORM_CONF_MAC_ADDR */
#if !NETSTACK_CONF_WITH_IPV6
static
uint16_t
node_id
=
0x0102
;
#endif
/* !NETSTACK_CONF_WITH_IPV6 */
...
...
@@ -177,12 +182,12 @@ set_lladdr(void)
memset
(
&
addr
,
0
,
sizeof
(
linkaddr_t
));
#if NETSTACK_CONF_WITH_IPV6
memcpy
(
addr
.
u8
,
serial_id
,
sizeof
(
addr
.
u8
));
memcpy
(
addr
.
u8
,
mac_addr
,
sizeof
(
addr
.
u8
));
#else
if
(
node_id
==
0
)
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
linkaddr_t
);
++
i
)
{
addr
.
u8
[
i
]
=
serial_id
[
7
-
i
];
addr
.
u8
[
i
]
=
mac_addr
[
7
-
i
];
}
}
else
{
addr
.
u8
[
0
]
=
node_id
&
0xff
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment