• Shmulik Ladkani's avatar
    net: skbuff: Limit skb_vlan_pop/push() to expect skb->data at mac header · b6a79208
    Shmulik Ladkani authored
    skb_vlan_pop/push were too generic, trying to support the cases where
    skb->data is at mac header, and cases where skb->data is arbitrarily
    elsewhere.
    
    Supporting an arbitrary skb->data was complex and bogus:
     - It failed to unwind skb->data to its original location post actual
       pop/push.
       (Also, semantic is not well defined for unwinding: If data was into
        the eth header, need to use same offset from start; But if data was
        at network header or beyond, need to adjust the original offset
        according to the push/pull)
     - It mangled the rcsum post actual push/pop, without taking into account
       that the eth bytes might already have been pulled out of the csum.
    
    Most callers (ovs, bpf) already had their skb->data at mac_header upon
    invoking skb_vlan_pop/push.
    Last caller that failed to do so (act_vlan) has been recently fixed.
    
    Therefore, to simplify things, no longer support arbitrary skb->data
    inputs for skb_vlan_pop/push().
    
    skb->data is expected to be exactly at mac_header; WARN otherwise.
    Signed-off-by: default avatarShmulik Ladkani <shmulik.ladkani@gmail.com>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Pravin Shelar <pshelar@ovn.org>
    Cc: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b6a79208
skbuff.c 122 KB