Discussion:
All structures for network packets must have __attribute__((packed))
Maksim Tamarsky
2014-10-16 15:54:29 UTC
Permalink
All structures for network packets must have __attribute__((packed))
We already speak about this problem 2 years ago.
On my platform i have bad structure alignment in ospf and i need make
this fix.

ospf.h
..............
struct immsb
{
#ifdef CPU_BIG_ENDIAN
u8 padding:5;
u8 i:1;
u8 m:1;
u8 ms:1;
#else
u8 ms:1;
u8 m:1;
u8 i:1;
u8 padding:5;
#endif
}*__attribute__((packed))*;

union imms
{
u8 byte;
struct immsb bit;
}*__attribute__((packed))*;
.......
--
RU:
ТаЌарскОй МаксОЌ АлексаМЎрПвОч
ИМжеМер-прПграЌЌОст

ООО ЭМ-Эс-ДжО
г.МПсква, КОрпОчМая 39/41 Пф.1302
ППчтПвый аЎрес: 105187 РПссОя, МПсква
ул.ВПльМая, ÐŽ.35, Пф.NSG

Тел./факс: +7 495 727-19-59
Web-сайт: http://www.nsg.ru

EN:
Maksim Tamarsky
Software Engineer
NSG Ltd.
35 Volnaya Street, 105187 Moscow, Russia
+7 495 727-19-59
http://www.nsg.ru
Ondrej Filip
2014-10-16 16:08:56 UTC
Permalink
Post by Maksim Tamarsky
All structures for network packets must have
__attribute__((packed)) We already speak about this problem 2
years ago. On my platform i have bad structure alignment in ospf
and i need make this fix.
Thanks Maksim for the report. Added into git tree.

Ondrej
Post by Maksim Tamarsky
ospf.h .............. struct immsb { #ifdef CPU_BIG_ENDIAN u8
padding:5; u8 i:1; u8 m:1; u8 ms:1; #else u8 ms:1; u8 m:1; u8
i:1; u8 padding:5; #endif }*__attribute__((packed))*;
union imms { u8 byte; struct immsb bit;
}*__attribute__((packed))*; .......
-- RU: ????????? ?????? ????????????? ???????-???????????
105187 ??????, ?????? ??.???????, ?.35, ??.NSG
???./????: +7 495 727-19-59 Web-????: http://www.nsg.ru
EN: Maksim Tamarsky Software Engineer NSG Ltd. 35 Volnaya Street,
105187 Moscow, Russia +7 495 727-19-59 http://www.nsg.ru
Loading...