Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mbuf from scratch



I’ve hit on this question before and basically have it working my only concern is the ifnet structure with in the mbuf.

 

Here’s my dilemma, I have driver, in the kernel, that I catch all incoming and outgoing packets. It is working. My hesitation lies in the outgoing packets. For my purposes I create new mbufs, and load my data into the mbuf and out it goes. I create my mbuf with m_dev. Now with some help, from this forum, I set my values, in the new mbuf as:

struct mbuf m;

 

// create the new mbuf with m_dev

m->m_pkthdr.header = (void*)m_mtod(m);

 

m->m_pkthdr.rcvif = m_saved->m_pkthdr.rcvif;

 

My questions are, I am saving the m_pkthdr.rcvif from the ‘captured’ mbuf in my filter. I feel that this is unnecessary and potential dangerous, now is there some way to create an m_pkthdr.rcvif (a struct ifnet item) from scratch or is there some reason I need the original from the interface I am currently filtering?

 

Does the m_dev function create a new m_pkthdr.rcvif for me?

 

Any information would greatly be appreciated.

 

Carl

 

PS I have looked Steven’s stuff over and over again, and if this answer is in there I have missed it. All his code and examples have the ifnet structure, ifp, handed down to them.

 



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.