diff options
-rw-r--r-- | usr.sbin/smtpd/dns.c | 33 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 22 |
2 files changed, 30 insertions, 25 deletions
diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c index b6bd5a13a3b..009145ab76a 100644 --- a/usr.sbin/smtpd/dns.c +++ b/usr.sbin/smtpd/dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dns.c,v 1.41 2011/05/01 12:57:11 eric Exp $ */ +/* $OpenBSD: dns.c,v 1.42 2011/05/06 19:21:43 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -37,6 +37,31 @@ #include "smtpd.h" #include "log.h" + +struct mx { + char host[MAXHOSTNAMELEN]; + int prio; +}; + +struct dnssession { + SPLAY_ENTRY(dnssession) nodes; + u_int64_t id; + struct dns query; + struct event ev; + struct asr_query *aq; + struct mx mxarray[MAX_MX_COUNT]; + size_t mxarraysz; + size_t mxcurrent; + size_t mxfound; +}; + +static int dnssession_cmp(struct dnssession *, struct dnssession *); + +SPLAY_HEAD(dnstree, dnssession) dns_sessions = SPLAY_INITIALIZER(&dns_sessions); + +SPLAY_PROTOTYPE(dnstree, dnssession, nodes, dnssession_cmp); + + static struct dnssession *dnssession_init(struct dns *); static void dnssession_destroy(struct dnssession *); static void dnssession_mx_insert(struct dnssession *, const char *, int); @@ -312,7 +337,7 @@ dnssession_init(struct dns *query) dnssession->id = query->id; dnssession->query = *query; - SPLAY_INSERT(dnstree, &env->dns_sessions, dnssession); + SPLAY_INSERT(dnstree, &dns_sessions, dnssession); return dnssession; } @@ -320,7 +345,7 @@ static void dnssession_destroy(struct dnssession *dnssession) { env->stats->lka.queries_active--; - SPLAY_REMOVE(dnstree, &env->dns_sessions, dnssession); + SPLAY_REMOVE(dnstree, &dns_sessions, dnssession); event_del(&dnssession->ev); free(dnssession); } @@ -348,7 +373,7 @@ dnssession_mx_insert(struct dnssession *dnssession, const char *host, int prio) sizeof (dnssession->mxarray[i].host)); } -int +static int dnssession_cmp(struct dnssession *s1, struct dnssession *s2) { /* diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 4f1aef729f0..ccfd77bd79f 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.220 2011/05/01 12:57:11 eric Exp $ */ +/* $OpenBSD: smtpd.h,v 1.221 2011/05/06 19:21:43 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -627,7 +627,6 @@ struct smtpd { SPLAY_HEAD(ssltree, ssl) *sc_ssl; SPLAY_HEAD(childtree, child) children; SPLAY_HEAD(lkatree, lkasession) lka_sessions; - SPLAY_HEAD(dnstree, dnssession) dns_sessions; SPLAY_HEAD(mtatree, mta_session) mta_sessions; LIST_HEAD(mdalist, mda_session) mda_sessions; @@ -804,23 +803,6 @@ struct lkasession { struct submit_status ss; }; -struct mx { - char host[MAXHOSTNAMELEN]; - int prio; -}; - -struct dnssession { - SPLAY_ENTRY(dnssession) nodes; - u_int64_t id; - struct dns query; - struct event ev; - struct asr_query *aq; - struct mx mxarray[MAX_MX_COUNT]; - size_t mxarraysz; - size_t mxcurrent; - size_t mxfound; -}; - enum mta_state { MTA_INVALID_STATE, MTA_INIT, @@ -969,8 +951,6 @@ void dns_query_host(char *, int, u_int64_t); void dns_query_mx(char *, int, u_int64_t); void dns_query_ptr(struct sockaddr_storage *, u_int64_t); void dns_async(struct imsgev *, int, struct dns *); -int dnssession_cmp(struct dnssession *, struct dnssession *); -SPLAY_PROTOTYPE(dnstree, dnssession, nodes, dnssession_cmp); /* enqueue.c */ |