Patches to argus-clients-3.0.0.rc.15
Peter Van Epp
vanepp at sfu.ca
Thu Jul 6 10:57:23 EDT 2006
Below are a pair of patch sets one each for (argus-clients-2.0.6.fixes.1
and argus-clients-3.0.0.rc.15, the 2.0.6 patch is in another message because
the combined one hit the list moderation limit :-)) that almost fix most of
the errors that occur when comparing 2.0.6 ra output to 3.0 ra output. The
user data stuff is still broken (looks like thats a Carter task :-)) because I
can't quite figure out what its supposed to do :-).
While fixing the tcp window code, the thought struck that it would be
interesting to know that a window hit 0 (indicating host buffer conjestion) and
for how long.
Peter Van Epp / Operations and Technical Support
Simon Fraser University, Burnaby, B.C. Canada
argus-clients-3.0.0.rc.15
*** common/argus_util.c.orig Sun Jul 2 15:24:45 2006
--- common/argus_util.c Wed Jul 5 19:33:14 2006
***************
*** 2869,2887 ****
case IPPROTO_ICMP: {
char type[32];
! sprintf (type, "%d", flow->flow_un.icmp.type);
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
switch (parser->RaFieldWidth) {
case RA_FIXED_WIDTH:
sprintf (&buf[strlen(buf)], "%-*.*s%c", len, len, type, parser->RaFieldDelimiter);
break;
default:
! sprintf (&buf[strlen(buf)], "%d%c", flow->flow_un.icmp.type, parser->RaFieldDelimiter);
break;
}
} else {
! sprintf (&buf[strlen(buf)], "%-*.*s ", len, len, type);
! }
done++;
break;
}
--- 2869,2887 ----
case IPPROTO_ICMP: {
char type[32];
! type[0] = '\0';
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
switch (parser->RaFieldWidth) {
case RA_FIXED_WIDTH:
sprintf (&buf[strlen(buf)], "%-*.*s%c", len, len, type, parser->RaFieldDelimiter);
break;
default:
! sprintf (&buf[strlen(buf)], "%s%c", type, parser->RaFieldDelimiter);
break;
}
} else {
! sprintf (&buf[strlen(buf)], "%-*.*s ", len, len, type);
! }
done++;
break;
}
***************
*** 2988,2994 ****
case IPPROTO_ICMP: {
char code[32];
! sprintf (code, "%d", flow->flow_un.icmp.code);
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
switch (parser->RaFieldWidth) {
--- 2988,2994 ----
case IPPROTO_ICMP: {
char code[32];
! code[0] = '\0';
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
switch (parser->RaFieldWidth) {
***************
*** 2996,3002 ****
sprintf (&buf[strlen(buf)], "%-*.*s%c", len, len, code, parser->RaFieldDelimiter);
break;
default:
! sprintf (&buf[strlen(buf)], "%d%c", flow->flow_un.icmp.code, parser->RaFieldDelimiter);
break;
}
} else {
--- 2996,3002 ----
sprintf (&buf[strlen(buf)], "%-*.*s%c", len, len, code, parser->RaFieldDelimiter);
break;
default:
! sprintf (&buf[strlen(buf)], "%s%c", code, parser->RaFieldDelimiter);
break;
}
} else {
***************
*** 4724,4733 ****
} else {
char value[32];
! bzero(value, 4);
if (argus && ((jitter = &argus->canon.jitter) != NULL)) {
! double stdev = 0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
unsigned int n;
float meanval;
--- 4724,4733 ----
} else {
char value[32];
! bzero(value, 32);
if (argus && ((jitter = &argus->canon.jitter) != NULL)) {
! double stdev = 0.0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
unsigned int n;
float meanval;
***************
*** 4811,4821 ****
}
} else {
! double stdev = 0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
unsigned int n;
float meanval;
char sbuf[32];
! bzero(sbuf, 4);
if (argus && ((jitter = &argus->canon.jitter) != NULL)) {
if ((n = (jitter->act.dst.n + jitter->idle.dst.n)) > 0) {
--- 4811,4821 ----
}
} else {
! double stdev = 0.0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
unsigned int n;
float meanval;
char sbuf[32];
! bzero(sbuf, 32);
if (argus && ((jitter = &argus->canon.jitter) != NULL)) {
if ((n = (jitter->act.dst.n + jitter->idle.dst.n)) > 0) {
***************
*** 5927,5933 ****
bzero(vlanbuf, sizeof(vlanbuf));
if (vlan != NULL)
! if ((vlan->hdr.argus_dsrvl8.qual & ARGUS_SRC_VLAN) || (vlan->sid > 0))
sprintf (vlanbuf, "%d", (vlan->sid & 0x0FFF));
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
--- 5927,5933 ----
bzero(vlanbuf, sizeof(vlanbuf));
if (vlan != NULL)
! if (vlan->hdr.argus_dsrvl8.qual & ARGUS_SRC_VLAN)
sprintf (vlanbuf, "%d", (vlan->sid & 0x0FFF));
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
***************
*** 6027,6033 ****
bzero(vstr, sizeof(vstr));
if (vlan != NULL)
! if ((vlan->hdr.argus_dsrvl8.qual & ARGUS_SRC_VLAN) || (vlan->sid > 0))
sprintf (vstr, "0x%04x", vlan->sid);
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
--- 6027,6033 ----
bzero(vstr, sizeof(vstr));
if (vlan != NULL)
! if (vlan->hdr.argus_dsrvl8.qual & ARGUS_SRC_VLAN)
sprintf (vstr, "0x%04x", vlan->sid);
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
***************
*** 6056,6062 ****
bzero(vstr, sizeof(vstr));
if (vlan != NULL)
! if ((vlan->hdr.argus_dsrvl8.qual & ARGUS_DST_VLAN) || (vlan->did > 0))
sprintf (vstr, "0x%04x", vlan->did);
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
--- 6056,6062 ----
bzero(vstr, sizeof(vstr));
if (vlan != NULL)
! if (vlan->hdr.argus_dsrvl8.qual & ARGUS_DST_VLAN)
sprintf (vstr, "0x%04x", vlan->did);
if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
***************
*** 6240,6246 ****
switch (flow->ip_flow.ip_p) {
case IPPROTO_TCP: {
int win = tcp->src.win << tcp->src.winshift;
! sprintf (winbuf, "%d", win);
break;
}
default:
--- 6240,6246 ----
switch (flow->ip_flow.ip_p) {
case IPPROTO_TCP: {
int win = tcp->src.win << tcp->src.winshift;
! sprintf (winbuf, "%u", win);
break;
}
default:
***************
*** 6252,6258 ****
switch (flow->ipv6_flow.ip_p) {
case IPPROTO_TCP: {
int win = tcp->src.win << tcp->src.winshift;
! sprintf (winbuf, "%d", win);
break;
}
default:
--- 6252,6258 ----
switch (flow->ipv6_flow.ip_p) {
case IPPROTO_TCP: {
int win = tcp->src.win << tcp->src.winshift;
! sprintf (winbuf, "%u", win);
break;
}
default:
***************
*** 6301,6308 ****
case ARGUS_TYPE_IPV4:
switch (flow->ip_flow.ip_p) {
case IPPROTO_TCP: {
! int win = tcp->dst.win << tcp->src.winshift;
! sprintf (winbuf, "%d", win);
break;
}
default:
--- 6301,6308 ----
case ARGUS_TYPE_IPV4:
switch (flow->ip_flow.ip_p) {
case IPPROTO_TCP: {
! int win = tcp->dst.win << tcp->dst.winshift;
! sprintf (winbuf, "%u", win);
break;
}
default:
***************
*** 6314,6320 ****
switch (flow->ipv6_flow.ip_p) {
case IPPROTO_TCP: {
int win = tcp->dst.win << tcp->src.winshift;
! sprintf (winbuf, "%d", win);
break;
}
default:
--- 6314,6320 ----
switch (flow->ipv6_flow.ip_p) {
case IPPROTO_TCP: {
int win = tcp->dst.win << tcp->src.winshift;
! sprintf (winbuf, "%u", win);
break;
}
default:
***************
*** 8106,8112 ****
break;
}
exlen += 8;
! if (len > 10) exlen++;
if ((user = (struct ArgusDataStruct *)argus->dsrs[ARGUS_SRCUSERDATA_INDEX]) != NULL) {
unsigned short *sptr = &user->hdr.argus_dsrvl16.len;
--- 8106,8118 ----
break;
}
exlen += 8;
!
! /* Assuming this compensates for the extra digit in the s[%d], it needs
! to start at 10 and occur again at 100+ other than that this still
! doesn't work correctly :-) */
!
! if (len >= 10) exlen++;
! if (len >= 100) exlen++;
if ((user = (struct ArgusDataStruct *)argus->dsrs[ARGUS_SRCUSERDATA_INDEX]) != NULL) {
unsigned short *sptr = &user->hdr.argus_dsrvl16.len;
***************
*** 12765,12770 ****
--- 12771,12777 ----
tcp->src.bytes = nv2tcp->src.bytes;
tcp->src.retrans = nv2tcp->src.rpkts;
tcp->src.win = nv2tcp->src.win;
+ tcp->src.winshift = 0;
tcp->src.flags = nv2tcp->src.flags;
tcp->src.status = 0; tcp->src.seq = 0;
tcp->src.ack = 0; tcp->src.winnum = 0;
***************
*** 12774,12779 ****
--- 12781,12787 ----
tcp->dst.bytes = nv2tcp->dst.bytes;
tcp->dst.retrans = nv2tcp->dst.rpkts;
tcp->dst.win = nv2tcp->dst.win;
+ tcp->dst.winshift = 0;
tcp->dst.flags = nv2tcp->dst.flags;
tcp->dst.status = 0; tcp->dst.seq = 0;
tcp->dst.ack = 0; tcp->dst.winnum = 0;
***************
*** 12825,12831 ****
user->hdr.subtype = ARGUS_LEN_16BITS | ARGUS_SRC_DATA;
user->hdr.argus_dsrvl16.len = nv2user->length + 1;
user->size = nv2user->length * 4;
! user->count = user->size;
bcopy (&nv2user->data, &user->array, (nv2user->length - 1) * 4);
dsr += user->hdr.argus_dsrvl16.len;
--- 12833,12839 ----
user->hdr.subtype = ARGUS_LEN_16BITS | ARGUS_SRC_DATA;
user->hdr.argus_dsrvl16.len = nv2user->length + 1;
user->size = nv2user->length * 4;
! user->count = user->hdr.argus_dsrvl16.len + 1;
bcopy (&nv2user->data, &user->array, (nv2user->length - 1) * 4);
dsr += user->hdr.argus_dsrvl16.len;
***************
*** 12840,12846 ****
user->hdr.subtype = ARGUS_LEN_16BITS | ARGUS_DST_DATA;
user->hdr.argus_dsrvl16.len = nv2user->length + 1;
user->size = nv2user->length * 4;
! user->count = user->size;
bcopy (&nv2user->data, &user->array, (nv2user->length - 1) * 4);
dsr += user->hdr.argus_dsrvl16.len;
--- 12848,12854 ----
user->hdr.subtype = ARGUS_LEN_16BITS | ARGUS_DST_DATA;
user->hdr.argus_dsrvl16.len = nv2user->length + 1;
user->size = nv2user->length * 4;
! user->count = user->hdr.argus_dsrvl16.len + 1;
bcopy (&nv2user->data, &user->array, (nv2user->length - 1) * 4);
dsr += user->hdr.argus_dsrvl16.len;
***************
*** 12924,12929 ****
--- 12932,12945 ----
vlan->hdr.type = ARGUS_VLAN_DSR;
vlan->hdr.subtype = 0;
vlan->hdr.argus_dsrvl8.len = sizeof(*vlan)/4;
+ if (nv2vlan->status & ARGUS_SRC_VLAN)
+ vlan->hdr.argus_dsrvl8.qual |= ARGUS_SRC_VLAN;
+ else
+ vlan->hdr.argus_dsrvl8.qual &= ~ARGUS_SRC_VLAN;
+ if (nv2vlan->status & ARGUS_DST_VLAN)
+ vlan->hdr.argus_dsrvl8.qual |= ARGUS_DST_VLAN;
+ else
+ vlan->hdr.argus_dsrvl8.qual &= ~ARGUS_DST_VLAN;
vlan->sid = nv2vlan->sid;
vlan->did = nv2vlan->did;
More information about the argus
mailing list