summaryrefslogtreecommitdiff
path: root/infra/test/TestPacketParser.cc
blob: 3671087cfbca8cdb7b1eb153675aa310a5e9b2cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920

extern "C"
{
#include <rte_mbuf.h>
#include <rte_ip.h>
#include <rte_tcp.h>
#include <rte_udp.h>
#include <arpa/inet.h>
#include <ldbc.h>
}

#include <gtest/gtest.h>

/*31	Ether/IPv4/TCP
		192.168.11.169	202.157.180.190	TCP	78	
	    64161→1443[SYN] Seq = 2421401215 Win = 65535 Len = 0 MSS = 1460 WS = 16 
		TSval = 1409022517 TSecr = 0 SACK_PERM = 1
*/

static const unsigned char pkt_031[78] = {
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0x9b, /* ........ */
	0x9c, 0xb2, 0x90, 0x51, 0x08, 0x00, 0x45, 0x00, /* ...Q..E. */
	0x00, 0x40, 0x74, 0x13, 0x40, 0x00, 0x40, 0x06, /* .@t.@.@. */
	0x7a, 0xf7, 0xc0, 0xa8, 0x0b, 0xa9, 0xca, 0x9d, /* z....... */
	0xb4, 0xbe, 0xfa, 0xa1, 0x05, 0xa3, 0x90, 0x53, /* .......S */
	0xa6, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x02, /* ........ */
	0xff, 0xff, 0x66, 0x07, 0x00, 0x00, 0x02, 0x04, /* ..f..... */
	0x05, 0xb4, 0x01, 0x03, 0x03, 0x04, 0x01, 0x01, /* ........ */
	0x08, 0x0a, 0x53, 0xfb, 0xfa, 0x35, 0x00, 0x00, /* ..S..5.. */
	0x00, 0x00, 0x04, 0x02, 0x00, 0x00              /* ...... */
};

/* 16	Ether/IPv6/TCP
		16.124364	3ffe:507:0:1:200:86ff:fe05:80da	3ffe:501:410:0:2c0:dfff:fe47:33e TCP 94	
		1022→22[SYN] Seq = 3598119713 Win = 8192 Len = 0 MSS = 1440 WS = 1 TSval = 576087 TSecr = 0
*/
/* Frame (94 bytes) */
static const unsigned char pkt_16[94] = {
	0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00, /* .`..i... */
	0x86, 0x05, 0x80, 0xda, 0x86, 0xdd, 0x60, 0x00, /* ......`. */
	0x00, 0x00, 0x00, 0x28, 0x06, 0x40, 0x3f, 0xfe, /* ...(.@?. */
	0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, /* ........ */
	0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x3f, 0xfe, /* ......?. */
	0x05, 0x01, 0x04, 0x10, 0x00, 0x00, 0x02, 0xc0, /* ........ */
	0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e, 0x03, 0xfe, /* ...G.>.. */
	0x00, 0x16, 0xd6, 0x76, 0xf3, 0x21, 0x00, 0x00, /* ...v.!.. */
	0x00, 0x00, 0xa0, 0x02, 0x20, 0x00, 0x18, 0xd5, /* .... ... */
	0x00, 0x00, 0x02, 0x04, 0x05, 0xa0, 0x01, 0x03, /* ........ */
	0x03, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x00, 0x08, /* ........ */
	0xca, 0x57, 0x00, 0x00, 0x00, 0x00              /* .W.... */
};


/*200	Ether/IPv4/IPv6/TCP
		2001:410:90ff::6	2401:8d00:1::1	TCP	106	
		40527→53[SYN] Seq = 2032252526 Win = 28800 Len = 0 MSS = 1440 SACK_PERM = 1 WS = 128
*/

/* Frame (106 bytes) */
static const unsigned char pkt_200[106] = {
	0x2c, 0x6b, 0xf5, 0x45, 0x88, 0x00, 0x5c, 0x5e, /* ,k.E..\^ */
	0xab, 0x27, 0xa8, 0x00, 0x08, 0x00, 0x45, 0x00, /* .'....E. */
	0x00, 0x5c, 0x5f, 0x96, 0x00, 0x00, 0xf3, 0x29, /* .\_....) */
	0xd4, 0x6b, 0xd8, 0x42, 0x54, 0x32, 0x01, 0x08, /* .k.BT2.. */
	0x65, 0xfa, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, /* e.`....  */
	0x06, 0x38, 0x20, 0x01, 0x04, 0x10, 0x90, 0xff, /* .8 ..... */
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
	0x00, 0x06, 0x24, 0x01, 0x8d, 0x00, 0x00, 0x01, /* ..$..... */
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
	0x00, 0x01, 0x9e, 0x4f, 0x00, 0x35, 0x79, 0x21, /* ...O.5y! */
	0xb6, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, /* .n...... */
	0x70, 0x80, 0xca, 0x76, 0x00, 0x00, 0x02, 0x04, /* p..v.... */
	0x05, 0xa0, 0x01, 0x01, 0x04, 0x02, 0x01, 0x03, /* ........ */
	0x03, 0x07                                      /* .. */
};

/*
	30	Ether/IPv4/UDP/DNS
	192.168.11.169	202.106.0.20	DNS	87	Standard query 0xdf66  A 750cnchannel.digisocial.com
	51435->53 UDP
*/

/* Frame (87 bytes) */
static const unsigned char pkt30[87] = {
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0x9b, /* ........ */
	0x9c, 0xb2, 0x90, 0x51, 0x08, 0x00, 0x45, 0x00, /* ...Q..E. */
	0x00, 0x49, 0x24, 0x04, 0x00, 0x00, 0xff, 0x11, /* .I$..... */
	0x00, 0xd0, 0xc0, 0xa8, 0x0b, 0xa9, 0xca, 0x6a, /* .......j */
	0x00, 0x14, 0xc8, 0xeb, 0x00, 0x35, 0x00, 0x35, /* .....5.5 */
	0x02, 0x27, 0xdf, 0x66, 0x01, 0x00, 0x00, 0x01, /* .'.f.... */
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x37, /* .......7 */
	0x35, 0x30, 0x63, 0x6e, 0x63, 0x68, 0x61, 0x6e, /* 50cnchan */
	0x6e, 0x65, 0x6c, 0x0a, 0x64, 0x69, 0x67, 0x69, /* nel.digi */
	0x73, 0x6f, 0x63, 0x69, 0x61, 0x6c, 0x03, 0x63, /* social.c */
	0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01        /* om..... */
};

/*  73 Ether/IPv4/UDP/G-VxLan/Ether/VLAN/IPv4/TCP
	
	Outer IPv4
	1.1.15.100		10.0.4.120	UDP
	60014->4789

	Inner IPv4
	125.33.49.137	39.66.162.89 TCP	114
	28402→11235[ACK] Seq = 2772490367 Ack = 2640082106 Win = 64440 Len = 0
*/

