[RP-PPPoE] rp-pppoe.h: endian detection patch

Sascha W. master.b.at.raven at chefmail.de
Mon Jul 30 17:20:31 EDT 2012



--- pppoe.h    2011-10-23 22:40:39.000000000 +0200
+++ dd-wrt/rp-pppoe-3.5/src/pppoe.h    2012-07-30 23:14:41.965798008 +0200
@@ -221,12 +221,14 @@
 /* A PPPoE Packet, including Ethernet headers */
 typedef struct PPPoEPacketStruct {
     struct ethhdr ethHdr;    /* Ethernet header */
-#ifdef PACK_BITFIELDS_REVERSED
+#if __BYTE_ORDER == __BIG_ENDIAN
     unsigned int type:4;    /* PPPoE Type (must be 1) */
     unsigned int ver:4;        /* PPPoE Version (must be 1) */
-#else
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
     unsigned int ver:4;        /* PPPoE Version (must be 1) */
     unsigned int type:4;    /* PPPoE Type (must be 1) */
+#else
+#error "Could not determine the system's endianness"
 #endif
     unsigned int code:8;    /* PPPoE code */
     unsigned int session:16;    /* PPPoE session */



regards
sash (DD-WRT)


More information about the RP-PPPoE mailing list