Skip to content

Commit e617c23

Browse files
committed
lldp_head: remove all references
There were a number of references missed during the module cleanup. This hits the remaining ones. Fixes: 07a83c5 ("lldp_head: rename and make extern") Signed-off-by: Aaron Conole <[email protected]> (cherry picked from commit ed6a8e5)
1 parent 173d482 commit e617c23

File tree

9 files changed

+21
-37
lines changed

9 files changed

+21
-37
lines changed

ctrl_iface.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
#include "lldp_util.h"
5454
#include "messages.h"
5555

56-
extern struct lldp_head lldp_head;
57-
5856
struct ctrl_dst {
5957
struct ctrl_dst *next;
6058
struct sockaddr_un addr;
@@ -116,7 +114,7 @@ int clif_iface_module(struct clif_data *clifd,
116114
return cmd_invalid;
117115
}
118116

119-
mod = find_module_by_id(&lldp_head, module_id);
117+
mod = find_module_by_id(&lldp_mod_head, module_id);
120118
if (mod && mod->ops && mod->ops->client_cmd)
121119
return (mod->ops->client_cmd)(clifd, from, fromlen,
122120
cmd_start, cmd_len, rbuf+strlen(rbuf), rlen);

lldp_8021qaz.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#include "lldp_dcbx.h"
4949

5050

51-
struct lldp_head lldp_head;
5251
extern config_t lldpad_cfg;
5352
extern bool read_only_8021qaz;
5453

@@ -84,7 +83,7 @@ static int ieee8021qaz_check_pending(struct port *port,
8483
if (!port->portEnabled)
8584
return 0;
8685

87-
iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ);
86+
iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ);
8887
if (iud) {
8988
LIST_FOREACH(tlv, &iud->head, entry) {
9089
if (!strncmp(port->ifname, tlv->ifname, IFNAMSIZ)) {
@@ -143,7 +142,7 @@ struct ieee8021qaz_tlvs *ieee8021qaz_data(const char *ifname)
143142
struct ieee8021qaz_user_data *iud;
144143
struct ieee8021qaz_tlvs *tlv = NULL;
145144

146-
iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ);
145+
iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ);
147146
if (iud) {
148147
LIST_FOREACH(tlv, &iud->head, entry) {
149148
if (!strncmp(tlv->ifname, ifname, IFNAMSIZ))
@@ -629,7 +628,7 @@ void ieee8021qaz_ifup(char *ifname, struct lldp_agent *agent)
629628
LIST_INIT(&tlvs->app_head);
630629
read_cfg_file(port->ifname, agent, tlvs);
631630

632-
iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ);
631+
iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ);
633632
LIST_INSERT_HEAD(&iud->head, tlvs, entry);
634633

635634
initialized:
@@ -2179,7 +2178,7 @@ int ieee8021qaz_tlvs_rxed(const char *ifname)
21792178
struct ieee8021qaz_user_data *iud;
21802179
struct ieee8021qaz_tlvs *tlv = NULL;
21812180

2182-
iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ);
2181+
iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ);
21832182
if (iud) {
21842183
LIST_FOREACH(tlv, &iud->head, entry) {
21852184
if (!strncmp(tlv->ifname, ifname, IFNAMSIZ))
@@ -2198,7 +2197,7 @@ int ieee8021qaz_check_active(const char *ifname)
21982197
struct ieee8021qaz_user_data *iud;
21992198
struct ieee8021qaz_tlvs *tlv = NULL;
22002199

2201-
iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ);
2200+
iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ);
22022201
if (iud) {
22032202
LIST_FOREACH(tlv, &iud->head, entry) {
22042203
if (!strncmp(tlv->ifname, ifname, IFNAMSIZ))

lldp_8023.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
#include "lldp_8023_clif.h"
4040
#include "lldp_8023_cmds.h"
4141

42-
extern struct lldp_head lldp_head;
43-
4442
struct tlv_info_8023_maccfg {
4543
u8 oui[3];
4644
u8 sub;
@@ -84,7 +82,7 @@ static struct ieee8023_data *ieee8023_data(const char *ifname, enum agent_type t
8482
struct ieee8023_user_data *ud;
8583
struct ieee8023_data *bd = NULL;
8684

87-
ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8023);
85+
ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8023);
8886
if (ud) {
8987
LIST_FOREACH(bd, &ud->head, entry) {
9088
if (!strncmp(ifname, bd->ifname, IFNAMSIZ) &&
@@ -456,7 +454,7 @@ void ieee8023_ifup(char *ifname, struct lldp_agent *agent)
456454
goto out_err;
457455
}
458456

459-
ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8023);
457+
ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8023);
460458
LIST_INSERT_HEAD(&ud->head, bd, entry);
461459
LLDPAD_INFO("%s:port %s added\n", __func__, ifname);
462460
return;

lldp_basman.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ struct tlv_info_manaddr {
7575
struct tlv_info_maoid o;
7676
} __attribute__ ((__packed__));
7777

78-
extern struct lldp_head lldp_head;
79-
8078
static const struct lldp_mod_ops basman_ops = {
8179
.lldp_mod_register = basman_register,
8280
.lldp_mod_unregister = basman_unregister,
@@ -91,7 +89,7 @@ static struct basman_data *basman_data(const char *ifname, enum agent_type type)
9189
struct basman_user_data *bud;
9290
struct basman_data *bd = NULL;
9391

94-
bud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_BASIC);
92+
bud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_BASIC);
9593
if (bud) {
9694
LIST_FOREACH(bd, &bud->head, entry) {
9795
if (!strncmp(ifname, bd->ifname, IFNAMSIZ) &&
@@ -688,7 +686,7 @@ void basman_ifup(char *ifname, struct lldp_agent *agent)
688686
goto out_err;
689687
}
690688

691-
bud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_BASIC);
689+
bud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_BASIC);
692690
LIST_INSERT_HEAD(&bud->head, bd, entry);
693691
LLDPAD_DBG("%s:port %s added\n", __func__, ifname);
694692
return;

lldp_evb.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@
3636
#include "messages.h"
3737
#include "config.h"
3838

39-
extern struct lldp_head lldp_head;
40-
4139
struct evb_data *evb_data(char *ifname, enum agent_type type)
4240
{
4341
struct evb_user_data *ud;
4442
struct evb_data *ed = NULL;
4543

46-
ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB);
44+
ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_EVB);
4745
if (ud) {
4846
LIST_FOREACH(ed, &ud->head, entry) {
4947
if (!strncmp(ifname, ed->ifname, IFNAMSIZ) &&
@@ -347,7 +345,7 @@ static void evb_ifup(char *ifname, struct lldp_agent *agent)
347345

348346
evb_init_tlv(ed, agent);
349347

350-
ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB);
348+
ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_EVB);
351349
LIST_INSERT_HEAD(&ud->head, ed, entry);
352350
LLDPAD_DBG("%s:%s agent %d added\n", __func__, ifname, agent->type);
353351
}

