EDIT: As far as I know, there is no way to check for zero padding directly with the sk_buff structure without looking at the ethernet header, which is quite simple.
However, using simple pointer arithmetic and subtracting bytes, you can use the length field in the IP data to determine padding.
This is a good link for sk_buff: http://vger.kernel.org/~davem/skb_data.html
And here is a good link for the package structure, showing the "length" field in the bottom image in the "data".
http://nerdcrunch.com/wp-content/uploads/2011/05/Ethernet-Frame-Explained.png
I think this is how it should be done, but it does not require parsing, as you previously supported. The fields of the header / data structure are configured in such a way that they can be referenced / deleted directly through the pointer / array without parsing, and then by subtracting the length of the header + data from the raw packet length, you can get filling without checking the data.
Hope this helps.
Also, for best practice, you probably should have included your driver account for both versions of 802.3. You can do this by checking the Ethertype / length field. If the value is greater than 1536 (0x0600) than you know, it is an Ethernet II type packet and the field contains an ethertype type that tells you that the ethernet packet is encapsulating. There are some popular ones if you are Wikipedia for "Ethertype".
For example, IP = 0x0800. If the field stands for Ethertype, you should resort to searching the data length field inside to find the indentation. If this does not happen, which is not on the Ethernet LAN, then you can directly use the field specified as the length to do your job.
source share