Re: mbuf data access
Re: mbuf data access
- Subject: Re: mbuf data access
- From: Vincent Lubet <email@hidden>
- Date: Wed, 7 Jun 2006 10:31:00 -0700
On Jun 7, 2006, at 9:34 AM, email@hidden wrote:
I'm writing some NKE UDP filter with packet mangling + packet re-
injection,
when i have a mbuf (in chain) with flags set to MBUF_PKTHDR i've
got an
access to data using MTOD(tMbuf, caddr_t), at this point every
things works
fine but when the mbuf in the chain is marked as MBUF_EXT nothing
work at all.
- How can have access to packet data ?
mbuf_data() gives you access to the start of the data.
- mbuf_len() on a mbuf (marked as MBUF_EXT) in a mbuf chain
is a valid length ?
A packet can be made of several mbuf that are chained. mbuf_len()
gives you the length of each mbuf. The linkage to the next mbuf of
the chain is given by mbuf_next(). The total length of the packet is
given by mbuf_pkthdr_len() of the first mbuf of the chain (the one
marked with MBUF_PKTHDR)
- when modifying such packets do i need to compute some checksums ?
Yes you need to recompute the checksum(s) to compensate for the
modification. Depending on what you modify this will be the IP
checksum or the UDP checksum or both.
Vincent
_______________________________________________
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