* Cut a possibly compressed PPP protocol number from the front of a frame. */
| 2432 | * Cut a possibly compressed PPP protocol number from the front of a frame. |
| 2433 | */ |
| 2434 | static struct mbuf * |
| 2435 | ng_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. |
no test coverage detected