/* Frame (114 bytes) */
static const unsigned char pkt73[114] = {
	0xe8, 0x4d, 0xd0, 0xca, 0x3a, 0x1f, 0x58, 0x69, /* .M..:.Xi */
	0x6c, 0x6f, 0x96, 0xf3, 0x08, 0x00, 0x45, 0x00, /* lo....E. */
	0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0xfd, 0x11, /* .d...... */
	0x9e, 0xac, 0x01, 0x01, 0x0f, 0x64, 0x0a, 0x00, /* .....d.. */
	0x04, 0x78, 0xea, 0x6e, 0x12, 0xb5, 0x00, 0x50, /* .x.n...P */
	0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x50, /* .......P */
	0x01, 0x00, 0x64, 0xf6, 0x9d, 0x5f, 0xb9, 0x76, /* ..d.._.v */
	0xa4, 0x93, 0x4c, 0xc6, 0xe5, 0x5f, 0x81, 0x00, /* ..L.._.. */
	0x00, 0x01, 0x08, 0x00, 0x45, 0x00, 0x00, 0x28, /* ....E..( */
	0x59, 0x6f, 0x40, 0x00, 0x7b, 0x06, 0x2e, 0x1b, /* Yo@.{... */
	0x7d, 0x21, 0x31, 0x89, 0x27, 0x42, 0xa2, 0x59, /* }!1.'B.Y */
	0x6e, 0xf2, 0x2b, 0xe3, 0xa5, 0x40, 0xd8, 0x7f, /* n.+..@.. */
	0x9d, 0x5c, 0x74, 0xba, 0x50, 0x10, 0xfb, 0xb8, /* .\t.P... */
	0x11, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* .)...... */
	0x00, 0x00                                      /* .. */
};

/*47	Ether/IPv4/UDP/G-Vxlan/Cisco HDLC/IPv4/TCP

        Outer IPv4
        172.26.127.189->172.26.78.1 UDP
        User Datagram Protocol, Src Port: 50909 (50909), Dst Port: 4789 (4789)

        173.194.31.248	36.149.130.101	TCP	114	I->C	
        443 → 21274[SYN, ACK] Seq = 0 Ack = 1 Win = 28400 Len = 0 MSS = 1432 
        SACK_PERM = 1 TSval = 3227044076 TSecr = 33726894 WS = 256 cert_Vxlan

*/

static const unsigned char pkt47[114] = {
    0xa0, 0x8c, 0xf8, 0xa9, 0x50, 0x3c, 0x74, 0x4a, /* ....P<tJ */
    0xa4, 0x1f, 0xf1, 0xc0, 0x08, 0x00, 0x45, 0x00, /* ......E. */
    0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0xfd, 0x11, /* .d...... */
    0x97, 0x95, 0xac, 0x1a, 0x7f, 0xbd, 0xac, 0x1a, /* ........ */
    0x4e, 0x01, 0xc6, 0xdd, 0x12, 0xb5, 0x00, 0x50, /* N......P */
    0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x3c, /* .......< */
    0x07, 0x00, 0x0f, 0x00, 0x08, 0x00, 0x45, 0x04, /* ......E. */
    0x00, 0x3c, 0x38, 0xbd, 0x00, 0x00, 0x33, 0x06, /* .<8...3. */
    0xda, 0x46, 0xad, 0xc2, 0x1f, 0xf8, 0x24, 0x95, /* .F....$. */
    0x82, 0x65, 0x01, 0xbb, 0x53, 0x1a, 0xd4, 0x51, /* .e..S..Q */
    0xaa, 0x9f, 0x1d, 0x0a, 0x08, 0x5c, 0xa0, 0x12, /* .....\.. */
    0x6e, 0xf0, 0x3e, 0x43, 0x00, 0x00, 0x02, 0x04, /* n.>C.... */
    0x05, 0x98, 0x04, 0x02, 0x08, 0x0a, 0xc0, 0x58, /* .......X */
    0xc8, 0xec, 0x02, 0x02, 0xa1, 0xae, 0x01, 0x03, /* ........ */
    0x03, 0x08                                      /* .. */
};

/* 
94  Ether/IPv4/UDP/G-Vxlan/PPP/IPv4/TCP
    
    Outer IPv4
    Internet Protocol Version 4, Src: 172.30.127.188 (172.30.127.188), Dst: NFJD302_V78.9 (172.30.78.9)
    User Datagram Protocol, Src Port: 10000 (10000), Dst Port: 4789 (4789)

    Inner IPv4
    Internet Protocol Version 4, Src: 160.16.206.51 (160.16.206.51), Dst: 117.143.73.98 (117.143.73.98)
    Transmission Control Protocol, Src Port: 443 (443), Dst Port: 18470 (18470), Seq: 0, Ack: 1, Len: 0
*/

static const unsigned char pkt94[98] = {
    0x48, 0x7b, 0x6b, 0xac, 0xe9, 0x2d, 0xb0, 0xf9, /* H{k..-.. */
    0x63, 0xd3, 0xb8, 0x01, 0x08, 0x00, 0x45, 0x00, /* c.....E. */
    0x00, 0x54, 0x64, 0x0f, 0x00, 0x00, 0xfe, 0x11, /* .Td..... */
    0x32, 0x87, 0xac, 0x1e, 0x7f, 0xbc, 0xac, 0x1e, /* 2....... */
    0x4e, 0x09, 0x27, 0x10, 0x12, 0xb5, 0x00, 0x40, /* N.'....@ */
    0xba, 0x8d, 0x08, 0x00, 0x00, 0x00, 0x08, 0x48, /* .......H */
    0x03, 0x00, 0xff, 0x03, 0x00, 0x21, 0x45, 0x04, /* .....!E. */
    0x00, 0x2c, 0x00, 0x00, 0x40, 0x00, 0x35, 0x06, /* .,[email protected]. */
    0x18, 0x93, 0xa0, 0x10, 0xce, 0x33, 0x75, 0x8f, /* .....3u. */
    0x49, 0x62, 0x01, 0xbb, 0x48, 0x26, 0xe2, 0xc5, /* Ib..H&.. */
    0xc9, 0xf6, 0x07, 0xed, 0x28, 0x5c, 0x60, 0x12, /* ....(\`. */
    0x39, 0x08, 0x0a, 0xf2, 0x00, 0x00, 0x02, 0x04, /* 9....... */
    0x05, 0xb4                                      /* .. */
};

/* Frame (119 bytes)
 * 81.211.157.203	10.160.72.52	UDP	119	6564 → 13530 Len=39
 */
