#include "netlink.h"
#include "process.h"
+#ifdef NETLINK_DEBUG
+#define MDEBUG(...) Message(M_DEBUG, __VA_ARGS__)
+#else /* !NETLINK_DEBUG */
+#define MDEBUG(...) ((void)0)
+#endif /* !NETLINK_DEBUG */
+
#define ICMP_TYPE_ECHO_REPLY 0
#define ICMP_TYPE_UNREACHABLE 3
client->outcount++;
}
+/* Deliver a packet to the host; used after we have decided that that
+ * is what to do with it. */
+static void netlink_host_deliver(struct netlink *st,
+ uint32_t source, uint32_t dest,
+ struct buffer_if *buf)
+{
+ st->deliver_to_host(st->dst,buf);
+ st->outcount++;
+}
+
/* Deliver a packet. "client" is the _origin_ of the packet, not its
destination, and is NULL for packets from the host and packets
generated internally in secnet. */
/* The packet's not going down a tunnel. It might (ought to)
be for the host. */
if (ipset_contains_addr(st->networks,dest)) {
- st->deliver_to_host(st->dst,buf);
- st->outcount++;
+ netlink_host_deliver(st,source,dest,buf);
BUF_ASSERT_FREE(buf);
} else {
string_t s,d;
address validity and generate ICMP, etc. */
if (st->ptp) {
if (client) {
- st->deliver_to_host(st->dst,buf);
+ netlink_host_deliver(st,source,dest,buf);
} else {
netlink_client_deliver(st,st->clients,source,dest,buf);
}