industrialNETworXnetx

DrunkenHero

DrunkenHero

| 09.11.2009 | 15:13 | 4 replies

Ident All + Given Buffer is too short

Hi,

I have a problem with the Ident All Packet.

APIOC_DCP_IDENT_ALL_REQ_T send_Identall;
			APIOC_DCP_IDENT_ENTRY_PCK_T receive_Identall={{0}};
			APIOC_DCP_IDENT_ENTRY_PCK_T reIdentEntry={0};

send_Identall.tHead.ulDest=0x20;
send_Identall.tHead.ulSrc=0;
send_Identall.tHead.ulDestId=0;
send_Identall.tHead.ulSrcId=0;
send_Identall.tHead.ulLen=4;
send_Identall.tHead.ulId=0;
send_Identall.tHead.ulSta=0;
send_Identall.tHead.ulCmd=0xc10;
send_Identall.tHead.ulExt=0;
send_Identall.tHead.ulRout=0;
send_Identall.tData.ulTimeout=5;

printf("Ident all I/O devices:\r\n");
if(CIFX_NO_ERROR == (lRet=xChannelPutPacket(hChannel,(CIFX_PACKET *)&send_Identall,PACKET_WAIT_TIMEOUT)))
Sleep(3000);

lRet=xChannelGetPacket(hChannel, sizeof(help), (CIFX_PACKET *)&help, PACKET_WAIT_TIMEOUT); //get Ident all conf paket
lRet=xChannelGetPacket(hChannel,sizeof(receive_Identall), (CIFX_PACKET *)&receive_Identall, PACKET_WAIT_TIMEOUT);//get Ident Entry Indication paket

if(CIFX_NO_ERROR==lRet)
printf("packet command: %u",receive_Identall.tRsp.tHead.ulCmd);
else
showError(lRet);

printf("Show ident all pakets?---(1)Yes / (0)No: ");
scanf_s("%d",&a);
if(a){
printf("Send IdentAll Packet: \r\n");
DumpPacket((CIFX_PACKET *)&send_Identall);
printf("Received IdentAll Packet: \r\n");
DumpPacket((CIFX_PACKET *)&receive_Identall);
}

printf("IP Adresse: 0x%08X \r\n",receive_Identall.tInd.tData.ulIp);
printf("Netzmaske: 0x%08X \r\n",receive_Identall.tInd.tData.ulNetMask);
printf("Gateway: 0x%08X \r\n",receive_Identall.tInd.tData.ulGateway);
printf("Vendor ID: %d \r\n",receive_Identall.tInd.tData.usVendorId);
printf("ulCmd: 0x%08X \r\n",receive_Identall.tInd.tHead.ulCmd);
printf("ulState: 0x%08X \r\n",receive_Identall.tInd.tHead.ulSta);
printf("Namenslänge der Station:%d\r\n",receive_Identall.tInd.tData.usLenName);
printf("Name der Station:%s\r\n",receive_Identall.tInd.tData.abNameOfStation);

My Problem is that I get the error message (Given buffer is too short)
The Output of my Programm is:
...
04 63 A8 C0 00 FF FF FF 04 63 A8 C0 0B 00 09 00
76 01 02 00 01 00 00 05 94 02 40 8A 68 CC CC CC
CC CC CC CC CC CC CC CC 20 00 00 00 00 00 00 00
IP Adresse: 0xC0A86304
Netzmaske: 0xFFFFFF00
Gateway: 0xC0A86304
Vendor ID: 374
ulCmd: 0x00000C24
ulState: 0x00000000
Namenslõnge der Station:11
Name der Station:h╠╠╠╠╠╠╠╠╠╠╠
...

the "Name der Station" should be hostapitest

Regards
C.Huiskens

Benjamin Meyer

Benjamin Meyer

Hilscher Gesellschaft fuer Systemautomation mbH

| 09.11.2009 | 15:27

This is strange.

which version of the IO-Controller firmware do you use?

is it possible for you to create a wireshark trace (.pcap) while performing the bus scan with IdentAll?

DrunkenHero

DrunkenHero

| 09.11.2009 | 16:03

Here is a wireshark trace:

No.     Time        Source                Destination           Protocol Info
      1 0.000000    Hilscher_20:ca:cf     PN-MC_00:00:00        PN-DCP   Ident Req, Xid:0xf0, All

Frame 1 (60 bytes on wire, 60 bytes captured)
Arrival Time: Nov 9, 2009 15:50:54.353127000
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1
Frame Length: 60 bytes
Capture Length: 60 bytes
[Frame is marked: False]
[Protocols in frame: eth:pn_rt:pn_dcp]
[Coloring Rule Name: Broadcast]
[Coloring Rule String: eth[0] & 1]
Ethernet II, Src: Hilscher_20:ca:cf (00:02:a2:20:ca:cf), Dst: PN-MC_00:00:00 (01:0e:cf:00:00:00)
Destination: PN-MC_00:00:00 (01:0e:cf:00:00:00)
Address: PN-MC_00:00:00 (01:0e:cf:00:00:00)
.... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: Hilscher_20:ca:cf (00:02:a2:20:ca:cf)
Address: Hilscher_20:ca:cf (00:02:a2:20:ca:cf)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Type: PROFINET (0x8892)
PROFINET acyclic Real-Time, ID:0xfefe, Len: 44
FrameID: 0xfefe (Real-Time: DCP (Dynamic Configuration Protocol) identify multicast request)
PROFINET DCP, Ident Req, Xid:0xf0, All
ServiceID: Identify (5)
ServiceType: Request (0)
Xid: 0x000000f0
ResponseDelay: 255
DCPDataLength: 4
Block: All/All
Option: All Selector (255)
Suboption: ALL Selector (255)
DCPBlockLength: 0

