dummynet.c (187771) | dummynet.c (187787) |
---|---|
1/* 2 * Copyright (c) 2002-2003 Luigi Rizzo 3 * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp 4 * Copyright (c) 1994 Ugen J.S.Antsilevich 5 * 6 * Idea and grammar partially left from: 7 * Copyright (c) 1993 Daniel Boulet 8 * 9 * Redistribution and use in source forms, with and without modification, 10 * are permitted provided that this entire comment appears intact. 11 * 12 * Redistribution in binary form may occur without any restrictions. 13 * Obviously, it would be nice if you gave credit where credit is due 14 * but requiring it would be too onerous. 15 * 16 * This software is provided ``AS IS'' without any warranties of any kind. 17 * 18 * NEW command line interface for IP firewall facility 19 * | 1/* 2 * Copyright (c) 2002-2003 Luigi Rizzo 3 * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp 4 * Copyright (c) 1994 Ugen J.S.Antsilevich 5 * 6 * Idea and grammar partially left from: 7 * Copyright (c) 1993 Daniel Boulet 8 * 9 * Redistribution and use in source forms, with and without modification, 10 * are permitted provided that this entire comment appears intact. 11 * 12 * Redistribution in binary form may occur without any restrictions. 13 * Obviously, it would be nice if you gave credit where credit is due 14 * but requiring it would be too onerous. 15 * 16 * This software is provided ``AS IS'' without any warranties of any kind. 17 * 18 * NEW command line interface for IP firewall facility 19 * |
20 * $FreeBSD: head/sbin/ipfw/dummynet.c 187771 2009-01-27 12:24:53Z luigi $ | 20 * $FreeBSD: head/sbin/ipfw/dummynet.c 187787 2009-01-27 20:26:45Z luigi $ |
21 * 22 * dummynet support 23 */ 24 25#include <sys/types.h> 26#include <sys/socket.h> 27#include <sys/sockio.h> 28#include <sys/sysctl.h> --- 123 unchanged lines hidden (view full) --- 152 else 153 printf("%4u ", q[l].id.proto); 154 ina.s_addr = htonl(q[l].id.src_ip); 155 printf("%15s/%-5d ", 156 inet_ntoa(ina), q[l].id.src_port); 157 ina.s_addr = htonl(q[l].id.dst_ip); 158 printf("%15s/%-5d ", 159 inet_ntoa(ina), q[l].id.dst_port); | 21 * 22 * dummynet support 23 */ 24 25#include <sys/types.h> 26#include <sys/socket.h> 27#include <sys/sockio.h> 28#include <sys/sysctl.h> --- 123 unchanged lines hidden (view full) --- 152 else 153 printf("%4u ", q[l].id.proto); 154 ina.s_addr = htonl(q[l].id.src_ip); 155 printf("%15s/%-5d ", 156 inet_ntoa(ina), q[l].id.src_port); 157 ina.s_addr = htonl(q[l].id.dst_ip); 158 printf("%15s/%-5d ", 159 inet_ntoa(ina), q[l].id.dst_port); |
160 printf("%4qu %8qu %2u %4u %3u\n", 161 q[l].tot_pkts, q[l].tot_bytes, | 160 printf("%4llu %8llu %2u %4u %3u\n", 161 align_uint64(&q[l].tot_pkts), 162 align_uint64(&q[l].tot_bytes), |
162 q[l].len, q[l].len_bytes, q[l].drops); 163 if (co.verbose) | 163 q[l].len, q[l].len_bytes, q[l].drops); 164 if (co.verbose) |
164 printf(" S %20qd F %20qd\n", 165 q[l].S, q[l].F); | 165 printf(" S %20llu F %20llu\n", 166 align_uint64(&q[l].S), align_uint64(&q[l].F)); |
166 } 167 168 /* Print IPv6 flows */ 169 index_printed = 0; 170 for (l = 0; l < fs->rq_elements; l++) { 171 if (!IS_IP6_FLOW_ID(&(q[l].id))) 172 continue; 173 --- 23 unchanged lines hidden (view full) --- 197 else 198 printf("%9u ", q[l].id.proto); 199 printf("%7d %39s/%-5d ", q[l].id.flow_id6, 200 inet_ntop(AF_INET6, &(q[l].id.src_ip6), buff, sizeof(buff)), 201 q[l].id.src_port); 202 printf(" %39s/%-5d ", 203 inet_ntop(AF_INET6, &(q[l].id.dst_ip6), buff, sizeof(buff)), 204 q[l].id.dst_port); | 167 } 168 169 /* Print IPv6 flows */ 170 index_printed = 0; 171 for (l = 0; l < fs->rq_elements; l++) { 172 if (!IS_IP6_FLOW_ID(&(q[l].id))) 173 continue; 174 --- 23 unchanged lines hidden (view full) --- 198 else 199 printf("%9u ", q[l].id.proto); 200 printf("%7d %39s/%-5d ", q[l].id.flow_id6, 201 inet_ntop(AF_INET6, &(q[l].id.src_ip6), buff, sizeof(buff)), 202 q[l].id.src_port); 203 printf(" %39s/%-5d ", 204 inet_ntop(AF_INET6, &(q[l].id.dst_ip6), buff, sizeof(buff)), 205 q[l].id.dst_port); |
205 printf(" %4qu %8qu %2u %4u %3u\n", 206 q[l].tot_pkts, q[l].tot_bytes, | 206 printf(" %4llu %8llu %2u %4u %3u\n", 207 align_uint64(&q[l].tot_pkts), 208 align_uint64(&q[l].tot_bytes), |
207 q[l].len, q[l].len_bytes, q[l].drops); 208 if (co.verbose) | 209 q[l].len, q[l].len_bytes, q[l].drops); 210 if (co.verbose) |
209 printf(" S %20qd F %20qd\n", q[l].S, q[l].F); | 211 printf(" S %20llu F %20llu\n", 212 align_uint64(&q[l].S), 213 align_uint64(&q[l].F)); |
210 } 211} 212 213static void 214print_flowset_parms(struct dn_flow_set *fs, char *prefix) 215{ 216 int l; 217 char qs[30]; --- 72 unchanged lines hidden (view full) --- 290 sprintf(buf, "%7.3f Kbit/s", b/1000); 291 else 292 sprintf(buf, "%7.3f bit/s ", b); 293 294 sprintf(prefix, "%05d: %s %4d ms ", 295 p->pipe_nr, buf, p->delay); 296 print_flowset_parms(&(p->fs), prefix); 297 if (co.verbose) | 214 } 215} 216 217static void 218print_flowset_parms(struct dn_flow_set *fs, char *prefix) 219{ 220 int l; 221 char qs[30]; --- 72 unchanged lines hidden (view full) --- 294 sprintf(buf, "%7.3f Kbit/s", b/1000); 295 else 296 sprintf(buf, "%7.3f bit/s ", b); 297 298 sprintf(prefix, "%05d: %s %4d ms ", 299 p->pipe_nr, buf, p->delay); 300 print_flowset_parms(&(p->fs), prefix); 301 if (co.verbose) |
298 printf(" V %20qd\n", p->V >> MY_M); | 302 printf(" V %20llu\n", align_uint64(&p->V) >> MY_M); |
299 300 q = (struct dn_flow_queue *)(p+1); 301 list_queues(&(p->fs), q); 302 } 303 for (fs = next; nbytes >= sizeof *fs; fs = next) { 304 char prefix[80]; 305 306 if (SLIST_NEXT(fs, next) != (struct dn_flow_set *)DN_IS_QUEUE) --- 410 unchanged lines hidden --- | 303 304 q = (struct dn_flow_queue *)(p+1); 305 list_queues(&(p->fs), q); 306 } 307 for (fs = next; nbytes >= sizeof *fs; fs = next) { 308 char prefix[80]; 309 310 if (SLIST_NEXT(fs, next) != (struct dn_flow_set *)DN_IS_QUEUE) --- 410 unchanged lines hidden --- |