net: Avoid ABI change for min_header_len
authorBen Hutchings <ben@decadent.org.uk>
Sat, 18 Feb 2017 21:22:41 +0000 (21:22 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 27 Feb 2017 15:58:07 +0000 (15:58 +0000)
Adding net_device::min_header_len is a massive ABI break that we don't
want right now.  Instead, check for the specific device types and
minimum length in dev_validate_header().

Gbp-Pq: Topic debian
Gbp-Pq: Name net-avoid-abi-change-for-min_header_len.patch

drivers/net/loopback.c
include/linux/netdevice.h
net/ethernet/eth.c

index 1b65f0f975cfb2167faf741ba04dd45768f2ff12..6255973e3dda35fd41464ce51f0f9fb9f0b8364b 100644 (file)
@@ -164,7 +164,6 @@ static void loopback_setup(struct net_device *dev)
 {
        dev->mtu                = 64 * 1024;
        dev->hard_header_len    = ETH_HLEN;     /* 14   */
-       dev->min_header_len     = ETH_HLEN;     /* 14   */
        dev->addr_len           = ETH_ALEN;     /* 6    */
        dev->type               = ARPHRD_LOOPBACK;      /* 0x0001*/
        dev->flags              = IFF_LOOPBACK;
index bb9b102c15cdc8b9538c12c6cac830e481f5ec29..6c62cd171935ff62f9d3168a1edb982656172d19 100644 (file)
@@ -1508,7 +1508,6 @@ enum netdev_priv_flags {
  *     @mtu:           Interface MTU value
  *     @type:          Interface hardware type
  *     @hard_header_len: Maximum hardware header length.
- *     @min_header_len:  Minimum hardware header length
  *
  *     @needed_headroom: Extra headroom the hardware may need, but not in all
  *                       cases can this be guaranteed
@@ -1729,7 +1728,6 @@ struct net_device {
        unsigned int            mtu;
        unsigned short          type;
        unsigned short          hard_header_len;
-       unsigned short          min_header_len;
 
        unsigned short          needed_headroom;
        unsigned short          needed_tailroom;
@@ -2785,7 +2783,11 @@ static inline bool dev_validate_header(const struct net_device *dev,
 {
        if (likely(len >= dev->hard_header_len))
                return true;
-       if (len < dev->min_header_len)
+       if ((dev->type == 1 /*ARPHRD_ETHER*/ ||
+            dev->type == 772 /*ARPHRD_LOOPBACK*/ ||
+            dev->type == 801 /*ARPHRD_IEEE80211*/ ||
+            dev->type == 803 /*ARPHRD_IEEE80211_RADIOTAP*/) &&
+           len < 14 /*ETH_HLEN*/)
                return false;
 
        if (capable(CAP_SYS_RAWIO)) {
index 24d7aff8db1ac8afda0d8537fe0b84fe316bde06..02acfff36028bfc3260d7568881bb412be312d27 100644 (file)
@@ -356,7 +356,6 @@ void ether_setup(struct net_device *dev)
        dev->header_ops         = &eth_header_ops;
        dev->type               = ARPHRD_ETHER;
        dev->hard_header_len    = ETH_HLEN;
-       dev->min_header_len     = ETH_HLEN;
        dev->mtu                = ETH_DATA_LEN;
        dev->addr_len           = ETH_ALEN;
        dev->tx_queue_len       = 1000; /* Ethernet wants good queues */