Skip to content

Commit

Permalink
desync: ignore higher ttls in cmsgs
Browse files Browse the repository at this point in the history
Instead of short-circuting processing subsequent cmsgs, assume the TTL in a
cmsg is probably incorrect if its higher than max TTL sent.
  • Loading branch information
ignoramous committed Aug 22, 2024
1 parent 840c927 commit fb41a2f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions intra/dialers/split_and_desync.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,19 @@ func desyncWithTraceroute(d *protect.RDial, ipp netip.AddrPort) (*overwriteSplit
if exceedsHopLimit(cmsgs) {
fromPort := from.(*unix.SockaddrInet6).Port
ttl := fromPort - basePort
if ttl > desync_max_ttl {
break
}
oc.ttl = max(oc.ttl, ttl)
processed = true
if ttl <= desync_max_ttl {
oc.ttl = max(oc.ttl, ttl)
processed = true
} // else: corrupted packet?
}
} else {
if exceedsTTL(cmsgs) {
fromPort := from.(*unix.SockaddrInet4).Port
ttl := fromPort - basePort
if ttl > desync_max_ttl {
break
}
oc.ttl = max(oc.ttl, ttl)
processed = true
if ttl <= desync_max_ttl {
oc.ttl = max(oc.ttl, ttl)
processed = true
} // else: corrupted packet?
}
}
}
Expand Down

1 comment on commit fb41a2f

@ignoramous
Copy link
Contributor Author

@ignoramous ignoramous commented on fb41a2f Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.