Re: mbuf from scratch
Re: mbuf from scratch
- Subject: Re: mbuf from scratch
- From: "Justin C. Walker" <email@hidden>
- Date: Tue, 28 Jun 2005 12:04:02 -0700
Carl,
Please don't cross-post.
On Jun 28, 2005, at 11:46 , Carl Smith wrote:
Here’s my dilemma, I have driver, in the kernel, that I catch all
incoming and outgoing packets.
To be nit-picky, it's an NKE, not a driver (and darwin-kernel is the
right list).
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.
You mean "m_devget"?
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);
You have 'm' declared as a struct mbuf, not a struct mbuf *; you mean
the latter?
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?
m_devget() takes an "ifp" as one of its arguments, and stores that in
the rcvif slot. You can check this yourself, of course, using the
Darwin source for the kernel; that's why it's there :-} (well, that's
one reason it's there).
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Institute for General Semantics
--------
Men are from Earth.
Women are from Earth.
Deal with it.
--------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden