[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#553299: nstx: Does not support cross-endianness



Package: nstx
Version: 1.1-beta6-5
Severity: normal
Tags: patch upstream

My laptop is x86 and my router is Big-endian Mips. nstx doesn't work
very well in that case just because of endianness which flips the fields
of the nstxhdr structure around. The 12bit length field makes it even
more tricky.

In the attached patch, I have just increased the id size to 16 to
make it easier to just revert the fields.  I don't know whether nstx
considers cross-version compatibility?  In such case my patch won't be
ok, of course, and send/reception bitmagic will be needed instead.

Samuel

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages nstx depends on:
ii  adduser                       3.111      add and remove users and groups
ii  libc6                         2.9-25     GNU C Library: Shared libraries

nstx recommends no packages.

nstx suggests no packages.

-- no debconf information

-- 
Samuel Thibault <samuel.thibault@fnac.net>
<y> le y est un animal discret se logeant facilement dans un terminal
*** c has changed the topic on channel #ens-mim to ne pas jeter de cacahuetes aux ys, svp
 -+- #ens-mim - n'oubliez pas le guide -+-
diff -ur nstx-1.1-beta6/nstxfun.h /home/samy/src/nstx-1.1-beta6/nstxfun.h
--- nstx-1.1-beta6/nstxfun.h	2004-06-27 23:43:34.000000000 +0200
+++ /home/samy/src/nstx-1.1-beta6/nstxfun.h	2009-10-29 05:49:52.000000000 +0100
@@ -32,11 +32,19 @@
 /* nstx header */
 
 struct nstxhdr {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
    unsigned char magic;
    unsigned char seq:4;
-   unsigned char chan:4; /* Unused yet... */
-   unsigned short id:12;
-   unsigned short flags:4;
+   unsigned char chan:2; /* Unused yet... */
+   unsigned char flags:2;
+   unsigned short id:16;
+#else
+   unsigned char magic;
+   unsigned char flags:2;
+   unsigned char chan:2; /* Unused yet... */
+   unsigned char seq:4;
+   unsigned short id:16;
+#endif
 };
 
 /* flags... more to come ?! */

Reply to: