From 4d1a5b3910987ae2498b7fb1eefe19876f6579a9 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 23 Jan 2012 18:05:13 +0100 Subject: [PATCH] core: SMART_HIDDEN macro does not really need the configuration --- src/agent.c | 14 +++++++------- src/client.c | 4 ++-- src/lldpd.c | 3 +-- src/lldpd.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/agent.c b/src/agent.c index fba56ee8..fe64bbaa 100644 --- a/src/agent.c +++ b/src/agent.c @@ -210,7 +210,7 @@ header_tprindexed_table(struct variable *vp, oid *name, size_t *length, if (!header_index_init(vp, name, length, exact, var_len, write_method)) return NULL; TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries) { TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(scfg, port)) continue; + if (SMART_HIDDEN(port)) continue; if (withmed && !port->p_chassis->c_med_cap_available) continue; oid index[3] = { lastchange(port), hardware->h_ifindex, @@ -253,7 +253,7 @@ header_tpripindexed_table(struct variable *vp, oid *name, size_t *length, if (!header_index_init(vp, name, length, exact, var_len, write_method)) return NULL; TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries) { TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(scfg, port)) continue; + if (SMART_HIDDEN(port)) continue; if (port->p_chassis->c_mgmt.s_addr == INADDR_ANY) continue; oid index[9] = { lastchange(port), @@ -285,7 +285,7 @@ header_tprmedindexed_table(struct variable *vp, oid *name, size_t *length, if (!header_index_init(vp, name, length, exact, var_len, write_method)) return NULL; TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries) { TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(scfg, port)) continue; + if (SMART_HIDDEN(port)) continue; if (!port->p_chassis->c_med_cap_available) continue; switch (variant) { case TPR_VARIANT_MED_POLICY: @@ -355,7 +355,7 @@ header_tprvindexed_table(struct variable *vp, oid *name, size_t *length, if (!header_index_init(vp, name, length, exact, var_len, write_method)) return NULL; TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries) { TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(scfg, port)) continue; + if (SMART_HIDDEN(port)) continue; TAILQ_FOREACH(vlan, &port->p_vlans, v_entries) { oid index[4] = { lastchange(port), hardware->h_ifindex, @@ -401,7 +401,7 @@ header_tprppvidindexed_table(struct variable *vp, oid *name, size_t *length, if (!header_index_init(vp, name, length, exact, var_len, write_method)) return NULL; TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries) { TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(scfg, port)) continue; + if (SMART_HIDDEN(port)) continue; TAILQ_FOREACH(ppvid, &port->p_ppvids, p_entries) { oid index[4] = { lastchange(port), hardware->h_ifindex, @@ -448,7 +448,7 @@ header_tprpiindexed_table(struct variable *vp, oid *name, size_t *length, if (!header_index_init(vp, name, length, exact, var_len, write_method)) return NULL; TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries) { TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(scfg, port)) continue; + if (SMART_HIDDEN(port)) continue; TAILQ_FOREACH(pi, &port->p_pids, p_entries) { oid index[4] = { lastchange(port), hardware->h_ifindex, @@ -595,7 +595,7 @@ agent_h_scalars(struct variable *vp, oid *name, size_t *length, long_ret = 0; TAILQ_FOREACH(hardware, &scfg->g_hardware, h_entries) TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(scfg, port)) continue; + if (SMART_HIDDEN(port)) continue; if (port->p_lastchange > long_ret) long_ret = port->p_lastchange; } diff --git a/src/client.c b/src/client.c index 8b5ea28b..036fa89d 100644 --- a/src/client.c +++ b/src/client.c @@ -250,7 +250,7 @@ client_handle_port_related(struct lldpd *cfg, struct hmsg *r, struct hmsg *s) p = &s->data; i = 0; TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(cfg, port)) continue; + if (SMART_HIDDEN(port)) continue; i++; } memcpy(p, &i, sizeof(int)); @@ -272,7 +272,7 @@ client_handle_port_related(struct lldpd *cfg, struct hmsg *r, struct hmsg *s) memcpy(&i, p, sizeof(int)); p = &s->data; TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (SMART_HIDDEN(cfg, port)) continue; + if (SMART_HIDDEN(port)) continue; if (i-- == 0) break; } if (!port) { diff --git a/src/lldpd.c b/src/lldpd.c index 6f592d61..7f99d9ff 100644 --- a/src/lldpd.c +++ b/src/lldpd.c @@ -898,8 +898,7 @@ lldpd_send_all(struct lldpd *cfg) TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { /* If this remote port is disabled, we don't * consider it */ - if (port->p_hidden_out && - (cfg->g_smart & SMART_OUTGOING_FILTER)) + if (port->p_hidden_out) continue; if (port->p_protocol == cfg->g_protocols[i].mode) { diff --git a/src/lldpd.h b/src/lldpd.h index 646c5246..ad9ce7da 100644 --- a/src/lldpd.h +++ b/src/lldpd.h @@ -335,7 +335,7 @@ struct protocol { #define SMART_OUTGOING (SMART_OUTGOING_FILTER | \ SMART_OUTGOING_ONE_PROTO | \ SMART_OUTGOING_ONE_NEIGH) -#define SMART_HIDDEN(cfg, port) ((cfg->g_smart & SMART_INCOMING_FILTER) && port->p_hidden_in) +#define SMART_HIDDEN(port) (port->p_hidden_in) #define CALLBACK_SIG struct lldpd*, struct lldpd_callback* -- 2.39.5