[P4] SOS - segfault Encap + Decap
Sándor Laki
lakis at elte.hu
Thu May 31 11:09:49 CEST 2018
Pl.
dataplane.c@ 901 [CORE 1 at 0] HANDLING PACKET (port 1, 64 bytes) : aa 22
bb 44 cc 66 30 9c 23 5f 2e 4c 08 00 45 00 00 32 00 01 00 00 40 06 74 be
02 00 01 02 03 03 00 03 00 14 00 50 00 00 00 00 00 00 00 00 50 02 20 00
89 6d 00 00 00 00 00 00 00 00 00 00 00 00
parser.c@ 28 [CORE 1 at 0] entering parser state start...
parser.c@ 96 [CORE 1 at 0] entering parser state parse_ipv4...
parser.c@ 224 [CORE 1 at 0] entering parser state accept...
dataplane.c@ 888 [CORE 1 at 0] Parsed packet
dataplane.c@ 891 [CORE 1 at 0] :::: Header ethernet (14
bytes) : aa 22 bb 44 cc 66 30 9c 23 5f 2e 4c 08 00
dataplane.c@ 891 [CORE 1 at 0] :::: Header ipv4 (20
bytes) : 45 00 00 32 00 01 00 00 40 06 74 be 02 00 01 02 03 03 00 03
dataplane.c@ 691 [CORE 1 at 0] entering control MyVerifyChecksum...
dataplane.c@ 701 [CORE 1 at 0] entering control MyIngress...
dataplane.c@ 47 [CORE 1 at 0] :::: EXECUTING TABLE ue_selector
dataplane.c@ 62 [CORE 1 at 0] :: EXECUTING ACTION gtp_encapsulate_0...
actions.c@ 32 [CORE 1 at 0] Setting header instance inner_ipv4 as
valid actions.c@ 38 [CORE 1 at 0] Setting header instance udp as valid
actions.c@ 42 [CORE 1 at 0] Setting header instance gtp_common as valid
actions.c@ 46 [CORE 1 at 0] Setting header instance gtp_teid as
validdataplane.c@ 80 [CORE 1 at 0] :::: EXECUTING TABLE ipv4_lpm
dataplane.c@ 91 [CORE 1 at 0] :: EXECUTING ACTION set_nhgrp_0...
dataplane.c@ 109 [CORE 1 at 0] :::: EXECUTING TABLE ipv4_forward
dataplane.c@ 120 [CORE 1 at 0] :: EXECUTING ACTION pkt_send_0...
dataplane.c@ 731 [CORE 1 at 0] entering control MyEgress...
dataplane.c@ 741 [CORE 1 at 0] entering control Ipv4ComputeChecksum...
dataplane.c@ 751 [CORE 1 at 0] entering control MyDeparser...
dataplane.c@ 879 [CORE 1 at 0] :::: Reordering emit
dataplane.c@ 835 [CORE 1 at 0] :: Preparing 11 header instances for
storage...
dataplane.c@ 844 [CORE 1 at 0] : Storing 14 bytes ( ethernet) : 00 00
00 00 2d 19 00 11 22 33 44 55 08 00
dataplane.c@ 841 [CORE 1 at 0] : Skipping header ( arp)
: (invalid header)
dataplane.c@ 841 [CORE 1 at 0] : Skipping header ( arp_ipv4) :
(invalid header)
dataplane.c@ 844 [CORE 1 at 0] : Storing 20 bytes (
ipv4) : 45 00 00 56 00 01 00 00 fe 11 74 be 0a 00 00 01 01 01 00 03
dataplane.c@ 841 [CORE 1 at 0] : Skipping header ( icmp)
: (invalid header)
dataplane.c@ 844 [CORE 1 at 0] : Storing 08 bytes (
udp) : 08 68 08 68 00 3a 00 00
dataplane.c@ 844 [CORE 1 at 0] : Storing 04 bytes ( gtp_common) : 30
ff 00 3a
dataplane.c@ 844 [CORE 1 at 0] : Storing 04 bytes ( gtp_teid) : 03 00
00 00
dataplane.c@ 844 [CORE 1 at 0] : Storing 20 bytes ( inner_ipv4) : 45
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
dataplane.c@ 841 [CORE 1 at 0] : Skipping header ( inner_icmp) :
(invalid header)
dataplane.c@ 841 [CORE 1 at 0] : Skipping header ( inner_udp) :
(invalid header)
dataplane.c@ 849 [CORE 1 at 0] :: Stored 70
bytes : 00 00 00 00 2d 19 00 11 22 33 44 55 08 00
45 00 00 56 00 01 00 00 fe 11 74 be 0a 00 00 01 01 01 00 03 08 68 08 68
00 3a 00 00 30 ff 00 3a 03 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
dataplane.c@ 856 [CORE 1 at 0] :: Adding 36 bytes to
packet : (header: from 34 bytes to 70 bytes)
dataplane.c@ 873 [CORE 1 at 0] :: Headers: 70 bytes from storage:
00 00 00 00 2d 19 00 11 22 33 44 55 08 00 45 00 00 56 00 01 00 00 fe 11
74 be 0a 00 00 01 01 01 00 03 08 68 08 68 00 3a 00 00 30 ff 00 3a 03 00
00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
main_loop.c@ 323 [CORE 1 at 0] :::: EGRESSING
main_loop.c@ 331 [CORE 1 at 0] :: sending packet on port 0 (lcore 1)
2018.05.31. 11:01 keltezéssel, Kitlei Róbert írta:
>
> Két kérdés:
>
>
> - Mit ír ki a rendszer, ha "dbg" kapcsolót is adsz neki? Abból
> kiderül, hogy a fejlécekbe helyesen íródik-e be a tartalom, vagy már
> ott rossz...
>
> - Mit tartalmaz a bemenő csomag? (dbg-gal indítva ki is írja)
>
>
> On 2018. 05. 31. 10:27, Sándor Laki wrote:
>> 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
>>>>>
>>>>
>>>
>>
>
> _______________________________________________
> P4 mailing list
> P4 at plc.inf.elte.hu
> https://plc.inf.elte.hu/mailman/listinfo/p4
--
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