Mercurial > dnsbl
comparison src/context.cpp @ 460:ad05c61d6372 stable-6-0-74
add debug code for spf check with microsoft /14
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 24 Dec 2018 09:37:36 -0800 |
parents | 48cfa55cd73b |
children | f3f1ece619ba |
comparison
equal
deleted
inserted
replaced
459:e2c09e0c4784 | 460:ad05c61d6372 |
---|---|
1213 if (s) *s = '\0'; | 1213 if (s) *s = '\0'; |
1214 in_addr ipx; | 1214 in_addr ipx; |
1215 if (inet_aton(p, &ipx)) { | 1215 if (inet_aton(p, &ipx)) { |
1216 uint32_t ipy = ntohl(ipx.s_addr); | 1216 uint32_t ipy = ntohl(ipx.s_addr); |
1217 int mask = (s) ? atoi(s+1) : 32; | 1217 int mask = (s) ? atoi(s+1) : 32; |
1218 if ((mask >= 16) && (mask <= 32)) { | 1218 if ((mask >= 14) && (mask <= 32)) { // microsoft has a /14 |
1219 uint32_t low = (1 << (32-mask)) - 1; | 1219 uint32_t low = (1 << (32-mask)) - 1; |
1220 ipy &= low ^ 0xffffffff; | 1220 ipy &= low ^ 0xffffffff; |
1221 { | |
1222 char buf[maxlen]; | |
1223 snprintf(buf, maxlen, "ip=%08x, spf=%08x/%d, mask=%08x", ip, ipy, mask, low); | |
1224 log(priv->queueid, "spf check %s", buf); | |
1225 } | |
1221 if ((ipy <= ip) && (ip <= ipy + low)) { | 1226 if ((ipy <= ip) && (ip <= ipy + low)) { |
1222 if (s) *s = '/'; | 1227 if (s) *s = '/'; |
1223 log(priv->queueid, "match ip4:%s", p); | 1228 log(priv->queueid, "match ip4:%s", p); |
1224 return true; | 1229 return true; |
1225 } | 1230 } |