static const unsigned char pkt_mpls_pw[119] = {
    0x18, 0x10, 0x04, 0x00, 0x00, 0x1c, 0x00, 0x00, /* ........ */
    0x00, 0x00, 0x04, 0x36, 0x88, 0x47, 0x93, 0x75, /* ...6.G.u */
    0x0a, 0xff, 0x4a, 0xe5, 0x0a, 0xff, 0xc3, 0x60, /* ..J....` */
    0x2b, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x49, /* +......I */
    0x0b, 0xc0, 0x71, 0xca, 0x28, 0xa6, 0xdb, 0xee, /* ..q.(... */
    0xb0, 0xd0, 0x81, 0x00, 0xa4, 0xad, 0x81, 0x00, /* ........ */
    0xa1, 0x04, 0x08, 0x00, 0x45, 0xb8, 0x00, 0x43, /* ....E..C */
    0x52, 0xee, 0x00, 0x00, 0x3e, 0x11, 0xe6, 0x91, /* R...>... */
    0x51, 0xd3, 0x9d, 0xcb, 0x0a, 0xa0, 0x48, 0x34, /* Q.....H4 */
    0x19, 0xa4, 0x34, 0xda, 0x00, 0x2f, 0x00, 0x00, /* ..4../.. */
    0x8e, 0x2e, 0x09, 0x08, 0x02, 0x1b, 0x30, 0x0a, /* ......0. */
    0x20, 0x88, 0xec, 0xfc, 0xcf, 0x2f, 0xa4, 0x3f, /*  ..../.? */
    0x59, 0x58, 0xb4, 0x05, 0x90, 0x84, 0x05, 0x0c, /* YX...... */
    0x06, 0x86, 0x9e, 0x3b, 0x79, 0xa9, 0x0f, 0x0d, /* ...;y... */
    0x11, 0x08, 0xf8, 0x64, 0x90, 0x32, 0x06        /* ...d.2. */
};

/* Frame (143 bytes)
 * 10.33.60.116	217.76.77.34	GTP <DNS>	143	Standard query 0xc4a8 A config.inmobi.com
 * */
static const unsigned char pkt_mpls_eth[143] = {
    0x18, 0x10, 0x04, 0x00, 0x00, 0x1c, 0x00, 0x00, /* ........ */
    0x00, 0x00, 0x04, 0x17, 0x88, 0x47, 0x40, 0x14, /* .....G@. */
    0x41, 0xfd, 0x04, 0x27, 0x58, 0x6f, 0x9f, 0x8d, /* A..'Xo.. */
    0x28, 0xa6, 0xdb, 0xee, 0xb0, 0x97, 0x81, 0x00, /* (....... */
    0x01, 0x4d, 0x81, 0x00, 0x02, 0xc3, 0x88, 0x47, /* .M.....G */
    0x08, 0x05, 0x21, 0xff, 0x45, 0x00, 0x00, 0x63, /* ..!.E..c */
    0x86, 0xbe, 0x00, 0x00, 0xfd, 0x11, 0x54, 0x69, /* ......Ti */
    0x51, 0xd3, 0x87, 0x91, 0x51, 0xd3, 0xb7, 0x2a, /* Q...Q..* */
    0x08, 0x68, 0x08, 0x68, 0x00, 0x4f, 0x33, 0xa3, /* .h.h.O3. */
    0x30, 0xff, 0x00, 0x3f, 0x0d, 0x24, 0x07, 0x59, /* 0..?.$.Y */
    0x45, 0x00, 0x00, 0x3f, 0x7f, 0x24, 0x40, 0x00, /* E..?.$@. */
    0x40, 0x11, 0x4e, 0x86, 0x0a, 0x21, 0x3c, 0x74, /* @.N..!<t */
    0xd9, 0x4c, 0x4d, 0x22, 0x9c, 0x5c, 0x00, 0x35, /* .LM".\.5 */
    0x00, 0x2b, 0x3f, 0x00, 0xc4, 0xa8, 0x01, 0x00, /* .+?..... */
    0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
    0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x06, /* .config. */
    0x69, 0x6e, 0x6d, 0x6f, 0x62, 0x69, 0x03, 0x63, /* inmobi.c */
    0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01        /* om..... */
};

/*
 * Frame 2: 159 bytes on wire (1272 bits), 159 bytes captured (1272 bits)
Ethernet II, Src: HuaweiTe_40:e9:c3 (ac:b3:b5:40:e9:c3), Dst: zte_0e:f5:14 (74:4a:a4:0e:f5:14)
802.1Q Virtual LAN, PRI: 2, DEI: 0, ID: 504
Internet Protocol Version 6, Src: 2409:8034:4025::10:171, Dst: 2409:8034:4040:5300::206
    0110 .... = Version: 6
    .... 0100 1000 .... .... .... .... .... = Traffic Class: 0x48 (DSCP: AF21, ECN: Not-ECT)
    .... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
    Payload Length: 101
    Next Header: UDP (17)
    Hop Limit: 252
    Source Address: 2409:8034:4025::10:171
    Destination Address: 2409:8034:4040:5300::206
User Datagram Protocol, Src Port: 2152, Dst Port: 2152
    Source Port: 2152
    Destination Port: 2152
    Length: 101
    Checksum: 0x5242 [unverified]
    [Checksum Status: Unverified]
    [Stream index: 2]
    [Timestamps]
    UDP payload (93 bytes)
GPRS Tunneling Protocol
    Flags: 0x36
    Message Type: T-PDU (0xff)
    Length: 85
    TEID: 0x001b5d7d (1793405)
    Sequence number: 0x02c1 (705)
    Next extension header type: PDU Session container (0x85)
    Extension header (PDU Session container)
Internet Protocol Version 4, Src: 10.25.188.248, Dst: 112.5.230.54
User Datagram Protocol, Src Port: 64541, Dst Port: 53
    Source Port: 64541
    Destination Port: 53
    Length: 57
    Checksum: 0xc2ed [unverified]
    [Checksum Status: Unverified]
    [Stream index: 3]
    [Timestamps]
    UDP payload (49 bytes)
Domain Name System (query)
 */
