summaryrefslogtreecommitdiff
path: root/lib/librte_ip_frag
diff options
context:
space:
mode:
authorAnatoly Burakov <anatoly.burakov@intel.com>2014-06-18 15:50:33 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-06-26 22:51:30 +0200
commit4dc5d0ad3bb6c4d3b2fcba706d6fbed9ef744d70 (patch)
treea3a998c2daf40866f9502425b630a8963bf8a714 /lib/librte_ip_frag
parent2505824261f3e64ae357655c3545c46628f377fd (diff)
downloaddpdk-4dc5d0ad3bb6c4d3b2fcba706d6fbed9ef744d70.zip
dpdk-4dc5d0ad3bb6c4d3b2fcba706d6fbed9ef744d70.tar.gz
dpdk-4dc5d0ad3bb6c4d3b2fcba706d6fbed9ef744d70.tar.xz
ip_frag: custom memmove
Some implementations of memmove may make a copy of src before writing to dst. We avoid that by explicitly writing from src to dst backwards. Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Diffstat (limited to 'lib/librte_ip_frag')
-rw-r--r--lib/librte_ip_frag/rte_ipv6_reassembly.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c
index c622827..3f06960 100644
--- a/lib/librte_ip_frag/rte_ipv6_reassembly.c
+++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c
@@ -45,6 +45,16 @@
*
*/
+static inline void
+ip_frag_memmove(char *dst, char *src, int len)
+{
+ int i;
+
+ /* go backwards to make sure we don't overwrite anything important */
+ for (i = len - 1; i >= 0; i--)
+ dst[i] = src[i];
+}
+
/*
* Reassemble fragments into one packet.
*/
@@ -115,7 +125,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
ip_hdr->proto = frag_hdr->next_header;
- memmove(rte_pktmbuf_mtod(m, char*) + sizeof(*frag_hdr),
+ ip_frag_memmove(rte_pktmbuf_mtod(m, char*) + sizeof(*frag_hdr),
rte_pktmbuf_mtod(m, char*), move_len);
rte_pktmbuf_adj(m, sizeof(*frag_hdr));