View | Details | Raw Unified
Collapse All | Expand All

(-) tun.c (-8 / +26 lines)
 Lines 1220-1245    Link Here 
{
{
  if (tt)
  if (tt)
    {
    {
#ifdef CONFIG_FEATURE_IPROUTE
	if (tt->type != DEV_TYPE_NULL && tt->did_ifconfig)
	if (tt->type != DEV_TYPE_NULL && tt->did_ifconfig)
	  {
	  {
	    char command_line[256];
	    char command_line[256];
	    struct gc_arena gc = gc_new ();
	    struct gc_arena gc = gc_new ();
#ifdef CONFIG_FEATURE_IPROUTE
	    if (is_tun_p2p (tt))
	      {
		openvpn_snprintf (command_line, sizeof (command_line),
			"%s addr del dev %s local %s peer %s",
			iproute_path,
			tt->actual_name,
			print_in_addr_t (tt->local, 0, &gc),
			print_in_addr_t (tt->remote_netmask, 0, &gc)
			);
	      }
	    else
	      {
		openvpn_snprintf (command_line, sizeof (command_line),
			"%s addr add dev %s %s/%d",
			iproute_path,
			tt->actual_name,
			print_in_addr_t (tt->local, 0, &gc),
			count_netmask_bits(print_in_addr_t (tt->remote_netmask, 0, &gc))
			);
	      }
#else
	    openvpn_snprintf (command_line, sizeof (command_line),
	    openvpn_snprintf (command_line, sizeof (command_line),
			  "%s addr del dev %s local %s peer %s",
			IFCONFIG_PATH "%s addr 0.0.0.0",
			  iproute_path,
			tt->actual_name
			  tt->actual_name,
			);
			  print_in_addr_t (tt->local, 0, &gc),
#endif
			  print_in_addr_t (tt->remote_netmask, 0, &gc)
			  );
	    msg (M_INFO, "%s", command_line);
	    msg (M_INFO, "%s", command_line);
	    system_check (command_line, NULL, S_FATAL, "Linux ip addr del failed");
	    system_check (command_line, NULL, S_FATAL, "Linux ip addr del failed");
	    gc_free (&gc);
	    gc_free (&gc);
	  }
	  }
#endif
      close_tun_generic (tt);
      close_tun_generic (tt);
      free (tt);
      free (tt);
    }
    }