Skip to contentSkip to conversation

examples/ipsec-secgw: fix over MTU packet crash

PATCH Applied Marcin Smoczynski 3 participants 3 messages Sep 24, 2019 – Sep 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/ipsec-secgw: fix over MTU packet crash

When sending an encrypted packet which size after encapsulation exceeds MTU, ipsec-secgw application tries to fragment it. If --reassemble option has not been set it results with a segmantation fault, because fragmentation buckets have not been initialized.

Fix crashing by adding extra check: if --ressemble option has not been set and packet exceeds MTU after encapsulation - drop it.

Fixes b01d1cd213 ("examples/ipsec-secgw: support fragmentation and reassembly")
---
 examples/ipsec-secgw/ipsec-secgw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
examples/ipsec-secgw/ipsec-secgw.c +3 -1
index 0d1fd6af6..91c602436 100644
@@ -548,8 +548,10 @@ send_single_packet(struct rte_mbuf *m, uint16_t port, uint8_t proto)
 		len++;
 
 	/* need to fragment the packet */
-	} else
+	} else if (frag_tbl_sz > 0)
 		len = send_fragment_packet(qconf, m, port, proto);
+	else
+		rte_pktmbuf_free(m);
 
 	/* enough pkts to be sent */
 	if (unlikely(len == MAX_PKT_BURST)) {
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 32 lines

-----Original Message-----
From: Smoczynski, MarcinX
Sent: Tuesday, September 24, 2019 11:55 AM
To: Ananyev, Konstantin <[email protected]>; [email protected]
Cc: [email protected]; Smoczynski, MarcinX <[email protected]>; [email protected]
Subject: [PATCH] examples/ipsec-secgw: fix over MTU packet crash

When sending an encrypted packet which size after encapsulation exceeds MTU, ipsec-secgw application tries to fragment it. If --reassemble option has not been set it results with a segmantation fault, because fragmentation buckets have not been initialized.

Fix crashing by adding extra check: if --ressemble option has not been set and packet exceeds MTU after encapsulation - drop it.

Fixes b01d1cd213 ("examples/ipsec-secgw: support fragmentation and reassembly")
---
 examples/ipsec-secgw/ipsec-secgw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
examples/ipsec-secgw/ipsec-secgw.c +0 -0
index 0d1fd6af6..91c602436 100644
@@ -548,8 +548,10 @@ send_single_packet(struct rte_mbuf *m, uint16_t port, uint8_t proto)
 		len++;
 

examples/ipsec-secgw/ipsec-secgw.c send_single_packet(struct rte_mbuf *m, uint16_t port, uint8_t proto)

Quoted 10 lines
examples/ipsec-secgw/ipsec-secgw.c +3 -2
 	/* need to fragment the packet */
-	} else
+	} else if (frag_tbl_sz > 0)
 		len = send_fragment_packet(qconf, m, port, proto);
+	else
+		rte_pktmbuf_free(m);
 
 	/* enough pkts to be sent */
 	if (unlikely(len == MAX_PKT_BURST)) {
--
Quoted 1 line

2.17.1

Acked-by Applied
#2 lore raw
Quoted 9 lines
Quoted 9 lines

When sending an encrypted packet which size after encapsulation exceeds MTU, ipsec-secgw application tries to fragment it. If --reassemble option has not been set it results with a segmantation fault, because fragmentation buckets have not been initialized.

Fix crashing by adding extra check: if --ressemble option has not been set and packet exceeds MTU after encapsulation - drop it.

Quoted 6 lines
Quoted 1 line
Fixes b01d1cd213 ("examples/ipsec-secgw: support fragmentation and

reassembly")

Quoted 3 lines

Applied to dpdk-next-crypto

Thanks.