{
struct lldpd_aa_isid_vlan_maps_tlv *lm = xzalloc(sizeof *lm);
- if (hardware->h_ifname) {
- VLOG_INFO("\t\t hardware->h_ifname=%s", hardware->h_ifname);
- }
+ VLOG_INFO("\t\t hardware->h_ifname=%s", hardware->h_ifname);
lm->isid_vlan_data.isid = m->isid;
lm->isid_vlan_data.vlan = m->vlan;
}
hmap_remove(&lldp->mappings_by_aux, &m->hmap_node_aux);
- free(m);
/* Remove from all the lldp instances */
LIST_FOR_EACH (hw, h_entries, &lldp->lldpd->g_hardware) {
- if (hw->h_ifname) {
- VLOG_INFO("\t\t hardware->h_ifname=%s", hw->h_ifname);
- }
-
+ VLOG_INFO("\t\t hardware->h_ifname=%s", hw->h_ifname);
aa_mapping_unregister_mapping(lldp, hw, m);
}
+ free(m);
/* Remove from the all_mappings */
HMAP_FOR_EACH (m, hmap_node_isid, all_mappings) {
* fields in 'wc' that were used to make the determination.
*/
bool
-lldp_should_process_flow(const struct flow *flow)
+lldp_should_process_flow(struct lldp *lldp, const struct flow *flow)
{
- return (flow->dl_type == htons(ETH_TYPE_LLDP));
+ return (flow->dl_type == htons(ETH_TYPE_LLDP) && lldp->enabled);
}
ret = timer_expired(&cfg->tx_timer);
ovs_mutex_unlock(&mutex);
+ /* LLDP must be enabled */
+ ret &= cfg->enabled;
+
return ret;
}
{
long long int retval;
- if (!lldp) {
+ if (!lldp || !lldp->enabled) {
return LLONG_MAX;
}
*/
void
lldp_put_packet(struct lldp *lldp, struct dp_packet *packet,
- uint8_t eth_src[ETH_ADDR_LEN]) OVS_EXCLUDED(mutex)
+ const struct eth_addr eth_src) OVS_EXCLUDED(mutex)
{
struct lldpd *mylldpd = lldp->lldpd;
struct lldpd_hardware *hw = lldpd_first_hardware(mylldpd);
- static const uint8_t eth_addr_lldp[6] =
- {0x01, 0x80, 0xC2, 0x00, 0x00, 0x0e};
+ static const struct eth_addr eth_addr_lldp =
+ { { { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x0e } } };
ovs_mutex_lock(&mutex);
/* Configures the LLDP stack.
*/
bool
-lldp_configure(struct lldp *lldp) OVS_EXCLUDED(mutex)
+lldp_configure(struct lldp *lldp, const struct smap *cfg) OVS_EXCLUDED(mutex)
{
if (lldp) {
+ if (cfg && smap_get_bool(cfg, "enable", false)) {
+ lldp->enabled = true;
+ } else {
+ lldp->enabled = false;
+ }
+
ovs_mutex_lock(&mutex);
timer_set_expired(&lldp->tx_timer);
timer_set_duration(&lldp->tx_timer, LLDP_DEFAULT_TRANSMIT_INTERVAL_MS);
lchassis->c_cap_enabled = LLDP_CAP_BRIDGE;
lchassis->c_id_subtype = LLDP_CHASSISID_SUBTYPE_LLADDR;
lchassis->c_id_len = ETH_ADDR_LEN;
- lchassis->c_id = xmalloc(ETH_ADDR_LEN);
- netdev_get_etheraddr(netdev, lchassis->c_id);
+
+ struct eth_addr *mac = xmalloc(ETH_ADDR_LEN);
+ netdev_get_etheraddr(netdev, mac);
+ lchassis->c_id = &mac->ea[0];
list_init(&lchassis->c_mgmt);
lchassis->c_ttl = lldp->lldpd->g_config.c_tx_interval *