@@ -139,6 +139,7 @@ struct sockmap_options {
139
139
bool sendpage ;
140
140
bool data_test ;
141
141
bool drop_expected ;
142
+ bool check_recved_len ;
142
143
int iov_count ;
143
144
int iov_length ;
144
145
int rate ;
@@ -556,8 +557,12 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
556
557
int err , i , flags = MSG_NOSIGNAL ;
557
558
bool drop = opt -> drop_expected ;
558
559
bool data = opt -> data_test ;
560
+ int iov_alloc_length = iov_length ;
559
561
560
- err = msg_alloc_iov (& msg , iov_count , iov_length , data , tx );
562
+ if (!tx && opt -> check_recved_len )
563
+ iov_alloc_length *= 2 ;
564
+
565
+ err = msg_alloc_iov (& msg , iov_count , iov_alloc_length , data , tx );
561
566
if (err )
562
567
goto out_errno ;
563
568
if (peek_flag ) {
@@ -665,6 +670,13 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
665
670
666
671
s -> bytes_recvd += recv ;
667
672
673
+ if (opt -> check_recved_len && s -> bytes_recvd > total_bytes ) {
674
+ errno = EMSGSIZE ;
675
+ fprintf (stderr , "recv failed(), bytes_recvd:%zd, total_bytes:%f\n" ,
676
+ s -> bytes_recvd , total_bytes );
677
+ goto out_errno ;
678
+ }
679
+
668
680
if (data ) {
669
681
int chunk_sz = opt -> sendpage ?
670
682
iov_length * cnt :
@@ -744,7 +756,8 @@ static int sendmsg_test(struct sockmap_options *opt)
744
756
745
757
rxpid = fork ();
746
758
if (rxpid == 0 ) {
747
- iov_buf -= (txmsg_pop - txmsg_start_pop + 1 );
759
+ if (txmsg_pop || txmsg_start_pop )
760
+ iov_buf -= (txmsg_pop - txmsg_start_pop + 1 );
748
761
if (opt -> drop_expected || txmsg_ktls_skb_drop )
749
762
_exit (0 );
750
763
@@ -1688,6 +1701,19 @@ static void test_txmsg_ingress_parser(int cgrp, struct sockmap_options *opt)
1688
1701
test_exec (cgrp , opt );
1689
1702
}
1690
1703
1704
+ static void test_txmsg_ingress_parser2 (int cgrp , struct sockmap_options * opt )
1705
+ {
1706
+ if (ktls == 1 )
1707
+ return ;
1708
+ skb_use_parser = 10 ;
1709
+ opt -> iov_length = 20 ;
1710
+ opt -> iov_count = 1 ;
1711
+ opt -> rate = 1 ;
1712
+ opt -> check_recved_len = true;
1713
+ test_exec (cgrp , opt );
1714
+ opt -> check_recved_len = false;
1715
+ }
1716
+
1691
1717
char * map_names [] = {
1692
1718
"sock_map" ,
1693
1719
"sock_map_txmsg" ,
@@ -1786,7 +1812,8 @@ struct _test test[] = {
1786
1812
{"txmsg test pull-data" , test_txmsg_pull },
1787
1813
{"txmsg test pop-data" , test_txmsg_pop },
1788
1814
{"txmsg test push/pop data" , test_txmsg_push_pop },
1789
- {"txmsg text ingress parser" , test_txmsg_ingress_parser },
1815
+ {"txmsg test ingress parser" , test_txmsg_ingress_parser },
1816
+ {"txmsg test ingress parser2" , test_txmsg_ingress_parser2 },
1790
1817
};
1791
1818
1792
1819
static int check_whitelist (struct _test * t , struct sockmap_options * opt )
0 commit comments