From f42d3718eaa93d9efb2cfcb7cb455d7b8f4bc775 Mon Sep 17 00:00:00 2001 From: sapanb Date: Mon, 26 Apr 2010 21:15:36 +0000 Subject: [PATCH] Cleaned the code up, replacing references to xid --> slice_id git-svn-id: http://svn.planet-lab.org/svn/fprobe-ulog/trunk@17790 8c455092-636d-4788-adf5-e71def0336e8 --- src/fprobe-ulog.c | 27 +++++++++++++-------------- src/fprobe-ulog.h | 2 +- src/netflow.c | 2 +- src/netflow.h | 4 ++-- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/fprobe-ulog.c b/src/fprobe-ulog.c index 80ff15f..0896cb5 100644 --- a/src/fprobe-ulog.c +++ b/src/fprobe-ulog.c @@ -8,7 +8,7 @@ Sapan Bhatia - 7/11/2007 Added data collection (-f) functionality, xid support in the header and log file + 7/11/2007 Added data collection (-f) functionality, slice_id support in the header and log file rotation. 15/11/2007 Added check to make sure fprobe doesn't overflow the disk. Also added a test facility. @@ -375,7 +375,7 @@ inline void copy_flow(struct Flow *src, struct Flow *dst) dst->sip = src->sip; dst->dip = src->dip; dst->tos = src->tos; - dst->xid = src->xid; + dst->slice_id = src->slice_id; dst->proto = src->proto; dst->tcp_flags = src->tcp_flags; dst->id = src->id; @@ -584,12 +584,12 @@ done: flown->size += flow->size; flown->pkts += flow->pkts; - /* The xid of the first xid of a flow is misleading. Reset the xid of the flow + /* The slice_id of the first slice_id of a flow is misleading. Reset the slice_id of the flow * if a better value comes along. A good example of this is that by the time CoDemux sets the * peercred of a flow, it has already been accounted for here and attributed to root. */ - if (flown->xid<1) - flown->xid = flow->xid; + if (flown->slice_id<1) + flown->slice_id = flow->slice_id; if (flow->flags & FLOW_FRAG) { @@ -762,9 +762,9 @@ void *fill(int fields, uint16_t *format, struct Flow *flow, void *p) *((uint8_t *) p) = 0; p += NETFLOW_PAD8_SIZE; break; - case NETFLOW_XID: - *((uint32_t *) p) = flow->xid; - p += NETFLOW_XID_SIZE; + case NETFLOW_SLICE_ID: + *((uint32_t *) p) = flow->slice_id; + p += NETFLOW_SLICE_ID_SIZE; break; case NETFLOW_PAD16: /* Unsupported (uint16_t) */ @@ -1156,19 +1156,18 @@ void *cap_thread() /* It's going to be expensive calling this syscall on every flow. * We should keep a local hash table, for now just bear the overhead... - Sapan*/ - flow->xid=0; + flow->slice_id=0; if (ulog_msg->mark > 0) { - /* flow->xid is really the slice id :-/ */ - flow->xid = xid_to_slice_id(ulog_msg->mark); + flow->slice_id = xid_to_slice_id(ulog_msg->mark); } - if (flow->xid < 1 || flow->xid!=challenge) - flow->xid = ulog_msg->mark; + if (flow->slice_id < 1) + flow->slice_id = ulog_msg->mark; // Couldn't look up the slice id, let's at least store the local xid if ((flow->dip.s_addr == inet_addr("10.0.0.8")) || (flow->sip.s_addr == inet_addr("10.0.0.8"))) { - my_log(LOG_INFO, "Received test flow to corewars.org from slice %d ",flow->xid); + my_log(LOG_INFO, "Received test flow to corewars.org from slice %d ",flow->slice_id); } flow->iif = snmp_index(ulog_msg->indev_name); flow->oif = snmp_index(ulog_msg->outdev_name); diff --git a/src/fprobe-ulog.h b/src/fprobe-ulog.h index 96995a8..27add4b 100644 --- a/src/fprobe-ulog.h +++ b/src/fprobe-ulog.h @@ -53,7 +53,7 @@ struct Flow { /* ip ToS */ uint16_t tos; /* user credentials */ - int xid; + int slice_id; /* tcp flags */ uint8_t tcp_flags; /* number of packets */ diff --git a/src/netflow.c b/src/netflow.c index 4ede900..9f0952f 100644 --- a/src/netflow.c +++ b/src/netflow.c @@ -69,7 +69,7 @@ static uint16_t NetFlow5_Flow[] = { NETFLOW_SRC_TOS, NETFLOW_SRC_AS, NETFLOW_DST_AS, - NETFLOW_XID + NETFLOW_SLICE_ID /* * Who needs the src and dst masks... Or deal * with this later - Sapan diff --git a/src/netflow.h b/src/netflow.h index 450f289..057c808 100644 --- a/src/netflow.h +++ b/src/netflow.h @@ -162,8 +162,8 @@ #define NETFLOW_IPV6_OPTION_HEADERS 64 #define NETFLOW_IPV6_OPTION_HEADERS_SIZE 4 -#define NETFLOW_XID 65 -#define NETFLOW_XID_SIZE 4 +#define NETFLOW_SLICE_ID 65 +#define NETFLOW_SLICE_ID_SIZE 4 #define NETFLOW_VERSION 1001 #define NETFLOW_VERSION_SIZE 2 -- 2.43.0