lxip: allocate skb with properly aligned IP header

Comment in Linux sources:

  Since an ethernet header is 14 bytes network drivers often end up with
  the IP header at an unaligned offset. The IP header can be aligned by
  shifting the start of the packet by 2 bytes. Drivers should do this
  with:

  skb_reserve(skb, NET_IP_ALIGN);

This is ensured when using netdev_alloc_skb_ip_align().

Issue #4094
This commit is contained in:
Christian Helmuth 2021-05-12 17:07:07 +02:00
parent a24224ffc3
commit 813f4d976b

View File

@ -119,7 +119,7 @@ void net_driver_rx(void *addr, unsigned long size)
enum {
ADDITIONAL_HEADROOM = 4, /* smallest value found by trial & error */
};
struct sk_buff *skb = dev_alloc_skb(size + ADDITIONAL_HEADROOM);
struct sk_buff *skb = netdev_alloc_skb_ip_align(_dev, size + ADDITIONAL_HEADROOM);
if (!skb) {
printk(KERN_NOTICE "genode_net_rx: low on mem - packet dropped!\n");
stats->rx_dropped++;