No. Time Source Destination Protocol Info
2 2.013824 IxxatAut_02:40:8a Hilscher_20:ca:cf PN-DCP Ident Ok , Xid:0xf0,Dev-Options(9), TypeOfStation, NameOfStation:"hostapitest", Dev-ID, Dev-Role, IP

Frame 2 (120 bytes on wire, 120 bytes captured)
Arrival Time: Nov 9, 2009 15:50:56.366951000
[Time delta from previous captured frame: 2.013824000 seconds]
[Time delta from previous displayed frame: 2.013824000 seconds]
[Time since reference or first frame: 2.013824000 seconds]
Frame Number: 2
Frame Length: 120 bytes
Capture Length: 120 bytes
[Frame is marked: False]
[Protocols in frame: eth:pn_rt:pn_dcp]
Ethernet II, Src: IxxatAut_02:40:8a (00:05:94:02:40:8a), Dst: Hilscher_20:ca:cf (00:02:a2:20:ca:cf)
Destination: Hilscher_20:ca:cf (00:02:a2:20:ca:cf)
Address: Hilscher_20:ca:cf (00:02:a2:20:ca:cf)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: IxxatAut_02:40:8a (00:05:94:02:40:8a)
Address: IxxatAut_02:40:8a (00:05:94:02:40:8a)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Type: PROFINET (0x8892)
PROFINET acyclic Real-Time, ID:0xfeff, Len: 104
FrameID: 0xfeff (Real-Time: DCP (Dynamic Configuration Protocol) identify response)
PROFINET DCP, Ident Ok , Xid:0xf0, Dev-Options(9), TypeOfStation, NameOfStation:"hostapitest", Dev-ID, Dev-Role, IP
ServiceID: Identify (5)
ServiceType: Response Success (1)
Xid: 0x000000f0
Reserved: 0
DCPDataLength: 94
Block: Device/Device Options, BlockInfo: Reserved, 9 options
Option: Device properties (2)
Suboption: Device Options (5)
DCPBlockLength: 20
BlockInfo: Reserved (0)
Option: Device properties (2)
Suboption: Manufacturer specific (Type of Station) (1)
Option: Device properties (2)
Suboption: Name of Station (2)
Option: Device properties (2)
Suboption: Device ID (3)
Option: Device properties (2)
Suboption: Device Role (4)
Option: Device properties (2)
Suboption: Device Options (5)
Option: Device properties (2)
Suboption: Alias Name (6)
Option: IP (1)
Suboption: MAC address (1)
Option: IP (1)
Suboption: IP parameter (2)
Option: DHCP (3)
Suboption: DHCP client identifier (61)
Block: Device/Manufacturer specific, BlockInfo: Reserved, TypeOfStation: "IE Module"
Option: Device properties (2)
Suboption: Manufacturer specific (Type of Station) (1)
DCPBlockLength: 11
BlockInfo: Reserved (0)
TypeOfStation: IE Module
Padding: 1 byte
Block: Device/NameOfStation, BlockInfo: Reserved, "hostapitest"
Option: Device properties (2)
Suboption: Name of Station (2)
DCPBlockLength: 13
BlockInfo: Reserved (0)
NameOfStation: hostapitest
Padding: 1 byte
Block: Device/Device ID, BlockInfo: Reserved, VendorID: 0x0176 / DeviceID: 0x0002
Option: Device properties (2)
Suboption: Device ID (3)
DCPBlockLength: 6
BlockInfo: Reserved (0)
VendorID: 0x0176
DeviceID: 0x0002
Block: Device/Device Role, BlockInfo: Reserved, IO-Device
Option: Device properties (2)
Suboption: Device Role (4)
DCPBlockLength: 4
BlockInfo: Reserved (0)
DeviceRoleDetails: 0x01
Reserved: 0
Block: IP/IP, BlockInfo: IP set, IP: 192.168.99.4, Subnet: 255.255.255.0, Gateway: 192.168.99.4
Option: IP (1)
Suboption: IP parameter (2)
DCPBlockLength: 14
BlockInfo: IP set (1)
IPaddress: 192.168.99.4 (192.168.99.4)
Subnetmask: 255.255.255.0 (255.255.255.0)
StandardGateway: 192.168.99.4 (192.168.99.4)

DrunkenHero

DrunkenHero

| 11.11.2009 | 11:24

Hi ,

I found a way to fix that problem.
I changed the size of abNameOfStation[1](struct:APIOC_DCP_IDENT_ENTRY_PCK_T) into 100 (abNameOfStation[100]).

Question: Why is [1],the standard size of abNameOfSation (declared in PNM_PNIOAPCTL_Public.h)????

regards C.Huiskens

Benjamin Meyer

Benjamin Meyer

Hilscher Gesellschaft fuer Systemautomation mbH

| 12.11.2009 | 19:39

DrunkenHero wrote:
I found a way to fix that problem.
I changed the size of abNameOfStation[1](struct:APIOC_DCP_IDENT_ENTRY_PCK_T) into 100 (abNameOfStation[100]).

If that really helps solving your problem then the real problem is not the firmware. The firmware does not know anything about your change of a header-file.

I agree with you, the packet should have been defined with abNameofStation and abTypeOfStation as arrays with length 240 (max. possible value). i do not know why this is not the case. however such a change influences existing applications (API-change) and i am not sure if Hilscher will change its API.

Login