Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame] | 1 | From 07a83c583b9d508c7040dc6254a6a7113b2ce55f Mon Sep 17 00:00:00 2001 |
| 2 | From: Aaron Conole <aconole@redhat.com> |
| 3 | Date: Mon, 3 Aug 2020 15:05:42 -0400 |
| 4 | Subject: [PATCH 2/9] lldp_head: rename and make extern |
| 5 | |
| 6 | Try to resolve this silly mod issue |
| 7 | |
| 8 | Signed-off-by: Aaron Conole <aconole@redhat.com> |
| 9 | --- |
| 10 | config.c | 4 ++-- |
| 11 | event_iface.c | 4 ++-- |
| 12 | include/lldp_mod.h | 2 +- |
| 13 | lldp/agent.c | 2 +- |
| 14 | lldp/rx.c | 4 ++-- |
| 15 | lldp/tx.c | 4 ++-- |
| 16 | lldp_dcbx.c | 8 ++++---- |
| 17 | lldp_mand_cmds.c | 8 ++++---- |
| 18 | lldpad.c | 12 +++++++----- |
| 19 | lldptool.c | 14 ++++++++------ |
| 20 | lldptool_cmds.c | 2 +- |
| 21 | qbg/ecp22.c | 8 ++++---- |
| 22 | qbg/vdp.c | 4 ++-- |
| 23 | qbg/vdp22.c | 6 +++--- |
| 24 | qbg/vdp22_cmds.c | 2 +- |
| 25 | vdptool.c | 16 +++++++++------- |
| 26 | 16 files changed, 53 insertions(+), 47 deletions(-) |
| 27 | |
| 28 | diff --git a/config.c b/config.c |
| 29 | index be458fd..bc3fbae 100644 |
| 30 | --- a/config.c |
| 31 | +++ b/config.c |
| 32 | @@ -185,7 +185,7 @@ void scan_port(UNUSED void *eloop_data, UNUSED void *user_ctx) |
| 33 | LIST_FOREACH(agent, &port->agent_head, entry) { |
| 34 | LLDPAD_DBG("%s: calling ifdown for agent %p.\n", |
| 35 | __func__, agent); |
| 36 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 37 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 38 | ops = np->ops; |
| 39 | if (ops->lldp_mod_ifdown) |
| 40 | ops->lldp_mod_ifdown(ifname, agent); |
| 41 | @@ -394,7 +394,7 @@ void init_ports(void) |
| 42 | LIST_FOREACH(agent, &port->agent_head, entry) { |
| 43 | LLDPAD_DBG("%s: calling ifup for agent %p.\n", |
| 44 | __func__, agent); |
| 45 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 46 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 47 | if (np->ops->lldp_mod_ifup) |
| 48 | np->ops->lldp_mod_ifup(p->if_name, agent); |
| 49 | } |
| 50 | diff --git a/event_iface.c b/event_iface.c |
| 51 | index 43a95c7..1be2963 100644 |
| 52 | --- a/event_iface.c |
| 53 | +++ b/event_iface.c |
| 54 | @@ -216,7 +216,7 @@ int oper_add_device(char *device_name) |
| 55 | LIST_FOREACH(agent, &port->agent_head, entry) { |
| 56 | LLDPAD_DBG("%s: calling ifup for agent %p.\n", |
| 57 | __func__, agent); |
| 58 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 59 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 60 | if (np->ops->lldp_mod_ifup) |
| 61 | np->ops->lldp_mod_ifup(device_name, agent); |
| 62 | } |
| 63 | @@ -283,7 +283,7 @@ static void event_if_decode_nlmsg(int route_type, void *data, int len) |
| 64 | LIST_FOREACH(agent, &port->agent_head, entry) { |
| 65 | LLDPAD_DBG("%s: calling ifdown for agent %p.\n", |
| 66 | __func__, agent); |
| 67 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 68 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 69 | ops = np->ops; |
| 70 | if (ops->lldp_mod_ifdown) |
| 71 | ops->lldp_mod_ifdown(device_name, |
| 72 | diff --git a/include/lldp_mod.h b/include/lldp_mod.h |
| 73 | index 49a50e4..9733595 100644 |
| 74 | --- a/include/lldp_mod.h |
| 75 | +++ b/include/lldp_mod.h |
| 76 | @@ -96,7 +96,7 @@ struct lldp_module { |
| 77 | }; |
| 78 | |
| 79 | LIST_HEAD(lldp_head, lldp_module); |
| 80 | -struct lldp_head lldp_head; |
| 81 | +extern struct lldp_head lldp_mod_head; |
| 82 | |
| 83 | static inline struct lldp_module *find_module_by_id(struct lldp_head *head, int id) |
| 84 | { |
| 85 | diff --git a/lldp/agent.c b/lldp/agent.c |
| 86 | index 333929a..aa4a8d1 100644 |
| 87 | --- a/lldp/agent.c |
| 88 | +++ b/lldp/agent.c |
| 89 | @@ -163,7 +163,7 @@ static void timer(UNUSED void *eloop_data, UNUSED void *user_ctx) |
| 90 | run_rx_sm(port, agent); |
| 91 | update_rx_timers(agent); |
| 92 | |
| 93 | - LIST_FOREACH(n, &lldp_head, lldp) { |
| 94 | + LIST_FOREACH(n, &lldp_mod_head, lldp) { |
| 95 | if (n->ops && n->ops->timer) |
| 96 | n->ops->timer(port, agent); |
| 97 | } |
| 98 | diff --git a/lldp/rx.c b/lldp/rx.c |
| 99 | index 12d07bc..43aeeba 100644 |
| 100 | --- a/lldp/rx.c |
| 101 | +++ b/lldp/rx.c |
| 102 | @@ -359,7 +359,7 @@ void rxProcessFrame(struct port *port, struct lldp_agent *agent) |
| 103 | } |
| 104 | |
| 105 | /* rx per lldp module */ |
| 106 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 107 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 108 | if (!np->ops || !np->ops->lldp_mod_rchange) |
| 109 | continue; |
| 110 | |
| 111 | @@ -402,7 +402,7 @@ u8 mibDeleteObjects(struct port *port, struct lldp_agent *agent) |
| 112 | { |
| 113 | struct lldp_module *np; |
| 114 | |
| 115 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 116 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 117 | if (!np->ops || !np->ops->lldp_mod_mibdelete) |
| 118 | continue; |
| 119 | np->ops->lldp_mod_mibdelete(port, agent); |
| 120 | diff --git a/lldp/tx.c b/lldp/tx.c |
| 121 | index c3a5c62..0746e34 100644 |
| 122 | --- a/lldp/tx.c |
| 123 | +++ b/lldp/tx.c |
| 124 | @@ -71,7 +71,7 @@ bool mibConstrInfoLLDPDU(struct port *port, struct lldp_agent *agent) |
| 125 | fb_offset += sizeof(struct l2_ethhdr); |
| 126 | |
| 127 | /* Generic TLV Pack */ |
| 128 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 129 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 130 | if (!np->ops || !np->ops->lldp_mod_gettlv) |
| 131 | continue; |
| 132 | |
| 133 | @@ -206,7 +206,7 @@ bool mibConstrShutdownLLDPDU(struct port *port, struct lldp_agent *agent) |
| 134 | memcpy(agent->tx.frameout, (void *)ð, sizeof(struct l2_ethhdr)); |
| 135 | fb_offset += sizeof(struct l2_ethhdr); |
| 136 | |
| 137 | - np = find_module_by_id(&lldp_head, LLDP_MOD_MAND); |
| 138 | + np = find_module_by_id(&lldp_mod_head, LLDP_MOD_MAND); |
| 139 | if (!np) |
| 140 | goto error; |
| 141 | if (!np->ops || !np->ops->lldp_mod_gettlv) |
| 142 | diff --git a/lldp_dcbx.c b/lldp_dcbx.c |
| 143 | index 7e53c0f..809086f 100644 |
| 144 | --- a/lldp_dcbx.c |
| 145 | +++ b/lldp_dcbx.c |
| 146 | @@ -129,7 +129,7 @@ struct dcbx_tlvs *dcbx_data(const char *ifname) |
| 147 | struct dcbd_user_data *dud; |
| 148 | struct dcbx_tlvs *tlv = NULL; |
| 149 | |
| 150 | - dud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_DCBX); |
| 151 | + dud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_DCBX); |
| 152 | if (dud) { |
| 153 | LIST_FOREACH(tlv, &dud->head, entry) { |
| 154 | if (!strncmp(tlv->ifname, ifname, IFNAMSIZ)) |
| 155 | @@ -148,7 +148,7 @@ int dcbx_tlvs_rxed(const char *ifname, struct lldp_agent *agent) |
| 156 | if (agent->type != NEAREST_BRIDGE) |
| 157 | return 0; |
| 158 | |
| 159 | - dud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_DCBX); |
| 160 | + dud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_DCBX); |
| 161 | if (dud) { |
| 162 | LIST_FOREACH(tlv, &dud->head, entry) { |
| 163 | if (!strncmp(tlv->ifname, ifname, IFNAMSIZ)) |
| 164 | @@ -172,7 +172,7 @@ int dcbx_check_active(const char *ifname) |
| 165 | struct dcbd_user_data *dud; |
| 166 | struct dcbx_tlvs *tlv = NULL; |
| 167 | |
| 168 | - dud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_DCBX); |
| 169 | + dud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_DCBX); |
| 170 | if (dud) { |
| 171 | LIST_FOREACH(tlv, &dud->head, entry) { |
| 172 | if (!strncmp(tlv->ifname, ifname, IFNAMSIZ)) |
| 173 | @@ -507,7 +507,7 @@ void dcbx_ifup(char *ifname, struct lldp_agent *agent) |
| 174 | ifindex = get_ifidx(ifname); |
| 175 | port = port_find_by_ifindex(ifindex); |
| 176 | |
| 177 | - dud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_DCBX); |
| 178 | + dud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_DCBX); |
| 179 | tlvs = dcbx_data(ifname); |
| 180 | |
| 181 | if (!port) |
| 182 | diff --git a/lldp_mand_cmds.c b/lldp_mand_cmds.c |
| 183 | index 8a88177..1c43bf4 100644 |
| 184 | --- a/lldp_mand_cmds.c |
| 185 | +++ b/lldp_mand_cmds.c |
| 186 | @@ -466,7 +466,7 @@ int handle_get_args(struct cmd *cmd, UNUSED char *arg, char *argvalue, |
| 187 | nbuf = obuf; |
| 188 | nbuf_len = obuf_len; |
| 189 | |
| 190 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 191 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 192 | if (!np->ops->get_arg_handler) |
| 193 | continue; |
| 194 | if (!(ah = np->ops->get_arg_handler())) |
| 195 | @@ -496,7 +496,7 @@ int handle_get_arg(struct cmd *cmd, char *arg, char *argvalue, |
| 196 | struct arg_handlers *ah; |
| 197 | int rval, status = cmd_not_applicable; |
| 198 | |
| 199 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 200 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 201 | if (!np->ops->get_arg_handler) |
| 202 | continue; |
| 203 | if (!(ah = np->ops->get_arg_handler())) |
| 204 | @@ -593,7 +593,7 @@ int handle_test_arg(struct cmd *cmd, char *arg, char *argvalue, |
| 205 | struct arg_handlers *ah; |
| 206 | int rval, status = cmd_not_applicable; |
| 207 | |
| 208 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 209 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 210 | if (!np->ops->get_arg_handler) |
| 211 | continue; |
| 212 | if (!(ah = np->ops->get_arg_handler())) |
| 213 | @@ -626,7 +626,7 @@ int handle_set_arg(struct cmd *cmd, char *arg, char *argvalue, |
| 214 | struct arg_handlers *ah; |
| 215 | int rval, status = cmd_not_applicable; |
| 216 | |
| 217 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 218 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 219 | if (!np->ops->get_arg_handler) |
| 220 | continue; |
| 221 | if (!(ah = np->ops->get_arg_handler())) |
| 222 | diff --git a/lldpad.c b/lldpad.c |
| 223 | index 01fb588..65e92c7 100644 |
| 224 | --- a/lldpad.c |
| 225 | +++ b/lldpad.c |
| 226 | @@ -80,6 +80,8 @@ struct lldp_module *(*register_tlv_table[])(void) = { |
| 227 | NULL, |
| 228 | }; |
| 229 | |
| 230 | +struct lldp_head lldp_mod_head; |
| 231 | + |
| 232 | char *cfg_file_name = NULL; |
| 233 | bool daemonize = 0; |
| 234 | int loglvl = LOG_WARNING; |
| 235 | @@ -98,7 +100,7 @@ static void init_modules(void) |
| 236 | struct lldp_module *premod = NULL; |
| 237 | int i = 0; |
| 238 | |
| 239 | - LIST_INIT(&lldp_head); |
| 240 | + LIST_INIT(&lldp_mod_head); |
| 241 | for (i = 0; register_tlv_table[i]; i++) { |
| 242 | module = register_tlv_table[i](); |
| 243 | if (!module) |
| 244 | @@ -106,7 +108,7 @@ static void init_modules(void) |
| 245 | if (premod) |
| 246 | LIST_INSERT_AFTER(premod, module, lldp); |
| 247 | else |
| 248 | - LIST_INSERT_HEAD(&lldp_head, module, lldp); |
| 249 | + LIST_INSERT_HEAD(&lldp_mod_head, module, lldp); |
| 250 | premod = module; |
| 251 | } |
| 252 | } |
| 253 | @@ -115,9 +117,9 @@ void deinit_modules(void) |
| 254 | { |
| 255 | struct lldp_module *module; |
| 256 | |
| 257 | - while (lldp_head.lh_first != NULL) { |
| 258 | - module = lldp_head.lh_first; |
| 259 | - LIST_REMOVE(lldp_head.lh_first, lldp); |
| 260 | + while (lldp_mod_head.lh_first != NULL) { |
| 261 | + module = lldp_mod_head.lh_first; |
| 262 | + LIST_REMOVE(lldp_mod_head.lh_first, lldp); |
| 263 | module->ops->lldp_mod_unregister(module); |
| 264 | } |
| 265 | } |
| 266 | diff --git a/lldptool.c b/lldptool.c |
| 267 | index 2b14f61..664a248 100644 |
| 268 | --- a/lldptool.c |
| 269 | +++ b/lldptool.c |
| 270 | @@ -64,6 +64,8 @@ |
| 271 | #include "lldp_util.h" |
| 272 | #include "lldpad_status.h" |
| 273 | |
| 274 | +struct lldp_head lldp_mod_head; |
| 275 | + |
| 276 | static int show_raw; |
| 277 | |
| 278 | static const char *cli_version = |
| 279 | @@ -199,7 +201,7 @@ static void init_modules(void) |
| 280 | if (premod) |
| 281 | LIST_INSERT_AFTER(premod, module, lldp); |
| 282 | else |
| 283 | - LIST_INSERT_HEAD(&lldp_head, module, lldp); |
| 284 | + LIST_INSERT_HEAD(&lldp_mod_head, module, lldp); |
| 285 | premod = module; |
| 286 | } |
| 287 | } |
| 288 | @@ -208,9 +210,9 @@ void deinit_modules(void) |
| 289 | { |
| 290 | struct lldp_module *module; |
| 291 | |
| 292 | - while (lldp_head.lh_first != NULL) { |
| 293 | - module = lldp_head.lh_first; |
| 294 | - LIST_REMOVE(lldp_head.lh_first, lldp); |
| 295 | + while (lldp_mod_head.lh_first != NULL) { |
| 296 | + module = lldp_mod_head.lh_first; |
| 297 | + LIST_REMOVE(lldp_mod_head.lh_first, lldp); |
| 298 | module->ops->lldp_mod_unregister(module); |
| 299 | } |
| 300 | } |
| 301 | @@ -346,7 +348,7 @@ cli_cmd_help(UNUSED struct clif *clif, UNUSED int argc, UNUSED char *argv[], |
| 302 | printf("%s\n%s\n%s", commands_usage, commands_options, commands_help); |
| 303 | |
| 304 | printf("\nTLV identifiers:\n"); |
| 305 | - LIST_FOREACH(np, &lldp_head, lldp) |
| 306 | + LIST_FOREACH(np, &lldp_mod_head, lldp) |
| 307 | if (np->ops->print_help) |
| 308 | np->ops->print_help(); |
| 309 | return 0; |
| 310 | @@ -406,7 +408,7 @@ u32 lookup_tlvid(char *tlvid_str) |
| 311 | struct lldp_module *np; |
| 312 | u32 tlvid = INVALID_TLVID; |
| 313 | |
| 314 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 315 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 316 | if (np->ops->lookup_tlv_name) { |
| 317 | tlvid = np->ops->lookup_tlv_name(tlvid_str); |
| 318 | if (tlvid != INVALID_TLVID) |
| 319 | diff --git a/lldptool_cmds.c b/lldptool_cmds.c |
| 320 | index daef8c8..70b7b0d 100644 |
| 321 | --- a/lldptool_cmds.c |
| 322 | +++ b/lldptool_cmds.c |
| 323 | @@ -464,7 +464,7 @@ static void print_tlvs(struct cmd *cmd, char *ibuf) |
| 324 | offset += 8; |
| 325 | |
| 326 | printed = 0; |
| 327 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 328 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 329 | if (np->ops->print_tlv(tlvid, tlv_len, ibuf+offset)) { |
| 330 | printed = 1; |
| 331 | break; |
| 332 | diff --git a/qbg/ecp22.c b/qbg/ecp22.c |
| 333 | index 6561d14..825392b 100644 |
| 334 | --- a/qbg/ecp22.c |
| 335 | +++ b/qbg/ecp22.c |
| 336 | @@ -774,7 +774,7 @@ void ecp22_start(char *ifname) |
| 337 | struct ecp22 *ecp; |
| 338 | |
| 339 | LLDPAD_DBG("%s:%s start ecp\n", __func__, ifname); |
| 340 | - eud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_ECP22); |
| 341 | + eud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_ECP22); |
| 342 | if (!eud) { |
| 343 | LLDPAD_DBG("%s:%s no ECP module\n", __func__, ifname); |
| 344 | return; |
| 345 | @@ -837,7 +837,7 @@ void ecp22_stop(char *ifname) |
| 346 | struct ecp22 *ecp; |
| 347 | |
| 348 | LLDPAD_DBG("%s:%s stop ecp\n", __func__, ifname); |
| 349 | - eud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_ECP22); |
| 350 | + eud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_ECP22); |
| 351 | ecp = find_ecpdata(ifname, eud); |
| 352 | if (ecp) |
| 353 | ecp22_remove(ecp); |
| 354 | @@ -852,7 +852,7 @@ static int ecp22_data_from_evb(char *ifname, struct evb22_to_ecp22 *ptr) |
| 355 | struct ecp22_user_data *eud; |
| 356 | struct ecp22 *ecp; |
| 357 | |
| 358 | - eud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_ECP22); |
| 359 | + eud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_ECP22); |
| 360 | ecp = find_ecpdata(ifname, eud); |
| 361 | if (ecp) { |
| 362 | ecp->max_rte = ptr->max_rte; |
| 363 | @@ -930,7 +930,7 @@ static int ecp22_req2send(char *ifname, unsigned short subtype, |
| 364 | |
| 365 | LLDPAD_DBG("%s:%s subtype:%d\n", __func__, ifname, subtype); |
| 366 | |
| 367 | - eud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_ECP22); |
| 368 | + eud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_ECP22); |
| 369 | ecp = find_ecpdata(ifname, eud); |
| 370 | if (!ecp) { |
| 371 | rc = -ENODEV; |
| 372 | diff --git a/qbg/vdp.c b/qbg/vdp.c |
| 373 | index d131560..c26bbd6 100644 |
| 374 | --- a/qbg/vdp.c |
| 375 | +++ b/qbg/vdp.c |
| 376 | @@ -188,7 +188,7 @@ struct vdp_data *vdp_data(char *ifname) |
| 377 | struct vdp_user_data *ud; |
| 378 | struct vdp_data *vd = NULL; |
| 379 | |
| 380 | - ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_VDP02); |
| 381 | + ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_VDP02); |
| 382 | if (ud) { |
| 383 | LIST_FOREACH(vd, &ud->head, entry) { |
| 384 | if (!strncmp(ifname, vd->ifname, IFNAMSIZ)) |
| 385 | @@ -1624,7 +1624,7 @@ void vdp_ifup(char *ifname, struct lldp_agent *agent) |
| 386 | |
| 387 | LIST_INIT(&vd->profile_head); |
| 388 | |
| 389 | - ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_VDP02); |
| 390 | + ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_VDP02); |
| 391 | LIST_INSERT_HEAD(&ud->head, vd, entry); |
| 392 | |
| 393 | out_start_again: |
| 394 | diff --git a/qbg/vdp22.c b/qbg/vdp22.c |
| 395 | index cf02310..81ea3a8 100644 |
| 396 | --- a/qbg/vdp22.c |
| 397 | +++ b/qbg/vdp22.c |
| 398 | @@ -694,7 +694,7 @@ static struct vdp22 *vdp22_findif(const char *ifname, |
| 399 | struct vdp22 *vdp = 0; |
| 400 | |
| 401 | if (!ud) { |
| 402 | - ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_VDP22); |
| 403 | + ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_VDP22); |
| 404 | if (!ud) |
| 405 | LLDPAD_DBG("%s:%s no VDP22 module\n", __func__, |
| 406 | ifname); |
| 407 | @@ -794,7 +794,7 @@ void vdp22_stop(char *ifname) |
| 408 | struct vsi22 *vsi; |
| 409 | |
| 410 | LLDPAD_DBG("%s:%s stop vdp\n", __func__, ifname); |
| 411 | - vud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_VDP22); |
| 412 | + vud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_VDP22); |
| 413 | if (!vud) { |
| 414 | LLDPAD_ERR("%s:%s no VDP22 module\n", __func__, ifname); |
| 415 | return; |
| 416 | @@ -874,7 +874,7 @@ void vdp22_start(const char *ifname, int role) |
| 417 | struct vsi22 *vsi; |
| 418 | |
| 419 | LLDPAD_DBG("%s:%s start vdp\n", __func__, ifname); |
| 420 | - vud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_VDP22); |
| 421 | + vud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_VDP22); |
| 422 | if (!vud) { |
| 423 | LLDPAD_ERR("%s:%s no VDP22 module\n", __func__, ifname); |
| 424 | return; |
| 425 | diff --git a/qbg/vdp22_cmds.c b/qbg/vdp22_cmds.c |
| 426 | index 2e1bbbd..a8025ee 100644 |
| 427 | --- a/qbg/vdp22_cmds.c |
| 428 | +++ b/qbg/vdp22_cmds.c |
| 429 | @@ -57,7 +57,7 @@ static struct lldp_module *get_my_module(int thisid) |
| 430 | { |
| 431 | struct lldp_module *np = NULL; |
| 432 | |
| 433 | - LIST_FOREACH(np, &lldp_head, lldp) |
| 434 | + LIST_FOREACH(np, &lldp_mod_head, lldp) |
| 435 | if (thisid == np->id) |
| 436 | break; |
| 437 | return np; |
| 438 | diff --git a/vdptool.c b/vdptool.c |
| 439 | index 8f36277..f1d946c 100644 |
| 440 | --- a/vdptool.c |
| 441 | +++ b/vdptool.c |
| 442 | @@ -61,6 +61,8 @@ |
| 443 | #define OUI_ENCODE_HNDLR(name) name##_oui_encode_hndlr |
| 444 | #define OUI_PRNT_DECODE_HNDLR(name) name##_oui_print_decode_hndlr |
| 445 | |
| 446 | +struct lldp_head lldp_mod_head; |
| 447 | + |
| 448 | #define EXTERN_OUI_FN(name) \ |
| 449 | extern bool name##_oui_encode_hndlr(char *, char *, size_t); \ |
| 450 | extern void name##_oui_print_decode_hndlr(char *) |
| 451 | @@ -796,13 +798,13 @@ static void init_modules(void) |
| 452 | struct lldp_module *premod = NULL; |
| 453 | int i = 0; |
| 454 | |
| 455 | - LIST_INIT(&lldp_head); |
| 456 | + LIST_INIT(&lldp_mod_head); |
| 457 | for (i = 0; register_tlv_table[i]; i++) { |
| 458 | module = register_tlv_table[i](); |
| 459 | if (premod) |
| 460 | LIST_INSERT_AFTER(premod, module, lldp); |
| 461 | else |
| 462 | - LIST_INSERT_HEAD(&lldp_head, module, lldp); |
| 463 | + LIST_INSERT_HEAD(&lldp_mod_head, module, lldp); |
| 464 | premod = module; |
| 465 | } |
| 466 | } |
| 467 | @@ -811,9 +813,9 @@ void deinit_modules(void) |
| 468 | { |
| 469 | struct lldp_module *module; |
| 470 | |
| 471 | - while (lldp_head.lh_first != NULL) { |
| 472 | - module = lldp_head.lh_first; |
| 473 | - LIST_REMOVE(lldp_head.lh_first, lldp); |
| 474 | + while (lldp_mod_head.lh_first != NULL) { |
| 475 | + module = lldp_mod_head.lh_first; |
| 476 | + LIST_REMOVE(lldp_mod_head.lh_first, lldp); |
| 477 | module->ops->lldp_mod_unregister(module); |
| 478 | } |
| 479 | } |
| 480 | @@ -953,7 +955,7 @@ cli_cmd_help(UNUSED struct clif *clif, UNUSED int argc, UNUSED char *argv[], |
| 481 | printf("%s\n%s\n%s", commands_usage, commands_options, commands_help); |
| 482 | |
| 483 | printf("\nTLV identifiers:\n"); |
| 484 | - LIST_FOREACH(np, &lldp_head, lldp) |
| 485 | + LIST_FOREACH(np, &lldp_mod_head, lldp) |
| 486 | if (np->ops->print_help) |
| 487 | np->ops->print_help(); |
| 488 | return 0; |
| 489 | @@ -1006,7 +1008,7 @@ u32 lookup_tlvid(char *tlvid_str) |
| 490 | struct lldp_module *np; |
| 491 | u32 tlvid = INVALID_TLVID; |
| 492 | |
| 493 | - LIST_FOREACH(np, &lldp_head, lldp) { |
| 494 | + LIST_FOREACH(np, &lldp_mod_head, lldp) { |
| 495 | if (np->ops->lookup_tlv_name) { |
| 496 | tlvid = np->ops->lookup_tlv_name(tlvid_str); |
| 497 | if (tlvid != INVALID_TLVID) |
| 498 | -- |
| 499 | 2.28.0 |
| 500 | |