Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6-1]: src Apply patch, requested by rmind in ticket 986:



details:   https://anonhg.NetBSD.org/src/rev/d8df9ed89910
branches:  netbsd-6-1
changeset: 775883:d8df9ed89910
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Nov 17 19:21:14 2013 +0000

description:
Apply patch, requested by rmind in ticket 986:
        usr.sbin/npf/npfctl/npf_ncgen.c                 patch
        sys/net/npf/npf_instr.c                         patch
fix the byteorder for port range comparison

diffstat:

 sys/net/npf/npf_instr.c         |  8 ++++----
 usr.sbin/npf/npfctl/npf_ncgen.c |  6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r 3e85c50d0f5d -r d8df9ed89910 sys/net/npf/npf_instr.c
--- a/sys/net/npf/npf_instr.c   Sun Nov 17 19:17:04 2013 +0000
+++ b/sys/net/npf/npf_instr.c   Sun Nov 17 19:21:14 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_instr.c,v 1.9.2.7 2013/02/11 21:49:48 riz Exp $    */
+/*     $NetBSD: npf_instr.c,v 1.9.2.7.2.1 2013/11/17 19:21:14 bouyer Exp $     */
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_instr.c,v 1.9.2.7 2013/02/11 21:49:48 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_instr.c,v 1.9.2.7.2.1 2013/11/17 19:21:14 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -154,7 +154,7 @@
        KASSERT(npf_iscached(npc, NPC_TCP));
 
        /* Match against the port range. */
-       return NPF_PORTRANGE_MATCH(prange, p) ? 0 : -1;
+       return NPF_PORTRANGE_MATCH(prange, ntohs(p)) ? 0 : -1;
 }
 
 /*
@@ -169,7 +169,7 @@
        KASSERT(npf_iscached(npc, NPC_UDP));
 
        /* Match against the port range. */
-       return NPF_PORTRANGE_MATCH(prange, p) ? 0 : -1;
+       return NPF_PORTRANGE_MATCH(prange, ntohs(p)) ? 0 : -1;
 }
 
 /*
diff -r 3e85c50d0f5d -r d8df9ed89910 usr.sbin/npf/npfctl/npf_ncgen.c
--- a/usr.sbin/npf/npfctl/npf_ncgen.c   Sun Nov 17 19:17:04 2013 +0000
+++ b/usr.sbin/npf/npfctl/npf_ncgen.c   Sun Nov 17 19:21:14 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_ncgen.c,v 1.7.2.6 2012/11/26 17:39:29 riz Exp $    */
+/*     $NetBSD: npf_ncgen.c,v 1.7.2.6.2.1 2013/11/17 19:21:14 bouyer Exp $     */
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: npf_ncgen.c,v 1.7.2.6 2012/11/26 17:39:29 riz Exp $");
+__RCSID("$NetBSD: npf_ncgen.c,v 1.7.2.6.2.1 2013/11/17 19:21:14 bouyer Exp $");
 
 #include <stdlib.h>
 #include <stddef.h>
@@ -313,7 +313,7 @@
        *nc++ = (opts & NC_MATCH_TCP) ?
            NPF_OPCODE_TCP_PORTS : NPF_OPCODE_UDP_PORTS;
        *nc++ = (opts & (NC_MATCH_DST | NC_MATCH_SRC)) >> 1;
-       *nc++ = ((uint32_t)from << 16) | to;
+       *nc++ = ((uint32_t)ntohs(from) << 16) | ntohs(to);
 
        /* Comparison block (2 words). */
        npfctl_ncgen_addjmp(ctx, &nc);



Home | Main Index | Thread Index | Old Index