RE: mbuf from scratch
RE: mbuf from scratch
- Subject: RE: mbuf from scratch
- From: "Carl Smith" <email@hidden>
- Date: Tue, 28 Jun 2005 15:27:04 -0400
- Thread-topic: mbuf from scratch
Ah yes on all points and OK.
Sorry I was writing what I had put into my driver from memory, because
my MAC OS X is acting up. It keeps trying to say it wants to reinstall
the OS, another question for another forum I guess.
But back to my original question, then I must be passing in the 'ifp'
from my saved mbuf, in the function "m_devget".
But my original question still stands. Should I be using this saved
copy, of 'ifp' or should I some how be creating or getting this 'ifp'
new/from scratch when creating my 'new' mbuf?
Another way to ask the question if one is creating a new mbuf, via
m_devget, where would one get the 'ifp' to put into m_devget?
Thanks
Carl
-----Original Message-----
From: darwin-kernel-bounces+csmith=email@hidden
[mailto:darwin-kernel-bounces+csmith=email@hidden]
On Behalf Of Justin C. Walker
Sent: Tuesday, June 28, 2005 3:04 PM
To: Darwin Kernel
Subject: Re: mbuf from scratch
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:
ch.com
This email sent to email@hidden
_______________________________________________
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