Mailing Lists: Apple Mailing Lists

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

RE: mbufs




Thanks for the information, Chas.

Even though I am using 10.3, I still followed your suggestion with the
proper substitution for the 10.4 calls. Things work fine for traffic
flowing in the proper sequence, in packets going up the stack and out
packets going out the machine, but in some instances I do a turn around,
meaning that I look at packets coming in, and if they are of a certain
type I do some manipulating to the contents then turn them around, with
out sending up the stack and try to send them 'out' the machine.

My problem is that these, turn arounds, do not go out the machine, I
know this because I am watching the traffic on a sniffer.


So I was wondering if anyone has any insight as to why the 'turn
arounds' might not be going out.

I am using the ifnet ifp from the incoming packet and pointing it to the
ifp in mbuf_pkthdr_setrcvif(m, ifp). Some of my thoughts where, is there
something different about the ifp coming in then there is for the one
going out? Can there be some kind of mbuf buffer being full and I have
to clear some cache to let the turn around go out?

Also, just to let everyone know I am using dlili_inject_if_output for my
'out' routine, instead of dlil_output.

Thanks
Carl

>I have tried several methods of creating the mbuf but when I use
>dlil_if_inject_output I get an error =3D 22. But if I do an m_copyback
=
>of
>an mbuf I copied coming in I can make dlil_if_inject_output work, but
>not with the 240 bytes I want. Instead of going into a lot of
>explanation of what I am doing and why I basically just need to know
how
>to create a 'new' mbuf with the data as described above for sending
>out/in the driver.

i ported parts of the forethought atm stack and while it doesnt generate
packets completly from scratch, you do need to a little work on the
mbufs before you can hand them over to dlil.

    mbuf_t m;
    char *ehdr, *pkt; /* ethernet header */
    ifnet_t ifp;
    int maxchunks = 1;

    ifp = /* you will need to find this somewhow */

    mbuf_allocpacket(MBUF_WAITOK, 240, &maxchunks, &m);
 
    mbuf_pkthdr_setlen(m, 240);
    mbuf_pkthdr_setrcvif(m, ifp);
    mbuf_pkthdr_setheader(m, mbuf_data(m));
    ehdr = mbuf_data(m);
    mbuf_adj(m, ETHER_HDR_LEN);
    pkt = mbuf_data(m);

    /* write ehdr */
    /* write pkt */

#ifdef tiger
    ifnet_input(ifp, m, &stats);
#else
    dlil_input(ifp, m, m);
#endif

looking at the ppp (or firewire) source code can be pretty helpful.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden



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.