If a large packet is passed into GSO routines of unknown protocol
then library would log a message and pass it through. This is incorrect
behaviour on many levels:
- it allows oversize packet to get passed on to NIC driver
- no direct return is visible to applications
- if it happens once, many more will follow and log will fill.
- bonus it is only log message with GSO type.
The fix is to just return -EINVAL which is what this library
does in many other places when looking at headers.
Fixes: 119583797b6a ("gso: support TCP/IPv4 GSO")
Cc: jiayu.hu@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/common/eal_common_log.c | 2 +-
lib/eal/include/rte_log.h | 1 -
lib/gso/rte_gso.c | 3 +--
3 files changed, 2 insertions(+), 4 deletions(-)
@@ -368,7 +368,7 @@ static const struct logtype logtype_strings[] = {
{RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"},
{RTE_LOGTYPE_EFD, "lib.efd"},
{RTE_LOGTYPE_EVENTDEV, "lib.eventdev"},
- {RTE_LOGTYPE_GSO, "lib.gso"},
+
{RTE_LOGTYPE_USER1, "user1"},
{RTE_LOGTYPE_USER2, "user2"},
{RTE_LOGTYPE_USER3, "user3"},
@@ -46,7 +46,6 @@ extern "C" {
#define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
#define RTE_LOGTYPE_EFD 18 /**< Log related to EFD. */
#define RTE_LOGTYPE_EVENTDEV 19 /**< Log related to eventdev. */
-#define RTE_LOGTYPE_GSO 20 /**< Log related to GSO. */
/* these log types can be used in an application */
#define RTE_LOGTYPE_USER1 24 /**< User-defined log type 1. */
@@ -81,8 +81,7 @@ rte_gso_segment(struct rte_mbuf *pkt,
indirect_pool, pkts_out, nb_pkts_out);
} else {
/* unsupported packet, skip */
- RTE_LOG(DEBUG, GSO, "Unsupported packet type\n");
- ret = 0;
+ ret = -EINVAL;
}
if (ret < 0) {