lldpd (0.7.6)
* Features:
+ Provide a way to build packages for OSX.
+ + Add an option to update interface description with neighbor name.
* Fixes:
+ Compilation fix for OSX 10.6.
/* conf*.c */
void register_commands_configure(struct cmd_node *);
-void register_commands_configure_system(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_med(struct cmd_node *, struct cmd_node *);
void register_commands_configure_dot3(struct cmd_node *);
return 1;
}
+static int
+cmd_update_descriptions(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_ifdescr_update,
+ arg?1:0) == NULL) {
+ log_warnx("lldpctl", "unable to %s interface description update: %s",
+ arg?"enable":"disable",
+ lldpctl_last_strerror(conn));
+ lldpctl_atom_dec_ref(config);
+ return 0;
+ }
+ log_info("lldpctl", "interface description update %s",
+ arg?"enabled":"disabled");
+ lldpctl_atom_dec_ref(config);
+ return 1;
+}
+
/**
* Register `configure system` commands.
*
* Those are the commands to configure protocol-independant stuff.
*/
void
-register_commands_configure_system(struct cmd_node *configure)
+register_commands_configure_system(struct cmd_node *configure,
+ struct cmd_node *unconfigure)
{
struct cmd_node *configure_system = commands_new(
configure,
"system", "System configuration",
cmd_check_no_env, NULL, "ports");
+ struct cmd_node *unconfigure_system = commands_new(
+ unconfigure,
+ "system", "System configuration",
+ cmd_check_no_env, NULL, "ports");
struct cmd_node *configure_interface = commands_new(
configure_system,
- "interface", "Configure interface related items",
+ "interface", "Interface related items",
+ NULL, NULL, NULL);
+ struct cmd_node *unconfigure_interface = commands_new(
+ unconfigure_system,
+ "interface", "Interface related items",
NULL, NULL, NULL);
commands_new(
NULL, cmd_store_env_value, "iface-pattern"),
NEWLINE, "Set active interface pattern",
NULL, cmd_iface_pattern, NULL);
+
+ commands_new(
+ commands_new(configure_interface,
+ "description", "Update interface descriptions with neighbor name",
+ NULL, NULL, NULL),
+ NEWLINE, "Update interface descriptions with neighbor name",
+ NULL, cmd_update_descriptions, "enable");
+ commands_new(
+ commands_new(unconfigure_interface,
+ "description", "Don't update interface descriptions with neighbor name",
+ NULL, NULL, NULL),
+ NEWLINE, "Don't update interface descriptions with neighbor name",
+ NULL, cmd_update_descriptions, NULL);
}
+
cmd_restrict_ports(configure);
cmd_restrict_ports(unconfigure);
- register_commands_configure_system(configure);
+ register_commands_configure_system(configure, unconfigure);
register_commands_configure_lldp(configure);
register_commands_configure_med(configure, unconfigure);
register_commands_configure_dot3(configure);
tag_datatag(w, "advertise-version", "Advertise version",
lldpctl_atom_get_int(configuration, lldpctl_k_config_advertise_version)?
"yes":"no");
+ tag_datatag(w, "ifdescr-update", "Update interface descriptions",
+ lldpctl_atom_get_int(configuration, lldpctl_k_config_ifdescr_update)?
+ "yes":"no");
tag_datatag(w, "lldpmed-no-inventory", "Disable LLDP-MED inventory",
(lldpctl_atom_get_int(configuration, lldpctl_k_config_lldpmed_noinventory) == 0)?
"no":"yes");
.Em eth2 .
.Ed
+.Cd configure
+.Cd system interface description
+.Bd -ragged -offset XXXXXX
+Some OS allows the user to set a description for an interface. Setting
+this option will enable
+.Nm lldpd
+to override this description with the name of the peer neighbor if one
+is found or with the number of neighbors found.
+.Ed
+
.Cd configure
.Cd lldp tx-interval Ar interval
.Bd -ragged -offset XXXXXX
cfg->g_config.c_platform = strdup(config->c_platform);
levent_update_now(cfg);
}
+ if (config->c_set_ifdescr != cfg->g_config.c_set_ifdescr) {
+ log_debug("rpc", "%s setting of interface description based on discovered neighbors",
+ config->c_set_ifdescr?"enable":"disable");
+ cfg->g_config.c_set_ifdescr = config->c_set_ifdescr;
+ levent_update_now(cfg);
+ }
lldpd_config_cleanup(config);
free(config);
static void
lldpd_display_neighbors(struct lldpd *cfg)
{
+ if (!cfg->g_config.c_set_ifdescr) return;
struct lldpd_hardware *hardware;
TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries) {
struct lldpd_port *port;
liblldpctl_la_SOURCES = lldpctl.h private.h errors.c connection.c atom.c atom-private.c
liblldpctl_la_LIBADD = $(top_builddir)/src/libcommon-daemon-lib.la
-liblldpctl_la_LDFLAGS = -export-symbols-regex '^lldpctl_' -version-info 4:0:0
+liblldpctl_la_LDFLAGS = -export-symbols-regex '^lldpctl_' -version-info 5:0:1
# -version-info format is `current`:`revision`:`age`. For more details, see:
# http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91
return c->config->c_receiveonly;
case lldpctl_k_config_advertise_version:
return c->config->c_advertise_version;
+ case lldpctl_k_config_ifdescr_update:
+ return c->config->c_set_ifdescr;
#ifdef ENABLE_LLDPMED
case lldpctl_k_config_lldpmed_noinventory:
return c->config->c_noinventory;
config.c_tx_interval = value;
if (value > 0) c->config->c_tx_interval = value;
break;
+ case lldpctl_k_config_ifdescr_update:
+ config.c_set_ifdescr = c->config->c_set_ifdescr = value;
+ break;
#ifdef ENABLE_LLDPMED
case lldpctl_k_config_fast_start_enabled:
config.c_enable_fast_start = value?1:2;
lldpctl_k_config_paused, /**< `(I)` lldpd is paused */
lldpctl_k_config_fast_start_enabled, /**< `(I,WO)` Is fast start enabled */
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_interface_name = 1000, /**< `(S)` The interface name. */
char *c_platform; /* Override platform description (for CDP) */
char *c_description; /* Override chassis description */
int c_advertise_version; /* Should the precise version be advertised? */
+ int c_set_ifdescr; /* Set interface description */
#ifdef ENABLE_LLDPMED
int c_noinventory; /* Don't send inventory with LLDP-MED */