SCCS-vsn: sys/deprecated/netimp/if_imp.c 7.9
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)if_imp.c 7.8 (Berkeley) %G%
+ * @(#)if_imp.c 7.9 (Berkeley) %G%
* Pull the interface pointer out of the mbuf
* and save for later; adjust mbuf to look at rest of data.
*/
* Pull the interface pointer out of the mbuf
* and save for later; adjust mbuf to look at rest of data.
*/
- ifp = *(mtod(m, struct ifnet **));
- IF_ADJ(m);
+if ((m->m_flags && M_PKTHDR) == 0)
+panic("No header in impinput");
+ ifp = m->m_pkthdr.rcvif;
/* verify leader length. */
if (m->m_len < sizeof(struct control_leader) &&
(m = m_pullup(m, sizeof(struct control_leader))) == 0)
/* verify leader length. */
if (m->m_len < sizeof(struct control_leader) &&
(m = m_pullup(m, sizeof(struct control_leader))) == 0)
case IMPLINK_IP:
m->m_len -= sizeof(struct imp_leader);
case IMPLINK_IP:
m->m_len -= sizeof(struct imp_leader);
- m->m_off += sizeof(struct imp_leader);
+ if (m->m_flags & M_PKTHDR)
+ m->m_pkthdr.len -= sizeof(struct imp_leader);
+ m->m_data += sizeof(struct imp_leader);
schednetisr(NETISR_IP);
inq = &ipintrq;
break;
schednetisr(NETISR_IP);
inq = &ipintrq;
break;
if (inq == &impintrq)
schednetisr(NETISR_IMP);
if (inq == &impintrq)
schednetisr(NETISR_IMP);
- /*
- * Re-insert interface pointer in the mbuf chain
- * for the next protocol up.
- */
- if (M_HASCL(m) && (mtod(m, int) & CLOFSET) < sizeof(struct ifnet *)) {
- struct mbuf *n;
-
- MGET(n, M_DONTWAIT, MT_HEADER);
- if (n == 0)
- goto drop;
- n->m_next = m;
- m = n;
- m->m_len = 0;
- m->m_off = MMINOFF + sizeof(struct ifnet *);
- }
- m->m_off -= sizeof(struct ifnet *);
- m->m_len += sizeof(struct ifnet *);
- *(mtod(m, struct ifnet **)) = ifp;
-
s = splimp();
if (!IF_QFULL(inq)) {
IF_ENQUEUE(inq, m);
s = splimp();
if (!IF_QFULL(inq)) {
IF_ENQUEUE(inq, m);
* first mbuf, allocate another. If that should fail, we
* drop this sucker.
*/
* first mbuf, allocate another. If that should fail, we
* drop this sucker.
*/
- if (m->m_off > MMAXOFF ||
- MMINOFF + sizeof(struct imp_leader) > m->m_off) {
- MGET(m, M_DONTWAIT, MT_HEADER);
- if (m == 0) {
- error = ENOBUFS;
- goto drop;
- }
- m->m_next = m0;
- m->m_len = sizeof(struct imp_leader);
- } else {
- m->m_off -= sizeof(struct imp_leader);
- m->m_len += sizeof(struct imp_leader);
- }
+ M_PREPEND(m, sizeof(struct imp_leadr), M_DONTWAIT);
imp = mtod(m, struct imp_leader *);
imp->il_format = IMP_NFF;
imp->il_mtype = IMPTYPE_DATA;
imp = mtod(m, struct imp_leader *);
imp->il_format = IMP_NFF;
imp->il_mtype = IMPTYPE_DATA;