Thread (14 messages) flat view 14 messages, 4 authors, 2012-11-21

RE: [PATCH 9/9] batman-adv: Use packing of 2 for all headers before an ethernet header

From: David Laight <hidden>
Date: 2012-11-21 13:38:06
Also in: batman

All packet headers in front of an ethernet header have to be completely
divisible by 2 but not by 4 to make the payload after the ethernet header again
4 bytes boundary aligned.
I'm not sure that statement is correct - whether the patches are
correct rather depends on the actual packet format(s) you are
generating/modifying.

If you are adding data to an ethernet packet you'll need
to add a multiple of 4 bytes in order maintain the alignment
of the IP header (which needs to be 4 byte aligned and is
usually 14 bytes from the start of the receive data).

This means that the data you add probably has to be 4n+2
aligned - since I guess you are adding between the source
MAC address and ethertype?
If you are inserting data after the ethertype (ie after some
protocol identifier), then your header can be 4 byte aligned
provided it ends with the replacement ethertype (0800 or 0806
for IP protocols).

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help