diff options
Diffstat (limited to 'meta-networking')
10 files changed, 882 insertions, 1 deletions
diff --git a/meta-networking/recipes-protocols/openlldp/files/0001-cmds-fix-enum-conversion.patch b/meta-networking/recipes-protocols/openlldp/files/0001-cmds-fix-enum-conversion.patch new file mode 100644 index 000000000..680f6b67d --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0001-cmds-fix-enum-conversion.patch | |||
@@ -0,0 +1,91 @@ | |||
1 | From 090854e09fe18ebf1ba428864895a690086f78ee Mon Sep 17 00:00:00 2001 | ||
2 | From: Aaron Conole <aconole@redhat.com> | ||
3 | Date: Mon, 19 Aug 2019 11:41:13 -0400 | ||
4 | Subject: [PATCH 1/9] cmds: fix enum conversion | ||
5 | |||
6 | Multiple modules use implicit conversion between enum types, but | ||
7 | this triggers warnings with some compilers. ex: | ||
8 | |||
9 | qbg/vdp_cmds.c:110:39: error: implicit conversion from enumeration type | ||
10 | 'lldp_cmd' to different enumeration type 'cmd_status' | ||
11 | [-Werror,-Wenum-conversion] | ||
12 | cmd_status good_cmd = vdp_cmdok(cmd, cmd_gettlv); | ||
13 | |||
14 | Reported-at: https://github.com/intel/openlldp/issues/53 | ||
15 | Signed-off-by: Aaron Conole <aconole@redhat.com> | ||
16 | --- | ||
17 | lldp_evb22_cmds.c | 2 +- | ||
18 | lldp_evb_cmds.c | 2 +- | ||
19 | qbg/vdp22_cmds.c | 2 +- | ||
20 | qbg/vdp_cmds.c | 2 +- | ||
21 | vdptool.c | 2 +- | ||
22 | 5 files changed, 5 insertions(+), 5 deletions(-) | ||
23 | |||
24 | diff --git a/lldp_evb22_cmds.c b/lldp_evb22_cmds.c | ||
25 | index cebfeb2..51810bc 100644 | ||
26 | --- a/lldp_evb22_cmds.c | ||
27 | +++ b/lldp_evb22_cmds.c | ||
28 | @@ -225,7 +225,7 @@ int evb22_conf_enabletx(char *ifname, enum agent_type type) | ||
29 | TLVID(OUI_IEEE_8021Qbg22, LLDP_EVB22_SUBTYPE)); | ||
30 | } | ||
31 | |||
32 | -static int evb22_cmdok(struct cmd *cmd, cmd_status expected) | ||
33 | +static int evb22_cmdok(struct cmd *cmd, int expected) | ||
34 | { | ||
35 | if (cmd->cmd != expected) | ||
36 | return cmd_invalid; | ||
37 | diff --git a/lldp_evb_cmds.c b/lldp_evb_cmds.c | ||
38 | index eec4f33..e6af03b 100644 | ||
39 | --- a/lldp_evb_cmds.c | ||
40 | +++ b/lldp_evb_cmds.c | ||
41 | @@ -163,7 +163,7 @@ int evb_conf_enabletx(char *ifname, enum agent_type type) | ||
42 | return is_tlv_txenabled(ifname, type, TLVID_8021Qbg(LLDP_EVB_SUBTYPE)); | ||
43 | } | ||
44 | |||
45 | -static int evb_cmdok(struct cmd *cmd, cmd_status expected) | ||
46 | +static int evb_cmdok(struct cmd *cmd, int expected) | ||
47 | { | ||
48 | if (cmd->cmd != expected) | ||
49 | return cmd_invalid; | ||
50 | diff --git a/qbg/vdp22_cmds.c b/qbg/vdp22_cmds.c | ||
51 | index 479b1b0..2e1bbbd 100644 | ||
52 | --- a/qbg/vdp22_cmds.c | ||
53 | +++ b/qbg/vdp22_cmds.c | ||
54 | @@ -296,7 +296,7 @@ int vdp22_sendevent(struct vdpnl_vsi *p) | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | -static int vdp22_cmdok(struct cmd *cmd, cmd_status expected) | ||
59 | +static int vdp22_cmdok(struct cmd *cmd, int expected) | ||
60 | { | ||
61 | if (cmd->cmd != expected) | ||
62 | return cmd_invalid; | ||
63 | diff --git a/qbg/vdp_cmds.c b/qbg/vdp_cmds.c | ||
64 | index 95bcfb1..50f2781 100644 | ||
65 | --- a/qbg/vdp_cmds.c | ||
66 | +++ b/qbg/vdp_cmds.c | ||
67 | @@ -85,7 +85,7 @@ static char *print_mode(char *s, size_t length, struct vsi_profile *p) | ||
68 | return s; | ||
69 | } | ||
70 | |||
71 | -static int vdp_cmdok(struct cmd *cmd, cmd_status expected) | ||
72 | +static int vdp_cmdok(struct cmd *cmd, int expected) | ||
73 | { | ||
74 | if (cmd->cmd != expected) | ||
75 | return cmd_invalid; | ||
76 | diff --git a/vdptool.c b/vdptool.c | ||
77 | index 9872348..8f36277 100644 | ||
78 | --- a/vdptool.c | ||
79 | +++ b/vdptool.c | ||
80 | @@ -141,7 +141,7 @@ static char *print_status(cmd_status status) | ||
81 | str = "TLV does not support agent type"; | ||
82 | break; | ||
83 | default: | ||
84 | - str = print_vdp_status(status); | ||
85 | + str = print_vdp_status((enum vdp22_cmd_status)status); | ||
86 | break; | ||
87 | } | ||
88 | return str; | ||
89 | -- | ||
90 | 2.28.0 | ||
91 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/files/0002-lldp_head-rename-and-make-extern.patch b/meta-networking/recipes-protocols/openlldp/files/0002-lldp_head-rename-and-make-extern.patch new file mode 100644 index 000000000..8f65b799f --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0002-lldp_head-rename-and-make-extern.patch | |||
@@ -0,0 +1,500 @@ | |||
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 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/files/0003-lldp-add-packed-struct-definition.patch b/meta-networking/recipes-protocols/openlldp/files/0003-lldp-add-packed-struct-definition.patch new file mode 100644 index 000000000..4d0594cb6 --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0003-lldp-add-packed-struct-definition.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From 702dd20f43d9ca7e0bcb917e8acfec3f1acdcb5c Mon Sep 17 00:00:00 2001 | ||
2 | From: Aaron Conole <aconole@redhat.com> | ||
3 | Date: Mon, 3 Aug 2020 15:14:50 -0400 | ||
4 | Subject: [PATCH 3/9] lldp: add packed struct definition | ||
5 | |||
6 | Signed-off-by: Aaron Conole <aconole@redhat.com> | ||
7 | --- | ||
8 | include/lldp.h | 6 ++++++ | ||
9 | lldp/l2_packet.h | 5 ++--- | ||
10 | 2 files changed, 8 insertions(+), 3 deletions(-) | ||
11 | |||
12 | diff --git a/include/lldp.h b/include/lldp.h | ||
13 | index fb5ee93..de6a4ad 100644 | ||
14 | --- a/include/lldp.h | ||
15 | +++ b/include/lldp.h | ||
16 | @@ -255,5 +255,11 @@ enum { | ||
17 | #define LLDP_EVB_DEFAULT_RTE 15 | ||
18 | #define LLDP_EVB_DEFAULT_MAX_RTE 31 | ||
19 | |||
20 | +#ifndef _MSC_VER | ||
21 | +#define STRUCT_PACKED(STRUCT) STRUCT __attribute__((__packed__)) | ||
22 | +#else | ||
23 | +#define STRUCT_PACKED(STRUCT) __pragma(pack(push, 1)) STRUCT __pragma(pack(pop)) | ||
24 | +#endif | ||
25 | + | ||
26 | void somethingChangedLocal(const char *ifname, int type); | ||
27 | #endif /* _LLDP_H */ | ||
28 | diff --git a/lldp/l2_packet.h b/lldp/l2_packet.h | ||
29 | index 607b8a3..831958c 100644 | ||
30 | --- a/lldp/l2_packet.h | ||
31 | +++ b/lldp/l2_packet.h | ||
32 | @@ -58,12 +58,11 @@ | ||
33 | */ | ||
34 | struct l2_packet_data; | ||
35 | |||
36 | - | ||
37 | -struct l2_ethhdr { | ||
38 | +STRUCT_PACKED(struct l2_ethhdr { | ||
39 | u8 h_dest[ETH_ALEN]; | ||
40 | u8 h_source[ETH_ALEN]; | ||
41 | u16 h_proto; | ||
42 | -} STRUCT_PACKED; | ||
43 | +}); | ||
44 | |||
45 | /** | ||
46 | * l2_packet_init - Initialize l2_packet interface | ||
47 | -- | ||
48 | 2.28.0 | ||
49 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/files/0004-lldptool-make-extern.patch b/meta-networking/recipes-protocols/openlldp/files/0004-lldptool-make-extern.patch new file mode 100644 index 000000000..16b7def68 --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0004-lldptool-make-extern.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From 8229f4fb700ba4fcb2ec3e9956491bf5ee8c0ae2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Aaron Conole <aconole@redhat.com> | ||
3 | Date: Mon, 3 Aug 2020 15:17:31 -0400 | ||
4 | Subject: [PATCH 4/9] lldptool: make extern | ||
5 | |||
6 | This should only exist per final linked object. | ||
7 | |||
8 | Signed-off-by: Aaron Conole <aconole@redhat.com> | ||
9 | --- | ||
10 | include/lldptool.h | 2 +- | ||
11 | lldptool.c | 1 + | ||
12 | 2 files changed, 2 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/include/lldptool.h b/include/lldptool.h | ||
15 | index c919873..a190009 100644 | ||
16 | --- a/include/lldptool.h | ||
17 | +++ b/include/lldptool.h | ||
18 | @@ -29,7 +29,7 @@ | ||
19 | |||
20 | #include "clif.h" | ||
21 | |||
22 | -struct lldp_head lldp_cli_head; | ||
23 | +extern struct lldp_head lldp_cli_head; | ||
24 | |||
25 | int clif_command(struct clif *clif, char *cmd, int raw); | ||
26 | void print_raw_message(char *msg, int print); | ||
27 | diff --git a/lldptool.c b/lldptool.c | ||
28 | index 664a248..d76cc48 100644 | ||
29 | --- a/lldptool.c | ||
30 | +++ b/lldptool.c | ||
31 | @@ -64,6 +64,7 @@ | ||
32 | #include "lldp_util.h" | ||
33 | #include "lldpad_status.h" | ||
34 | |||
35 | +struct lldp_head lldp_cli_head; | ||
36 | struct lldp_head lldp_mod_head; | ||
37 | |||
38 | static int show_raw; | ||
39 | -- | ||
40 | 2.28.0 | ||
41 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/files/0005-cisco_oui-match-encode-handler-prototypes.patch b/meta-networking/recipes-protocols/openlldp/files/0005-cisco_oui-match-encode-handler-prototypes.patch new file mode 100644 index 000000000..4bdc5f2f6 --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0005-cisco_oui-match-encode-handler-prototypes.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From 9203dec731e53fb72e1c0d62639e6e54378f66cc Mon Sep 17 00:00:00 2001 | ||
2 | From: Aaron Conole <aconole@redhat.com> | ||
3 | Date: Mon, 3 Aug 2020 15:20:59 -0400 | ||
4 | Subject: [PATCH 5/9] cisco_oui: match encode handler prototypes | ||
5 | |||
6 | The EXTERN_FN prototype generated requires size_t be the third parameter. | ||
7 | |||
8 | Signed-off-by: Aaron Conole <aconole@redhat.com> | ||
9 | --- | ||
10 | vdptool_cisco_oui.c | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/vdptool_cisco_oui.c b/vdptool_cisco_oui.c | ||
14 | index 7003521..3f88c76 100644 | ||
15 | --- a/vdptool_cisco_oui.c | ||
16 | +++ b/vdptool_cisco_oui.c | ||
17 | @@ -28,7 +28,7 @@ | ||
18 | #include "lldp_util.h" | ||
19 | #include "vdp_cisco.h" | ||
20 | |||
21 | -bool cisco_oui_encode_hndlr(char *dst, char *src, int len) | ||
22 | +bool cisco_oui_encode_hndlr(char *dst, char *src, size_t len) | ||
23 | { | ||
24 | char *src_temp = strdup(src); | ||
25 | char *key, *data; | ||
26 | -- | ||
27 | 2.28.0 | ||
28 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/files/0006-ecp22-make-enum-a-type-rather-than-instance.patch b/meta-networking/recipes-protocols/openlldp/files/0006-ecp22-make-enum-a-type-rather-than-instance.patch new file mode 100644 index 000000000..2b0289df2 --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0006-ecp22-make-enum-a-type-rather-than-instance.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 2723219c08726efa08a6bad04ffb775f850a96bc Mon Sep 17 00:00:00 2001 | ||
2 | From: Aaron Conole <aconole@redhat.com> | ||
3 | Date: Mon, 3 Aug 2020 15:23:28 -0400 | ||
4 | Subject: [PATCH 6/9] ecp22: make enum a type rather than instance | ||
5 | |||
6 | The enum defined in the qbg header is setup as a discreet instance | ||
7 | rather than a type. Fix this. | ||
8 | |||
9 | Signed-off-by: Aaron Conole <aconole@redhat.com> | ||
10 | --- | ||
11 | include/qbg_ecp22.h | 4 ++-- | ||
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/include/qbg_ecp22.h b/include/qbg_ecp22.h | ||
15 | index 567f6df..fe66bb3 100644 | ||
16 | --- a/include/qbg_ecp22.h | ||
17 | +++ b/include/qbg_ecp22.h | ||
18 | @@ -49,10 +49,10 @@ enum { /* ECP Transmit states */ | ||
19 | ECP22_TX_ERROR | ||
20 | }; | ||
21 | |||
22 | -enum { | ||
23 | +enum ecp22_mode { | ||
24 | ECP22_REQUEST = 0, | ||
25 | ECP22_ACK | ||
26 | -} ecp22_mode; | ||
27 | +}; | ||
28 | |||
29 | struct ecp22_hdr { /* ECP22 header */ | ||
30 | u16 ver_op_sub; /* ECP22 version, operation, subtype */ | ||
31 | -- | ||
32 | 2.28.0 | ||
33 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/files/0007-lldp_8021qaz-extern-config-object.patch b/meta-networking/recipes-protocols/openlldp/files/0007-lldp_8021qaz-extern-config-object.patch new file mode 100644 index 000000000..36b575c56 --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0007-lldp_8021qaz-extern-config-object.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From 275fe9da663193a843de450f03e810daedc06955 Mon Sep 17 00:00:00 2001 | ||
2 | From: Aaron Conole <aconole@redhat.com> | ||
3 | Date: Mon, 3 Aug 2020 15:25:38 -0400 | ||
4 | Subject: [PATCH 7/9] lldp_8021qaz: extern config object | ||
5 | |||
6 | The config object only exists as part of the config translation unit | ||
7 | so remove the extra config object in the 8021qaz module. | ||
8 | |||
9 | Signed-off-by: Aaron Conole <aconole@redhat.com> | ||
10 | --- | ||
11 | lldp_8021qaz.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c | ||
15 | index a42fd11..673d758 100644 | ||
16 | --- a/lldp_8021qaz.c | ||
17 | +++ b/lldp_8021qaz.c | ||
18 | @@ -49,7 +49,7 @@ | ||
19 | |||
20 | |||
21 | struct lldp_head lldp_head; | ||
22 | -struct config_t lldpad_cfg; | ||
23 | +extern config_t lldpad_cfg; | ||
24 | extern bool read_only_8021qaz; | ||
25 | |||
26 | static int ieee8021qaz_check_pending(struct port *port, struct lldp_agent *); | ||
27 | -- | ||
28 | 2.28.0 | ||
29 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/files/0008-stringops-fix-some-string-copy-errors.patch b/meta-networking/recipes-protocols/openlldp/files/0008-stringops-fix-some-string-copy-errors.patch new file mode 100644 index 000000000..501b66699 --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0008-stringops-fix-some-string-copy-errors.patch | |||
@@ -0,0 +1,61 @@ | |||
1 | From 61291de03cb6dd1aea2a633eb72951f3fe453e7f Mon Sep 17 00:00:00 2001 | ||
2 | From: Aaron Conole <aconole@redhat.com> | ||
3 | Date: Mon, 3 Aug 2020 15:33:08 -0400 | ||
4 | Subject: [PATCH 8/9] stringops: fix some string copy errors | ||
5 | |||
6 | Reported when using gcc-10. | ||
7 | |||
8 | Signed-off-by: Aaron Conole <aconole@redhat.com> | ||
9 | --- | ||
10 | dcb_protocol.c | 13 ++++--------- | ||
11 | lldp/ports.c | 2 +- | ||
12 | 2 files changed, 5 insertions(+), 10 deletions(-) | ||
13 | |||
14 | diff --git a/dcb_protocol.c b/dcb_protocol.c | ||
15 | index 75ca139..930251b 100644 | ||
16 | --- a/dcb_protocol.c | ||
17 | +++ b/dcb_protocol.c | ||
18 | @@ -2257,13 +2257,8 @@ cmd_status get_bwg_descrpt(char *device_name, u8 bwgid, char **name) | ||
19 | |||
20 | if ((it != NULL) && | ||
21 | (bwgid < it->second->max_pgid_desc)) { | ||
22 | - size = (int)strlen(it->second->pgid_desc[bwgid]) + | ||
23 | - sizeof(char); /* Localization OK */ | ||
24 | - *name = (char*)malloc(size); | ||
25 | - if (*name != NULL) { | ||
26 | - strncpy(*name, it->second->pgid_desc[bwgid], | ||
27 | - size); /* Localization OK */ | ||
28 | - } else { | ||
29 | + *name = strdup(it->second->pgid_desc[bwgid]); | ||
30 | + if (*name == NULL) { | ||
31 | goto Error; | ||
32 | } | ||
33 | } else { | ||
34 | @@ -2272,9 +2267,9 @@ cmd_status get_bwg_descrpt(char *device_name, u8 bwgid, char **name) | ||
35 | size = (int)strlen( | ||
36 | attribs.descript.pgid_desc[bwgid]) + | ||
37 | sizeof(char); | ||
38 | - *name = (char*)malloc(size); | ||
39 | + *name = (char*)calloc(size, sizeof(char)); | ||
40 | if (*name != NULL) { | ||
41 | - memcpy(*name, attribs.descript.pgid_desc[bwgid], size); /* Localization OK */ | ||
42 | + memcpy(*name, attribs.descript.pgid_desc[bwgid], size - 1); /* Localization OK */ | ||
43 | } else { | ||
44 | goto Error; | ||
45 | } | ||
46 | diff --git a/lldp/ports.c b/lldp/ports.c | ||
47 | index 6384f14..9b681f7 100644 | ||
48 | --- a/lldp/ports.c | ||
49 | +++ b/lldp/ports.c | ||
50 | @@ -264,7 +264,7 @@ struct port *add_port(int ifindex, const char *ifname) | ||
51 | memset(newport, 0, sizeof(*newport)); | ||
52 | newport->ifindex = ifindex; | ||
53 | newport->next = NULL; | ||
54 | - strncpy(newport->ifname, ifname, IFNAMSIZ); | ||
55 | + strncpy(newport->ifname, ifname, IFNAMSIZ - 1); | ||
56 | |||
57 | newport->bond_master = is_bond(ifname); | ||
58 | /* Initialize relevant port variables */ | ||
59 | -- | ||
60 | 2.28.0 | ||
61 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/files/0009-8021qaz-mark-prio-map-functions-static.patch b/meta-networking/recipes-protocols/openlldp/files/0009-8021qaz-mark-prio-map-functions-static.patch new file mode 100644 index 000000000..0f84426f9 --- /dev/null +++ b/meta-networking/recipes-protocols/openlldp/files/0009-8021qaz-mark-prio-map-functions-static.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 7ae79b0dff53a23fa0a964f77b9e3bb387a293c4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Aaron Conole <aconole@redhat.com> | ||
3 | Date: Tue, 4 Aug 2020 09:17:50 -0400 | ||
4 | Subject: [PATCH 9/9] 8021qaz: mark prio map functions static | ||
5 | |||
6 | Inline is not the correct way to mark a function for inclusion | ||
7 | in a single translation unit. Use 'static' to restrict export | ||
8 | of these functions. | ||
9 | |||
10 | Signed-off-by: Aaron Conole <aconole@redhat.com> | ||
11 | --- | ||
12 | lldp_8021qaz.c | 4 ++-- | ||
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c | ||
16 | index 673d758..16ae167 100644 | ||
17 | --- a/lldp_8021qaz.c | ||
18 | +++ b/lldp_8021qaz.c | ||
19 | @@ -397,7 +397,7 @@ static int read_cfg_file(char *ifname, struct lldp_agent *agent, | ||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | -inline int get_prio_map(u32 prio_map, int prio) | ||
24 | +static int get_prio_map(u32 prio_map, int prio) | ||
25 | { | ||
26 | if (prio > 7) | ||
27 | return 0; | ||
28 | @@ -405,7 +405,7 @@ inline int get_prio_map(u32 prio_map, int prio) | ||
29 | return (prio_map >> (4 * (7-prio))) & 0xF; | ||
30 | } | ||
31 | |||
32 | -inline void set_prio_map(u32 *prio_map, u8 prio, int tc) | ||
33 | +static void set_prio_map(u32 *prio_map, u8 prio, int tc) | ||
34 | { | ||
35 | u32 mask = ~(0xffffffff & (0xF << (4 * (7-prio)))); | ||
36 | *prio_map &= mask; | ||
37 | -- | ||
38 | 2.28.0 | ||
39 | |||
diff --git a/meta-networking/recipes-protocols/openlldp/openlldp_1.0.1.bb b/meta-networking/recipes-protocols/openlldp/openlldp_1.0.1.bb index 5fbf0645e..d8a0d6913 100644 --- a/meta-networking/recipes-protocols/openlldp/openlldp_1.0.1.bb +++ b/meta-networking/recipes-protocols/openlldp/openlldp_1.0.1.bb | |||
@@ -12,11 +12,21 @@ inherit ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} | |||
12 | 12 | ||
13 | DEPENDS = "libnl libconfig readline" | 13 | DEPENDS = "libnl libconfig readline" |
14 | 14 | ||
15 | SRCREV = "36d729de7ce5b56cf061d94d610cf0510154820c" | 15 | SRCREV = "b71bfb87fefb31c4b1a6a7ae351791c90966c3a8" |
16 | PV .= "+git${SRCPV}" | ||
16 | SRC_URI = "git://github.com/intel/openlldp.git;protocol=https;branch=master \ | 17 | SRC_URI = "git://github.com/intel/openlldp.git;protocol=https;branch=master \ |
17 | file://0001-Fix-musl-libc-build-issue.patch \ | 18 | file://0001-Fix-musl-libc-build-issue.patch \ |
18 | file://0001-autotools-Add-include-path-to-generated-version.h.patch \ | 19 | file://0001-autotools-Add-include-path-to-generated-version.h.patch \ |
19 | file://0001-autotools-Add-option-to-disable-installation-of-syst.patch \ | 20 | file://0001-autotools-Add-option-to-disable-installation-of-syst.patch \ |
21 | file://0001-cmds-fix-enum-conversion.patch \ | ||
22 | file://0002-lldp_head-rename-and-make-extern.patch \ | ||
23 | file://0003-lldp-add-packed-struct-definition.patch \ | ||
24 | file://0004-lldptool-make-extern.patch \ | ||
25 | file://0005-cisco_oui-match-encode-handler-prototypes.patch \ | ||
26 | file://0006-ecp22-make-enum-a-type-rather-than-instance.patch \ | ||
27 | file://0007-lldp_8021qaz-extern-config-object.patch \ | ||
28 | file://0008-stringops-fix-some-string-copy-errors.patch \ | ||
29 | file://0009-8021qaz-mark-prio-map-functions-static.patch \ | ||
20 | " | 30 | " |
21 | 31 | ||
22 | # Makefile.am adds -Werror to AM_CFLAGS. There are warnings so disable it. | 32 | # Makefile.am adds -Werror to AM_CFLAGS. There are warnings so disable it. |