On Wed, 2021-06-23 at 14:52 +0100, David Woodhouse wrote:
quoted hunk ↗ jump to hunk
@@ -2343,6 +2351,17 @@ static int tun_xdp_one(struct tun_struct *tun,
if (tun->flags & IFF_VNET_HDR)
gso = &hdr->gso;
+ if (!(tun->flags & IFF_NO_PI)) {
+ struct tun_pi *pi = xdp->data;
+ if (datasize < sizeof(*pi)) {
+ atomic_long_inc(&tun->rx_frame_errors);
+ return -EINVAL;
+ }
+ proto = pi->proto;
+ reservelen += sizeof(*pi);
+ datasize -= sizeof(*pi);
+ }
+
xdp_prog = rcu_dereference(tun->xdp_prog);
if (xdp_prog) {
if (gso && gso->gso_type) {
Joy... that's wrong because when tun does both the PI and the vnet
headers, the PI header comes *first*. When tun does only PI and vhost
does the vnet headers, they come in the other order.
Will fix (and adjust the test cases to cope).