diff options
author | Laurent Vivier <lvivier@redhat.com> | 2025-09-02 09:52:38 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2025-09-03 20:43:25 +0200 |
commit | c4cad316e4e9d65e3b77ea3afa72cddc2b43258a (patch) | |
tree | 5446fa21bca02fdefe1a115af1b851dbe1773294 | |
parent | 54f15c6d9d3901139ec441f120a41236e9c9b72f (diff) | |
download | passt-c4cad316e4e9d65e3b77ea3afa72cddc2b43258a.tar passt-c4cad316e4e9d65e3b77ea3afa72cddc2b43258a.tar.gz passt-c4cad316e4e9d65e3b77ea3afa72cddc2b43258a.tar.bz2 passt-c4cad316e4e9d65e3b77ea3afa72cddc2b43258a.tar.lz passt-c4cad316e4e9d65e3b77ea3afa72cddc2b43258a.tar.xz passt-c4cad316e4e9d65e3b77ea3afa72cddc2b43258a.tar.zst passt-c4cad316e4e9d65e3b77ea3afa72cddc2b43258a.zip |
dhcpv6: Convert to iov_tail
Use packet_data() and extract headers using IOV_REMOVE_HEADER()
and IOV_PEEK_HEADER() rather than packet_get().
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | dhcpv6.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -533,12 +533,18 @@ int dhcpv6(struct ctx *c, const struct pool *p, { const struct opt_hdr *client_id, *server_id, *ia; const struct in6_addr *src; + struct msg_hdr mh_storage; const struct msg_hdr *mh; + struct udphdr uh_storage; const struct udphdr *uh; struct opt_hdr *bad_ia; + struct iov_tail data; size_t mlen, n; - uh = packet_get(p, 0, 0, sizeof(*uh), &mlen); + if (!packet_data(p, 0, &data)) + return -1; + + uh = IOV_REMOVE_HEADER(&data, uh_storage); if (!uh) return -1; @@ -551,6 +557,7 @@ int dhcpv6(struct ctx *c, const struct pool *p, if (!IN6_IS_ADDR_MULTICAST(daddr)) return -1; + mlen = iov_tail_size(&data); if (mlen + sizeof(*uh) != ntohs(uh->len) || mlen < sizeof(*mh)) return -1; @@ -558,7 +565,7 @@ int dhcpv6(struct ctx *c, const struct pool *p, src = &c->ip6.our_tap_ll; - mh = packet_get(p, 0, sizeof(*uh), sizeof(*mh), NULL); + mh = IOV_PEEK_HEADER(&data, mh_storage); if (!mh) return -1; |