struct cdp_tlv_address_head ah;
struct cdp_tlv_address_one ao;
struct cdp_tlv_capabilities cap;
+#ifdef ENABLE_FDP
char *capstr;
+#endif
unsigned int c = -1, i, len;
#define IOV_NEW \
fatal(NULL);
/* Handle FDP */
+#ifdef ENABLE_FDP
if (version == 0) {
const u_int8_t fdpmcastaddr[] = FDP_MULTICAST_ADDR;
const u_int8_t fdpllcorg[] = LLC_ORG_FOUNDRY;
memcpy(mcastaddr, fdpmcastaddr, sizeof(mcastaddr));
memcpy(llcorg, fdpllcorg, sizeof(llcorg));
}
+#endif
/* Ether + LLC */
memset(&llc, 0, sizeof(llc));
IOV_NEW;
iov[c].iov_base = ∩
iov[c].iov_len = sizeof(cap);
+#ifdef ENABLE_FDP
} else {
/* With FDP, it seems that a string is used in place of an int */
memset(&cap, 0, sizeof(cap));
IOV_NEW;
iov[c].iov_base = capstr;
iov[c].iov_len = strlen(capstr);
+#endif
}
/* Software version */
char *software = NULL, *platform = NULL;
int software_len = 0, platform_len = 0;
const unsigned char cdpaddr[] = CDP_MULTICAST_ADDR;
+#ifdef ENABLE_FDP
const unsigned char fdpaddr[] = CDP_MULTICAST_ADDR;
- int i, f, len, rlen, fdp = 0;
+ int fdp = 0;
+#endif
+ int i, f, len, rlen;
if ((chassis = calloc(1, sizeof(struct lldpd_chassis))) == NULL) {
LLOG_WARN("failed to allocate remote chassis");
llc = (struct ethllc *)frame;
if (memcmp(&llc->ether.dhost, cdpaddr, sizeof(cdpaddr)) != 0) {
+#ifdef ENABLE_FDP
if (memcmp(&llc->ether.dhost, fdpaddr, sizeof(fdpaddr)) != 0)
fdp = 1;
else {
+#endif
LLOG_INFO("frame not targeted at CDP/FDP multicast address received on %s",
hardware->h_ifname);
goto malformed;
+#ifdef ENABLE_FDP
}
+#endif
}
if (ntohs(llc->ether.size) > s - sizeof(struct ieee8023)) {
LLOG_WARNX("incorrect 802.3 frame size reported on %s",
break;
case CDP_TLV_CAPABILITIES:
f += sizeof(struct cdp_tlv_head);
+#ifdef ENABLE_FDP
if (fdp) {
/* Capabilities are string with FDP */
if (!strncmp("Router", frame + f, len))
f += len;
break;
}
+#endif
if (len != 4) {
LLOG_WARNX("incorrect size for capabilities TLV "
"on frame received from %s",
return -1;
}
+#ifdef ENABLE_CDP
int
cdpv1_send(struct lldpd *global, struct lldpd_chassis *chassis,
struct lldpd_hardware *hardware)
{
return cdp_send(global, chassis, hardware, 2);
}
+#endif
+#ifdef ENABLE_FDP
int
fdp_send(struct lldpd *global, struct lldpd_chassis *chassis,
struct lldpd_hardware *hardware)
{
return cdp_send(global, chassis, hardware, 0);
}
+#endif
+#ifdef ENABLE_CDP
static int
cdp_guess(char *frame, int len, int version)
{
{
return cdp_guess(frame, len, 2);
}
+#endif
#endif /* defined (ENABLE_CDP) || defined (ENABLE_FDP) */