changeset 392:ea458101de9b

start parsing spf txt records
author Carl Byington <carl@five-ten-sg.com>
date Mon, 06 Mar 2017 18:06:24 -0800
parents 88ef2b4e6f1e
children dffedbdc8566
files src/context.cpp
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/context.cpp	Mon Mar 06 17:23:05 2017 -0800
+++ b/src/context.cpp	Mon Mar 06 18:06:24 2017 -0800
@@ -1125,6 +1125,7 @@
 
 bool CONTEXT::resolve_spf(const char *from, uint32_t ip, mlfiPriv *priv, int level)
 {
+    ip = ntohl(ip);
     char buf[maxlen];
     log(priv->queueid, "looking for %s txt record", from);
     dns_interface(*priv, from, ns_t_txt, false, NULL, buf, maxlen);
@@ -1140,7 +1141,7 @@
             if (s) *s = '\0';
             in_addr ipx;
             if (inet_aton(p, &ipx)) {
-                uint32_t ipy = htonl(ipx.s_addr);
+                uint32_t ipy = ntohl(ipx.s_addr);
                 int mask = (s) ? atoi(s+1) : 32;
                 if ((mask >= 16) && (mask <= 32)) {
                     uint32_t low = (1 << (32-mask)) - 1;