Skip to content

Commit

Permalink
Port patches to windows: "conntrack: Fix conntrack new state"
Browse files Browse the repository at this point in the history
Port following commits to windows to fix the conntrack new state issue:
- a867c01
- ac23d20

Signed-off-by: Rui Cao <[email protected]>
  • Loading branch information
ruicao93 committed Jun 18, 2020
1 parent d6e5c21 commit a23ed56
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion datapath-windows/ovsext/Conntrack-other.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,19 @@ OvsConntrackUpdateOtherEntry(OVS_CT_ENTRY *conn_,
{
ASSERT(conn_);
struct conn_other *conn = OvsCastConntrackEntryToOtherEntry(conn_);
enum CT_UPDATE_RES ret = CT_UPDATE_VALID;

if (reply && conn->state != OTHERS_BIDIR) {
conn->state = OTHERS_BIDIR;
} else if (conn->state == OTHERS_FIRST) {
conn->state = OTHERS_MULTIPLE;
ret = CT_UPDATE_VALID_NEW;
}

OvsConntrackUpdateExpiration(&conn->up, now,
other_timeouts[conn->state]);

return CT_UPDATE_VALID;
return ret;
}

OVS_CT_ENTRY *
Expand Down
14 changes: 10 additions & 4 deletions datapath-windows/ovsext/Conntrack-tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,17 @@ OvsConntrackUpdateTcpEntry(OVS_CT_ENTRY* conn_,
return CT_UPDATE_INVALID;
}

if (((tcp_flags & (TCP_SYN|TCP_ACK)) == TCP_SYN)
&& dst->state >= CT_DPIF_TCPS_FIN_WAIT_2
if ((tcp_flags & (TCP_SYN|TCP_ACK)) == TCP_SYN) {
if (dst->state >= CT_DPIF_TCPS_FIN_WAIT_2
&& src->state >= CT_DPIF_TCPS_FIN_WAIT_2) {
src->state = dst->state = CT_DPIF_TCPS_CLOSED;
return CT_UPDATE_NEW;
src->state = dst->state = CT_DPIF_TCPS_CLOSED;
return CT_UPDATE_NEW;
} else if (src->state <= CT_DPIF_TCPS_SYN_SENT) {
src->state = CT_DPIF_TCPS_SYN_SENT;
OvsConntrackUpdateExpiration(&conn->up, now,
30 * CT_INTERVAL_SEC);
return CT_UPDATE_VALID_NEW;
}
}

if (src->wscale & CT_WSCALE_FLAG
Expand Down
3 changes: 3 additions & 0 deletions datapath-windows/ovsext/Conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ OvsProcessConntrackEntry(OvsForwardingContext *fwdCtx,
return NULL;
}
break;
case CT_UPDATE_VALID_NEW:
state |= OVS_CS_F_NEW;
break;
}
}
if (entry) {
Expand Down
1 change: 1 addition & 0 deletions datapath-windows/ovsext/Conntrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ typedef enum CT_UPDATE_RES {
CT_UPDATE_INVALID,
CT_UPDATE_VALID,
CT_UPDATE_NEW,
CT_UPDATE_VALID_NEW,
} CT_UPDATE_RES;

/* Metadata mark for masked write to conntrack mark */
Expand Down

0 comments on commit a23ed56

Please sign in to comment.