* Features:
+ Allow to configure hold value from lldpcli (and hence the TTL).
+ Allow to configure pattern for valid interfaces from lldpcli.
+ + Allow to override system description from lldpcli.
lldpd (0.7.3)
* Features:
return 1;
}
+static int
+cmd_system_description(struct lldpctl_conn_t *conn, struct writer *w,
+ struct cmd_env *env, void *arg)
+{
+ log_debug("lldpctl", "set system description");
+ 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_str(config,
+ lldpctl_k_config_description, cmdenv_get(env, "description")) == NULL) {
+ log_warnx("lldpctl", "unable to set system description. %s",
+ lldpctl_last_strerror(conn));
+ lldpctl_atom_dec_ref(config);
+ return 0;
+ }
+ log_info("lldpctl", "system description set to new value %s",
+ cmdenv_get(env, "description"));
+ lldpctl_atom_dec_ref(config);
+ return 1;
+}
+
/**
* Register `configure system` commands.
*
"interface", "Configure interface related items",
NULL, NULL, NULL);
+ commands_new(
+ commands_new(
+ commands_new(configure_system,
+ "description", "Override system description",
+ NULL, NULL, NULL),
+ NULL, "System description",
+ NULL, cmd_store_env_value, "description"),
+ NEWLINE, "Override system description",
+ NULL, cmd_system_description, NULL);
+
commands_new(
commands_new(
commands_new(configure_interface,
update its information and send new LLDP PDU on all interfaces.
.Ed
+.Cd configure
+.Cd system description Ar description
+.Bd -ragged -offset XXXXXX
+Override chassis description with the provided value instead of using
+kernel name, node name, kernel version, build date and architecture.
+.Ed
+
.Cd configure
.Cd system interface pattern Ar pattern
.Bd -ragged -offset XXXXXX
}
#endif
if (config->c_iface_pattern) {
- log_debug("rpc", "change c_iface_pattern %s", config->c_iface_pattern);
+ log_debug("rpc", "change interface pattern to %s", config->c_iface_pattern);
free(cfg->g_config.c_iface_pattern);
cfg->g_config.c_iface_pattern = strdup(config->c_iface_pattern);
levent_update_now(cfg);
}
+ if (config->c_description) {
+ log_debug("rpc", "change system description to %s", config->c_description);
+ free(cfg->g_config.c_description);
+ cfg->g_config.c_description = strdup(config->c_description);
+ levent_update_now(cfg);
+ }
lldpd_config_cleanup(config);
free(config);
(struct _lldpctl_atom_config_t *)atom;
struct lldpd_config config;
char *iface_pattern = NULL;
+ char *system_description = NULL;
int rc, len;
memset(&config, 0, sizeof(struct lldpd_config));
free(c->config->c_iface_pattern);
c->config->c_iface_pattern = strdup(iface_pattern);
break;
+ case lldpctl_k_config_description:
+ system_description = _lldpctl_alloc_in_atom(atom, strlen(value) + 1);
+ if (!system_description)
+ return NULL;
+ memcpy(system_description, value, len);
+ config.c_description = system_description;
+ free(c->config->c_description);
+ c->config->c_description = strdup(system_description);
+ break;
default:
SET_ERROR(atom->conn, LLDPCTL_ERR_NOT_EXIST);
return NULL;
lldpctl_k_config_mgmt_pattern, /**< `(S)` Pattern to choose the management address */
lldpctl_k_config_iface_pattern, /**< `(S,WO)` Pattern of enabled interfaces */
lldpctl_k_config_cid_pattern, /**< `(S)` Interface pattern to choose the chassis ID */
- lldpctl_k_config_description, /**< `(S)` Chassis description overridden */
+ lldpctl_k_config_description, /**< `(S,WO)` Chassis description overridden */
lldpctl_k_config_platform, /**< `(S)` Platform description overridden (CDP) */
lldpctl_k_config_advertise_version, /**< `(I)` Advertise version */
lldpctl_k_config_lldpmed_noinventory, /**< `(I)` Disable LLDP-MED inventory */