Commit 5884ef61 authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Grzegorz Daniluk

lib/lldp: fix formating

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent c81b799e
......@@ -17,6 +17,7 @@
#include "endpoint.h"
#include "ipv4.h"
#include "shell.h"
#include <wrpc.h> /*needed for htons()*/
static char lldpdu[LLDP_PKT_LEN];
static uint16_t lldpdu_len;
......@@ -38,10 +39,6 @@ static void lldp_header_tlv(int tlv_type) {
lldpdu_len += LLDP_HEADER;
}
#ifndef htons
#define htons(x) x
#endif
static void lldp_add_tlv(int tlv_type) {
unsigned char mac[6];
......@@ -138,7 +135,7 @@ static void lldp_init(void)
struct wr_sockaddr saddr;
int i;
/* LLDP: raw ethernet*/
/* LLDP: raw ethernet*/
memset(&saddr, 0x0, sizeof(saddr));
saddr.ethertype = htons(LLDP_ETH_TYP);
......@@ -158,7 +155,7 @@ static void lldp_init(void)
/* add optional TLVs */
lldp_add_tlv(MNG_ADD);
/* end TLVs */
/* end TLVs */
lldp_add_tlv(END_LLDP);
}
......@@ -167,19 +164,19 @@ static void lldp_poll(void)
static int ticks;
/* periodic tasks */
if (ticks > LLDP_TX_FQ) {
if (ticks > LLDP_TX_FQ) {
if (HAS_IP & (ip_status != IP_TRAINING)) {
lldp_add_tlv(PORT);
/* update other dynamic TLVs */
}
if (HAS_IP && (ip_status != IP_TRAINING)) {
lldp_add_tlv(PORT);
/* update other dynamic TLVs */
}
ptpd_netif_sendto(lldp_socket, &addr, lldpdu, LLDP_PKT_LEN, 0);
ticks = 0;
}
else
ticks += 1;
ticks = 0;
} else {
ticks += 1;
}
}
DEFINE_WRC_TASK(lldp) = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment