aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-04-20 20:02:28 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-04-20 20:02:28 +0400
commit4d4668a0d4022583208d20bac9b8a0bede6f073d (patch)
tree14fbacb9511c738b40919aecbf168151605d28cb /src/protocol.c
parent6cc47586dbcbf21fb67be92f6736fd76ca8baffb (diff)
downloadrspamd-4d4668a0d4022583208d20bac9b8a0bede6f073d.tar.gz
rspamd-4d4668a0d4022583208d20bac9b8a0bede6f073d.zip
* Fix spf plugin that was broken in 0.4.7
* Add partial ipv6 support for some rspamd modules.
Diffstat (limited to 'src/protocol.c')
-rw-r--r--src/protocol.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/protocol.c b/src/protocol.c
index 40bd01e0c..fc03acacb 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -537,10 +537,27 @@ parse_header (struct worker_task *task, f_str_t * line)
/* ip_addr */
if (g_ascii_strncasecmp (headern, IP_ADDR_HEADER, sizeof (IP_ADDR_HEADER) - 1) == 0) {
tmp = memory_pool_fstrdup (task->task_pool, line);
+#ifdef HAVE_INET_PTON
+ if (inet_pton (AF_INET, tmp, &task->from_addr.d.in4) != 1) {
+ /* Try ipv6 */
+ if (inet_pton (AF_INET6, tmp, &task->from_addr.d.in6) == 1) {
+ task->from_addr.ipv6 = TRUE;
+ }
+ else {
+ msg_info ("bad ip header: '%s'", tmp);
+ return FALSE;
+ }
+ }
+ else {
+ task->from_addr.ipv6 = FALSE;
+ }
+ task->from_addr.has_addr = TRUE;
+#else
if (!inet_aton (tmp, &task->from_addr)) {
msg_info ("bad ip header: '%s'", tmp);
return FALSE;
}
+#endif
debug_task ("read IP header, value: %s", tmp);
}
else {