-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from thetoster/dev
add totd deamon
- Loading branch information
Showing
4 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# | ||
# Copyright (C) 2006-2011 OpenWrt.org | ||
# | ||
# This is free software, licensed under the GNU General Public License v2. | ||
# See /LICENSE for more information. | ||
# | ||
|
||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=totd | ||
PKG_VERSION:=1.5.3 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||
PKG_SOURCE_URL:=https://github.com/fwdillema/totd.git | ||
PKG_SOURCE_PROTO:=git | ||
PKG_SOURCE_VERSION:=$(PKG_VERSION) | ||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) | ||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) | ||
|
||
include $(INCLUDE_DIR)/package.mk | ||
|
||
define Package/totd | ||
SECTION:=ipv6 | ||
CATEGORY:=IPv6 | ||
DEPENDS:=@IPV6 +tayga | ||
TITLE:=Small DNS proxy that supports IPv6/IPv4 record translation | ||
URL:=http://www.dillema.net/software/totd.html | ||
endef | ||
|
||
define Package/totd/description | ||
totd is a small DNS proxy nameserver which supports IPv6 and enable IPv6 | ||
only sites to access IPv4 sites by using some translation mechanism such | ||
as NAT-PT, KAME faith, etc... | ||
endef | ||
|
||
define Package/totd/conffiles | ||
/etc/totd.conf | ||
endef | ||
|
||
# uses GNU configure | ||
|
||
define Build/Compile | ||
$(MAKE) -C $(PKG_BUILD_DIR) \ | ||
DESTDIR="$(PKG_INSTALL_DIR)" \ | ||
CC="$(TARGET_CC)" \ | ||
all | ||
endef | ||
|
||
define Package/totd/install | ||
$(INSTALL_DIR) $(1)/usr/sbin/ | ||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/ | ||
$(INSTALL_DIR) $(1)/etc/ | ||
$(INSTALL_CONF) ./files/totd.conf $(1)/etc/ | ||
$(INSTALL_DIR) $(1)/etc/init.d/ | ||
$(INSTALL_BIN) ./files/totd.init $(1)/etc/init.d/totd | ||
$(INSTALL_BIN) ./files/totd_configure_dhcp $(1)/etc/init.d/ | ||
endef | ||
|
||
$(eval $(call BuildPackage,totd)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
; Totd sample configuration file | ||
; you can have multiple forwarders, totd will always prefer | ||
; forwarders listed early and only use forwarders listed later | ||
; if the first ones are unresponsive. | ||
forwarder 8.8.8.8 port 53 | ||
|
||
; you can have multiple prefixes or even no prefixes at all | ||
; totd uses them in round-robin fashion | ||
prefix 2001:1418:0200:0:: | ||
|
||
; the port totd listens on for incoming requests | ||
port 5353 | ||
|
||
; the pidfile to use (default: /var/run/totd.pid) | ||
pidfile /var/run/totd.pid | ||
|
||
; interfaces totd listens on (UDP only for now and not on Linux) | ||
; If left out totd will only open wildcard sockets. | ||
; interfaces lo br0 | ||
; 6to4 reverse lookup | ||
; stf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh /etc/rc.common | ||
# Copyright (C) 2006 OpenWrt.org | ||
|
||
START=60 | ||
BIN=totd | ||
RUN_D=/var/run | ||
PID_F=$RUN_D/$BIN.pid | ||
|
||
|
||
start() { | ||
mkdir -p $RUN_D | ||
$BIN -c /etc/totd.conf -no6 | ||
} | ||
|
||
stop() { | ||
[ -f $PID_F ] && kill $(cat $PID_F) | ||
} | ||
|
||
restart() { | ||
stop | ||
sleep 1 | ||
start | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh /etc/rc.common | ||
|
||
START=19 | ||
STOP=10 | ||
|
||
SERVICE_DAEMONIZE=0 | ||
SERVICE_WRITE_PID=0 | ||
|
||
start() | ||
{ | ||
uci set dhcp.@dnsmasq[0].noresolv=1 | ||
SERVERS="$(uci get dhcp.@dnsmasq[0].server)" | ||
INTERFACES="$(uci get dhcp.@dnsmasq[0].interface)" | ||
if [ "${SERVERS}" != "127.0.0.1#5353" ]; then | ||
echo "adding servers" | ||
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5353 | ||
fi | ||
if [ "${INTERFACES}" != "lowpan0 eth0" ]; then | ||
echo "adding interfaces" | ||
uci add_list dhcp.@dnsmasq[0].interface=lowpan0 | ||
uci add_list dhcp.@dnsmasq[0].interface=eth0 | ||
fi | ||
uci commit | ||
|
||
grep -q -F 'cache-size=0' /etc/dnsmasq.conf || echo 'cache-size=0' >> /etc/dnsmasq.conf | ||
grep -q -F 'log-queries=extra' /etc/dnsmasq.conf || echo 'log-queries=extra' >> /etc/dnsmasq.conf | ||
} | ||
|
||
stop() | ||
{ | ||
echo "Stop" | ||
} |