James Carlson wrote:
> Garrett D'Amore writes:
>   
>> Andrew Gallatin wrote:
>>     
>>> Why don't you just fix the checksum by "subtracting" off the last 4
>>> bytes of the expanded vlan header (bytes 14..17 of the frame).
>>>   
>>>       
>> I had considered that, but done it mostly because I am not entirely sure 
>> that this is universally "safe".  (This is due to ignorance on my part, 
>> and I'd love to be better informed.)
>>
>> There are two complexities in the checksum calculation that I'm 
>> concerned about.  The first is the inclusion of carry bits.  The second 
>> is the negation (~).  I'm not entirely sure after these are done, that 
>> the operation is reversible enough to safely subtract those bytes.
>>     
>
> That shouldn't be an issue.  It's just 1's complement math, not
> something exotic like a Galios field.
>
> The hard part is knowing which bytes are overhead and need to be
> removed.  If the sender doesn't tell you, then you're probably sunk.
>   

Okay Jim.  Knowing that have to subtract the VLAN tag (which is bytes 14 
thru 17 of the frame), can you take a quick look at uts/sun/io/hme.c 
line 6049, and tell me how I can adjust the value of cksum.  Is it safe 
to simply subtract from cksum?  (Or perhaps I need to negate the bits 
first.)

I can see that I'll have to add a check for ETHERTYPE_VLAN or somesuch, 
and then also check for ETHERTYPE_IP/IPV6 at bytes 18/19.  Its the 
subtraction/math that I want help with.  I'm *not* a cyborg, and I don't 
want to screw it up. :-)

    -- Garrett


_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to