- LLDPD_CONFIG_ARGS="--with-embedded-libevent"
- LLDPD_CONFIG_ARGS="--disable-privsep --with-snmp"
- LLDPD_CONFIG_ARGS="--with-snmp --with-xml --with-json --disable-lldpmed --disable-dot1 --disable-dot3"
+ - LLDPD_CONFIG_ARGS="--with-snmp --with-xml --with-json --disable-lldpmed --disable-dot1 --disable-dot3 --disable-custom"
matrix:
include:
- os: linux
lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
+lldp_ARG_ENABLE([custom], [Custom TLV support], [yes])
# Oldies
lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
LLDPMED........: $enable_lldpmed
DOT1...........: $enable_dot1
DOT3...........: $enable_dot3
+ CUSTOM.........: $enable_custom
XML output.....: ${with_xml-no}
JSON output....: ${with_json-no}
Oldies support.: $enable_oldies
%bcond_without lldpmed
%bcond_without dot1
%bcond_without dot3
+%bcond_without custom
# On RHEL < 5, disable SNMP, Net-SNMP installation seems broken
%if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 500 || 0%{?centos_version} > 0 && 0%{?centos_version} < 500
--enable-dot3 \
%else
--disable-dot3 \
+%endif
+%if %{with custom}
+ --enable-custom \
+%else
+ --disable-custom \
%endif
--with-privsep-user=%lldpd_user \
--with-privsep-group=%lldpd_group \
return 1;
}
+#ifdef ENABLE_CUSTOM
static int
cmd_custom_tlv_set(struct lldpctl_conn_t *conn, struct writer *w,
struct cmd_env *env, void *arg)
NEWLINE, "Add custom TLV(s) to be broadcast on ports",
NULL, cmd_custom_tlv_set, "enable");
}
+#endif /* ENABLE_CUSTOM */
/**
* Register `configure lldp` commands.
NULL, cmd_chassis_mgmt_advertise, NULL);
+#ifdef ENABLE_CUSTOM
register_commands_configure_lldp_custom_tlvs(configure_lldp);
commands_new(
commands_new(unconfigure_lldp,
NULL, NULL, NULL),
NEWLINE, "Clear all (previously set) custom TLVs",
NULL, cmd_custom_tlv_set, NULL);
+#endif
}
sizeof(struct lldpd_dot3_power));
}
#endif
+#ifdef ENABLE_CUSTOM
if (set->custom_list_clear) {
log_debug("rpc", "requested custom TLVs clear");
lldpd_custom_list_cleanup(port);
} else
log_warn("rpc", "could not allocate memory for custom TLV");
}
+#endif
ret = 1;
break;
TAILQ_INIT(&hardware->h_lport.p_ppvids);
TAILQ_INIT(&hardware->h_lport.p_pids);
#endif
+#ifdef ENABLE_CUSTOM
TAILQ_INIT(&hardware->h_lport.p_custom_list);
+#endif
levent_hardware_init(hardware);
return hardware;
int i;
const u_int8_t med[] = LLDP_TLV_ORG_MED;
#endif
+#ifdef ENABLE_CUSTOM
struct lldpd_custom *custom;
+#endif
port = &hardware->h_lport;
chassis = port->p_chassis;
length = hardware->h_mtu;
}
#endif
+#ifdef ENABLE_CUSTOM
TAILQ_FOREACH(custom, &port->p_custom_list, next) {
if (!(
POKE_START_LLDP_TLV(LLDP_TLV_ORG) &&
POKE_END_LLDP_TLV))
goto toobig;
}
+#endif
end:
/* END */
u_int8_t addr_str_length, addr_str_buffer[32];
u_int8_t addr_family, addr_length, *addr_ptr, iface_subtype;
u_int32_t iface_number, iface;
+#ifdef ENABLE_CUSTOM
struct lldpd_custom *custom;
+#endif
log_debug("lldp", "receive LLDP PDU on %s",
hardware->h_ifname);
TAILQ_INIT(&port->p_ppvids);
TAILQ_INIT(&port->p_pids);
#endif
+#ifdef ENABLE_CUSTOM
TAILQ_INIT(&port->p_custom_list);
+#endif
length = s;
pos = (u_int8_t*)frame;
orgid[0], orgid[1], orgid[2],
hardware->h_ifname);
hardware->h_rx_unrecognized_cnt++;
+#ifdef ENABLE_CUSTOM
custom = (struct lldpd_custom*)calloc(1, sizeof(struct lldpd_custom));
if (!custom)
return ENOMEM;
if (custom->oui_info_len > 0)
PEEK_BYTES(custom->oui_info, custom->oui_info_len);
TAILQ_INSERT_TAIL(&port->p_custom_list, custom, next);
+#endif
}
break;
default:
atom_med_caelement,
atom_med_power,
#endif
+#ifdef ENABLE_CUSTOM
atom_custom_list,
atom_custom,
+#endif
} atom_t;
void *_lldpctl_alloc_in_atom(lldpctl_atom_t *, size_t);
};
#endif
+#ifdef ENABLE_CUSTOM
struct _lldpctl_atom_custom_list_t {
lldpctl_atom_t base;
struct _lldpctl_atom_port_t *parent;
struct _lldpctl_atom_port_t *parent;
struct lldpd_custom *tlv;
};
+#endif
struct lldpctl_atom_t *_lldpctl_new_atom(lldpctl_conn_t *conn, atom_t type, ...);
#include "atom.h"
#include "helpers.h"
+#ifdef ENABLE_CUSTOM
+
#define min(x,y) ( (x > y) ? y : x )
static lldpctl_atom_iter_t*
ATOM_BUILDER_REGISTER(custom_list, 22);
ATOM_BUILDER_REGISTER(custom, 23);
+#endif /* ENABLE_CUSTOM */
+
case lldpctl_k_port_med_power:
return _lldpctl_new_atom(atom->conn, atom_med_power, p);
#endif
+#ifdef ENABLE_CUSTOM
case lldpctl_k_custom_tlvs:
return _lldpctl_new_atom(atom->conn, atom_custom_list, p);
+#endif
default:
SET_ERROR(atom->conn, LLDPCTL_ERR_NOT_EXIST);
return NULL;
struct _lldpctl_atom_med_policy_t *mpol;
struct _lldpctl_atom_med_location_t *mloc;
#endif
+#ifdef ENABLE_CUSTOM
struct _lldpctl_atom_custom_t *custom;
+#endif
/* Local port only */
if (hardware == NULL) {
set.med_location = mloc->location;
break;
#endif
+#ifdef ENABLE_CUSTOM
case lldpctl_k_custom_tlvs_clear:
set.custom_list_clear = 1;
break;
custom = (struct _lldpctl_atom_custom_t *)value;
set.custom = custom->tlv;
break;
+#endif
default:
SET_ERROR(atom->conn, LLDPCTL_ERR_NOT_EXIST);
return NULL;
}
#endif
+#ifdef ENABLE_CUSTOM
void
lldpd_custom_list_cleanup(struct lldpd_port *port)
{
}
TAILQ_INIT(&port->p_custom_list);
}
+#endif
/* Cleanup a remote port. The before last argument, `expire` is a function that
* should be called when a remote port is removed. If the last argument is 1,
port->p_chassis->c_refcount--;
port->p_chassis = NULL;
}
+#ifdef ENABLE_CUSTOM
lldpd_custom_list_cleanup(port);
+#endif
}
}
#endif
MARSHAL_END(lldpd_chassis);
+#ifdef ENABLE_CUSTOM
/* Custom TLV struct as defined on page 35 of IEEE 802.1AB-2005 */
struct lldpd_custom {
TAILQ_ENTRY(lldpd_custom) next; /* Pointer to next custom TLV */
MARSHAL_BEGIN(lldpd_custom)
MARSHAL_TQE(lldpd_custom, next)
MARSHAL_END(lldpd_custom);
+#endif
struct lldpd_port {
TAILQ_ENTRY(lldpd_port) p_entries;
TAILQ_HEAD(, lldpd_ppvid) p_ppvids;
TAILQ_HEAD(, lldpd_pi) p_pids;
#endif
+#ifdef ENABLE_CUSTOM
TAILQ_HEAD(, lldpd_custom) p_custom_list;
+#endif
};
MARSHAL_BEGIN(lldpd_port)
MARSHAL_TQE(lldpd_port, p_entries)
MARSHAL_SUBTQ(lldpd_port, lldpd_ppvid, p_ppvids)
MARSHAL_SUBTQ(lldpd_port, lldpd_pi, p_pids)
#endif
+#ifdef ENABLE_CUSTOM
MARSHAL_SUBTQ(lldpd_port, lldpd_custom, p_custom_list)
+#endif
MARSHAL_END(lldpd_port);
/* Used to modify some port related settings */
#ifdef ENABLE_DOT3
struct lldpd_dot3_power *dot3_power;
#endif
+#ifdef ENABLE_CUSTOM
struct lldpd_custom *custom;
int custom_list_clear;
+#endif
};
MARSHAL_BEGIN(lldpd_port_set)
MARSHAL_STR(lldpd_port_set, ifname)
#ifdef ENABLE_DOT3
MARSHAL_POINTER(lldpd_port_set, lldpd_dot3_power, dot3_power)
#endif
+#ifdef ENABLE_CUSTOM
MARSHAL_POINTER(lldpd_port_set, lldpd_custom, custom)
+#endif
MARSHAL_END(lldpd_port_set);
/* Smart mode / Hide mode */
void lldpd_vlan_cleanup(struct lldpd_port *);
void lldpd_pi_cleanup(struct lldpd_port *);
#endif
+#ifdef ENABLE_CUSTOM
void lldpd_custom_list_cleanup(struct lldpd_port *);
+#endif
#endif