Step 2a (2/2): LLDP transmit, switch shows name and IP
- aes67_net/lldp.c: IEEE 802.1AB LLDPDU sent as a raw frame with esp_eth_transmit every 30 s (TTL 120 s) and immediately on a new IP or hostname change. TLVs: chassis/port ID (MAC), port description, system name (net.hostname), system description (project + version), capabilities station-only, IPv4 management address. - Docs: LLDP in the core Network section; step 2a ticked. - Verified on an HP 2530-8G-PoE+ (show lldp info remote-device 2): all fields shown, management address 192.168.192.244. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "esp_event.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_netif.h"
|
||||
#include "lldp.h"
|
||||
#include "mdns.h"
|
||||
|
||||
static const char *TAG = "net";
|
||||
@@ -58,6 +59,7 @@ static void ip_event(void *arg, esp_event_base_t base, int32_t id, void *data)
|
||||
const ip_event_got_ip_t *ev = data;
|
||||
ESP_LOGI(TAG, "got IP " IPSTR " mask " IPSTR " gw " IPSTR,
|
||||
IP2STR(&ev->ip_info.ip), IP2STR(&ev->ip_info.netmask), IP2STR(&ev->ip_info.gw));
|
||||
lldp_changed();
|
||||
}
|
||||
|
||||
// Static addressing needs ip + mask; gw/dns are optional (none on the AES67 side with VLAN split).
|
||||
@@ -129,6 +131,7 @@ static void net_apply(const cJSON *g)
|
||||
if (mdns_hostname_set(host) == ESP_OK && mdns_instance_name_set(host) == ESP_OK) {
|
||||
ESP_LOGI(TAG, "mDNS: now %s.local", host);
|
||||
}
|
||||
lldp_changed();
|
||||
}
|
||||
|
||||
static void net_status(cJSON *st)
|
||||
@@ -170,6 +173,7 @@ esp_err_t aes67_net_init(esp_eth_handle_t eth)
|
||||
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, ip_event, NULL));
|
||||
|
||||
mdns_setup();
|
||||
ESP_ERROR_CHECK(lldp_start(eth, s_netif));
|
||||
status_register(net_status);
|
||||
return esp_eth_start(eth);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user