Signed-off-by: Laurent Vivier
---
ndp.c | 16 ++++++++--------
ndp.h | 4 ++--
tap.c | 10 +++-------
3 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/ndp.c b/ndp.c
index b09a1a133f56..95cb1d983f12 100644
--- a/ndp.c
+++ b/ndp.c
@@ -336,13 +336,17 @@ static void ndp_ra(const struct ctx *c, const struct in6_addr *dst)
* @c: Execution context
* @ih: ICMPv6 header
* @saddr: Source IPv6 address
- * @p: Packet pool
+ * @data: Single packet with ICMPv6 header
*
* Return: 0 if not handled here, 1 if handled, -1 on failure
*/
-int ndp(const struct ctx *c, const struct icmp6hdr *ih,
- const struct in6_addr *saddr, const struct pool *p)
+int ndp(const struct ctx *c, const struct in6_addr *saddr,
+ struct iov_tail *data)
{
+ struct icmp6hdr ihc;
+ const struct icmp6hdr *ih;
+
+ ih = IOV_PEEK_HEADER(data, ihc);
if (ih->icmp6_type < RS || ih->icmp6_type > NA)
return 0;
@@ -351,13 +355,9 @@ int ndp(const struct ctx *c, const struct icmp6hdr *ih,
if (ih->icmp6_type == NS) {
const struct ndp_ns *ns;
- struct iov_tail data;
struct ndp_ns nsc;
- if (!packet_data(p, 0, &data))
- return -1;
-
- ns = IOV_REMOVE_HEADER(&data, nsc);
+ ns = IOV_REMOVE_HEADER(data, nsc);
if (!ns)
return -1;
diff --git a/ndp.h b/ndp.h
index 41c2000356ec..b1dd5e82c085 100644
--- a/ndp.h
+++ b/ndp.h
@@ -8,8 +8,8 @@
struct icmp6hdr;
-int ndp(const struct ctx *c, const struct icmp6hdr *ih,
- const struct in6_addr *saddr, const struct pool *p);
+int ndp(const struct ctx *c, const struct in6_addr *saddr,
+ struct iov_tail *data);
void ndp_timer(const struct ctx *c, const struct timespec *now);
#endif /* NDP_H */
diff --git a/tap.c b/tap.c
index d70e387fa7cc..3b5315cf541d 100644
--- a/tap.c
+++ b/tap.c
@@ -940,9 +940,7 @@ resume:
}
if (proto == IPPROTO_ICMPV6) {
- const struct icmp6hdr *l4h;
- struct icmp6hdr l4hc;
- PACKET_POOL_P(pkt, 1, in->buf, in->buf_size);
+ struct iov_tail ndp_data;
if (c->no_icmp)
continue;
@@ -950,10 +948,8 @@ resume:
if (l4len < sizeof(struct icmp6hdr))
continue;
- packet_add(pkt, &data);
-
- l4h = IOV_PEEK_HEADER(&data, l4hc);
- if (ndp(c, (struct icmp6hdr *)l4h, saddr, pkt))
+ ndp_data = data;
+ if (ndp(c, saddr, &ndp_data))
continue;
tap_packet_debug(NULL, ip6h, NULL, proto, NULL, 1);
--
2.49.0