packetcap / go-pcap

Packet capture library and tools in native go
Apache License 2.0
14 stars 4 forks source link

subProtocol of filter didn't support custom ip protocol #44

Open yxhl opened 10 months ago

yxhl commented 10 months ago

I want to filte sctp protocol that protocol-numbers defined. But I can't complie it successful, the golang code didn't define it and it reject filter by ip proto 132.

Another issue that i got useless bpf when i use expression imcp.

Filter expression: &{raw:icmp lexer:{reader:0xc0000f0180} buffer:{token:18 word:icmp}}
Filter: {0 2 0 16 false }
BPF instruction:
         ldh [12]
         ret #262144
         ret #0
yxhl commented 10 months ago

The source code define sctp as stp...

yxhl commented 10 months ago

Use the protocol separately for filtering will get invalid BPF

deitch commented 10 months ago

A PR is welcome.