mirror of
https://passt.top/passt
synced 2025-06-14 03:25:34 +02:00
pif: Pass originating pif to tap handler functions
For now, packets passed to the various *_tap_handler() functions always come from the single "tap" interface. We want to allow the possibility to broaden that in future. As preparation for that, have the code in tap.c pass the pif id of the originating interface to each of those handler functions. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
732e249376
commit
f6d8dc2355
7 changed files with 34 additions and 17 deletions
6
tcp.c
6
tcp.c
|
@ -2562,6 +2562,7 @@ static void tcp_conn_from_sock_finish(struct ctx *c, struct tcp_tap_conn *conn,
|
|||
/**
|
||||
* tcp_tap_handler() - Handle packets from tap and state transitions
|
||||
* @c: Execution context
|
||||
* @pif: pif on which the packet is arriving
|
||||
* @af: Address family, AF_INET or AF_INET6
|
||||
* @saddr: Source address
|
||||
* @daddr: Destination address
|
||||
|
@ -2571,7 +2572,8 @@ static void tcp_conn_from_sock_finish(struct ctx *c, struct tcp_tap_conn *conn,
|
|||
*
|
||||
* Return: count of consumed packets
|
||||
*/
|
||||
int tcp_tap_handler(struct ctx *c, int af, const void *saddr, const void *daddr,
|
||||
int tcp_tap_handler(struct ctx *c, uint8_t pif, int af,
|
||||
const void *saddr, const void *daddr,
|
||||
const struct pool *p, int idx, const struct timespec *now)
|
||||
{
|
||||
struct tcp_tap_conn *conn;
|
||||
|
@ -2581,6 +2583,8 @@ int tcp_tap_handler(struct ctx *c, int af, const void *saddr, const void *daddr,
|
|||
char *opts;
|
||||
int count;
|
||||
|
||||
(void)pif;
|
||||
|
||||
th = packet_get(p, idx, 0, sizeof(*th), &len);
|
||||
if (!th)
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue