bb70811183
Implement a packet abstraction providing boundary and size checks based on packet descriptors: packets stored in a buffer can be queued into a pool (without storage of its own), and data can be retrieved referring to an index in the pool, specifying offset and length. Checks ensure data is not read outside the boundaries of buffer and descriptors, and that packets added to a pool are within the buffer range with valid offset and indices. This implies a wider rework: usage of the "queueing" part of the abstraction mostly affects tap_handler_{passt,pasta}() functions and their callees, while the "fetching" part affects all the guest or tap facing implementations: TCP, UDP, ICMP, ARP, NDP, DHCP and DHCPv6 handlers. Suggested-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
20 lines
497 B
C
20 lines
497 B
C
/* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
* Copyright (c) 2021 Red Hat GmbH
|
|
* Author: Stefano Brivio <sbrivio@redhat.com>
|
|
*/
|
|
|
|
/**
|
|
* struct arpmsg - 802.2 ARP IPv4 payload
|
|
* @sha: Sender hardware address
|
|
* @sip: Sender IP address
|
|
* @tha: Target hardware address
|
|
* @tip: Target IP address
|
|
*/
|
|
struct arpmsg {
|
|
unsigned char sha[ETH_ALEN];
|
|
unsigned char sip[4];
|
|
unsigned char tha[ETH_ALEN];
|
|
unsigned char tip[4];
|
|
} __attribute__((__packed__));
|
|
|
|
int arp(struct ctx *c, struct pool *p);
|