• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/openvpn-2.3.1/src/plugins/down-root/

Lines Matching defs:context

262 free_context (struct down_root_context *context)
264 if (context)
266 if (context->command)
267 free (context->command);
268 free (context);
275 struct down_root_context *context;
278 * Allocate our context
280 context = (struct down_root_context *) calloc (1, sizeof (struct down_root_context));
281 if (!context)
283 context->foreground_fd = -1;
301 * Save our argument in context
303 context->command = build_command_line (&argv[1]);
311 context->verb = atoi (verb_string);
314 return (openvpn_plugin_handle_t) context;
317 free_context (context);
324 struct down_root_context *context = (struct down_root_context *) handle;
326 if (type == OPENVPN_PLUGIN_UP && context->foreground_fd == -1) /* fork off a process to hold onto root */
355 context->background_pid = pid;
368 context->foreground_fd = fd[0];
388 down_root_server (fd[1], context->command, argv, envp, context->verb);
395 else if (type == OPENVPN_PLUGIN_DOWN && context->foreground_fd >= 0)
397 if (send_control (context->foreground_fd, COMMAND_RUN_SCRIPT) == -1)
403 const int status = recv_control (context->foreground_fd);
416 struct down_root_context *context = (struct down_root_context *) handle;
418 if (DEBUG (context->verb))
421 if (context->foreground_fd >= 0)
424 if (send_control (context->foreground_fd, COMMAND_EXIT) == -1)
428 if (context->background_pid > 0)
429 waitpid (context->background_pid, NULL, 0);
431 close (context->foreground_fd);
432 context->foreground_fd = -1;
435 free_context (context);
441 struct down_root_context *context = (struct down_root_context *) handle;
443 if (context && context->foreground_fd >= 0)
446 send_control (context->foreground_fd, COMMAND_EXIT);
447 close (context->foreground_fd);
448 context->foreground_fd = -1;