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

Function ng_ppp_cutproto

freebsd/netgraph/ng_ppp.c:2434–2454  ·  view source on GitHub ↗

* Cut a possibly compressed PPP protocol number from the front of a frame. */

Source from the content-addressed store, hash-verified

2432 * Cut a possibly compressed PPP protocol number from the front of a frame.
2433 */
2434static struct mbuf *
2435ng_ppp_cutproto(struct mbuf *m, uint16_t *proto)
2436{
2437
2438 *proto = 0;
2439 if (m->m_len < 1 && (m = m_pullup(m, 1)) == NULL)
2440 return (NULL);
2441
2442 *proto = *mtod(m, uint8_t *);
2443 m_adj(m, 1);
2444
2445 if (!PROT_VALID(*proto)) {
2446 if (m->m_len < 1 && (m = m_pullup(m, 1)) == NULL)
2447 return (NULL);
2448
2449 *proto = (*proto << 8) + *mtod(m, uint8_t *);
2450 m_adj(m, 1);
2451 }
2452
2453 return (m);
2454}
2455
2456/*
2457 * Prepend some bytes to an mbuf.

Callers 6

ng_ppp_rcvdata_compressFunction · 0.85
ng_ppp_rcvdata_decryptFunction · 0.85
ng_ppp_rcvdataFunction · 0.85
ng_ppp_frag_processFunction · 0.85
ng_ppp_frag_checkstaleFunction · 0.85

Calls 2

m_pullupFunction · 0.85
m_adjFunction · 0.85

Tested by

no test coverage detected