From 51c4fbb840b98380b4016bac030f0adbd5725d70 Mon Sep 17 00:00:00 2001 From: Ghanan Gowripalan Date: Fri, 1 Oct 2021 14:56:29 -0700 Subject: Drop ConnTrack.handlePacket Move the hook specific logic to the IPTables hook functions. This lets us avoid having to perform checks on the hook to determine what action to take. Later changes will drop the need for handlePacket's return value, reducing the value of this function that all hooks call into. PiperOrigin-RevId: 400298023 --- pkg/tcpip/stack/conntrack.go | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'pkg/tcpip/stack/conntrack.go') diff --git a/pkg/tcpip/stack/conntrack.go b/pkg/tcpip/stack/conntrack.go index bd47f734f..79bc001c7 100644 --- a/pkg/tcpip/stack/conntrack.go +++ b/pkg/tcpip/stack/conntrack.go @@ -403,29 +403,6 @@ func insertConn(tupleBkt *bucket, replyBkt *bucket, conn *conn) { } } -// handlePacket will manipulate the port and address of the packet if the -// connection exists. Returns whether, after the packet traverses the tables, -// it should create a new entry in the table. -func (ct *ConnTrack) handlePacket(pkt *PacketBuffer, hook Hook, r *Route) bool { - switch hook { - case Prerouting, Input, Output, Postrouting: - default: - return false - } - - if conn, dir := ct.connFor(pkt); conn != nil { - conn.handlePacket(pkt, hook, dir, r) - return false - } - - // Connection not found for the packet. - // - // If this is the last hook in the data path for this packet (Input if - // incoming, Postrouting if outgoing), indicate that a connection should be - // inserted by the end of this hook. - return hook == Input || hook == Postrouting -} - func (cn *conn) handlePacket(pkt *PacketBuffer, hook Hook, dir direction, r *Route) { if pkt.NatDone { return -- cgit v1.2.3