static const unsigned char pkt_gtp_u_ext_v6_v4[159] = {
0x74, 0x4a, 0xa4, 0x0e, 0xf5, 0x14, 0xac, 0xb3, /* tJ...... */
0xb5, 0x40, 0xe9, 0xc3, 0x81, 0x00, 0x41, 0xf8, /* [email protected]. */
0x86, 0xdd, 0x64, 0x80, 0x00, 0x00, 0x00, 0x65, /* ..d....e */
0x11, 0xfc, 0x24, 0x09, 0x80, 0x34, 0x40, 0x25, /* ..$..4@% */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* ........ */
0x01, 0x71, 0x24, 0x09, 0x80, 0x34, 0x40, 0x40, /* .q$..4@@ */
0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* S....... */
0x02, 0x06, 0x08, 0x68, 0x08, 0x68, 0x00, 0x65, /* ...h.h.e */
0x52, 0x42, 0x36, 0xff, 0x00, 0x55, 0x00, 0x1b, /* RB6..U.. */
0x5d, 0x7d, 0x02, 0xc1, 0x00, 0x85, 0x01, 0x10, /* ]}...... */
0x01, 0x00, 0x45, 0x00, 0x00, 0x4d, 0xc2, 0x7f, /* ..E..M.. */
0x40, 0x00, 0x40, 0x11, 0x5a, 0xd3, 0x0a, 0x19, /* @[email protected]... */
0xbc, 0xf8, 0x70, 0x05, 0xe6, 0x36, 0xfc, 0x1d, /* ..p..6.. */
0x00, 0x35, 0x00, 0x39, 0xc2, 0xed, 0x19, 0x9a, /* .5.9.... */
0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x11, 0x70, 0x75, 0x6c, 0x6c, 0x2d, /* ...pull- */
0x72, 0x74, 0x6d, 0x70, 0x2d, 0x6c, 0x32, 0x36, /* rtmp-l26 */
0x2d, 0x63, 0x6e, 0x79, 0x09, 0x64, 0x6f, 0x75, /* -cny.dou */
0x79, 0x69, 0x6e, 0x63, 0x64, 0x6e, 0x03, 0x63, /* yincdn.c */
0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01        /* om..... */
};

/*
 * Frame 3: 174 bytes on wire (1392 bits), 174 bytes captured (1392 bits)
Ethernet II, Src: zte_0e:f5:40 (74:4a:a4:0e:f5:40), Dst: HuaweiTe_62:e5:c0 (60:d7:55:62:e5:c0)
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 503
Internet Protocol Version 6, Src: 2409:8034:4040:5300::102, Dst: 2409:8034:4025::10:61
    0110 .... = Version: 6
    .... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, ECN: Not-ECT)
    .... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
    Payload Length: 116
    Next Header: UDP (17)
    Hop Limit: 127
    Source Address: 2409:8034:4040:5300::102
    Destination Address: 2409:8034:4025::10:61
User Datagram Protocol, Src Port: 2152, Dst Port: 2152
    Source Port: 2152
    Destination Port: 2152
    Length: 116
    Checksum: 0x96c3 [unverified]
    [Checksum Status: Unverified]
    [Stream index: 4]
    [Timestamps]
    UDP payload (108 bytes)
GPRS Tunneling Protocol
    Flags: 0x34
    Message Type: T-PDU (0xff)
    Length: 100
    TEID: 0x900000cf (2415919311)
    Next extension header type: PDU Session container (0x85)
    Extension header (PDU Session container)
Internet Protocol Version 6, Src: 2409:8034:2000::4, Dst: 2409:8934:4484:1236:60a5:d6ff:fefc:9c59
    0110 .... = Version: 6
    .... 0000 0100 .... .... .... .... .... = Traffic Class: 0x04 (DSCP: LE, ECN: Not-ECT)
    .... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
    Payload Length: 52
    Next Header: UDP (17)
    Hop Limit: 56
    Source Address: 2409:8034:2000::4
    Destination Address: 2409:8934:4484:1236:60a5:d6ff:fefc:9c59
User Datagram Protocol, Src Port: 53, Dst Port: 36680
Domain Name System (response)
 */
static const unsigned char pkt_gtp_u_ext_v6_v6[174] = {
0x60, 0xd7, 0x55, 0x62, 0xe5, 0xc0, 0x74, 0x4a, /* `.Ub..tJ */
0xa4, 0x0e, 0xf5, 0x40, 0x81, 0x00, 0x01, 0xf7, /* ...@.... */
0x86, 0xdd, 0x60, 0x00, 0x00, 0x00, 0x00, 0x74, /* ..`....t */
0x11, 0x7f, 0x24, 0x09, 0x80, 0x34, 0x40, 0x40, /* ..$..4@@ */
0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* S....... */
0x01, 0x02, 0x24, 0x09, 0x80, 0x34, 0x40, 0x25, /* ..$..4@% */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* ........ */
0x00, 0x61, 0x08, 0x68, 0x08, 0x68, 0x00, 0x74, /* .a.h.h.t */
0x96, 0xc3, 0x34, 0xff, 0x00, 0x64, 0x90, 0x00, /* ..4..d.. */
0x00, 0xcf, 0x00, 0x00, 0x00, 0x85, 0x01, 0x00, /* ........ */
0x01, 0x00, 0x60, 0x40, 0x00, 0x00, 0x00, 0x34, /* ..`@...4 */
0x11, 0x38, 0x24, 0x09, 0x80, 0x34, 0x20, 0x00, /* .8$..4 . */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x04, 0x24, 0x09, 0x89, 0x34, 0x44, 0x84, /* ..$..4D. */
0x12, 0x36, 0x60, 0xa5, 0xd6, 0xff, 0xfe, 0xfc, /* .6`..... */
0x9c, 0x59, 0x00, 0x35, 0x8f, 0x48, 0x00, 0x34, /* .Y.5.H.4 */
0x51, 0x52, 0xe2, 0x9f, 0x81, 0x82, 0x00, 0x01, /* QR...... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x39, /* .......9 */
0x39, 0x03, 0x31, 0x38, 0x37, 0x02, 0x34, 0x38, /* 9.187.48 */
0x03, 0x31, 0x31, 0x32, 0x07, 0x69, 0x6e, 0x2d, /* .112.in- */
0x61, 0x64, 0x64, 0x72, 0x04, 0x61, 0x72, 0x70, /* addr.arp */
0x61, 0x00, 0x00, 0x0c, 0x00, 0x01              /* a..... */
};

#define TestCheckIPv4Addr(__result, __str_src_addr, __str_dst_addr)					\
do {																				\
	struct rte_ipv4_hdr * _ipv4_hdr = (struct rte_ipv4_hdr *)__result->data;		\
	struct in_addr _src_in_addr;													\
	struct in_addr _dst_in_addr;													\
																					\
	inet_aton(__str_src_addr, &_src_in_addr);										\
	inet_aton(__str_dst_addr, &_dst_in_addr);										\
																					\
	EXPECT_EQ(_ipv4_hdr->src_addr, _src_in_addr.s_addr);							\
	EXPECT_EQ(_ipv4_hdr->dst_addr, _dst_in_addr.s_addr);							\
																					\
} while(0)

#define TestCheckIPv6Addr(__result, __str_src_addr, __str_dst_addr)					\
do {																				\
	struct rte_ipv6_hdr * _ipv6_hdr = (struct rte_ipv6_hdr *)__result->data;		\
	struct in6_addr _src_in6_addr;													\
	struct in6_addr _dst_in6_addr;													\
																					\
	inet_pton(AF_INET6, __str_src_addr, &_src_in6_addr);							\
	inet_pton(AF_INET6, __str_dst_addr, &_dst_in6_addr);							\
																					\
	EXPECT_TRUE(IN6_ARE_ADDR_EQUAL(_ipv6_hdr->src_addr, &_src_in6_addr));			\
	EXPECT_TRUE(IN6_ARE_ADDR_EQUAL(_ipv6_hdr->dst_addr, &_dst_in6_addr));			\
																					\
} while(0)

