public void TestDumpFiltered() { if (IsLinux) { ConntrackSystem cts = new ConntrackSystem(); IPAddress addr = IPAddress.Parse("1.1.1.1"); UInt32 addr32; unchecked { addr32 = (UInt32)addr.ToInt(); } var pinned = GCHandle.Alloc(addr32, GCHandleType.Pinned); ConntrackQueryFilter[] qf = new ConntrackQueryFilter[] { new ConntrackQueryFilter{Key = cts.GetConstant("CTA_TUPLE_ORIG"), Max = cts.GetConstant("CTA_TUPLE_MAX"), CompareLength = 0}, new ConntrackQueryFilter{Key = cts.GetConstant("CTA_TUPLE_IP"), Max = cts.GetConstant("CTA_IP_MAX"), CompareLength = 0}, new ConntrackQueryFilter{Key = cts.GetConstant("CTA_IP_V4_DST"), Max = 0, CompareLength = 4, Compare = pinned.AddrOfPinnedObject()}, }; Console.WriteLine(qf[0].ToString()); List<byte[]> list = new List<byte[]>(); cts.Dump(false, list.Add, qf); pinned.Free(); } }
public void TestDump() { if (IsLinux) { ConntrackSystem cts = new ConntrackSystem(); List <byte[]> list = new List <byte[]>(); cts.Dump(false, list.Add); } }
public void TestDump() { if (IsLinux) { ConntrackSystem cts = new ConntrackSystem(); List<byte[]> list = new List<byte[]>(); cts.Dump(false,list.Add); } }
public void TestDumpFiltered() { if (IsLinux) { ConntrackSystem cts = new ConntrackSystem(); IPAddress addr = IPAddress.Parse("1.1.1.1"); UInt32 addr32; unchecked { addr32 = (UInt32)addr.ToInt(); } var pinned = GCHandle.Alloc(addr32, GCHandleType.Pinned); ConntrackQueryFilter[] qf = new ConntrackQueryFilter[] { new ConntrackQueryFilter { Key = cts.GetConstant("CTA_TUPLE_ORIG"), Max = cts.GetConstant("CTA_TUPLE_MAX"), CompareLength = 0 }, new ConntrackQueryFilter { Key = cts.GetConstant("CTA_TUPLE_IP"), Max = cts.GetConstant("CTA_IP_MAX"), CompareLength = 0 }, new ConntrackQueryFilter { Key = cts.GetConstant("CTA_IP_V4_DST"), Max = 0, CompareLength = 4, Compare = pinned.AddrOfPinnedObject() }, }; Console.WriteLine(qf[0].ToString()); List <byte[]> list = new List <byte[]>(); cts.Dump(false, list.Add, qf); pinned.Free(); } }