]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blobdiff - net/core/dev.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[mirror_ubuntu-focal-kernel.git] / net / core / dev.c
index 969462ebb296250fe5f3b7c4621e9ba9720a2dbe..c624a04dad1fbbd8ea7ad0055b2d47d11c6caa1b 100644 (file)
@@ -1285,6 +1285,7 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
 
        return len;
 }
+EXPORT_SYMBOL(dev_set_alias);
 
 /**
  *     dev_get_alias - get ifalias of a device
@@ -2969,7 +2970,7 @@ netdev_features_t passthru_features_check(struct sk_buff *skb,
 }
 EXPORT_SYMBOL(passthru_features_check);
 
-static netdev_features_t dflt_features_check(const struct sk_buff *skb,
+static netdev_features_t dflt_features_check(struct sk_buff *skb,
                                             struct net_device *dev,
                                             netdev_features_t features)
 {
@@ -3996,9 +3997,9 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
                                     struct bpf_prog *xdp_prog)
 {
        struct netdev_rx_queue *rxqueue;
+       void *orig_data, *orig_data_end;
        u32 metalen, act = XDP_DROP;
        struct xdp_buff xdp;
-       void *orig_data;
        int hlen, off;
        u32 mac_len;
 
@@ -4037,6 +4038,7 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
        xdp.data_meta = xdp.data;
        xdp.data_end = xdp.data + hlen;
        xdp.data_hard_start = skb->data - skb_headroom(skb);
+       orig_data_end = xdp.data_end;
        orig_data = xdp.data;
 
        rxqueue = netif_get_rxqueue(skb);
@@ -4051,6 +4053,13 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
                __skb_push(skb, -off);
        skb->mac_header += off;
 
+       /* check if bpf_xdp_adjust_tail was used. it can only "shrink"
+        * pckt.
+        */
+       off = orig_data_end - xdp.data_end;
+       if (off != 0)
+               skb_set_tail_pointer(skb, xdp.data_end - xdp.data);
+
        switch (act) {
        case XDP_REDIRECT:
        case XDP_TX: