summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libiptc/libiptc.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index 9948157..9db28c5 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -1445,11 +1445,6 @@ subtract_counters(STRUCT_COUNTERS *answer,
{
answer->pcnt = a->pcnt - b->pcnt;
answer->bcnt = a->bcnt - b->bcnt;
-
- fprintf(stderr, "pcnt: %llu - %llu = %llu\n",
- a->pcnt, b->pcnt, answer->pcnt);
- fprintf(stderr, "bcnt: %llu - %llu = %llu\n",
- a->bcnt, b->bcnt, answer->bcnt);
}
int
@@ -1516,15 +1511,6 @@ TC_COMMIT(TC_HANDLE_T *handle)
return 0;
}
-#if 1
- fprintf(stderr, "Before adjust:\n");
- for (i = 0; i < (*handle)->new_number; i++) {
- fprintf(stderr, "counter %i/%i = %llu,%llu\n",
- i, (*handle)->new_number,
- repl->counters[i].pcnt,
- repl->counters[i].bcnt);
- }
-#endif
/* Put counters back. */
strcpy(newcounters->name, (*handle)->info.name);
newcounters->num_counters = (*handle)->new_number;
@@ -1561,15 +1547,21 @@ TC_COMMIT(TC_HANDLE_T *handle)
break;
}
}
-#if 1
- fprintf(stderr, "After adjust:\n");
- for (i = 0; i < (*handle)->new_number; i++) {
- fprintf(stderr, "counter %i/%i = %llu,%llu\n",
- i, (*handle)->new_number,
- newcounters->counters[i].pcnt,
- newcounters->counters[i].bcnt);
+
+#ifdef KERNEL_64_USERSPACE_32
+ {
+ /* Kernel will think that pointer should be 64-bits, and get
+ padding. So we accomodate here (assumption: alignment of
+ `counters' is on 64-bit boundary). */
+ u_int64_t *kernptr = (u_int64_t *)&newcounters->counters;
+ if ((unsigned long)&newcounters->counters % 8 != 0) {
+ fprintf(stderr,
+ "counters alignment incorrect! Mail rusty!\n");
+ abort();
+ }
+ *kernptr = newcounters->counters;
}
-#endif
+#endif /* KERNEL_64_USERSPACE_32 */
if (setsockopt(sockfd, TC_IPPROTO, SO_SET_ADD_COUNTERS,
newcounters, counterlen) < 0) {