x/net/ipv6: ControlMessage considers HopLimit==0 as missing #41820
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
According to RFC8200
So, HopLimit == 0 is perfectly valid for sending to targets inside the same subnet or even receiving a packet with HopLimit 0. In, practice, sending both HopLimit==1 or HopLimit==0 are equals as both avoid it to be forwarded to a different network. The difference is when it is received. If a host receives a packet with HopLimit==0, it can say it was never forwarded while HopLimit==1 might simply be using the last permitted hop.
However, ipv6.ControlMessage tells me that it must be between 1 and 255.
So, it should accept HopLimit as 0 <= value <= 255. This brings a seconds issue: the initial value of HopLimit (as for any non explicitly initialized integer inside go) is 0. There is no direct way to tell if ControlMessage HopLimit is missing or defined as zero.
Go also ignores when I set it as 0 for WriteTo().
Maybe an easy fix would be to set it initially to -1.
BTW, IPv4 TTL does not have the same issue as a packet with TTL==0 must be destroyed unconditionally.
What did you expect to see?
Something like:
Should I submit a PR?
What did you see instead?
I cannot set ControlMessage.HopLimit as 0 in ipv6.WriteTo() nor I can tell that ControlMessage.HopLimit in ipv6.ReadFrom() is missing or zero.
The text was updated successfully, but these errors were encountered: