Message ID | 20200417131410.1343135-2-aconole@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Thomas Monjalon |
Headers | show |
Series | ip_frag: add a unit test for fragmentation | expand |
Context | Check | Description |
---|---|---|
ci/iol-testing | fail | Testing issues |
ci/iol-mellanox-Performance | success | Performance Testing PASS |
ci/iol-nxp-Performance | success | Performance Testing PASS |
ci/iol-intel-Performance | success | Performance Testing PASS |
ci/Intel-compilation | success | Compilation OK |
ci/checkpatch | success | coding style OK |
> Do a formal parameter check of mtu length, as well as > checking the the various inputs for validity. If any > aren't acceptable, we bail. > > Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> > Signed-off-by: Aaron Conole <aconole@redhat.com> > --- > lib/librte_ip_frag/rte_ipv4_fragmentation.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c > index 9e9f986cc5..c36678a6d2 100644 > --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c > +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c > @@ -76,6 +76,15 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, > uint16_t fragment_offset, flag_offset, frag_size; > uint16_t frag_bytes_remaining; > > + /* > + * Formal parameter checking. > + */ > + if (unlikely(pkt_in == NULL) || unlikely(pkts_out == NULL) || > + unlikely(nb_pkts_out == 0) || > + unlikely(pool_direct == NULL) || unlikely(pool_indirect == NULL) || > + unlikely(mtu_size < 68)) It is better not to use hard-coded constant values. I think we have a macro for it at lib/librte_net/rte_ether.h: #define RTE_ETHER_MIN_MTU 68 /**< Minimum MTU for IPv4 packets, see RFC 791. */ Apart from that: Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> > + return -EINVAL; > + > /* > * Ensure the IP payload length of all fragments is aligned to a > * multiple of 8 bytes as per RFC791 section 2.3. > -- > 2.25.1
"Ananyev, Konstantin" <konstantin.ananyev@intel.com> writes: > >> Do a formal parameter check of mtu length, as well as >> checking the the various inputs for validity. If any >> aren't acceptable, we bail. >> >> Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> >> Signed-off-by: Aaron Conole <aconole@redhat.com> >> --- >> lib/librte_ip_frag/rte_ipv4_fragmentation.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c >> index 9e9f986cc5..c36678a6d2 100644 >> --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c >> +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c >> @@ -76,6 +76,15 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, >> uint16_t fragment_offset, flag_offset, frag_size; >> uint16_t frag_bytes_remaining; >> >> + /* >> + * Formal parameter checking. >> + */ >> + if (unlikely(pkt_in == NULL) || unlikely(pkts_out == NULL) || >> + unlikely(nb_pkts_out == 0) || >> + unlikely(pool_direct == NULL) || unlikely(pool_indirect == NULL) || >> + unlikely(mtu_size < 68)) > > It is better not to use hard-coded constant values. > I think we have a macro for it at lib/librte_net/rte_ether.h: > #define RTE_ETHER_MIN_MTU 68 /**< Minimum MTU for IPv4 packets, see RFC 791. */ Done. > Apart from that: > Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> > > >> + return -EINVAL; >> + >> /* >> * Ensure the IP payload length of all fragments is aligned to a >> * multiple of 8 bytes as per RFC791 section 2.3. >> -- >> 2.25.1
diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index 9e9f986cc5..c36678a6d2 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -76,6 +76,15 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, uint16_t fragment_offset, flag_offset, frag_size; uint16_t frag_bytes_remaining; + /* + * Formal parameter checking. + */ + if (unlikely(pkt_in == NULL) || unlikely(pkts_out == NULL) || + unlikely(nb_pkts_out == 0) || + unlikely(pool_direct == NULL) || unlikely(pool_indirect == NULL) || + unlikely(mtu_size < 68)) + return -EINVAL; + /* * Ensure the IP payload length of all fragments is aligned to a * multiple of 8 bytes as per RFC791 section 2.3.