Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/bind/dist/bin/named blacklist new files
details: https://anonhg.NetBSD.org/src/rev/710881567b0b
branches: trunk
changeset: 335825:710881567b0b
user: christos <christos%NetBSD.org@localhost>
date: Sun Jan 25 15:52:12 2015 +0000
description:
blacklist new files
diffstat:
external/bsd/bind/dist/bin/named/pfilter.c | 53 ++++++++++++++++++++++++++++++
external/bsd/bind/dist/bin/named/pfilter.h | 2 +
2 files changed, 55 insertions(+), 0 deletions(-)
diffs (63 lines):
diff -r 9e6f524fc8f8 -r 710881567b0b external/bsd/bind/dist/bin/named/pfilter.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/bind/dist/bin/named/pfilter.c Sun Jan 25 15:52:12 2015 +0000
@@ -0,0 +1,53 @@
+#include <config.h>
+
+#include <isc/platform.h>
+#include <isc/util.h>
+#include <named/types.h>
+#include <named/client.h>
+
+#include <blacklist.h>
+
+#include "pfilter.h"
+
+static struct blacklist *blstate;
+
+void
+pfilter_open(void)
+{
+ if (blstate == NULL)
+ blstate = blacklist_open();
+}
+
+#define TCP_CLIENT(c) (((c)->attributes & NS_CLIENTATTR_TCP) != 0)
+
+void
+pfilter_notify(isc_result_t res, ns_client_t *client, const char *msg)
+{
+ int rv;
+ isc_socket_t *socket;
+
+ pfilter_open();
+
+ if (TCP_CLIENT(client))
+ socket = client->tcpsocket;
+ else {
+ socket = client->udpsocket;
+ if (!client->peeraddr_valid) {
+ syslog(LOG_ERR, "no peer res=%d\n", res);
+ return;
+ }
+ }
+ if (socket == NULL) {
+ syslog(LOG_ERR, "null socket res=%d\n", res);
+ return;
+ }
+ if (blstate == NULL) {
+ syslog(LOG_ERR, "null blstate res=%d\n", res);
+ return;
+ }
+ rv = blacklist_sa_r(blstate,
+ res != ISC_R_SUCCESS, isc_socket_getfd(socket),
+ &client->peeraddr.type.sa, client->peeraddr.length, msg);
+ if (rv || res != ISC_R_SUCCESS)
+ syslog(LOG_ERR, "blacklist rv=%d res=%d\n", rv, res);
+}
diff -r 9e6f524fc8f8 -r 710881567b0b external/bsd/bind/dist/bin/named/pfilter.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/bind/dist/bin/named/pfilter.h Sun Jan 25 15:52:12 2015 +0000
@@ -0,0 +1,2 @@
+void pfilter_open(void);
+void pfilter_notify(isc_result_t, ns_client_t *, const char *);
Home |
Main Index |
Thread Index |
Old Index