diff options
-rw-r--r-- | platform/linux-generic/include/odp_packet_io_internal.h | 4 | ||||
-rw-r--r-- | platform/linux-generic/odp_packet_io.c | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 353b40d94..590b81668 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -30,6 +30,8 @@ extern "C" { #include <odp/hints.h> #include <net/if.h> +#define PKTIO_NAME_LEN 256 + /* Forward declaration */ struct pktio_if_ops; @@ -58,7 +60,7 @@ struct pktio_entry { STATE_STOP } state; classifier_t cls; /**< classifier linked with this pktio*/ - char name[IF_NAMESIZE]; /**< name of pktio provided to + char name[PKTIO_NAME_LEN]; /**< name of pktio provided to pktio_open() */ odp_pktio_param_t param; }; diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index f262cb61c..20c66f356 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -204,10 +204,10 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, int ret = -1; int pktio_if; - if (strlen(dev) >= IF_NAMESIZE) { + if (strlen(dev) >= PKTIO_NAME_LEN - 1) { /* ioctl names limitation */ ODP_ERR("pktio name %s is too big, limit is %d bytes\n", - dev, IF_NAMESIZE); + dev, PKTIO_NAME_LEN - 1); return ODP_PKTIO_INVALID; } @@ -239,7 +239,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, id = ODP_PKTIO_INVALID; ODP_ERR("Unable to init any I/O type.\n"); } else { - snprintf(pktio_entry->s.name, IF_NAMESIZE, "%s", dev); + snprintf(pktio_entry->s.name, + sizeof(pktio_entry->s.name), "%s", dev); pktio_entry->s.state = STATE_STOP; unlock_entry_classifier(pktio_entry); } @@ -344,7 +345,7 @@ odp_pktio_t odp_pktio_lookup(const char *dev) lock_entry(entry); if (!is_free(entry) && - strncmp(entry->s.name, dev, IF_NAMESIZE) == 0) + strncmp(entry->s.name, dev, sizeof(entry->s.name)) == 0) id = _odp_cast_scalar(odp_pktio_t, i); unlock_entry(entry); |