#define TestCheckTCPPort(__result, __s_port, __d_port)								\
do {																				\
	struct rte_tcp_hdr * _tcp_hdr = (struct rte_tcp_hdr *)__result->data;			\
	EXPECT_EQ(_tcp_hdr->src_port, ntohs(__s_port));									\
	EXPECT_EQ(_tcp_hdr->dst_port, ntohs(__d_port));									\
} while(0)

#define TestCheckUDPPort(__result, __s_port, __d_port)								\
do {																				\
	struct rte_udp_hdr * _tcp_hdr = (struct rte_udp_hdr *)__result->data;			\
	EXPECT_EQ(_tcp_hdr->src_port, ntohs(__s_port));									\
	EXPECT_EQ(_tcp_hdr->dst_port, ntohs(__d_port));									\
} while(0)

TEST(PacketParseOuterL3, EtherIPv4)
{
	struct pkt_parser _pkt_031_handler;
	_pkt_031_handler.expect_layer_type = LAYER_TYPE_L3;
	_pkt_031_handler.nr_expect_results = 1;
	_pkt_031_handler.nr_results = 0;

	ASSERT_TRUE(complex_parser_ether(&_pkt_031_handler, pkt_031) != NULL);
	EXPECT_EQ(_pkt_031_handler.nr_results, 1);

	struct pkt_parser_result * result = &_pkt_031_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

	TestCheckIPv4Addr(result, "192.168.11.169", "202.157.180.190");
}

TEST(PacketParseOuterL3, EtherIPv6)
{
	struct pkt_parser _pkt_016_handler;
	_pkt_016_handler.expect_layer_type = LAYER_TYPE_L3;
	_pkt_016_handler.nr_expect_results = 1;
	_pkt_016_handler.nr_results = 0;

	ASSERT_TRUE(complex_parser_ether(&_pkt_016_handler, pkt_16) != NULL);
	EXPECT_EQ(_pkt_016_handler.nr_results, 1);

	struct pkt_parser_result * result = &_pkt_016_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV6);
	EXPECT_TRUE(result->data != NULL);

	TestCheckIPv6Addr(result, "3ffe:507:0:1:200:86ff:fe05:80da",
		"3ffe:501:410:0:2c0:dfff:fe47:33e");
}

TEST(PacketParserOuterL3, EthernetOverMPLSWithPW)
{
    struct pkt_parser _pkt_mpls_handler;
    _pkt_mpls_handler.expect_layer_type = LAYER_TYPE_L3;
    _pkt_mpls_handler.nr_expect_results = 1;
    _pkt_mpls_handler.nr_results = 0;

    ASSERT_TRUE(complex_parser_ether(&_pkt_mpls_handler, pkt_mpls_pw) != NULL);
    EXPECT_EQ(_pkt_mpls_handler.nr_results, 1);

    struct pkt_parser_result * result = &_pkt_mpls_handler.results[0];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
    EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "81.211.157.203", "10.160.72.52");
}

TEST(PacketParserOuterL3, EthernetOverMPLSWithoutPW)
{
    struct pkt_parser _pkt_mpls_handler;
    _pkt_mpls_handler.expect_layer_type = LAYER_TYPE_L3;
    _pkt_mpls_handler.nr_expect_results = 1;
    _pkt_mpls_handler.nr_results = 0;

    ASSERT_TRUE(complex_parser_ether(&_pkt_mpls_handler, pkt_mpls_eth) != NULL);
    EXPECT_EQ(_pkt_mpls_handler.nr_results, 1);

    struct pkt_parser_result * result = &_pkt_mpls_handler.results[0];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
    EXPECT_TRUE(result->data != NULL);
    TestCheckIPv4Addr(result, "81.211.135.145", "81.211.183.42");
}

TEST(PacketParseOuterL4, EtherIPv4TCP)
{
	struct pkt_parser _pkt_031_handler;
	_pkt_031_handler.expect_layer_type = LAYER_TYPE_TCP;
	_pkt_031_handler.nr_expect_results = 1;
	_pkt_031_handler.nr_results = 0;

	ASSERT_TRUE(complex_parser_ether(&_pkt_031_handler, pkt_031) != NULL);
	EXPECT_EQ(_pkt_031_handler.nr_results, 1);

	struct pkt_parser_result * result = &_pkt_031_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_TCP);
	EXPECT_TRUE(result->data != NULL);

	TestCheckTCPPort(result, 64161, 1443);
}

TEST(PacketParseOuterL4, EtherIPv4UDP)
{
	struct pkt_parser _pkt_30_handler;
	_pkt_30_handler.expect_layer_type = LAYER_TYPE_UDP;
	_pkt_30_handler.nr_expect_results = 1;
	_pkt_30_handler.nr_results = 0;

	ASSERT_TRUE(complex_parser_ether(&_pkt_30_handler, pkt30) != NULL);
	EXPECT_EQ(_pkt_30_handler.nr_results, 1);

	struct pkt_parser_result * result = &_pkt_30_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_UDP);
	EXPECT_TRUE(result->data != NULL);

	TestCheckUDPPort(result, 51435, 53);
}

TEST(PacketParseInnerL3, EtherIPv4UDPVxlanEther)
{
	struct pkt_parser _pkt_73_handler;
	_pkt_73_handler.expect_layer_type = LAYER_TYPE_L3;
	_pkt_73_handler.nr_expect_results = 2;
	_pkt_73_handler.nr_results = 0;

	ASSERT_TRUE(complex_parser_ether(&_pkt_73_handler, pkt73) != NULL);
	EXPECT_EQ(_pkt_73_handler.nr_results, 2);

	struct pkt_parser_result * result = &_pkt_73_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

	TestCheckIPv4Addr(result, "1.1.15.100", "10.0.4.120");

	result = &_pkt_73_handler.results[1];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

	TestCheckIPv4Addr(result, "125.33.49.137", "39.66.162.89");
}

TEST(PacketParseInnerL4, EtherIPv4UDPVxlanEther)
{
	struct pkt_parser _pkt_73_handler;
	_pkt_73_handler.expect_layer_type = LAYER_TYPE_L4;
	_pkt_73_handler.nr_expect_results = 2;
	_pkt_73_handler.nr_results = 0;

	ASSERT_TRUE(complex_parser_ether(&_pkt_73_handler, pkt73) != NULL);
	EXPECT_EQ(_pkt_73_handler.nr_results, 2);

	struct pkt_parser_result * result = &_pkt_73_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_UDP);
	EXPECT_TRUE(result->data != NULL);

	TestCheckUDPPort(result, 60014, 4789);

	result = &_pkt_73_handler.results[1];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_TCP);
	EXPECT_TRUE(result->data != NULL);

	TestCheckTCPPort(result, 28402, 11235);
}

