"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mtrace.c" between
mrouted-3.9.7.tar.gz and mrouted-3.9.8.tar.gz

About: mrouted is an implementation of the DVMRP multicast routing protocol.

mtrace.c  (mrouted-3.9.7):mtrace.c  (mrouted-3.9.8)
skipping to change at line 902 skipping to change at line 902
printf("pkts: %u\n", ntohl(r->tr_pktcnt)); printf("pkts: %u\n", ntohl(r->tr_pktcnt));
printf("\t\t\t\tv_in: %u ", ntohl(s->tr_vifin)-ntohl(r->tr_vifin)); printf("\t\t\t\tv_in: %u ", ntohl(s->tr_vifin)-ntohl(r->tr_vifin));
printf("v_out: %u ", ntohl(s->tr_vifout) - ntohl(r->tr_vifout)); printf("v_out: %u ", ntohl(s->tr_vifout) - ntohl(r->tr_vifout));
printf("pkts: %u ", ntohl(s->tr_pktcnt) - ntohl(r->tr_pktcnt)); printf("pkts: %u ", ntohl(s->tr_pktcnt) - ntohl(r->tr_pktcnt));
printf("time: %d\n", timediff); printf("time: %d\n", timediff);
printf("\t\t\t\tres: %d\n", res); printf("\t\t\t\tres: %d\n", res);
} }
} }
/* /*
* Calculate the difference between two unsigned 32-bit counters
*/
static uint32_t u_diff(uint32_t u, uint32_t v)
{
return (u >= v ? u - v : v - u);
}
/*
* A fixup to check if any pktcnt has been reset, and to fix the * A fixup to check if any pktcnt has been reset, and to fix the
* byteorder bugs in mrouted 3.6 on little-endian machines. * byteorder bugs in mrouted 3.6 on little-endian machines.
*/ */
void fixup_stats(struct resp_buf *base, struct resp_buf *prev, struct resp_buf * new) void fixup_stats(struct resp_buf *base, struct resp_buf *prev, struct resp_buf * new)
{ {
int rno = base->len; int rno = base->len;
struct tr_resp *b = base->resps + rno; struct tr_resp *b = base->resps + rno;
struct tr_resp *p = prev->resps + rno; struct tr_resp *p = prev->resps + rno;
struct tr_resp *n = new->resps + rno; struct tr_resp *n = new->resps + rno;
int *r = reset + rno; int *r = reset + rno;
int *s = swaps + rno; int *s = swaps + rno;
int res; int res;
/* Check for byte-swappers */ /* Check for byte-swappers */
while (--rno >= 0) { while (--rno >= 0) {
--n; --p; --b; --s; --n; --p; --b; --s;
if (*s || abs(ntohl(n->tr_vifout) - ntohl(p->tr_vifout)) > 100000) { if (*s || u_diff(ntohl(n->tr_vifout), ntohl(p->tr_vifout)) > 100000) {
/* This host sends byteswapped reports; swap 'em */ /* This host sends byteswapped reports; swap 'em */
if (!*s) { if (!*s) {
*s = 1; *s = 1;
b->tr_qarr = byteswap(b->tr_qarr); b->tr_qarr = byteswap(b->tr_qarr);
b->tr_vifin = byteswap(b->tr_vifin); b->tr_vifin = byteswap(b->tr_vifin);
b->tr_vifout = byteswap(b->tr_vifout); b->tr_vifout = byteswap(b->tr_vifout);
b->tr_pktcnt = byteswap(b->tr_pktcnt); b->tr_pktcnt = byteswap(b->tr_pktcnt);
} }
n->tr_qarr = byteswap(n->tr_qarr); n->tr_qarr = byteswap(n->tr_qarr);
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS