diff --git a/include/conf/conn.h b/include/conf/conn.h index 86da70b66..0e5fa59dc 100644 --- a/include/conf/conn.h +++ b/include/conf/conn.h @@ -62,6 +62,7 @@ struct ip_vs_conn_entry { uint16_t in_af; uint16_t out_af; uint16_t proto; + uint16_t syncid; union inet_addr caddr; union inet_addr vaddr; union inet_addr laddr; diff --git a/include/ipvs/conn.h b/include/ipvs/conn.h index 9270f8d78..e44108a84 100644 --- a/include/ipvs/conn.h +++ b/include/ipvs/conn.h @@ -99,6 +99,7 @@ struct dp_vs_conn { struct dpvs_timer conn_sync_timer; struct timeval conn_sync_timeout; + uint16_t syncid; queueid_t qid; /* used in session synchronization*/ lcoreid_t lcore; diff --git a/include/ipvs/sync.h b/include/ipvs/sync.h index 104ebdb2c..81177d946 100644 --- a/include/ipvs/sync.h +++ b/include/ipvs/sync.h @@ -56,6 +56,7 @@ struct dp_vs_sync_conn { struct dp_vs_seq fnat_seq; uint32_t rs_end_seq; uint32_t rs_end_ack; + uint16_t syncid; }; struct dp_vs_sync_head { diff --git a/src/ipvs/ip_vs_conn.c b/src/ipvs/ip_vs_conn.c index 98281bab3..151290e33 100644 --- a/src/ipvs/ip_vs_conn.c +++ b/src/ipvs/ip_vs_conn.c @@ -743,6 +743,7 @@ struct dp_vs_conn * dp_vs_conn_copy_from_sync(void *param, struct dp_vs_dest *de new->rs_end_seq = sync_conn->rs_end_seq; new->rs_end_ack = sync_conn->rs_end_ack; + new->syncid = sync_conn->syncid; new->flags = sync_conn->flags | DPVS_CONN_F_SYNCED; new->state = sync_conn->state; new->qid = sync_conn->qid; @@ -1353,6 +1354,9 @@ static inline void sockopt_fill_conn_entry(const struct dp_vs_conn *conn, entry->lport = conn->lport; entry->dport = conn->dport; entry->timeout = conn->timeout.tv_sec; + if (conn->flags & DPVS_CONN_F_SYNCED) { + entry->syncid = conn->syncid; + } } static int sockopt_conn_get_specified(const struct ip_vs_conn_req *conn_req, diff --git a/src/ipvs/ip_vs_sync.c b/src/ipvs/ip_vs_sync.c index 6c8569ae6..b5a06084f 100644 --- a/src/ipvs/ip_vs_sync.c +++ b/src/ipvs/ip_vs_sync.c @@ -100,6 +100,7 @@ void dp_vs_sync_conn_enqueue(struct dp_vs_conn *cp, dp_vs_sync_type type) s->daddr = cp->daddr; s->qid = cp->qid; s->lcore = cp->lcore; + s->syncid = g_dp_vs_sync_conf.syncid; rte_memcpy(&s->fnat_seq, &cp->fnat_seq, sizeof(struct dp_vs_seq)); s->rs_end_seq = cp->rs_end_seq; diff --git a/tools/ipvsadm/ipvsadm.c b/tools/ipvsadm/ipvsadm.c index 7c94daa7f..c1aff2681 100644 --- a/tools/ipvsadm/ipvsadm.c +++ b/tools/ipvsadm/ipvsadm.c @@ -1573,9 +1573,15 @@ static void print_conn_entry(const ipvs_conn_entry_t *conn_entry, ntohs(conn_entry->dport), conn_entry->proto, format))) goto exit; - printf("[%d]%-3s %-6s %-11s %-18s %-18s %-18s %s\n", - conn_entry->lcoreid, proto_str, time_str, conn_entry->state, - cname, vname, lname, dname); + if (conn_entry->syncid) { + printf("[%d]%-3s %-6s %-11s %-18s %-18s %-18s %-18s syncid:%d\n", + conn_entry->lcoreid, proto_str, time_str, conn_entry->state, + cname, vname, lname, dname, conn_entry->syncid); + } else { + printf("[%d]%-3s %-6s %-11s %-18s %-18s %-18s %s\n", + conn_entry->lcoreid, proto_str, time_str, conn_entry->state, + cname, vname, lname, dname); + } exit: if (cname) free(cname);