Deleted Added
full compact
pf_print_state.c (145840) pf_print_state.c (171172)
1/* $OpenBSD: pf_print_state.c,v 1.40 2004/12/10 22:13:26 henning Exp $ */
1/* $OpenBSD: pf_print_state.c,v 1.44 2007/03/01 17:20:53 deraadt Exp $ */
2
3/*
4 * Copyright (c) 2001 Daniel Hartmeier
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 16 unchanged lines hidden (view full) ---

26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33#include <sys/cdefs.h>
2
3/*
4 * Copyright (c) 2001 Daniel Hartmeier
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 16 unchanged lines hidden (view full) ---

26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/contrib/pf/pfctl/pf_print_state.c 145840 2005-05-03 16:55:20Z mlaier $");
34__FBSDID("$FreeBSD: head/contrib/pf/pfctl/pf_print_state.c 171172 2007-07-03 12:30:03Z mlaier $");
35
36#include <sys/types.h>
37#include <sys/socket.h>
38#include <sys/endian.h>
39#include <net/if.h>
40#define TCPSTATES
41#include <netinet/tcp_fsm.h>
42#include <net/pfvar.h>

--- 52 unchanged lines hidden (view full) ---

95 printf("?");
96 else
97 printf("%s", buf);
98 }
99 break;
100 case PF_ADDR_NOROUTE:
101 printf("no-route");
102 return;
35
36#include <sys/types.h>
37#include <sys/socket.h>
38#include <sys/endian.h>
39#include <net/if.h>
40#define TCPSTATES
41#include <netinet/tcp_fsm.h>
42#include <net/pfvar.h>

--- 52 unchanged lines hidden (view full) ---

95 printf("?");
96 else
97 printf("%s", buf);
98 }
99 break;
100 case PF_ADDR_NOROUTE:
101 printf("no-route");
102 return;
103 case PF_ADDR_URPFFAILED:
104 printf("urpf-failed");
105 return;
103 case PF_ADDR_RTLABEL:
104 printf("route \"%s\"", addr->v.rtlabelname);
105 return;
106 default:
107 printf("?");
108 return;
109 }
110

--- 162 unchanged lines hidden (view full) ---

273 min = s->creation % 60;
274 s->creation /= 60;
275 printf(" age %.2u:%.2u:%.2u", s->creation, min, sec);
276 sec = s->expire % 60;
277 s->expire /= 60;
278 min = s->expire % 60;
279 s->expire /= 60;
280 printf(", expires in %.2u:%.2u:%.2u", s->expire, min, sec);
106 case PF_ADDR_RTLABEL:
107 printf("route \"%s\"", addr->v.rtlabelname);
108 return;
109 default:
110 printf("?");
111 return;
112 }
113

--- 162 unchanged lines hidden (view full) ---

276 min = s->creation % 60;
277 s->creation /= 60;
278 printf(" age %.2u:%.2u:%.2u", s->creation, min, sec);
279 sec = s->expire % 60;
280 s->expire /= 60;
281 min = s->expire % 60;
282 s->expire /= 60;
283 printf(", expires in %.2u:%.2u:%.2u", s->expire, min, sec);
281 printf(", %u:%u pkts, %u:%u bytes",
284 printf(", %llu:%llu pkts, %llu:%llu bytes",
285#ifdef __FreeBSD__
286 (unsigned long long)s->packets[0],
287 (unsigned long long)s->packets[1],
288 (unsigned long long)s->bytes[0],
289 (unsigned long long)s->bytes[1]);
290#else
282 s->packets[0], s->packets[1], s->bytes[0], s->bytes[1]);
291 s->packets[0], s->packets[1], s->bytes[0], s->bytes[1]);
292#endif
283 if (s->anchor.nr != -1)
284 printf(", anchor %u", s->anchor.nr);
285 if (s->rule.nr != -1)
286 printf(", rule %u", s->rule.nr);
287 if (s->src_node != NULL)
288 printf(", source-track");
289 if (s->nat_src_node != NULL)
290 printf(", sticky-address");
291 printf("\n");
292 }
293 if (opts & PF_OPT_VERBOSE2) {
293 if (s->anchor.nr != -1)
294 printf(", anchor %u", s->anchor.nr);
295 if (s->rule.nr != -1)
296 printf(", rule %u", s->rule.nr);
297 if (s->src_node != NULL)
298 printf(", source-track");
299 if (s->nat_src_node != NULL)
300 printf(", sticky-address");
301 printf("\n");
302 }
303 if (opts & PF_OPT_VERBOSE2) {
304 printf(" id: %016llx creatorid: %08x%s\n",
294#ifdef __FreeBSD__
305#ifdef __FreeBSD__
295 printf(" id: %016llx creatorid: %08x\n",
296 (long long)be64toh(s->id), ntohl(s->creatorid));
306 (unsigned long long)be64toh(s->id), ntohl(s->creatorid),
297#else
307#else
298 printf(" id: %016llx creatorid: %08x\n",
299 betoh64(s->id), ntohl(s->creatorid));
308 betoh64(s->id), ntohl(s->creatorid),
300#endif
309#endif
310 ((s->sync_flags & PFSTATE_NOSYNC) ? " (no-sync)" : ""));
301 }
302}
303
304int
305unmask(struct pf_addr *m, sa_family_t af)
306{
307 int i = 31, j = 0, b = 0;
308 u_int32_t tmp;

--- 12 unchanged lines hidden ---
311 }
312}
313
314int
315unmask(struct pf_addr *m, sa_family_t af)
316{
317 int i = 31, j = 0, b = 0;
318 u_int32_t tmp;

--- 12 unchanged lines hidden ---