TEST(PacketParseInnerL3, EtherIPv4UDPVxlanCHDLC)
{
    struct pkt_parser _pkt_47_handler;
    _pkt_47_handler.expect_layer_type = LAYER_TYPE_L3;
    _pkt_47_handler.nr_expect_results = 2;
    _pkt_47_handler.nr_results = 0;

    ASSERT_TRUE(complex_parser_ether(&_pkt_47_handler, pkt47) != NULL);
    EXPECT_EQ(_pkt_47_handler.nr_results, 2);

    struct pkt_parser_result * result = &_pkt_47_handler.results[0];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
    EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "172.26.127.189", "172.26.78.1");

    result = &_pkt_47_handler.results[1];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
    EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "173.194.31.248", "36.149.130.101");
}

TEST(PacketParserInnerL4, EtherIPv4UDPVxlanCHDLC)
{
    struct pkt_parser _pkt_47_handler;
    _pkt_47_handler.expect_layer_type = LAYER_TYPE_L4;
    _pkt_47_handler.nr_expect_results = 2;
    _pkt_47_handler.nr_results = 0;

    ASSERT_TRUE(complex_parser_ether(&_pkt_47_handler, pkt47) != NULL);
    EXPECT_EQ(_pkt_47_handler.nr_results, 2);

    struct pkt_parser_result * result = &_pkt_47_handler.results[0];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_UDP);
    EXPECT_TRUE(result->data != NULL);

    TestCheckUDPPort(result, 50909, 4789);

    result = &_pkt_47_handler.results[1];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_TCP);
    EXPECT_TRUE(result->data != NULL);

    TestCheckTCPPort(result, 443, 21274);
}


TEST(PacketParseInnerL3, EtherIPv4UDPVxlanPPP)
{
    struct pkt_parser _pkt_94_handler;
    _pkt_94_handler.expect_layer_type = LAYER_TYPE_L3;
    _pkt_94_handler.nr_expect_results = 2;
    _pkt_94_handler.nr_results = 0;

    ASSERT_TRUE(complex_parser_ether(&_pkt_94_handler, pkt94) != NULL);
    EXPECT_EQ(_pkt_94_handler.nr_results, 2);

    struct pkt_parser_result * result = &_pkt_94_handler.results[0];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
    EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "172.30.127.188", "172.30.78.9");

    result = &_pkt_94_handler.results[1];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
    EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "160.16.206.51", "117.143.73.98");
}

TEST(PacketParserInnerL4, EtherIPv4UDPVxlanPPP)
{
    struct pkt_parser _pkt_94_handler;
    _pkt_94_handler.expect_layer_type = LAYER_TYPE_L4;
    _pkt_94_handler.nr_expect_results = 2;
    _pkt_94_handler.nr_results = 0;

    ASSERT_TRUE(complex_parser_ether(&_pkt_94_handler, pkt94) != NULL);
    EXPECT_EQ(_pkt_94_handler.nr_results, 2);

    struct pkt_parser_result * result = &_pkt_94_handler.results[0];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_UDP);
    EXPECT_TRUE(result->data != NULL);

    TestCheckUDPPort(result, 10000, 4789);

    result = &_pkt_94_handler.results[1];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_TCP);
    EXPECT_TRUE(result->data != NULL);

    TestCheckTCPPort(result, 443, 18470);
}


/* Frame (111 bytes)
 *
 * Internet Protocol Version 4, Src: 10.7.84.136, Dst: 2.78.63.108
 * 83	06:00:00.000000	100.80.113.249	2.78.45.204
 * GTP <GQUIC>	111	40565 → 443 Len=29, PKN: 73, CID: 10917641376885890260
 */
static const unsigned char pkt83[111] = {
	0x18, 0x10, 0x04, 0x00, 0x03, 0x26, 0x00, 0x00, /* .....&.. */
	0x00, 0x00, 0x04, 0x25, 0x88, 0x47, 0x10, 0x03, /* ...%.G.. */
	0xfb, 0x3d, 0x45, 0xb8, 0x00, 0x5d, 0x7b, 0x75, /* .=E..]{u */
	0x00, 0x00, 0x3e, 0x11, 0x60, 0x1a, 0x0a, 0x07, /* ..>.`... */
	0x54, 0x88, 0x02, 0x4e, 0x3f, 0x6c, 0x22, 0x3c, /* T..N?l"< */
	0x08, 0x68, 0x00, 0x49, 0x04, 0x70, 0x30, 0xff, /* .h.I.p0. */
	0x00, 0x39, 0x25, 0x10, 0xe0, 0x50, 0x45, 0x00, /* .9%..PE. */
	0x00, 0x39, 0x0e, 0xda, 0x40, 0x00, 0x40, 0x11, /* .9..@.@. */
	0x25, 0x77, 0x64, 0x50, 0x71, 0xf9, 0x02, 0x4e, /* %wdPq..N */
	0x2d, 0xcc, 0x9e, 0x75, 0x01, 0xbb, 0x00, 0x25, /* -..u...% */
	0x56, 0xfa, 0x0c, 0xd4, 0xdc, 0x63, 0xf6, 0xfc, /* V....c.. */
	0x40, 0x83, 0x97, 0x49, 0xea, 0x93, 0x91, 0x0b, /* @..I.... */
	0xd1, 0x87, 0xeb, 0x48, 0xa5, 0xf4, 0x25, 0xb5, /* ...H..%. */
	0x32, 0x26, 0x05, 0x4d, 0x8f, 0x86, 0x7f        /* 2&.M... */
};

TEST(PacketParseInnerL3, EtherIPv4UDPGTPv1)
{
	struct pkt_parser _pkt_83_handler;
	_pkt_83_handler.expect_layer_type = LAYER_TYPE_L3;
	_pkt_83_handler.nr_expect_results = 2;
	_pkt_83_handler.nr_results = 0;

	ASSERT_TRUE(complex_parser_ether(&_pkt_83_handler, pkt83) != NULL);
	EXPECT_EQ(_pkt_83_handler.nr_results, 2);

	struct pkt_parser_result * result = &_pkt_83_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

	TestCheckIPv4Addr(result, "10.7.84.136", "2.78.63.108");

	result = &_pkt_83_handler.results[1];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

	TestCheckIPv4Addr(result, "100.80.113.249", "2.78.45.204");
}

