mirror of
https://github.com/soypat/lneto.git
synced 2026-08-09 01:13:41 +00:00
up hardcoded number of IP protocols to 3 (ICMP,TCP,UDP)
This commit is contained in:
@@ -36,6 +36,7 @@ vendor/
|
||||
# IDE
|
||||
.vscode/
|
||||
agents.md
|
||||
*skill.md
|
||||
|
||||
# For local development and testing create `local` directories.
|
||||
local
|
||||
|
||||
@@ -164,7 +164,7 @@ func (s *StackAsync) Reset(cfg StackConfig) error {
|
||||
return err
|
||||
}
|
||||
s.link.SetAcceptMulticast(cfg.AcceptMulticast)
|
||||
const ipNodes = 2 // UDP, TCP ports.
|
||||
const ipNodes = 3 // 3 IP protocols possible: UDP, TCP, ICMP.
|
||||
err = s.ip.Reset(addr, ipNodes)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -75,6 +75,14 @@ func FuzzStackAsyncHTTP(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, pktnum int, a []byte) {
|
||||
var buf [MTU + ethernet.MaxOverheadSize]byte
|
||||
s1, s2, c1, c2 := newTCPStacks(t, seed, MTU)
|
||||
err = s1.EnableICMP(true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = s2.EnableICMP(true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err := s1.ListenTCP(c1, 80)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -181,6 +181,7 @@ func newTCPStacks(t testing.TB, randSeed int64, mtu int) (s1, s2 *StackAsync, c1
|
||||
MaxActiveTCPPorts: 1,
|
||||
HardwareAddress: [6]byte{0xbe, 0xef, 0, 0, 0, byte1},
|
||||
MTU: uint16(mtu),
|
||||
ICMPQueueLimit: 2,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -194,6 +195,7 @@ func newTCPStacks(t testing.TB, randSeed int64, mtu int) (s1, s2 *StackAsync, c1
|
||||
MaxActiveTCPPorts: 1,
|
||||
HardwareAddress: [6]byte{0xbe, 0xef, 0, 0, 0, byte2},
|
||||
MTU: uint16(mtu),
|
||||
ICMPQueueLimit: 2,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user