Ejemplo n.º 1
0
        public override void OnRecoveryLoad(XmlElement root)
        {
            XmlElement nodeDns = Utils.XmlGetFirstElementByTagName(root, "DnsSwitch");

            if (nodeDns != null)
            {
                foreach (XmlElement nodeEntry in nodeDns.ChildNodes)
                {
                    DnsSwitchEntry entry = new DnsSwitchEntry();
                    entry.ReadXML(nodeEntry);
                    m_listDnsSwitch.Add(entry);
                }
            }

            XmlElement nodeIpV6 = Utils.XmlGetFirstElementByTagName(root, "IpV6");

            if (nodeIpV6 != null)
            {
                foreach (XmlElement nodeEntry in nodeIpV6.ChildNodes)
                {
                    IpV6ModeEntry entry = new IpV6ModeEntry();
                    entry.ReadXML(nodeEntry);
                    m_listIpV6Mode.Add(entry);
                }
            }

            base.OnRecoveryLoad(root);
        }
Ejemplo n.º 2
0
        public override bool OnIpV6Do()
        {
            if (Engine.Instance.Storage.Get("ipv6.mode") == "disable")
            {
                string[] interfaces = GetInterfaces();
                foreach (string i in interfaces)
                {
                    string getInfo = ShellCmd("networksetup -getinfo \"" + i + "\"");

                    string mode    = Utils.RegExMatchOne(getInfo, "^IPv6: (.*?)$");
                    string address = Utils.RegExMatchOne(getInfo, "^IPv6 IP address: (.*?)$");

                    if ((mode == "") && (address != ""))
                    {
                        mode = "LinkLocal";
                    }

                    if (mode != "Off")
                    {
                        Engine.Instance.Log(Engine.LogType.Info, Messages.Format(Messages.NetworkAdapterIpV6Disabled, i));

                        IpV6ModeEntry entry = new IpV6ModeEntry();
                        entry.Interface = i;
                        entry.Mode      = mode;
                        entry.Address   = address;
                        if (mode == "Manual")
                        {
                            entry.Router       = Utils.RegExMatchOne(getInfo, "^IPv6 IP Router: (.*?)$");
                            entry.PrefixLength = Utils.RegExMatchOne(getInfo, "^IPv6 Prefix Length: (.*?)$");
                        }
                        m_listIpV6Mode.Add(entry);

                        ShellCmd("networksetup -setv6off \"" + i + "\"");
                    }
                }

                Recovery.Save();
            }

            base.OnIpV6Do();

            return(true);
        }
Ejemplo n.º 3
0
		public override bool OnIpV6Do()
		{
			if (Engine.Instance.Storage.Get("ipv6.mode") == "disable")
			{
				string[] interfaces = GetInterfaces();
				foreach (string i in interfaces)
				{
					string getInfo = ShellCmd("networksetup -getinfo \"" + i + "\"");

					string mode = Utils.RegExMatchOne(getInfo, "^IPv6: (.*?)$");
					string address = Utils.RegExMatchOne(getInfo, "^IPv6 IP address: (.*?)$");
					
					if( (mode == "") && (address != "") )
						mode = "LinkLocal";

					if (mode != "Off")
					{
						Engine.Instance.Log(Engine.LogType.Info, Messages.Format(Messages.NetworkAdapterIpV6Disabled, i));

						IpV6ModeEntry entry = new IpV6ModeEntry();
						entry.Interface = i;
						entry.Mode = mode;
						entry.Address = address;
						if (mode == "Manual")
						{
							entry.Router = Utils.RegExMatchOne(getInfo, "^IPv6 IP Router: (.*?)$");
							entry.PrefixLength = Utils.RegExMatchOne(getInfo, "^IPv6 Prefix Length: (.*?)$");
						}
						m_listIpV6Mode.Add(entry);

						ShellCmd("networksetup -setv6off \"" + i + "\"");
					}					
				}

				Recovery.Save();				
			}

			base.OnIpV6Do();

			return true;
		}
Ejemplo n.º 4
0
		public override void OnRecoveryLoad(XmlElement root)
		{
			XmlElement nodeDns = Utils.XmlGetFirstElementByTagName(root, "DnsSwitch");
			if (nodeDns != null)
			{
				foreach (XmlElement nodeEntry in nodeDns.ChildNodes)
				{
					DnsSwitchEntry entry = new DnsSwitchEntry();
					entry.ReadXML(nodeEntry);
					m_listDnsSwitch.Add(entry);
				}
			}

			XmlElement nodeIpV6 = Utils.XmlGetFirstElementByTagName(root, "IpV6");
			if (nodeIpV6 != null)
			{
				foreach (XmlElement nodeEntry in nodeIpV6.ChildNodes)
				{
					IpV6ModeEntry entry = new IpV6ModeEntry();
					entry.ReadXML(nodeEntry);
					m_listIpV6Mode.Add(entry);
				}
			}

			base.OnRecoveryLoad(root);
		}