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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 19 Jun 2016 11:08:51 -0700
From:	pravin shelar <pshelar@....org>
To:	William Tu <u9012063@...il.com>
Cc:	Linux Kernel Network Developers <netdev@...r.kernel.org>,
	Pravin Shelar <pshelar@...ira.com>
Subject: Re: [net-next,v3] openvswitch: Add packet len info to upcall.

On Fri, Jun 17, 2016 at 12:52 PM, William Tu <u9012063@...il.com> wrote:
> The commit f2a4d086ed4c ("openvswitch: Add packet truncation support.")
> introduces packet truncation before sending to userspace upcall receiver.
> This patch passes up the skb->len before truncation so that the upcall
> receiver knows the original packet size. Potentially this will be used
> by sFlow, where OVS translates sFlow config header=N to a sample action,
> truncating packet to N byte in kernel datapath. Thus, only N bytes instead
> of full-packet size is copied from kernel to userspace, saving the
> kernel-to-userspace bandwidth.
>
> Signed-off-by: William Tu <u9012063@...il.com>
> Cc: Pravin Shelar <pshelar@...ira.com>
> ---
> v2->v3:
> - remove platform specific name.
> - fix issue when receiving GSO packet
> - remove skblen in struct dp_upcall_info
> v1->v2:
> - pass skb->len to userspace instead of cutlen
> ---
>  include/uapi/linux/openvswitch.h |  2 ++
>  net/openvswitch/datapath.c       | 11 ++++++++++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
>

Patch looks good, I just have one minor comment.

> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index 6739342..623fc04 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -387,7 +387,8 @@ static size_t upcall_msg_size(const struct dp_upcall_info *upcall_info,
>  {
>         size_t size = NLMSG_ALIGN(sizeof(struct ovs_header))
>                 + nla_total_size(hdrlen) /* OVS_PACKET_ATTR_PACKET */
> -               + nla_total_size(ovs_key_attr_size()); /* OVS_PACKET_ATTR_KEY */
> +               + nla_total_size(ovs_key_attr_size()) /* OVS_PACKET_ATTR_KEY */
> +               + nla_total_size(sizeof(unsigned int)); /* OVS_PACKET_ATTR_LEN */
>
>         /* OVS_PACKET_ATTR_USERDATA */
>         if (upcall_info->userdata)
> @@ -514,6 +515,14 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
>                 pad_packet(dp, user_skb);
>         }
>
> +       /* Add OVS_PACKET_ATTR_LEN */
> +       if (nla_put_u32(user_skb, OVS_PACKET_ATTR_LEN,
> +                       skb->len)) {
> +               err = -ENOBUFS;
> +               goto out;
> +       }
> +       pad_packet(dp, user_skb);
> +
We should only send packet length in case of truncated packet. This
would avoid sending this extra attribute in miss flow handling case.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