Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/blacklist/bin apply the mask to the resulting a...



details:   https://anonhg.NetBSD.org/src/rev/b5b4bb4726d3
branches:  trunk
changeset: 335873:b5b4bb4726d3
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 27 20:16:11 2015 +0000

description:
apply the mask to the resulting address correctly.

diffstat:

 external/bsd/blacklist/bin/conf.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (57 lines):

diff -r 7cc4c8f533ab -r b5b4bb4726d3 external/bsd/blacklist/bin/conf.c
--- a/external/bsd/blacklist/bin/conf.c Tue Jan 27 19:49:37 2015 +0000
+++ b/external/bsd/blacklist/bin/conf.c Tue Jan 27 20:16:11 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.c,v 1.16 2015/01/27 19:40:36 christos Exp $       */
+/*     $NetBSD: conf.c,v 1.17 2015/01/27 20:16:11 christos Exp $       */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: conf.c,v 1.16 2015/01/27 19:40:36 christos Exp $");
+__RCSID("$NetBSD: conf.c,v 1.17 2015/01/27 20:16:11 christos Exp $");
 
 #include <stdio.h>
 #include <string.h>
@@ -521,10 +521,10 @@
 
        for (size_t i = 0; i < len; i++) {
                if (mask > 32) {
-                       m = (uint32_t)~0;
+                       m = htonl((uint32_t)~0);
                        mask -= 32;
                } else if (mask) {
-                       m = MASK(mask);
+                       m = htonl(MASK(mask));
                        mask = 0;
                } else
                        return 1;
@@ -557,12 +557,13 @@
 
        for (size_t i = 0; i < len; i++) {
                if (mask > 32) {
-                       m = (uint32_t)~0;
+                       m = htonl((uint32_t)~0);
                        mask -= 32;
                } else if (mask) {
-                       m = MASK(mask);
+                       m = htonl(MASK(mask));
                        mask = 0;
-               }
+               } else
+                       m = 0;
                a[i] &= m;
        }
 }
@@ -1099,6 +1100,8 @@
        conf_addr_set(cr, rss);
        /* match the remote config */
        confset_match(&rconf, cr, conf_merge);
+       /* to apply the mask */
+       conf_addr_set(cr, &cr->c_ss);
 
        return cr;
 }



Home | Main Index | Thread Index | Old Index