lldp_evb22.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@
3737
#include "messages.h"
3838
#include "config.h"
3939

40-
extern struct lldp_head lldp_head;
41-
4240
struct evb22_data *evb22_data(char *ifname, enum agent_type type)
4341
{
4442
struct evb22_user_data *ud;
4543
struct evb22_data *ed = NULL;
4644

47-
ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB22);
45+
ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_EVB22);
4846
if (ud) {
4947
LIST_FOREACH(ed, &ud->head, entry) {
5048
if (!strncmp(ifname, ed->ifname, IFNAMSIZ) &&
@@ -453,7 +451,7 @@ static void evb22_ifup(char *ifname, struct lldp_agent *agent)
453451
STRNCPY_TERMINATED(ed->ifname, ifname, IFNAMSIZ);
454452
ed->agenttype = agent->type;
455453
evb22_init_tlv(ed, agent);
456-
ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB22);
454+
ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_EVB22);
457455
LIST_INSERT_HEAD(&ud->head, ed, entry);
458456
LLDPAD_DBG("%s:%s agent %d added\n", __func__, ifname, agent->type);
459457
}

lldp_mand.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
#include "lldp/l2_packet.h"
4343
#include "lldp_tlv.h"
4444

45-
extern struct lldp_head lldp_head;
46-
4745
static const struct lldp_mod_ops mand_ops = {
4846
.lldp_mod_register = mand_register,
4947
.lldp_mod_unregister = mand_unregister,
@@ -59,7 +57,7 @@ struct mand_data *mand_data(const char *ifname, enum agent_type type)
5957
struct mand_user_data *mud;
6058
struct mand_data *md = NULL;
6159

62-
mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MAND);
60+
mud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_MAND);
6361
if (mud) {
6462
LIST_FOREACH(md, &mud->head, entry) {
6563
if (!strncmp(ifname, md->ifname, IFNAMSIZ) &&
@@ -610,7 +608,7 @@ void mand_ifup(char *ifname, struct lldp_agent *agent)
610608
STRNCPY_TERMINATED(md->ifname, ifname, IFNAMSIZ);
611609
md->agenttype = agent->type;
612610

613-
mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MAND);
611+
mud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_MAND);
614612
LIST_INSERT_HEAD(&mud->head, md, entry);
615613
}
616614

