Subject: Re: [PATCH iproute2 -next] tc: built-in eBPF exec proxy

From: Alexei Starovoitov <[email-masked]>
Date: Thu, 16 Apr 2015 10:48:39 -0700

On 4/15/15 7:52 AM, Daniel Borkmann wrote:
>
> File descriptors, based on their id, are being fetched from the same
> unix domain socket as demonstrated in the bpf_agent, the shell spawned
> via execvpe(2) and the map fds passed over the environment, and thus
> are made available to applications in the fashion of std{in,out,err}
> for read/write access, for example in case of iproute2's examples/bpf/:

Amazing that it worked.
Acked-by: Alexei Starovoitov <[email-masked]>

> +static void bpf_map_set_env(int *tfd)
> +{
> +	char key[64], *val;
> +	int i;
> +	for (i = 0; i < BPF_MAP_ID_MAX; i++) {
> +		memset(key, 0, sizeof(key));
> +		snprintf(key, sizeof(key), "BPF_MAP%d", i);
>
> +		val = secure_getenv(key);
> +		assert(val != NULL);

everything looks good. My only nit is that the name of the function
reads as this function is setting env vars, whereas it's actually
reading them. I guess in your mind it fits with the rest of
'bpf_map_set_*' functions, but the name is still confusing.