-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix panic when running ICMPv4 probe with DontFragment #686
Conversation
this is running this change with capabilities set:
and this is running this code without capabilities set:
the case that fails (last line) is the one that requires privileges, so the failure is expected. |
@dgl could you please take a look? |
Thanks for finding, and fixing this. This looks like the right fix to me, @dgl do you have any comments before I merge? |
prober/icmp.go
Outdated
rc, err := ipv4.NewRawConn(icmpConn) | ||
if err != nil { | ||
level.Error(logger).Log("msg", "Error creating raw connection", "err", err) | ||
return | ||
} | ||
socket = &v4Conn{c: rc, df: true} | ||
} else { | ||
var icmpConn *icmp.PacketConn | ||
// If the user has set the don't fragment option we cannot use unprivileged |
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.
Move comment to the other branch of the if, probably update it to say something like "Need to use RawConn rather than ICMP socket in order to set IP header level options."
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.
thanks, done!
LGTM, aside from my comment about the comment. |
A recent change modified the way an IPv4 raw socket is created and BBE is panicing when ICMPv4 is used with DontFragment set. golang.org/x/net doesn't seem to have a way to create the necessary socket, so fall back to the previous method for that case in particular (ICMP, IPv4, DontFragment=true). Fixes prometheus#685 Signed-off-by: Marcelo E. Magallon <[email protected]>
Thanks! |
A recent change modified the way an IPv4 raw socket is created and BBE
is panicing when ICMPv4 is used with DontFragment set.
golang.org/x/net doesn't seem to have a way to create the necessary
socket, so fall back to the previous method for that case in particular
(ICMP, IPv4, DontFragment=true).
Fixes #685
Signed-off-by: Marcelo E. Magallon [email protected]