Esempio n. 1
0
        private void AcceptIPInternal(IPAddress address)
        {
            if (address == null)
            {
                return;
            }

            using var adapter = System.GetTableAdapter(4);

            var chain = new IpTablesChain(IpTable, IpChain, 4, System);
            var rule  = new IpTablesRule(System, chain);

            rule.AppendToRule(GetAcceptRule(address));
            chain.AddRule(rule);

            var sync = new DefaultNetfilterSync <IpTablesRule>();

            (System.GetChain(adapter, IpTable, IpChain) as IpTablesChain).Sync(adapter, chain.Rules, sync);
            Logger.LogInformation($"Whitelisted {address}");
        }