/* conf*.c */
void register_commands_configure(struct cmd_node *);
void register_commands_configure_system(struct cmd_node *, struct cmd_node *);
-void register_commands_configure_lldp(struct cmd_node *);
+void register_commands_configure_lldp(struct cmd_node *, struct cmd_node *);
void register_commands_configure_med(struct cmd_node *, struct cmd_node *);
void register_commands_configure_dot3(struct cmd_node *);
void register_commands_medpow(struct cmd_node *);
return 1;
}
+static int
+cmd_chassis_cap_advertise(struct lldpctl_conn_t *conn, struct writer *w,
+ struct cmd_env *env, void *arg)
+{
+ lldpctl_atom_t *config = lldpctl_get_configuration(conn);
+ if (config == NULL) {
+ log_warnx("lldpctl", "unable to get configuration from lldpd. %s",
+ lldpctl_last_strerror(conn));
+ return 0;
+ }
+ if (lldpctl_atom_set_int(config,
+ lldpctl_k_config_chassis_cap_advertise,
+ arg?1:0) == NULL) {
+ log_warnx("lldpctl", "unable to %s chassis capabilities advertisement: %s",
+ arg?"enable":"disable",
+ lldpctl_last_strerror(conn));
+ lldpctl_atom_dec_ref(config);
+ return 0;
+ }
+ log_info("lldpctl", "chassis capabilities advertisement %s",
+ arg?"enabled":"disabled");
+ lldpctl_atom_dec_ref(config);
+ return 1;
+}
+
/**
* Register `configure lldp` commands.
*
* Dot1/Dot3/MED. Commands not related to LLDP should go in system instead.
*/
void
-register_commands_configure_lldp(struct cmd_node *configure)
+register_commands_configure_lldp(struct cmd_node *configure,
+ struct cmd_node *unconfigure)
{
struct cmd_node *configure_lldp = commands_new(
configure,
"lldp", "LLDP configuration",
NULL, NULL, NULL);
+ struct cmd_node *unconfigure_lldp = commands_new(
+ unconfigure,
+ "lldp", "LLDP configuration",
+ NULL, NULL, NULL);
commands_new(
commands_new(
b_map->string);
}
}
+
+ commands_new(
+ commands_new(configure_lldp,
+ "capabilities-advertisements",
+ "Enable chassis capabilities advertisement",
+ NULL, NULL, NULL),
+ NEWLINE, "Enable chassis capabilities advertisement",
+ NULL, cmd_chassis_cap_advertise, "enable");
+ commands_new(
+ commands_new(unconfigure_lldp,
+ "capabilities-advertisements",
+ "Don't enable chassis capabilities advertisement",
+ NULL, NULL, NULL),
+ NEWLINE, "Don't enable chassis capabilities advertisement",
+ NULL, cmd_chassis_cap_advertise, NULL);
}
cmd_restrict_ports(unconfigure);
register_commands_configure_system(configure, unconfigure);
- register_commands_configure_lldp(configure);
+ register_commands_configure_lldp(configure, unconfigure);
register_commands_configure_med(configure, unconfigure);
register_commands_configure_dot3(configure);
}
cfg->g_config.c_promisc = config->c_promisc;
levent_update_now(cfg);
}
+ if (CHANGED(c_cap_advertise)) {
+ log_debug("rpc", "%s chassis capabilities advertisement",
+ config->c_promisc?"enable":"disable");
+ cfg->g_config.c_cap_advertise = config->c_cap_advertise;
+ levent_update_now(cfg);
+ }
if (CHANGED(c_bond_slave_src_mac_type)) {
if (config->c_bond_slave_src_mac_type >
LLDP_BOND_SLAVE_SRC_MAC_TYPE_UNKNOWN &&
if ((lchassis = (struct lldpd_chassis*)
calloc(1, sizeof(struct lldpd_chassis))) == NULL)
fatal("localchassis", NULL);
+ cfg->g_config.c_cap_advertise = 1;
lchassis->c_cap_available = LLDP_CAP_BRIDGE | LLDP_CAP_WLAN |
LLDP_CAP_ROUTER | LLDP_CAP_STATION;
TAILQ_INIT(&lchassis->c_mgmt);
}
/* System capabilities */
- if (chassis->c_cap_available) {
+ if (global->g_config.c_cap_advertise && chassis->c_cap_available) {
if (!(
POKE_START_LLDP_TLV(LLDP_TLV_SYSTEM_CAP) &&
POKE_UINT16(chassis->c_cap_available) &&
return c->config->c_set_ifdescr;
case lldpctl_k_config_iface_promisc:
return c->config->c_promisc;
+ case lldpctl_k_config_chassis_cap_advertise:
+ return c->config->c_cap_advertise;
#ifdef ENABLE_LLDPMED
case lldpctl_k_config_lldpmed_noinventory:
return c->config->c_noinventory;
case lldpctl_k_config_iface_promisc:
config.c_promisc = c->config->c_promisc = value;
break;
+ case lldpctl_k_config_chassis_cap_advertise:
+ config.c_cap_advertise = c->config->c_cap_advertise = value;
+ break;
#ifdef ENABLE_LLDPMED
case lldpctl_k_config_fast_start_enabled:
config.c_enable_fast_start = c->config->c_enable_fast_start = value;
lldpctl_k_config_fast_start_interval, /**< `(I,WO)` Start fast transmit interval */
lldpctl_k_config_ifdescr_update, /**< `(I,WO)` Enable or disable setting interface description */
lldpctl_k_config_iface_promisc, /**< `(I,WO)` Enable or disable promiscuous mode on interfaces */
+ lldpctl_k_config_chassis_cap_advertise, /**< `(I,WO)` Enable or disable chassis capabilities advertisement */
lldpctl_k_interface_name = 1000, /**< `(S)` The interface name. */
int c_advertise_version; /* Should the precise version be advertised? */
int c_set_ifdescr; /* Set interface description */
int c_promisc; /* Interfaces should be in promiscuous mode */
+ int c_cap_advertise; /* Chassis capabilities advertisement */
#ifdef ENABLE_LLDPMED
int c_noinventory; /* Don't send inventory with LLDP-MED */