Skip to content

Commit c6e6d73

Browse files
author
Mathew
committed
agentic scripts & dotnet updated to dotnet 10
1 parent c444e4e commit c6e6d73

13 files changed

Lines changed: 706 additions & 16 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
env:
1414
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
15-
DOTNET_VERSION: '8.0.x' # The .NET SDK version to use
15+
DOTNET_VERSION: '10.0.x' # The .NET SDK version to use
1616
PRODUCT_VERSION: '0.1.0'
1717

1818
# A workflow run is made up of one or more jobs that can run sequentially or in parallel

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ x64/
3434
*.tli
3535
*.tlh
3636
*.tmp
37+
core
38+
core.*
3739
*.log
3840
*.vspscc
3941
*.vssscc
@@ -107,4 +109,4 @@ Generated_Code #added for RIA/Silverlight projects
107109
# Visual Studio version. Backup files are not needed, because we have git ;-)
108110
_UpgradeReport_Files/
109111
Backup*/
110-
UpgradeLog*.XML
112+
UpgradeLog*.XML

AGENTS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# AGENTS.md
2+
3+
## Overview
4+
5+
This repository contains a .NET 8 solution for working with Linux iptables from C#. The managed code lives under `IPTables.Net/`, the NUnit tests live under `IPTables.Net.Tests/`, and the native helper library used by the libiptc-based adapter lives under `ipthelper/`.
6+
7+
## Build And Test
8+
9+
- Use `./build.sh` for a full solution build.
10+
- Use `./test.sh` to build and run tests.
11+
- Use `./test.sh --fast` for the managed-heavy test pass that sets `SKIP_SYSTEM_TESTS=1`.
12+
- Use `./test.sh --full` on Linux when root or passwordless `sudo` is available to run the stable native and system iptables tests.
13+
- Set `RUN_UNSTABLE_SYSTEM_TESTS=1` with `./test.sh --full` to include tests marked `NotWorkingOnTravis`, including the conntrack coverage that can crash on some containerized hosts.
14+
15+
Both scripts will bootstrap a usable .NET SDK if `dotnet` is missing. By default they infer the needed SDK channel from the highest `TargetFramework` declared in the repo's `.csproj` files. On Linux they also build `libipthelper` and install missing native build dependencies through a supported package manager when needed.
16+
17+
## Native Helper Notes
18+
19+
- `ipthelper/` builds `libipthelper.so`, which is required for `IPTablesLibAdapter`, `IptcInterface`, and the conntrack/native tests.
20+
- The helper links against the system iptables development libraries, `libnl3`, and `libpcap`.
21+
- The scripts first try a normal helper build and then retry with `-DOLD_IPTABLES` if the local iptables headers are older.
22+
- `test.sh --full` prefers the `iptables-legacy` / `ip6tables-legacy` alternatives when they are available because that matches the native test expectations more closely.
23+
24+
## Testing Guidance
25+
26+
- Fast mode is the safest default when you only need parser, model, or mocked adapter coverage.
27+
- Full mode touches the real machine state. The system tests create and mutate chains like `test`, `test2`, and `test3`, and the opt-in conntrack tests hit kernel networking APIs directly.
28+
- If full mode fails because the host lacks privileges, kernel modules, or compatible iptables backends, rerun with `./test.sh --fast` unless you are specifically changing native or system behavior.
29+
30+
## Development Guidance
31+
32+
- Keep changes narrow and add or update NUnit coverage in `IPTables.Net.Tests/` when behavior changes.
33+
- Prefer following the existing project layout instead of introducing new abstractions unless the current design is clearly blocking the work.
34+
- When changing native interop behavior, verify both the managed call sites in `IPTables.Net/Iptables/NativeLibrary/` and the corresponding code in `ipthelper/`.
35+
- The tests project is also the best source of usage examples for the public API.

IPTables.Net.Benchmark/IPTables.Net.Benchmark.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

IPTables.Net.TestFramework/IPTables - Backup.Net.TestFramework.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
77
<ProjectReference Include="..\IPTables.Net\IPTables.Net.csproj" />

IPTables.Net.TestFramework/IPTables.Net.TestFramework.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
77
<ProjectReference Include="..\IPTables.Net\IPTables.Net.csproj" />
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<Compile Remove="GraphLayoutTests.cs" />
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
1313
<PackageReference Include="NUnit" Version="3.12.0" />
1414
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
1515
<PackageReference Include="SystemInteract.Local" Version="1.1.5" />
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<ProjectReference Include="..\IPTables.Net.TestFramework\IPTables.Net.TestFramework.csproj" />
20-
<ProjectReference Include="..\IPTables.Net\IPTables.Net.csproj" />
19+
<ProjectReference Include="..\IPTables.Net.TestFramework\IPTables.Net.TestFramework.csproj" SkipGetTargetFrameworkProperties="true" />
2120
</ItemGroup>
2221

2322
</Project>

IPTables.Net/IPTables.Net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

IPTables.Net/Iptables/IpTablesRule.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public override bool Equals(IpTablesRule x, IpTablesRule y)
9999
/// <summary>
100100
/// Data stored for each IPTables module / extension (including "core")
101101
/// </summary>
102-
private OrderedDictionary<string, IIpTablesModule> _moduleData =
103-
new OrderedDictionary<string, IIpTablesModule>();
102+
private IPTables.Net.Supporting.OrderedDictionary<string, IIpTablesModule> _moduleData =
103+
new IPTables.Net.Supporting.OrderedDictionary<string, IIpTablesModule>();
104104

105105
/// <summary>
106106
/// The System hosting this IPTables rule
@@ -148,7 +148,7 @@ public IpTablesRule(IpTablesRule rule)
148148
private void Cow()
149149
{
150150
var moduleData = _moduleData;
151-
_moduleData = new OrderedDictionary<string, IIpTablesModule>(moduleData.Count);
151+
_moduleData = new IPTables.Net.Supporting.OrderedDictionary<string, IIpTablesModule>(moduleData.Count);
152152

153153
foreach (var module in moduleData) _moduleData.Add(module.Key, module.Value.Clone() as IIpTablesModule);
154154
}
@@ -183,7 +183,7 @@ public PacketCounters Counters
183183
/// <summary>
184184
/// The parameters for all modules used in the rule (internal)
185185
/// </summary>
186-
internal OrderedDictionary<string, IIpTablesModule> ModuleDataInternal => _moduleData;
186+
internal IPTables.Net.Supporting.OrderedDictionary<string, IIpTablesModule> ModuleDataInternal => _moduleData;
187187

188188
/// <summary>
189189
/// The parameters for all modules used in the rule

IPTables.Net/SystemInteract.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
</dependencies>
1717
</metadata>
1818
<files>
19-
<file src="bin/Release/netcoreapp3.1/IPTables.Net.dll" target="lib" />
19+
<file src="bin/Release/net10.0/IPTables.Net.dll" target="lib/net10.0" />
2020
</files>
21-
</package>
21+
</package>

0 commit comments

Comments
 (0)