(t *testing.T)
| 578 | } |
| 579 | |
| 580 | func TestGenerateNfqueueDropProbeWithIPFilter(t *testing.T) { |
| 581 | ip := net.ParseIP("10.0.0.1") |
| 582 | config := TraceConfig{ |
| 583 | EnableNfqueueDrops: true, |
| 584 | FilterIPs: []net.IP{ip}, |
| 585 | } |
| 586 | |
| 587 | gen := NewScriptGenerator(config) |
| 588 | script := gen.Generate() |
| 589 | |
| 590 | // Should contain fexit probe |
| 591 | if !strings.Contains(script, "fexit:vmlinux:__nf_queue") { |
| 592 | t.Error("script missing fexit probe") |
| 593 | } |
| 594 | |
| 595 | // Should contain IP filter hex |
| 596 | if !strings.Contains(script, "0x0a000001") { |
| 597 | t.Error("script missing hex IP in NFQUEUE probe filter") |
| 598 | } |
| 599 | |
| 600 | // Should use bswap for filter |
| 601 | if !strings.Contains(script, "bswap($saddr_raw)") { |
| 602 | t.Error("script missing bswap in NFQUEUE probe filter") |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | func TestGenerateAllProbesIncludingNfqueue(t *testing.T) { |
| 607 | // Verify all probes can be generated together |
nothing calls this directly
no test coverage detected