aboutgitcodebugslistschat
path: root/tap.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-11-07 12:40:16 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-11-07 09:53:45 +0100
commitf6d8dc235553761a2541f7a6b782488160db03a7 (patch)
treebd91d104ba900c99cc9dbabdc277e95bf628d845 /tap.c
parent732e24937618f5848e182dc8a38eb170cf079394 (diff)
downloadpasst-f6d8dc235553761a2541f7a6b782488160db03a7.tar
passt-f6d8dc235553761a2541f7a6b782488160db03a7.tar.gz
passt-f6d8dc235553761a2541f7a6b782488160db03a7.tar.bz2
passt-f6d8dc235553761a2541f7a6b782488160db03a7.tar.lz
passt-f6d8dc235553761a2541f7a6b782488160db03a7.tar.xz
passt-f6d8dc235553761a2541f7a6b782488160db03a7.tar.zst
passt-f6d8dc235553761a2541f7a6b782488160db03a7.zip
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>
Diffstat (limited to 'tap.c')
-rw-r--r--tap.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/tap.c b/tap.c
index a7f6d8b..3a938f3 100644
--- a/tap.c
+++ b/tap.c
@@ -645,7 +645,8 @@ resume:
tap_packet_debug(iph, NULL, NULL, 0, NULL, 1);
packet_add(pkt, l4_len, l4h);
- icmp_tap_handler(c, AF_INET, &iph->saddr, &iph->daddr,
+ icmp_tap_handler(c, PIF_TAP, AF_INET,
+ &iph->saddr, &iph->daddr,
pkt, now);
continue;
}
@@ -719,14 +720,16 @@ append:
if (c->no_tcp)
continue;
for (k = 0; k < p->count; )
- k += tcp_tap_handler(c, AF_INET, &seq->saddr,
- &seq->daddr, p, k, now);
+ k += tcp_tap_handler(c, PIF_TAP, AF_INET,
+ &seq->saddr, &seq->daddr,
+ p, k, now);
} else if (seq->protocol == IPPROTO_UDP) {
if (c->no_udp)
continue;
for (k = 0; k < p->count; )
- k += udp_tap_handler(c, AF_INET, &seq->saddr,
- &seq->daddr, p, k, now);
+ k += udp_tap_handler(c, PIF_TAP, AF_INET,
+ &seq->saddr, &seq->daddr,
+ p, k, now);
}
}
@@ -807,7 +810,8 @@ resume:
tap_packet_debug(NULL, ip6h, NULL, proto, NULL, 1);
packet_add(pkt, l4_len, l4h);
- icmp_tap_handler(c, AF_INET6, saddr, daddr, pkt, now);
+ icmp_tap_handler(c, PIF_TAP, AF_INET6,
+ saddr, daddr, pkt, now);
continue;
}
@@ -883,14 +887,16 @@ append:
if (c->no_tcp)
continue;
for (k = 0; k < p->count; )
- k += tcp_tap_handler(c, AF_INET6, &seq->saddr,
- &seq->daddr, p, k, now);
+ k += tcp_tap_handler(c, PIF_TAP, AF_INET6,
+ &seq->saddr, &seq->daddr,
+ p, k, now);
} else if (seq->protocol == IPPROTO_UDP) {
if (c->no_udp)
continue;
for (k = 0; k < p->count; )
- k += udp_tap_handler(c, AF_INET6, &seq->saddr,
- &seq->daddr, p, k, now);
+ k += udp_tap_handler(c, PIF_TAP, AF_INET6,
+ &seq->saddr, &seq->daddr,
+ p, k, now);
}
}