public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox•net>
To: David Ahern <dsahern@gmail•com>, netdev@vger•kernel.org, ast@kernel•org
Subject: Re: [PATCH v3 net-next 1/7] bpf: Add mark and priority to sock options that can be set
Date: Fri, 01 Sep 2017 00:21:14 +0200	[thread overview]
Message-ID: <59A88BDA.9070609@iogearbox.net> (raw)
In-Reply-To: <1504217150-16151-2-git-send-email-dsahern@gmail.com>

On 09/01/2017 12:05 AM, David Ahern wrote:
> Add socket mark and priority to fields that can be set by
> ebpf program when a socket is created.
>
> Signed-off-by: David Ahern <dsahern@gmail•com>
> Acked-by: Alexei Starovoitov <ast@kernel•org>
> ---
>   include/uapi/linux/bpf.h |  2 ++
>   net/core/filter.c        | 26 ++++++++++++++++++++++++++
>   2 files changed, 28 insertions(+)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index d46cf326b95f..e9c89e20adff 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -758,6 +758,8 @@ struct bpf_sock {
>   	__u32 family;
>   	__u32 type;
>   	__u32 protocol;
> +	__u32 mark;
> +	__u32 priority;
>   };
>
>   #define XDP_PACKET_HEADROOM 256
> diff --git a/net/core/filter.c b/net/core/filter.c
> index c6a37fe0285b..f51b9690adf3 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -3455,6 +3455,10 @@ static bool sock_filter_is_valid_access(int off, int size,
>   		switch (off) {
>   		case offsetof(struct bpf_sock, bound_dev_if):
>   			break;
> +		case offsetof(struct bpf_sock, mark):
> +			break;
> +		case offsetof(struct bpf_sock, priority):
> +			break;

Can also be follow-up, but please do keep this consistent
to all the other *_is_valid_access() helpers, meaning:

	switch (off) {
	case offsetof(struct bpf_sock, bound_dev_if):
	case offsetof(struct bpf_sock, mark):
	case offsetof(struct bpf_sock, priority):
		break;
	default:
		return false;
	}

Rest:

Acked-by: Daniel Borkmann <daniel@iogearbox•net>

  reply	other threads:[~2017-08-31 22:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31 22:05 [PATCH v3 net-next 0/7] bpf: Add option to set mark and priority in cgroup sock programs David Ahern
2017-08-31 22:05 ` [PATCH v3 net-next 1/7] bpf: Add mark and priority to sock options that can be set David Ahern
2017-08-31 22:21   ` Daniel Borkmann [this message]
2017-08-31 22:05 ` [PATCH v3 net-next 2/7] bpf: Allow cgroup sock filters to use get_current_uid_gid helper David Ahern
2017-08-31 22:22   ` Daniel Borkmann
2017-08-31 22:05 ` [PATCH v3 net-next 3/7] samples/bpf: Update sock test to allow setting mark and priority David Ahern
2017-09-01  1:38   ` Alexei Starovoitov
2017-08-31 22:05 ` [PATCH v3 net-next 4/7] samples/bpf: Add detach option to test_cgrp2_sock David Ahern
2017-09-01  1:39   ` Alexei Starovoitov
2017-08-31 22:05 ` [PATCH v3 net-next 5/7] samples/bpf: Add option to dump socket settings David Ahern
2017-09-01  1:39   ` Alexei Starovoitov
2017-08-31 22:05 ` [PATCH v3 net-next 6/7] samples/bpf: Update cgrp2 socket tests David Ahern
2017-09-01  1:40   ` Alexei Starovoitov
2017-08-31 22:05 ` [PATCH v3 net-next 7/7] samples/bpf: Update cgroup socket examples to use uid gid helper David Ahern
2017-09-01  1:41   ` Alexei Starovoitov
2017-09-01  5:06 ` [PATCH v3 net-next 0/7] bpf: Add option to set mark and priority in cgroup sock programs David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59A88BDA.9070609@iogearbox.net \
    --to=daniel@iogearbox$(echo .)net \
    --cc=ast@kernel$(echo .)org \
    --cc=dsahern@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox