[P4] SOS - segfault Encap + Decap

Sándor Laki lakis at elte.hu
Thu May 31 11:05:03 CEST 2018


Hi,

A dekapszuláció nem dekapszulál

* 90 bájtos csomagok mennek be és ilyen méretű junk jön ki a másik oldalon.

* az ethernet fejléc rendben van

* az outer ip eleje kimásolódik belülről, de a vége így pl az ip címek 
maradnak.

* az, udp, gtp, inner ip headerek nem kerülnek eltávolításra, ha 
invalid, akkor nem kellene emittálni

Ez megy be:

10:50:50.409963 aa:cc:dd:cc:00:04 > aa:22:bb:44:cc:66, ethertype IPv4 
(0x0800), length 90: 1.1.0.4.2152 > 200.0.0.1.2152: UDP, length 48
         0x0000:  4500 004c 0001 0000 4011 b19a 0101 0004
         0x0010:  c800 0001 0868 0868 0038 fc9e 3000 0028
         0x0020:  0000 0004 4500 0028 0001 0000 4006 73c7 <--- a 
4500-nál kezdődik a belső ip
         0x0030:  0303 0004 0200 0202 0014 0050 0000 0000
         0x0040:  0000 0000 5002 2000 8876 0000

és ez jön ki:
10:52:05.554380 00:11:22:33:44:55 > aa:cc:dd:cc:00:05, ethertype IPv4 
(0x0800), length 90: 1.1.0.4.2152 > 200.0.0.1.2152: UDP, bad length 48 > 12
         0x0000:  4500 0028 0001 0000 3f11 b19a 0101 0004 <- mintha 9 
bájt másolódott volna ide a
         0x0010:  c800 0001 0868 0868 0038 fc9e 3000 0028 <- udp + gtp 
változatlanul
         0x0020:  0000 0004 4500 0028 0001 0000 4006 73c7
         0x0030:  0303 0004 0200 0202 0014 0050 0000 0000
         0x0040:  0000 0000 5002 2000 8876 0000

Üdv.
Sanyi

