Port-amiga archive

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

sizeof() problem in ISO CLNP kernel driver



I have been trying to bring up Isode 8.0 using the OSI network
layer in the NetBSD kernel (NetBSD 1.2 on an Amiga 3000). In the
process, I have identified some bugs in the CLNP and ESIS code:

The problems relate to two structures:
        clnp_fixed      defined in netiso/clnp.h
        esis_fixed      defined in netiso/esis.h

The affected sources include
        netiso/clnp_er.c
        netiso/clnp_input.c
        netiso/clnp_output.c
        netiso/esis.c

Both structures are 9 bytes but 'sizeof()' returns a value of 10.
The way the size is used, is to calculate offsets to the start
of the NSAP addresses in the packet header. The extra byte then
causes the addresses to be inserted in the wrong position in the 
output routines and incorrectly decoded in the input routines.

I have added some temporary fixes to my kernel to work round the 
extra byte and confirmed that this does fix the problem I was 
seeing with incorrect packet formats. The question is, what is 
the machine-independent way to fix this type of problem since I 
guess it is caused by data alignment rules which will be different
for different processors?


    George Harvey                  | Amiga A3000T, CyberStorm-II 040,
    email: fr30%dial.pipex.com@localhost     | Picasso-II, MFC-III, Ariadne





Home | Main Index | Thread Index | Old Index