config: count the interfaces as they are added.

This information is useful to the various clock types.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-10-19 11:29:49 +02:00
parent 8f7fb11fbc
commit 63e530e297
2 changed files with 3 additions and 0 deletions

View File

@ -607,6 +607,8 @@ struct interface *config_create_interface(char *name, struct config *cfg)
strncpy(iface->name, name, MAX_IFNAME_SIZE); strncpy(iface->name, name, MAX_IFNAME_SIZE);
sk_get_ts_info(iface->name, &iface->ts_info); sk_get_ts_info(iface->name, &iface->ts_info);
STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list); STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list);
cfg->n_interfaces++;
return iface; return iface;
} }

View File

@ -41,6 +41,7 @@ struct interface {
struct config { struct config {
/* configured interfaces */ /* configured interfaces */
STAILQ_HEAD(interfaces_head, interface) interfaces; STAILQ_HEAD(interfaces_head, interface) interfaces;
int n_interfaces;
/* hash of all non-legacy items */ /* hash of all non-legacy items */
struct hash *htab; struct hash *htab;