lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 2 Nov 2017 10:15:28 +0900
From:   Willem de Bruijn <willemdebruijn.kernel@...il.com>
To:     Jason Wang <jasowang@...hat.com>
Cc:     Network Development <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Tom Herbert <tom@...bertland.com>
Subject: Re: [PATCH net-next V2 2/3] tun: introduce ioctls to set and get
 steering policies

On Tue, Oct 31, 2017 at 7:32 PM, Jason Wang <jasowang@...hat.com> wrote:
> This patch introduces new ioctl for change packet steering policy for
> tun. Only automatic flow steering is supported, more policies will
> come.
>
> Signed-off-by: Jason Wang <jasowang@...hat.com>
> ---
>  drivers/net/tun.c           | 35 ++++++++++++++++++++++++++++++++++-
>  include/uapi/linux/if_tun.h |  7 +++++++
>  2 files changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index bff6259..ab109ff 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -122,7 +122,8 @@ do {                                                                \
>  #define TUN_VNET_BE     0x40000000
>
>  #define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \
> -                     IFF_MULTI_QUEUE | IFF_NAPI | IFF_NAPI_FRAGS)
> +                     IFF_MULTI_QUEUE | IFF_NAPI | IFF_NAPI_FRAGS | \
> +                     IFF_MULTI_STEERING)
>
>  #define GOODCOPY_LEN 128
>
> @@ -2516,6 +2517,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
>         unsigned int ifindex;
>         int le;
>         int ret;
> +       unsigned int steering;
>
>         if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == SOCK_IOC_TYPE) {
>                 if (copy_from_user(&ifr, argp, ifreq_len))
> @@ -2774,6 +2776,37 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
>                 ret = 0;
>                 break;
>
> +       case TUNSETSTEERING:
> +               ret = -EFAULT;
> +               if (copy_from_user(&steering, argp, sizeof(steering)))
> +                       break;
> +               ret = 0;
> +               switch (steering) {
> +               case TUN_STEERING_AUTOMQ:
> +                       tun->steering_ops = &tun_automq_ops;
> +                       break;
> +               default:
> +                       ret = -EFAULT;
> +               }
> +               break;
> +
> +       case TUNGETSTEERING:
> +               ret = 0;
> +               if (tun->steering_ops == &tun_automq_ops)
> +                       steering = TUN_STEERING_AUTOMQ;
> +               else
> +                       BUG();
> +               if (copy_to_user(argp, &steering, sizeof(steering)))
> +                       ret = -EFAULT;
> +               break;
> +
> +       case TUNGETSTEERINGFEATURES:
> +               ret = 0;
> +               steering = TUN_STEERING_AUTOMQ;
> +               if (copy_to_user(argp, &steering, sizeof(steering)))
> +                       ret = -EFAULT;
> +               break;
> +


Similar to my comment in patch 1/3: if only eBPF is used, these
calls can be avoided in favor of only TUNSETSTEERINGEBPF
from patch 3/3.

Powered by blists - more mailing lists