On 04/16/2015 07:48 PM, Alexei Starovoitov wrote:
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 <a...@plumgrid.com>

+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.

Ok, since it's example code, I'll find a better function name for it,
keep yours and Hannes' tags and resubmit. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to