summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhiren <hiren@FreeBSD.org>2015-04-06 22:41:13 +0000
committerhiren <hiren@FreeBSD.org>2015-04-06 22:41:13 +0000
commit1116474bdcea0dec418414174080cbde74de8359 (patch)
treeb4b626e19127c0f8c203bb6c77cf11cd048724f9
parentf79a9e3ea80c5db489709dcc81badf94ec6eb373 (diff)
downloadFreeBSD-src-1116474bdcea0dec418414174080cbde74de8359.zip
FreeBSD-src-1116474bdcea0dec418414174080cbde74de8359.tar.gz
MFC r280233, r280237, r280441
Add connection flowid and flowtype to siftr(4). Sponsored by: Limelight Networks
-rw-r--r--share/man/man4/siftr.418
-rw-r--r--sys/netinet/siftr.c18
2 files changed, 31 insertions, 5 deletions
diff --git a/share/man/man4/siftr.4 b/share/man/man4/siftr.4
index ab92f77..83ad63d 100644
--- a/share/man/man4/siftr.4
+++ b/share/man/man4/siftr.4
@@ -30,7 +30,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 12, 2010
+.Dd March 18, 2015
.Dt SIFTR 4
.Os
.Sh NAME
@@ -335,6 +335,22 @@ Bytes acknowledged via SACK are not excluded from this count.
.It Va 26
The current number of segments in the reassembly queue.
.El
+.Bl -tag -offset indent -width Va
+.It Va 27
+Flowid for the connection.
+A caveat: Zero '0' either represents a valid flowid or a default value when it's
+not being set. There is no easy way to differentiate without looking at actual
+network interface card and drivers being used.
+.El
+.Bl -tag -offset indent -width Va
+.It Va 28
+Flow type for the connection.
+Flowtype defines which protocol fields are hashed to produce the flowid.
+A complete listing is available in
+.Pa sys/mbuf.h
+under
+.Dv M_HASHTYPE_* .
+.El
.Pp
The third type of log message is written to the file when the module is disabled
and ceases collecting data from the running kernel.
diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c
index a484481..aae608d 100644
--- a/sys/netinet/siftr.c
+++ b/sys/netinet/siftr.c
@@ -225,6 +225,10 @@ struct pkt_node {
u_int sent_inflight_bytes;
/* Number of segments currently in the reassembly queue. */
int t_segqlen;
+ /* Flowid for the connection. */
+ u_int flowid;
+ /* Flow type for the connection. */
+ u_int flowtype;
/* Link to next pkt_node in the list. */
STAILQ_ENTRY(pkt_node) nodes;
};
@@ -442,7 +446,7 @@ siftr_process_pkt(struct pkt_node * pkt_node)
MAX_LOG_MSG_LEN,
"%c,0x%08x,%zd.%06ld,%x:%x:%x:%x:%x:%x:%x:%x,%u,%x:%x:%x:"
"%x:%x:%x:%x:%x,%u,%ld,%ld,%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,"
- "%u,%d,%u,%u,%u,%u,%u,%u\n",
+ "%u,%d,%u,%u,%u,%u,%u,%u,%u,%u\n",
direction[pkt_node->direction],
pkt_node->hash,
pkt_node->tval.tv_sec,
@@ -483,7 +487,9 @@ siftr_process_pkt(struct pkt_node * pkt_node)
pkt_node->rcv_buf_hiwater,
pkt_node->rcv_buf_cc,
pkt_node->sent_inflight_bytes,
- pkt_node->t_segqlen);
+ pkt_node->t_segqlen,
+ pkt_node->flowid,
+ pkt_node->flowtype);
} else { /* IPv4 packet */
pkt_node->ip_laddr[0] = FIRST_OCTET(pkt_node->ip_laddr[3]);
pkt_node->ip_laddr[1] = SECOND_OCTET(pkt_node->ip_laddr[3]);
@@ -499,7 +505,7 @@ siftr_process_pkt(struct pkt_node * pkt_node)
log_buf->ae_bytesused = snprintf(log_buf->ae_data,
MAX_LOG_MSG_LEN,
"%c,0x%08x,%jd.%06ld,%u.%u.%u.%u,%u,%u.%u.%u.%u,%u,%ld,%ld,"
- "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u,%u\n",
+ "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u,%u,%u,%u\n",
direction[pkt_node->direction],
pkt_node->hash,
(intmax_t)pkt_node->tval.tv_sec,
@@ -532,7 +538,9 @@ siftr_process_pkt(struct pkt_node * pkt_node)
pkt_node->rcv_buf_hiwater,
pkt_node->rcv_buf_cc,
pkt_node->sent_inflight_bytes,
- pkt_node->t_segqlen);
+ pkt_node->t_segqlen,
+ pkt_node->flowid,
+ pkt_node->flowtype);
#ifdef SIFTR_IPV6
}
#endif
@@ -785,6 +793,8 @@ siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, struct tcpcb *tp,
pn->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc;
pn->sent_inflight_bytes = tp->snd_max - tp->snd_una;
pn->t_segqlen = tp->t_segqlen;
+ pn->flowid = inp->inp_flowid;
+ pn->flowtype = inp->inp_flowtype;
/* We've finished accessing the tcb so release the lock. */
if (inp_locally_locked)
OpenPOWER on IntegriCloud