Skip to content

Commit

Permalink
Merge pull request #156 from negbie/master
Browse files Browse the repository at this point in the history
Add version flag, don't send unkown hep
  • Loading branch information
negbie authored Feb 20, 2020
2 parents 0e56af0 + be73e65 commit 9565a8f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Config struct {
Network string
Protobuf bool
Reassembly bool
Version bool
}

type InterfacesConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func (d *Decoder) processTransport(foundLayerTypes *[]gopacket.LayerType, udp *l
}
}

if pkt.Payload != nil {
if pkt.ProtoType > 0 && pkt.Payload != nil {
PacketQueue <- pkt
} else {
atomic.AddUint64(&d.unknownCount, 1)
Expand Down
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/sipcapture/heplify/sniffer"
)

const version = "heplify 1.55"
const version = "heplify 1.56"

func createFlags() {

Expand Down Expand Up @@ -62,6 +62,7 @@ func createFlags() {
flag.StringVar(&config.Cfg.Network, "nt", "udp", "Network types are [udp, tcp, tls]")
flag.BoolVar(&config.Cfg.Protobuf, "protobuf", false, "Use Protobuf on wire")
flag.BoolVar(&config.Cfg.Reassembly, "tcpassembly", false, "If true, tcpassembly will be enabled")
flag.BoolVar(&config.Cfg.Version, "version", false, "Show heplify version")
flag.Parse()

config.Cfg.Iface = &ifaceConfig
Expand Down Expand Up @@ -96,6 +97,11 @@ func checkCritErr(err error) {
func main() {
createFlags()

if config.Cfg.Version {
fmt.Println(version)
os.Exit(0)
}

err := logp.Init("heplify", config.Cfg.Logging)
checkCritErr(err)

Expand Down

0 comments on commit 9565a8f

Please sign in to comment.