STREAMS, DLPI, Structure padding ? problem

STREAMS, DLPI, Structure padding ? problem

Post by Victor Anoutchin » Thu, 11 Oct 2001 11:01:36



Dear All,

I'm writing communication software over X.25 LAPB  under Solaris 7 sparc
64-bit. I'm using SUN's implementation of X.25 - Solstice 9.2 and DLPI
interface over LAPB. Workshop 6u1 compilers. At some stage I need to get
information about DLPI provider and issuing DL_INFO_REQ request on the
stream. In response I expect DL_INFO_ACK structure, which is defined in
sys/dlpi.h as
typedef struct {
 t_uscalar_t dl_primitive;  /* set to DL_INFO_ACK */
 t_uscalar_t dl_max_sdu;  /* Max bytes in a DLSDU */
 ...
 t_uscalar_t dl_growth;  /* set to zero */

Quote:} dl_info_ack_t;

All members are 32-bit integers in both - 32 and 64-bit compilations. So
according to sparc allignment rules, I expect no holes between structure
members. Totally there is 19 members and sizeof(dl_info_ack_t) = 4 * 19 = 76
(32 and 64 bit).

So my problem is: when I get response from the driver via getmsg call,
providing buffer of 76 bytes, getmsg reports that some data remains
unretrieved. Next getmsg returns more 4 bytes, that look like a garbage. So
totally driver return 80 bytes instead of expected 76. First 76 bytes of 80
is valid dl_info_ack_t response for this DLPI provider, while tailing 4
bytes don't have stable structure from execution to execution.

Does anyone have an idea why this kind of padding may occur ?

Many thanks in advance,
Victor.

 
 
 

STREAMS, DLPI, Structure padding ? problem

Post by Victor Anoutchin » Fri, 12 Oct 2001 13:59:12




> #
> #   So my problem is: when I get response from the driver via getmsg call,
> #   providing buffer of 76 bytes, getmsg reports that some data remains
> #   unretrieved. Next getmsg returns more 4 bytes, that look like a
garbage. So
> #   totally driver return 80 bytes instead of expected 76. First 76 bytes
of 80
> #   is valid dl_info_ack_t response for this DLPI provider, while tailing
4
> #   bytes don't have stable structure from execution to execution.
> #
> #   Does anyone have an idea why this kind of padding may occur ?

> Can you put up for retrieval somewhere both the
> local and remote X.25 configuration files?

Thanks for replying. Unfortunately I'm far from live testing and using
software loopback with default parameters.

Quote:> Are the last four bytes of the dl_info_ack_t received
> as zero, like the struct comments say it should be?

Yes, whole struct is filled correctly. The problem is beyond of the end of
the struct, i.e. I'm getting more information than I expect. And these extra
4 bytes don't have any predictable values.
Any clues ?

Victor.

 
 
 

1. DLPI Stream Pseudo Driver Problem

        We develop a DLPI Stream Pseudo Driver to simulate a subnetwork of
machines as Unix process on Solaris. The goal is to have a subnetwork
managed by the pseudo-driver installed using the ifconfig command, and
passing ethernet frame to Unix process.

        But we encounter some major problems.

        The installation of the driver using add_drv moose is ok (this is the
name of our pseudo driver). This device is NOT a clone device. We launch
a demon which open the stream to have the stream permanently open.

        Now  we use ifconfig moose0 plumb to install the interface. The driver
receive DLPI Request ATTACH_REQ, INFO_REQ and all seems ok.

        BUT ifconfig (plumb_one_device from ifconfig.c) never ends. Here are
what truss command shows :

open("/dev/moose",O_REDONLY) =5
ioctl(5,I_PUSH,"ip") = 0
ioctl(5,0x80047336,0xEFFFF7C8) = 0
ioctl(5,0xC0206911,0x0002B010) = 0
open("/dev/moose",O_RDONLY) = 6
ioctl(6, I_PUSH, "arp") = 0
ioctl(5,I_PUSH,"arp")  (sleeping...)

The PUSH of module arp never end. I have no idea why. Is it because my
device is not clonable ?


seen this problem before or if you can help us on any way. Thanks in
advance.

Frederic BARNABE
Sema Group Telecom

2. Caldera and PPP problem -RESOLVED!!!!!

3. DLPI/Streams *big* problem! HELP!

4. Where can I find SLIRP?

5. gcc pads structures that contain pointers

6. lower/upper case

7. Why does xlc pad structures like this?

8. CDE differences with IBM and HP

9. Pads in structures in C++ (Solaris 2.3)

10. Bus errors due to structure padding 32 -> 64-bit porting

11. DLPI & STREAMS: How...

12. Find a DLPI Streams Reference

13. DLPI: How do I increase my STREAMS high-water mark?