Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
d4b80abd
Commit
d4b80abd
authored
Oct 14, 2020
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lldp: fix variables and pointers, lldp_poll was corrupting the memory
parent
1ee3cc45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lldp.c
lib/lldp.c
+7
-7
No files found.
lib/lldp.c
View file @
d4b80abd
...
...
@@ -240,8 +240,8 @@ void lldp_init(void)
int
lldp_poll
(
void
)
{
static
int
ticks
;
u
nsigned
char
new_ipWR
;
static
u
nsigned
char
old_ipWR
;
u
int8_t
new_ipWR
[
4
]
;
static
u
int8_t
old_ipWR
[
4
]
;
uint8_t
new_mac
[
ETH_ALEN
];
static
uint8_t
old_mac
[
ETH_ALEN
];
...
...
@@ -253,20 +253,20 @@ int lldp_poll(void)
if
(
ticks
>
LLDP_TX_TICK_INTERVAL
)
{
ep_get_mac_addr
(
&
wrc_endpoint_dev
,
new_mac
);
if
(
HAS_IP
)
{
getIP
(
&
new_ipWR
);
getIP
(
new_ipWR
);
}
/* Update only when IP or MAC changed */
/* TODO: or VLAN changed */
if
(
memcmp
(
&
new_mac
,
&
old_mac
,
ETH_ALEN
)
if
(
memcmp
(
new_mac
,
old_mac
,
ETH_ALEN
)
||
(
HAS_IP
&&
(
ip_status
!=
IP_TRAINING
)
&&
memcmp
(
&
new_ipWR
,
&
old_ipWR
,
IPLEN
))
&&
memcmp
(
new_ipWR
,
old_ipWR
,
IPLEN
))
)
{
/* update LLDP info */
lldp_update
();
/* copy new MAC nad IP */
memcpy
(
&
old_mac
,
&
new_mac
,
ETH_ALEN
);
memcpy
(
&
old_ipWR
,
&
new_ipWR
,
IPLEN
);
memcpy
(
old_mac
,
new_mac
,
ETH_ALEN
);
memcpy
(
old_ipWR
,
new_ipWR
,
IPLEN
);
}
ptpd_netif_sendto
(
lldp_socket
,
&
addr
,
lldpdu
,
lldpdu_len
,
0
);
...
...
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