isSelfDst reports whether pkt's destination IP is a local Tailscale IP assigned to this node. This is used by inject() to detect self-addressed packets that need loopback delivery.
(pkt *stack.PacketBuffer)
| 1169 | // assigned to this node. This is used by inject() to detect self-addressed |
| 1170 | // packets that need loopback delivery. |
| 1171 | func (ns *Impl) isSelfDst(pkt *stack.PacketBuffer) bool { |
| 1172 | hdr := pkt.Network() |
| 1173 | switch v := hdr.(type) { |
| 1174 | case header.IPv4: |
| 1175 | return ns.isLocalIP(netip.AddrFrom4(v.DestinationAddress().As4())) |
| 1176 | case header.IPv6: |
| 1177 | return ns.isLocalIP(netip.AddrFrom16(v.DestinationAddress().As16())) |
| 1178 | } |
| 1179 | return false |
| 1180 | } |
| 1181 | |
| 1182 | // isLocalIP reports whether ip is a Tailscale IP assigned to this |
| 1183 | // node directly (but not a subnet-routed IP). |