Small patch to multicast code...
Sam Leffler
sam at freebsd.org
Sat Aug 30 04:35:16 UTC 2008
Andrew Thompson wrote:
> On Fri, Aug 29, 2008 at 06:41:45PM +0200, Luigi Rizzo wrote:
>
>> On Fri, Aug 29, 2008 at 09:32:10AM -0700, Sam Leffler wrote:
>>
>>> Luigi Rizzo wrote:
>>>
>> ...
>>
>>>> and to be more explicit - the result of m_pullup is that
>>>> the number of bytes specified as m_pullup argument are in
>>>> a private piece of memory -- the 'data' region within the mbuf -- so
>>>> you can freely play with them without trouble.
>>>>
>>>> That is why i suggested to just increase the argument to m_pullup
>>>> by the size of the udp header so one can overwrite the checksum
>>>> within the mbuf without touching the shared part in the cluster
>>>> (if any).
>>>>
>>>>
>>> Hmm, never considered the m_pullup guaranteed a private copy (but I see
>>> it in the code). The original semantics were just that the data was
>>> contiguous.
>>>
>> funny, i thought the guarantee of a writable copy was also part
>> of the original semantics :)
>>
>
> The bridge code does a deep copy of the packet for each interface it
> broadcasts on due the firewall code modifying the headers. It sounds
> like this should just be a copy+pullup instead.
>
>
I'd not do that. I think there are paths that assume the deep copy.
Right now the network code is very poor honoring read-only-ness of mbuf
chains. To get this right we need to do a good audit. I know I hit
issues when doing some tricks w/ marking rx buffers read-only to avoid
cache flushes. netbsd trys to be more pedantic but still has problems too.
Sam
More information about the freebsd-net
mailing list