Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/7e87e110c8c8
branches:  netbsd-6-0
changeset: 774882:7e87e110c8c8
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Nov 17 19:21:21 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 2c1d4313b073 -r 7e87e110c8c8 sys/net/npf/npf_instr.c
--- a/sys/net/npf/npf_instr.c   Thu Nov 07 20:44:11 2013 +0000
+++ b/sys/net/npf/npf_instr.c   Sun Nov 17 19:21:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_instr.c,v 1.9.2.5 2012/07/25 20:45:23 jdc Exp $    */
+/*     $NetBSD: npf_instr.c,v 1.9.2.5.4.1 2013/11/17 19:21:21 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.5 2012/07/25 20:45:23 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_instr.c,v 1.9.2.5.4.1 2013/11/17 19:21:21 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -180,7 +180,7 @@
        p = sd ? th->th_sport : th->th_dport;
 
        /* Match against the port range. */
-       return NPF_PORTRANGE_MATCH(prange, p) ? 0 : -1;
+       return NPF_PORTRANGE_MATCH(prange, ntohs(p)) ? 0 : -1;
 }
 
 /*
@@ -202,7 +202,7 @@
        p = sd ? uh->uh_sport : uh->uh_dport;
 
        /* Match against the port range. */
-       return NPF_PORTRANGE_MATCH(prange, p) ? 0 : -1;
+       return NPF_PORTRANGE_MATCH(prange, ntohs(p)) ? 0 : -1;
 }
 
 /*
diff -r 2c1d4313b073 -r 7e87e110c8c8 usr.sbin/npf/npfctl/npf_ncgen.c
--- a/usr.sbin/npf/npfctl/npf_ncgen.c   Thu Nov 07 20:44:11 2013 +0000
+++ b/usr.sbin/npf/npfctl/npf_ncgen.c   Sun Nov 17 19:21:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_ncgen.c,v 1.7.2.5 2012/07/25 20:45:23 jdc Exp $    */
+/*     $NetBSD: npf_ncgen.c,v 1.7.2.5.4.1 2013/11/17 19:21:21 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.5 2012/07/25 20:45:23 jdc Exp $");
+__RCSID("$NetBSD: npf_ncgen.c,v 1.7.2.5.4.1 2013/11/17 19:21:21 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