-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: check etype size before decoding #252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I run it for few minutes on production traffic but now got the same err
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/producer/proto.IsIPv4(...)
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/producer/proto/producer_sf.go:211
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/producer/proto.ParseEthernetHeader(0xc00ca2f860, {0xc00d74c574, 0x3c, 0x22b4}, 0x0)
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/producer/proto/producer_sf.go:269 +0x1dbc
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/producer/proto.ParseSampledHeaderConfig(0x4?, 0x6?, 0x424d05?)
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/producer/proto/producer_sf.go:388 +0x2d
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/producer/proto.SearchSFlowSampleConfig(0xc00ca2f860, {0xace180?, 0xc00215ecd0?}, 0xc00254d908?)
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/producer/proto/producer_sf.go:418 +0x75c
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/producer/proto.SearchSFlowSamplesConfig({0xc000fdba00?, 0x6, 0xc00254d950?}, 0x4524e9?)
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/producer/proto/producer_sf.go:477 +0xf4
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/producer/proto.ProcessMessageSFlowConfig(0x9f7360?, 0xc00254d860?)
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/producer/proto/producer_sf.go:496 +0x273
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/producer/proto.(*ProtoProducer).Produce(0xc0002904c0, {0xa4f2e0?, 0xc00215ec80?}, 0xc002d9ae00)
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/producer/proto/proto.go:73 +0x14e
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/metrics.(*PromProducerWrapper).Produce(0xa4f360?, {0xa4f2e0?, 0xc00215ec80?}, 0xc002d9ae00)
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/metrics/producer.go:20 +0x52
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/utils.(*SFlowPipe).DecodeFlow(0xc0001f9fc0, {0x9f6160?, 0xc002d9ad90})
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/utils/pipe.go:127 +0x306
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: main.main.PromDecoderWrapper.func5({0x9f6160?, 0xc002d9ad90?})
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/metrics/decoder.go:53 +0x63c
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: github.com/netsampler/goflow2/v2/utils.(*UDPReceiver).decoders.func1()
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/utils/udp.go:215 +0x249
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: created by github.com/netsampler/goflow2/v2/utils.(*UDPReceiver).decoders in goroutine 1
Dec 06 16:15:43 flop-goflow-1 goflow2[2492936]: /buildir/goflow2/utils/udp.go:200 +0x32
Do you have encapsulation like MPLS? |
I think https://github.com/netsampler/goflow2/pull/252/files#diff-844aca8e5e9ed831ac96036a4286078314ccd61371b89907b7981b1e62575430R257 |
My guy says there's no mpls, but there's e.g. vxlan or GRE. |
I think we are hitting this condition goflow2/producer/proto/producer_sf.go Line 246 in 1a6d8c9
https://support.hpe.com/hpesc/public/docDisplay?docId=c03323978&docLocale=en_US |
Added a few more checks. |
it helped, but got another one
|
What in tarnation is this packet of death 😁 |
Added extra protection. This was a bug for MPLS packets. |
Looking good, got no more crash for a few hours it's running now. |
Closes #251
The
etherType
variable was not checked for length and could cause panic.