return NULL;
}
mgmt->m_family = family;
- assert(addrsize <= LLDPD_MGMT_MAXADDRSIZE);
memcpy(&mgmt->m_addr, addrptr, addrsize);
mgmt->m_addrsize = addrsize;
mgmt->m_iface = iface;
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
-#include <assert.h>
static int
cdp_send(struct lldpd *global,
mgmt = lldpd_alloc_mgmt(LLDPD_AF_IPV4, &addr,
sizeof(struct in_addr), 0);
if (mgmt == NULL) {
- assert(errno == ENOMEM);
- log_warn("cdp", "unable to allocate memory for management address");
+ if (errno == ENOMEM)
+ log_warn("cdp",
+ "unable to allocate memory for management address");
+ else
+ log_warn("cdp",
+ "too large management address received on %s",
+ hardware->h_ifname);
goto malformed;
}
TAILQ_INSERT_TAIL(&chassis->c_mgmt, mgmt, m_entries);
#include <errno.h>
#include <arpa/inet.h>
#include <fnmatch.h>
-#include <assert.h>
static int seq = 0;
#include <unistd.h>
#include <errno.h>
-#include <assert.h>
#include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
/* Management addresses */
TAILQ_FOREACH(mgmt, &chassis->c_mgmt, m_entries) {
proto = lldpd_af_to_lldp_proto(mgmt->m_family);
- assert(proto != LLDP_MGMT_ADDR_NONE);
+ if (proto == LLDP_MGMT_ADDR_NONE) continue;
if (!(
POKE_START_LLDP_TLV(LLDP_TLV_MGMT_ADDR) &&
/* Size of the address, including its type */
iface = 0;
mgmt = lldpd_alloc_mgmt(af, addr_ptr, addr_length, iface);
if (mgmt == NULL) {
- assert(errno == ENOMEM);
- log_warn("lldp", "unable to allocate memory "
- "for management address");
- goto malformed;
+ if (errno == ENOMEM)
+ log_warn("lldp", "unable to allocate memory "
+ "for management address");
+ else
+ log_warn("lldp", "too large management address "
+ "received on %s", hardware->h_ifname);
+ goto malformed;
}
TAILQ_INSERT_TAIL(&chassis->c_mgmt, mgmt, m_entries);
break;
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
-#include <assert.h>
static struct sonmp_chassis sonmp_chassis_types[] = {
{1, "unknown (via SONMP)"},
}
mgmt = lldpd_alloc_mgmt(LLDPD_AF_IPV4, &address, sizeof(struct in_addr), 0);
if (mgmt == NULL) {
- assert(errno == ENOMEM);
- log_warn("sonmp", "unable to allocate memory for management address");
+ if (errno == ENOMEM)
+ log_warn("sonmp", "unable to allocate memory for management address");
+ else
+ log_warn("sonmp", "too large management address received on %s",
+ hardware->h_ifname);
goto malformed;
}
TAILQ_INSERT_TAIL(&chassis->c_mgmt, mgmt, m_entries);