TEST(PacketParseInnerL3, EtherIPv6UDPGTPv1EXTIPv4)
{
    struct pkt_parser _pkt_gtp_u_ext_v6_v4_handler;
    _pkt_gtp_u_ext_v6_v4_handler.expect_layer_type = LAYER_TYPE_L3;
	_pkt_gtp_u_ext_v6_v4_handler.nr_expect_results = 2;
	_pkt_gtp_u_ext_v6_v4_handler.nr_results = 0;

    ASSERT_TRUE(complex_parser_ether(&_pkt_gtp_u_ext_v6_v4_handler, pkt_gtp_u_ext_v6_v4) != NULL);
	EXPECT_EQ(_pkt_gtp_u_ext_v6_v4_handler.nr_results, 2);

    struct pkt_parser_result * result = &_pkt_gtp_u_ext_v6_v4_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV6);
	EXPECT_TRUE(result->data != NULL);

    TestCheckIPv6Addr(result, "2409:8034:4025::10:171", "2409:8034:4040:5300::206");

    result = &_pkt_gtp_u_ext_v6_v4_handler.results[1];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
    EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "10.25.188.248", "112.5.230.54");
}


TEST(PacketParseInnerL3, EtherIPv6UDPGTPv1EXTIPv6)
{
    struct pkt_parser _pkt_gtp_u_ext_v6_v6_handler;
    _pkt_gtp_u_ext_v6_v6_handler.expect_layer_type = LAYER_TYPE_L3;
	_pkt_gtp_u_ext_v6_v6_handler.nr_expect_results = 2;
	_pkt_gtp_u_ext_v6_v6_handler.nr_results = 0;

    ASSERT_TRUE(complex_parser_ether(&_pkt_gtp_u_ext_v6_v6_handler, pkt_gtp_u_ext_v6_v6) != NULL);
	EXPECT_EQ(_pkt_gtp_u_ext_v6_v6_handler.nr_results, 2);

    struct pkt_parser_result * result = &_pkt_gtp_u_ext_v6_v6_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV6);
	EXPECT_TRUE(result->data != NULL);

    TestCheckIPv6Addr(result, "2409:8034:4040:5300::102", "2409:8034:4025::10:61");

    result = &_pkt_gtp_u_ext_v6_v6_handler.results[1];
    EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV6);
    EXPECT_TRUE(result->data != NULL);

    TestCheckIPv6Addr(result, "2409:8034:2000::4", "2409:8934:4484:1236:60a5:d6ff:fefc:9c59");
}

/* 
    Frame 33857: 318 bytes on wire (2544 bits), 318 bytes captured (2544 bits)
    Ethernet II, Src: 0a:0a:0a:0a:00:10 (0a:0a:0a:0a:00:10), Dst: 90:00:00:91:40:46 (90:00:00:91:40:46)
    Internet Protocol Version 4, Src: 10.10.0.16, Dst: 10.252.22.1
    User Datagram Protocol, Src Port: 60055, Dst Port: 4789
    Virtual eXtensible Local Area Network
    Ethernet II, Src: HuaweiTe_2a:dc:03 (10:51:72:2a:dc:03), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
    802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 600
    Internet Protocol Version 4, Src: 10.202.0.74, Dst: 10.254.142.4
    User Datagram Protocol, Src Port: 2152, Dst Port: 2152
    GPRS Tunneling Protocol
    Internet Protocol Version 4, Src: 216.58.209.132, Dst: 10.59.238.65
    Transmission Control Protocol, Src Port: 443, Dst Port: 37714, Seq: 1, Ack: 1, Len: 162
    Transport Layer Security
*/
static const unsigned char _pkt_gtp_u_over_vxlan_tls_1[318] = {
0x90, 0x00, 0x00, 0x91, 0x40, 0x46, 0x0a, 0x0a, /* ....@F.. */
0x0a, 0x0a, 0x00, 0x10, 0x08, 0x00, 0x45, 0x00, /* ......E. */
0x01, 0x30, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, /* .0..@.@. */
0x0e, 0xa7, 0x0a, 0x0a, 0x00, 0x10, 0x0a, 0xfc, /* ........ */
0x16, 0x01, 0xea, 0x97, 0x12, 0xb5, 0x01, 0x1c, /* ........ */
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x39, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 9....... */
0x10, 0x51, 0x72, 0x2a, 0xdc, 0x03, 0x81, 0x00, /* .Qr*.... */
0x02, 0x58, 0x08, 0x00, 0x45, 0x00, 0x00, 0xfa, /* .X..E... */
0xde, 0x40, 0x00, 0x00, 0x3d, 0x11, 0xfa, 0x9c, /* .@..=... */
0x0a, 0xca, 0x00, 0x4a, 0x0a, 0xfe, 0x8e, 0x04, /* ...J.... */
0x08, 0x68, 0x08, 0x68, 0x00, 0xe6, 0x00, 0x00, /* .h.h.... */
0x30, 0xff, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x8d, /* 0....... */
0x45, 0x00, 0x00, 0xd6, 0x8d, 0x70, 0x00, 0x00, /* E....p.. */
0x39, 0x06, 0x51, 0x76, 0xd8, 0x3a, 0xd1, 0x84, /* 9.Qv.:.. */
0x0a, 0x3b, 0xee, 0x41, 0x01, 0xbb, 0x93, 0x52, /* .;.A...R */
0xed, 0xc0, 0xfd, 0x50, 0x97, 0x79, 0xf8, 0x1f, /* ...P.y.. */
0x80, 0x19, 0x01, 0x05, 0xf7, 0x13, 0x00, 0x00, /* ........ */
0x01, 0x01, 0x08, 0x0a, 0x77, 0xe8, 0x07, 0x3f, /* ....w..? */
0x00, 0x22, 0xac, 0xc2, 0x16, 0x03, 0x03, 0x00, /* ."...... */
0x6a, 0x02, 0x00, 0x00, 0x66, 0x03, 0x03, 0x61, /* j...f..a */
0x92, 0x5a, 0x25, 0x9c, 0xf5, 0x72, 0xba, 0x26, /* .Z%..r.& */
0x90, 0xdd, 0xb7, 0xdb, 0x28, 0xad, 0xb3, 0xc7, /* ....(... */
0x84, 0xd1, 0xac, 0x58, 0x44, 0x46, 0x51, 0x44, /* ...XDFQD */
0x4f, 0x57, 0x4e, 0x47, 0x52, 0x44, 0x01, 0x20, /* OWNGRD.  */
0xca, 0xcb, 0x30, 0xe4, 0x4a, 0x36, 0x14, 0x93, /* ..0.J6.. */
0x1e, 0x53, 0x67, 0xa6, 0xa2, 0xc7, 0x94, 0xca, /* .Sg..... */
0x41, 0xd7, 0x05, 0xf9, 0xed, 0x97, 0xcc, 0x8b, /* A....... */
0xb5, 0x66, 0xbe, 0x9f, 0x54, 0x7f, 0xdd, 0x5e, /* .f..T..^ */
0xc0, 0x2b, 0x00, 0x00, 0x1e, 0x00, 0x17, 0x00, /* .+...... */
0x00, 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0b, /* ........ */
0x00, 0x02, 0x01, 0x00, 0x00, 0x10, 0x00, 0x0b, /* ........ */
0x00, 0x09, 0x08, 0x68, 0x74, 0x74, 0x70, 0x2f, /* ...http/ */
0x31, 0x2e, 0x31, 0x14, 0x03, 0x03, 0x00, 0x01, /* 1.1..... */
0x01, 0x16, 0x03, 0x03, 0x00, 0x28, 0x00, 0x00, /* .....(.. */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3d, /* ......>= */
0x1c, 0x7f, 0xe0, 0xdd, 0x4e, 0x13, 0x81, 0xd5, /* ....N... */
0x78, 0xc8, 0x3c, 0xe6, 0x6d, 0xa6, 0xfe, 0xbf, /* x.<.m... */
0x00, 0x02, 0xb0, 0x6c, 0xd7, 0x76, 0xa4, 0x30, /* ...l.v.0 */
0x16, 0xf7, 0xb1, 0x51, 0x3d, 0x54              /* ...Q=T */
};

