Add connection flow type to siftr(4).

Suggested by:	adrian
Sponsored by:	Limelight Networks
This commit is contained in:
Hiren Panchasara 2015-03-19 00:23:16 +00:00
parent ff9f2a36de
commit d0a8b2a5ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280237
2 changed files with 17 additions and 3 deletions

View File

@ -342,6 +342,15 @@ 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.

View File

@ -229,6 +229,8 @@ struct pkt_node {
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;
};
@ -488,7 +490,8 @@ siftr_process_pkt(struct pkt_node * pkt_node)
pkt_node->rcv_buf_cc,
pkt_node->sent_inflight_bytes,
pkt_node->t_segqlen,
pkt_node->flowid);
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]);
@ -504,7 +507,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,%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,
@ -538,7 +541,8 @@ siftr_process_pkt(struct pkt_node * pkt_node)
pkt_node->rcv_buf_cc,
pkt_node->sent_inflight_bytes,
pkt_node->t_segqlen,
pkt_node->flowid);
pkt_node->flowid,
pkt_node->flowtype);
#ifdef SIFTR_IPV6
}
#endif
@ -792,6 +796,7 @@ siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, struct tcpcb *tp,
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)