Some time ago pfsync was changed to send the rdomain IDs in the state
messages in network byte order. While this makes perfect sense it was
forgotten that the same code is used to print the state table but that
code was not changed because of this wrong numbers are printed.
The following diff should fix this problem.

-- 
:wq Claudio

Index: sbin/pfctl/pf_print_state.c
===================================================================
RCS file: /cvs/src/sbin/pfctl/pf_print_state.c,v
retrieving revision 1.57
diff -u -p -r1.57 pf_print_state.c
--- sbin/pfctl/pf_print_state.c 2 Sep 2010 14:01:04 -0000       1.57
+++ sbin/pfctl/pf_print_state.c 12 Nov 2010 11:08:08 -0000
@@ -165,11 +165,11 @@ print_name(struct pf_addr *addr, sa_fami
 }
 
 void
-print_host(struct pf_addr *addr, u_int16_t port, sa_family_t af, int rdom,
+print_host(struct pf_addr *addr, u_int16_t port, sa_family_t af, u_int16_t 
rdom,
     int opts)
 {
        if (rdom)
-               printf("(%d) ", rdom);
+               printf("(%u) ", ntohs(rdom));
 
        if (opts & PF_OPT_USEDNS)
                print_name(addr, af);
Index: sbin/pfctl/pfctl.h
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl.h,v
retrieving revision 1.45
diff -u -p -r1.45 pfctl.h
--- sbin/pfctl/pfctl.h  23 Mar 2010 13:31:29 -0000      1.45
+++ sbin/pfctl/pfctl.h  12 Nov 2010 10:20:56 -0000
@@ -107,7 +107,7 @@ struct pf_altq      *pfaltq_lookup(const char
 char           *rate2str(double);
 
 void    print_addr(struct pf_addr_wrap *, sa_family_t, int);
-void    print_host(struct pf_addr *, u_int16_t p, sa_family_t, int, int);
+void    print_host(struct pf_addr *, u_int16_t p, sa_family_t, u_int16_t, int);
 void    print_seq(struct pfsync_state_peer *);
 void    print_state(struct pfsync_state *, int);
 int     unmask(struct pf_addr *, sa_family_t);
Index: usr.sbin/tcpdump/pf_print_state.c
===================================================================
RCS file: /cvs/src/usr.sbin/tcpdump/pf_print_state.c,v
retrieving revision 1.8
diff -u -p -r1.8 pf_print_state.c
--- usr.sbin/tcpdump/pf_print_state.c   3 Nov 2009 10:59:04 -0000       1.8
+++ usr.sbin/tcpdump/pf_print_state.c   12 Nov 2010 11:09:44 -0000
@@ -129,11 +129,11 @@ print_name(struct pf_addr *addr, sa_fami
 }
 
 void
-print_host(struct pf_addr *addr, u_int16_t port, sa_family_t af, int rdom,
+print_host(struct pf_addr *addr, u_int16_t port, sa_family_t af, u_int16_t 
rdom,
     int opts)
 {
        if (rdom)
-               printf("(%d) ", rdom);
+               printf("(%u) ", ntohs(rdom));
 
        if (opts & PF_OPT_USEDNS)
                print_name(addr, af);

Reply via email to