TEST(PacketParseOuterL3, EtherVxlanGTPIPv4TCP)
{
    struct pkt_parser _pkt_gtp_u_over_vxlan_tls_1_handler;
    _pkt_gtp_u_over_vxlan_tls_1_handler.expect_layer_type = LAYER_TYPE_L3;
	_pkt_gtp_u_over_vxlan_tls_1_handler.nr_expect_results = 1;
	_pkt_gtp_u_over_vxlan_tls_1_handler.nr_results = 0;

    complex_parser_ether(&_pkt_gtp_u_over_vxlan_tls_1_handler, _pkt_gtp_u_over_vxlan_tls_1);
	EXPECT_EQ(_pkt_gtp_u_over_vxlan_tls_1_handler.nr_results, 1);

    struct pkt_parser_result * result = &_pkt_gtp_u_over_vxlan_tls_1_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "10.10.0.16", "10.252.22.1");
}

TEST(PacketParseInnerL3, EtherVxlanGTPIPv4TCP)
{
    struct pkt_parser _pkt_gtp_u_over_vxlan_tls_1_handler;
    _pkt_gtp_u_over_vxlan_tls_1_handler.expect_layer_type = LAYER_TYPE_L3;
	_pkt_gtp_u_over_vxlan_tls_1_handler.nr_expect_results = 4;
	_pkt_gtp_u_over_vxlan_tls_1_handler.nr_results = 0;

    complex_parser_ether(&_pkt_gtp_u_over_vxlan_tls_1_handler, _pkt_gtp_u_over_vxlan_tls_1);
	EXPECT_EQ(_pkt_gtp_u_over_vxlan_tls_1_handler.nr_results, 3);

    struct pkt_parser_result * result = &_pkt_gtp_u_over_vxlan_tls_1_handler.results[0];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "10.10.0.16", "10.252.22.1");

    result = &_pkt_gtp_u_over_vxlan_tls_1_handler.results[1];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "10.202.0.74", "10.254.142.4");

    result = &_pkt_gtp_u_over_vxlan_tls_1_handler.results[2];
	EXPECT_EQ(result->this_layer_type, LAYER_TYPE_IPV4);
	EXPECT_TRUE(result->data != NULL);

    TestCheckIPv4Addr(result, "216.58.209.132", "10.59.238.65");
}

#if 0
TEST(DistributerInner4, EtherIPv4VxLANIPv4TCP)
{
	struct distributer * dist_object = distributer_create(
		LDBC_DIST_INNER_TUPLE4, LDBC_HASH_SYM_CRC, 0);

	const int __nr_mbufs = 4;
	struct rte_mbuf __mbufs[__nr_mbufs];

	mbuf_init_helper(&__mbufs[0], (void *)stream_vxlan_pkt_0, sizeof(stream_vxlan_pkt_0));
	mbuf_init_helper(&__mbufs[1], (void *)stream_vxlan_pkt_1, sizeof(stream_vxlan_pkt_1));
	mbuf_init_helper(&__mbufs[2], (void *)stream_vxlan_pkt_2, sizeof(stream_vxlan_pkt_2));
	mbuf_init_helper(&__mbufs[3], (void *)stream_vxlan_pkt_not_in_stream, sizeof(stream_vxlan_pkt_not_in_stream));

	struct rte_mbuf * mbufs[__nr_mbufs];
	for (int i = 0; i < __nr_mbufs; i++)
	{
		mbufs[i] = &__mbufs[i];
	}

	ASSERT_TRUE(dist_object != NULL);
	distributer_caculate(dist_object, (struct rte_mbuf **)&mbufs, 4);

	for (int i = 0; i < __nr_mbufs; i++)
	{
		EXPECT_NE(__mbufs[i].hash.usr, 0);
	}

	for (int i = 0; i < __nr_mbufs - 1; i++)
	{
		EXPECT_EQ(__mbufs[0].hash.usr, __mbufs[i].hash.usr);
	}

	for (int i = 0; i < __nr_mbufs - 1; i++)
	{
		EXPECT_NE(__mbufs[__nr_mbufs - 1].hash.usr, __mbufs[i].hash.usr);
	}
}

TEST(DistributerInner4, EtherIPv4OffloadVxLANIPv4TCP)
{
	struct distributer * dist_object = distributer_create(
		LDBC_DIST_INNER_TUPLE4, LDBC_HASH_SYM_CRC, 0);

	const int __nr_mbufs = 4;
	struct rte_mbuf __mbufs[__nr_mbufs];

	mbuf_init_helper(&__mbufs[0], (void *)stream_vxlan_pkt_0, sizeof(stream_vxlan_pkt_0));
	mbuf_init_helper(&__mbufs[1], (void *)stream_vxlan_pkt_1, sizeof(stream_vxlan_pkt_1));
	mbuf_init_helper(&__mbufs[2], (void *)stream_vxlan_pkt_2, sizeof(stream_vxlan_pkt_2));
	mbuf_init_helper(&__mbufs[3], (void *)stream_vxlan_pkt_not_in_stream, sizeof(stream_vxlan_pkt_not_in_stream));

	struct rte_mbuf * mbufs[__nr_mbufs];
	for (int i = 0; i < __nr_mbufs; i++)
	{
		mbufs[i] = &__mbufs[i];
	}

	ASSERT_TRUE(dist_object != NULL);
	distributer_caculate(dist_object, (struct rte_mbuf **)&mbufs, 4);

	for (int i = 0; i < __nr_mbufs; i++)
	{
		EXPECT_NE(__mbufs[i].hash.usr, 0);
	}

	for (int i = 0; i < __nr_mbufs - 1; i++)
	{
		EXPECT_EQ(__mbufs[0].hash.usr, __mbufs[i].hash.usr);
	}

	for (int i = 0; i < __nr_mbufs - 1; i++)
	{
		EXPECT_NE(__mbufs[__nr_mbufs - 1].hash.usr, __mbufs[i].hash.usr);
	}
}

#endif