diff mbox

[v2] validation: pktio: generate valid test packets

Message ID 1434016821-16110-1-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit 56d3e13bff23a5306c8d568dac529e002a2c22ec
Headers show

Commit Message

Stuart Haslam June 11, 2015, 10 a.m. UTC
The test generates UDP packets with the source and destination port numbers
set to 0 and source and destination IP addresses of 0.0.0.0, which is
likely to cause them to be dropped and the test failing. Fix this by
correctly initialising the packet fields to use valid values.

Reported-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
This is a fix for; https://bugs.linaro.org/show_bug.cgi?id=1632

 test/validation/odp_pktio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Maxim Uvarov June 29, 2015, 1:17 p.m. UTC | #1
Merged,
Thanks,

Maxim.
On 06/11/15 13:00, Stuart Haslam wrote:
> The test generates UDP packets with the source and destination port numbers
> set to 0 and source and destination IP addresses of 0.0.0.0, which is
> likely to cause them to be dropped and the test failing. Fix this by
> correctly initialising the packet fields to use valid values.
>
> Reported-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
> ---
> This is a fix for; https://bugs.linaro.org/show_bug.cgi?id=1632
>
>   test/validation/odp_pktio.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
> index e1025d6..3586542 100644
> --- a/test/validation/odp_pktio.c
> +++ b/test/validation/odp_pktio.c
> @@ -154,8 +154,8 @@ static uint32_t pktio_init_packet(odp_packet_t pkt)
>   	/* IP */
>   	odp_packet_l3_offset_set(pkt, ODPH_ETHHDR_LEN);
>   	ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN);
> -	ip->dst_addr = odp_cpu_to_be_32(0);
> -	ip->src_addr = odp_cpu_to_be_32(0);
> +	ip->dst_addr = odp_cpu_to_be_32(0x0a000064);
> +	ip->src_addr = odp_cpu_to_be_32(0x0a000001);
>   	ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN;
>   	ip->tot_len = odp_cpu_to_be_16(pkt_len - ODPH_ETHHDR_LEN);
>   	ip->ttl = 128;
> @@ -168,8 +168,8 @@ static uint32_t pktio_init_packet(odp_packet_t pkt)
>   	/* UDP */
>   	odp_packet_l4_offset_set(pkt, ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN);
>   	udp = (odph_udphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN);
> -	udp->src_port = odp_cpu_to_be_16(0);
> -	udp->dst_port = odp_cpu_to_be_16(0);
> +	udp->src_port = odp_cpu_to_be_16(12049);
> +	udp->dst_port = odp_cpu_to_be_16(12050);
>   	udp->length = odp_cpu_to_be_16(pkt_len -
>   				       ODPH_ETHHDR_LEN - ODPH_IPV4HDR_LEN);
>   	udp->chksum = 0;
diff mbox

Patch

diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index e1025d6..3586542 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -154,8 +154,8 @@  static uint32_t pktio_init_packet(odp_packet_t pkt)
 	/* IP */
 	odp_packet_l3_offset_set(pkt, ODPH_ETHHDR_LEN);
 	ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN);
-	ip->dst_addr = odp_cpu_to_be_32(0);
-	ip->src_addr = odp_cpu_to_be_32(0);
+	ip->dst_addr = odp_cpu_to_be_32(0x0a000064);
+	ip->src_addr = odp_cpu_to_be_32(0x0a000001);
 	ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN;
 	ip->tot_len = odp_cpu_to_be_16(pkt_len - ODPH_ETHHDR_LEN);
 	ip->ttl = 128;
@@ -168,8 +168,8 @@  static uint32_t pktio_init_packet(odp_packet_t pkt)
 	/* UDP */
 	odp_packet_l4_offset_set(pkt, ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN);
 	udp = (odph_udphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN);
-	udp->src_port = odp_cpu_to_be_16(0);
-	udp->dst_port = odp_cpu_to_be_16(0);
+	udp->src_port = odp_cpu_to_be_16(12049);
+	udp->dst_port = odp_cpu_to_be_16(12050);
 	udp->length = odp_cpu_to_be_16(pkt_len -
 				       ODPH_ETHHDR_LEN - ODPH_IPV4HDR_LEN);
 	udp->chksum = 0;