2018.05.31. 10:27 keltezéssel, Sándor Laki írta:
> Hi,
>
> Az enkapszuláció utáni bájtok száma stimmel, az outer ip rendben van 
> az udp fejléc is. Azonban az innerip tartalma nem az, aminek lennie 
> kellene...
>
> pl -> ez kellene, hogy legyen:
>
> 4500 0032 0001 0000 4006 74be 0200 0102 0303 0003
>
> És helyette ezt látom, ami elég gyanús sorminta:
>
> 4500 0000 4400 0000 4400 0000 4400 0000 4400 0000
>
> És a payload utána rendben van, azaz uaz, mint amit beküldünk.
>
> Üdv.
> Sanyi
>
>
> 2018.05.31. 10:01 keltezéssel, Sándor Laki írta:
>> Parser probléma volt. Egy résznél az inner_ip parsolás is ki lett 
>> kommentezve. Köszi Máté!
>>
>> Mindjárt nézem, hogy milyen csomagokat kapunk vissza...
>>
>> Üdv.
>>
>> Sanyi
>>
>>
>> 2018.05.31. 0:02 keltezéssel, Sándor Laki írta:
>>> Nah, a downlink irány megy, elvben az encapsulation-nel, majd holnap 
>>> ellenőrzöm. Az uplink irányban viszont az a hiba még megoldásra vár...
>>>
>>> Üdv.
>>>
>>> Sanyi
>>>
>>>
>>> 2018.05.30. 23:34 keltezéssel, Sándor Laki írta:
>>>> Hi,
>>>>
>>>> decapsulation segfaultot dob - a lenti első memcpy sornál kapjuk:
>>>>
>>>> void action_code_gtp_decapsulate_0(packet_descriptor_t* pd, 
>>>> lookup_table_t** tables) { // actions at 41
>>>>     uint32_t value32, res32, mask32; // actions at 42
>>>>     (void)value32; (void)res32; (void)mask32; // actions at 43
>>>>     control_locals_MyIngress_t* control_locals = 
>>>> (control_locals_MyIngress_t*) pd->control_locals; // actions at 44
>>>> // TODO make it work properly for non-byte-aligned fields // 
>>>> codegen at 256
>>>> memcpy(pd->headers[header_instance_ipv4].pointer, 
>>>> pd->headers[header_instance_inner_ipv4].pointer, 
>>>> (field_instance_bit_width[header_instance_ipv4]+7)/8); // codegen at 257
>>>>
>>>> a debugger alapján:
>>>>
>>>> #0  0x00000000004389e8 in memcpy (__len=6, __src=0x0, 
>>>> __dest=0x7fffda81410e)
>>>>     at /usr/include/x86_64-linux-gnu/bits/string3.h:53
>>>> #1  action_code_gtp_decapsulate_0 (pd=pd at entry=0x7fffffffdcd0,
>>>>     tables=tables at entry=0x858580 <lcore_conf+9600>)
>>>>     at 
>>>> /home/p4/demo/t4p4s-16/build/vsmgw-no-typedef//../src_hardware_indep/actions.c:93
>>>> #2  0x000000000043859b in ue_selector_apply (
>>>>     tables=0x858580 <lcore_conf+9600>, pd=0x7fffffffdcd0)
>>>>     at 
>>>> /home/p4/demo/t4p4s-16/build/vsmgw-no-typedef//../src_hardware_indep/dataplane.c:67
>>>>
>>>>
>>>> Encapsulation hasonlan segfaultol, de itt a udp fejléces memcpy 
>>>> csinálja. Ez lehet, hogy kiküszöbölhető pl. az inner_udp 
>>>> eltűntetésével.
>>>>
>>>> void action_code_gtp_encapsulate_0(packet_descriptor_t* pd, 
>>>> lookup_table_t** tables, struct action_gtp_encapsulate_0_params 
>>>> parameters) { // actions at 41
>>>>     uint32_t value32, res32, mask32; // actions at 42
>>>>     (void)value32; (void)res32; (void)mask32; // actions at 43
>>>>     control_locals_MyIngress_t* control_locals = 
>>>> (control_locals_MyIngress_t*) pd->control_locals; // actions at 44
>>>> // setValid called on <Member>[#-2433][expr, header_ref, member, 
>>>> type] // codegen at 305
>>>> debug("Setting header instance inner_ipv4 as valid"); // codegen at 331
>>>> pd->headers[header_instance_inner_ipv4].pointer = 
>>>> (pd->header_tmp_storage + 
>>>> header_instance_byte_width_summed[header_instance_inner_ipv4]); // 
>>>> codegen at 332
>>>> // TODO initialise header instance contents? // codegen at 333
>>>> // TODO make it work properly for non-byte-aligned fields // 
>>>> codegen at 256
>>>> memcpy(pd->headers[header_instance_inner_ipv4].pointer, 
>>>> pd->headers[header_instance_ipv4].pointer, 
>>>> (field_instance_bit_width[header_instance_inner_ipv4]+7)/8); // 
>>>> codegen at 257
>>>> // TODO make it work properly for non-byte-aligned fields // 
>>>> codegen at 256
>>>> memcpy(pd->headers[header_instance_inner_udp].pointer, 
>>>> pd->headers[header_instance_udp].pointer, 
>>>> (field_instance_bit_width[header_instance_inner_udp]+7)/8);
>>>>
>>>> debugger:
>>>>
>>>> Thread 1 "vsmgw-no-typede" received signal SIGSEGV, Segmentation 
>>>> fault.
>>>> action_code_gtp_encapsulate_0 (pd=pd at entry=0x7fffffffdcd0,
>>>>     tables=tables at entry=0x858580 <lcore_conf+9600>, parameters=...)
>>>>     at 
>>>> /home/p4/demo/t4p4s-16/build/vsmgw-no-typedef//../src_hardware_indep/actions.c:38
>>>> 38 memcpy(pd->headers[header_instance_inner_udp].pointer, 
>>>> pd->headers[header_instance_udp].pointer, 
>>>> (field_instance_bit_width[header_instance_inner_udp]+7)/8); // 
>>>> codegen at 257
>>>> (gdb) bt
>>>> #0  action_code_gtp_encapsulate_0 (pd=pd at entry=0x7fffffffdcd0,
>>>>     tables=tables at entry=0x858580 <lcore_conf+9600>, parameters=...)
>>>>     at 
>>>> /home/p4/demo/t4p4s-16/build/vsmgw-no-typedef//../src_hardware_indep/actions.c:38
>>>>
>>>> Üdv.
>>>> Sanyi
>>>>
>>>
>>
>

-- 
Sándor Laki, PhD
Assistant professor
Department of Information Systems
Eötvös Loránd University
Pázmány Péter stny. 1/C
H-1117, Budapest, Hungary
Room 2.506
Web: http://lakis.web.elte.hu
Phone: +36 1 372 2869 / 8477
Cell: +36 70 374 2646


---
Ezt az e-mailt az Avast víruskereső szoftver átvizsgálta.
https://www.avast.com/antivirus



More information about the P4 mailing list