MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lacp_pdu_input

Function lacp_pdu_input

freebsd/net/ieee8023ad_lacp.c:267–335  ·  view source on GitHub ↗

* lacp_pdu_input: process lacpdu */

Source from the content-addressed store, hash-verified

265 * lacp_pdu_input: process lacpdu
266 */
267static int
268lacp_pdu_input(struct lacp_port *lp, struct mbuf *m)
269{
270 struct lacp_softc *lsc = lp->lp_lsc;
271 struct lacpdu *du;
272 int error = 0;
273
274 if (m->m_pkthdr.len != sizeof(*du)) {
275 goto bad;
276 }
277
278 if ((m->m_flags & M_MCAST) == 0) {
279 goto bad;
280 }
281
282 if (m->m_len < sizeof(*du)) {
283 m = m_pullup(m, sizeof(*du));
284 if (m == NULL) {
285 return (ENOMEM);
286 }
287 }
288
289 du = mtod(m, struct lacpdu *);
290
291 if (memcmp(&du->ldu_eh.ether_dhost,
292 &ethermulticastaddr_slowprotocols, ETHER_ADDR_LEN)) {
293 goto bad;
294 }
295
296 /*
297 * ignore the version for compatibility with
298 * the future protocol revisions.
299 */
300#if 0
301 if (du->ldu_sph.sph_version != 1) {
302 goto bad;
303 }
304#endif
305
306 /*
307 * ignore tlv types for compatibility with
308 * the future protocol revisions.
309 */
310 if (tlv_check(du, sizeof(*du), &du->ldu_tlv_actor,
311 lacp_info_tlv_template, FALSE)) {
312 goto bad;
313 }
314
315 if (V_lacp_debug > 0) {
316 lacp_dprintf(lp, "lacpdu receive\n");
317 lacp_dump_lacpdu(du);
318 }
319
320 if ((1 << lp->lp_ifp->if_dunit) & lp->lp_lsc->lsc_debug.lsc_rx_test) {
321 LACP_TPRINTF((lp, "Dropping RX PDU\n"));
322 goto bad;
323 }
324

Callers 1

lacp_inputFunction · 0.85

Calls 6

m_pullupFunction · 0.85
tlv_checkFunction · 0.85
lacp_dprintfFunction · 0.85
lacp_dump_lacpduFunction · 0.85
lacp_sm_rxFunction · 0.85
m_freemFunction · 0.50

Tested by

no test coverage detected