feature/conn25: allow ICMP packets
Allow packets with ICMPv4 or ICMPv6 proto to use the flow table and get NATted. Fixes tailscale/corp#40123 Signed-off-by: Fran Bull <fran@tailscale.com>
This commit is contained in:
@@ -120,14 +120,17 @@ func (dh *datapathHandler) StartFlowExpirySweepers(ctx context.Context) {
|
|||||||
go dh.connectorFlowTable.StartExpiredSweeper(ctx)
|
go dh.connectorFlowTable.StartExpiredSweeper(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isSupportedProtocol(proto ipproto.Proto) bool {
|
||||||
|
return proto == ipproto.TCP || proto == ipproto.UDP || proto == ipproto.ICMPv4 || proto == ipproto.ICMPv6
|
||||||
|
}
|
||||||
|
|
||||||
// HandlePacketFromWireGuard inspects packets coming from WireGuard, and performs
|
// HandlePacketFromWireGuard inspects packets coming from WireGuard, and performs
|
||||||
// appropriate DNAT or SNAT actions for Connectors 2025. Returning [filter.Accept] signals
|
// appropriate DNAT or SNAT actions for Connectors 2025. Returning [filter.Accept] signals
|
||||||
// that the packet should pass through subsequent stages of the datapath pipeline.
|
// that the packet should pass through subsequent stages of the datapath pipeline.
|
||||||
// Returning [filter.Drop] signals the packet should be dropped. This method handles all
|
// Returning [filter.Drop] signals the packet should be dropped. This method handles all
|
||||||
// packets coming from WireGuard, on both connectors, and clients of connectors.
|
// packets coming from WireGuard, on both connectors, and clients of connectors.
|
||||||
func (dh *datapathHandler) HandlePacketFromWireGuard(p *packet.Parsed, tun *tstun.Wrapper) filter.Response {
|
func (dh *datapathHandler) HandlePacketFromWireGuard(p *packet.Parsed, tun *tstun.Wrapper) filter.Response {
|
||||||
// TODO(tailscale/corp#38764): Support other protocols, like ICMP for error messages.
|
if !isSupportedProtocol(p.IPProto) {
|
||||||
if p.IPProto != ipproto.TCP && p.IPProto != ipproto.UDP {
|
|
||||||
return filter.Accept
|
return filter.Accept
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,8 +205,7 @@ func (dh *datapathHandler) HandlePacketFromWireGuard(p *packet.Parsed, tun *tstu
|
|||||||
// Returning [filter.Drop] signals the packet should be dropped. This method handles all
|
// Returning [filter.Drop] signals the packet should be dropped. This method handles all
|
||||||
// packets coming from the tun device, on both connectors, and clients of connectors.
|
// packets coming from the tun device, on both connectors, and clients of connectors.
|
||||||
func (dh *datapathHandler) HandlePacketFromTunDevice(p *packet.Parsed) filter.Response {
|
func (dh *datapathHandler) HandlePacketFromTunDevice(p *packet.Parsed) filter.Response {
|
||||||
// TODO(tailscale/corp#38764): Support other protocols, like ICMP for error messages.
|
if !isSupportedProtocol(p.IPProto) {
|
||||||
if p.IPProto != ipproto.TCP && p.IPProto != ipproto.UDP {
|
|
||||||
return filter.Accept
|
return filter.Accept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user