[PATCH] 2: 2.5.29-ether

From: Russell King (rmk@arm.linux.org.uk)
Date: Sat Aug 03 2002 - 13:16:15 EST


This patch has been verified to apply cleanly to 2.5.30

Some compilers may add extra padding at the end of struct ethhdr.
This patch ensures that sizeof(struct ethhdr) always packed, and
returns the expected size of 14 bytes.

This is particularly important when struct ethhdr is embedded into
a structure, thusly:

struct arc_eth_encap
{
    uint8_t proto; /* Always ARC_P_ETHER */
    struct ethhdr eth; /* standard ethernet header (yuck!) */
    uint8_t payload[0]; /* 493 bytes */
};
#define ETH_ENCAP_HDR_SIZE 14

or this:

                char *the_ip = (((char *)skb->data))
                                + sizeof(struct ethhdr)
                                + sizeof(struct arphdr) +
                                ETH_ALEN;

 include/linux/if_ether.h | 2 +-
 1 files changed, 1 insertion, 1 deletion

diff -urN orig/include/linux/if_ether.h linux/include/linux/if_ether.h
--- orig/include/linux/if_ether.h Mon Mar 11 11:56:23 2002
+++ linux/include/linux/if_ether.h Mon Mar 11 11:45:30 2002
@@ -96,6 +96,6 @@
         unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
         unsigned char h_source[ETH_ALEN]; /* source ether addr */
         unsigned short h_proto; /* packet type ID field */
-};
+} __attribute__((packed));
 
 #endif /* _LINUX_IF_ETHER_H */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Aug 07 2002 - 22:00:22 EST