public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Sargun Dhillon <sargun@sargun.me>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	daniel@iogearbox.net
Subject: Re: [PATCH net-next v5 2/2] samples/bpf: Add test/example of using bpf_probe_write_user bpf helper
Date: Sat, 23 Jul 2016 18:17:58 -0700	[thread overview]
Message-ID: <20160724011757.GB33568@ast-mbp.thefacebook.com> (raw)
In-Reply-To: <20160724004410.GA31798@ircssh.c.rugged-nimbus-611.internal>

On Sat, Jul 23, 2016 at 05:44:11PM -0700, Sargun Dhillon wrote:
> This example shows using a kprobe to act as a dnat mechanism to divert
> traffic for arbitrary endpoints. It rewrite the arguments to a syscall
> while they're still in userspace, and before the syscall has a chance
> to copy the argument into kernel space.
> 
> Although this is an example, it also acts as a test because the mapped
> address is 255.255.255.255:555 -> real address, and that's not a legal
> address to connect to. If the helper is broken, the example will fail.

nice. makes sense.

> Signed-off-by: Sargun Dhillon <sargun@sargun.me>
...
> +/* Copyright (c) 2013-2015 PLUMgrid, http://plumgrid.com

hmm, not sure what to think about this line.
plumgrid got a new employee? ;)

> +	if (load_bpf_file(filename)) {
> +		printf("%s", bpf_log_buf);
> +		return 1;
> +	}
> +
> +	/* Is the server's getsockname = the socket getpeername */
> +	assert(memcmp(&serv_addr, &tmp_addr, sizeof(struct sockaddr_in)) == 0);

thanks. so the $?==0 will indicate success, right?
After respin feel free to add my ack.

      reply	other threads:[~2016-07-24  1:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-24  0:44 [PATCH net-next v5 2/2] samples/bpf: Add test/example of using bpf_probe_write_user bpf helper Sargun Dhillon
2016-07-24  1:17 ` Alexei Starovoitov [this message]

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=20160724011757.GB33568@ast-mbp.thefacebook.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sargun@sargun.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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