From 94f780921f2f5bfd0445b0808c999b21184ddb5b Mon Sep 17 00:00:00 2001 From: clowwindy Date: Mon, 11 Aug 2014 01:15:57 +0800 Subject: [PATCH] fix mask > 0xFFFF with chnroute --- CHANGES | 3 +++ configure.ac | 2 +- openwrt/Makefile | 2 +- src/chinadns.c | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 13f4f32..f9498af 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1.1.2 2014-08-11 +- Fix mask > 0xFFFF with chnroute + 1.1.1 2014-08-08 - Use CIDR format in chnroute.txt diff --git a/configure.ac b/configure.ac index 2bc0121..00d9950 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) -AC_INIT([ChinaDNS-C], [1.1.1], [clowwindy42@gmail.com]) +AC_INIT([ChinaDNS-C], [1.1.2], [clowwindy42@gmail.com]) AC_CONFIG_SRCDIR([src/chinadns.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/openwrt/Makefile b/openwrt/Makefile index 50d97fc..6a8ee8d 100644 --- a/openwrt/Makefile +++ b/openwrt/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ChinaDNS-C -PKG_VERSION:=1.1.1 +PKG_VERSION:=1.1.2 PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_SOURCE_URL:=https://github.com/clowwindy/ChinaDNS-C/releases/download/$(PKG_VERSION) diff --git a/src/chinadns.c b/src/chinadns.c index 2d1ea02..abe8ed7 100644 --- a/src/chinadns.c +++ b/src/chinadns.c @@ -435,8 +435,10 @@ static int test_ip_in_list(struct in_addr ip, const net_list_t *netlist) { DLOG("%s, %d\n", inet_ntoa(netlist->nets[m].net), netlist->nets[m].mask); } + DLOG("result: %x\n", (ntohl(netlist->nets[l].net.s_addr) ^ ntohl(ip.s_addr))); + DLOG("mask: %x\n", (UINT32_MAX - netlist->nets[l].mask)); if ((ntohl(netlist->nets[l].net.s_addr) ^ ntohl(ip.s_addr)) & - (0xFFFF - netlist->nets[l].mask)) { + (UINT32_MAX - netlist->nets[l].mask)) { return 0; } return 1;