Re: [PATCH 2/2] tun: socket filter support

From: Patrick McHardy
Date: Mon Feb 15 2010 - 10:25:01 EST


Michael S. Tsirkin wrote:
> + case TUNATTACHFILTER:
> + /* Can be set only for TAPs */
> + ret = -EINVAL;
> + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV)
> + break;
> + ret = -EFAULT;
> + if (copy_from_user(&fprog, argp, sizeof(fprog)))
> + break;
> +
> + ret = sk_attach_filter(&fprog, tun->socket.sk);
> + break;
> +
> + case TUNDETACHFILTER:
> + /* Can be set only for TAPs */
> + ret = -EINVAL;
> + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV)
> + break;
> + ret = sk_detach_filter(tun->socket.sk);
> + break;
> +

I'm not sure how the tun socket is exposed, but won't the regular
SO_ATTACH_FILTER/SO_DETACH_FILTER setsockopts already work for
tun sockets?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/