@@ -638,16 +636,16 @@ struct lldp_module *mand_register(void)
638636
LLDPAD_ERR("failed to malloc LLDP Mandatory module data\n");
639637
goto out_err;
640638
}
641-
mud = malloc(sizeof(struct mand_user_data));
639+
mud = malloc(sizeof(struct mand_user_data));
642640
if (!mud) {
643641
free(mod);
644642
LLDPAD_ERR("failed to malloc LLDP Mandatory module user data\n");
645643
goto out_err;
646644
}
647645
LIST_INIT(&mud->head);
648646
mod->id = LLDP_MOD_MAND;
647+
mod->data = mud;
649648
mod->ops = &mand_ops;
650-
mod->data = mud;
651649
LLDPAD_INFO("%s:done\n", __func__);
652650
return mod;
653651
out_err:

lldp_med.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
#include "lldp_mand_clif.h"
4141
#include "lldp_med_cmds.h"
4242

43-
extern struct lldp_head lldp_head;
44-
4543
struct tlv_info_medcaps {
4644
u8 oui[OUI_SIZE];
4745
u8 subtype;
@@ -95,7 +93,7 @@ static struct med_data *med_data(const char *ifname, enum agent_type type)
9593
struct med_user_data *mud;
9694
struct med_data *md = NULL;
9795

98-
mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MED);
96+
mud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_MED);
9997
if (mud) {
10098
LIST_FOREACH(md, &mud->head, entry) {
10199
if (!strncmp(ifname, md->ifname, IFNAMSIZ) &&
@@ -914,7 +912,7 @@ void med_ifup(char *ifname, struct lldp_agent *agent)
914912
free(md);
915913
goto out_err;
916914
}
917-
mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MED);
915+
mud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_MED);
918916
LIST_INSERT_HEAD(&mud->head, md, entry);
919917
LLDPAD_INFO("%s:port %s added\n", __func__, ifname);
920918
return;

qbg_utils.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "qbg_utils.h"
3737

3838
extern int loglvl; /* Global lldpad log level */
39-
extern struct lldp_head lldp_head;
4039

4140
/*
4241
* hexdump_frame - print raw evb/ecp/vdp frame
@@ -73,7 +72,7 @@ void hexdump_frame(const char *ifname, char *txt, const unsigned char *buf,
7372
*/
7473
int modules_notify(int id, int sender_id, char *ifname, void *data)
7574
{
76-
struct lldp_module *mp = find_module_by_id(&lldp_head, id);
75+
struct lldp_module *mp = find_module_by_id(&lldp_mod_head, id);
7776
int rc = 0;
7877

7978
if (mp && mp->ops->lldp_mod_notify)

0 commit comments

Comments
 (0)