[PATCH] ip6t_LOG (little/big endian issue)

KUNITAKE Koichi kunitake@linux-ipv6.org
Tue, 16 Oct 2001 20:21:34 +0900


 Hey all!

 Here is a bugfix about little/big endian.
 Please apply it into your CVS server!

--- net/ipv6/netfilter/ip6t_LOG.c       Tue Oct 16 19:35:44 2001
+++ net/ipv6/netfilter/ip6t_LOG.c       Mon Sep 17 00:51:56 2001
@@ -87,13 +87,9 @@
        /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */
        printk("LEN=%u TC=%u HOPLIMIT=%u FLOWLBL=%u ",
               ntohs(ipv6h->payload_len) + sizeof(struct ipv6hdr),
-              /* The following may be incorrect (little/big endian issue) */
-              (ipv6h->priority << 4) | ((ipv6h->flow_lbl[0] >> 4) & 0xF),
+              (ntohl(*(u_int32_t *)ipv6h) & 0x0ff00000) >> 20,
               ipv6h->hop_limit,
-              /* The following may be incorrect (little/big endian issue) */
-              ((u_int32_t)ipv6h->flow_lbl[0] & 0xF) * 65536 +
-              (u_int32_t)ipv6h->flow_lbl[1] * 256 +
-              (u_int32_t)ipv6h->flow_lbl[2]);
+              (ntohl(*(u_int32_t *)ipv6h) & 0x000fffff));

cf.
http://www.linux-ipv6.org/cvsweb/usagi/kernel/linux24/net/ipv6/netfilter/ip6t_LOG.c.diff?r1=1.2&r2=1.3
 from YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Best regards,

-----------------------------------------
KUNITAKE Koichi <kunitake@linux-ipv6.org>