@ -82,7 +82,8 @@ update() {
local lhs="$1" family="$2" type="$3"
local lhs="$1" family="$2" type="$3"
shift 3
shift 3
echo -e "$PREFIX" "$lhs $family $type $@\nsend"
[ $dynamicdns -eq 1 ] && \
echo -e "$PREFIX" "$lhs $family $type $@\nsend" >> $dyn_file
}
}
explode() {
explode() {
@ -245,7 +246,7 @@ static_srvhosts() {
static_host_add() {
static_host_add() {
local cfg="$1"
local cfg="$1"
local broadcast hostid macn macs mac name ip leasetime
local broadcast hostid macn macs mac name ip ips revip leasetime
config_get macs "$cfg" "mac"
config_get macs "$cfg" "mac"
[ -n "$macs" ] || return 0
[ -n "$macs" ] || return 0
@ -302,6 +303,14 @@ static_host_add() {
config_list_foreach "$cfg" "dhcp_option" append_dhcp_options
config_list_foreach "$cfg" "dhcp_option" append_dhcp_options
echo "}"
echo "}"
done
done
ips="$ip"
for ip in $ips; do
revip="$(rev_str "$ip" ".")"
update "$name.$domain." IN A "$ip"
update "$revip.in-addr.arpa." IN PTR "$name.$domain."
done
}
}
static_hosts() {
static_hosts() {
@ -396,7 +405,7 @@ dhcpd_add() {
gateway="$IP"
gateway="$IP"
fi
fi
gen_dhcp_subnet "$cfg" >> $config_file
gen_dhcp_subnet "$cfg"
}
}
general_config() {
general_config() {
@ -540,12 +549,6 @@ start_service() {
general_config > $config_file
general_config > $config_file
rfc1918_nets=
config_foreach dhcpd_add dhcp 1
static_hosts >> $config_file
if [ $dynamicdns -eq 1 ]; then
if [ $dynamicdns -eq 1 ]; then
cat <<EOF > $dyn_file
cat <<EOF > $dyn_file
; Generated by /etc/init.d/dhcpd at $(date)
; Generated by /etc/init.d/dhcpd at $(date)
@ -553,15 +556,23 @@ start_service() {
ttl $TTL
ttl $TTL
EOF
EOF
fi
rfc1918_nets=
config_foreach dhcpd_add dhcp 1 >> $config_file
static_cnames >> $dyn_file
static_hosts >> $config _file
static_domains >> $dyn_file
static_cnames >> $config _file
static_mxhosts >> $dyn _file
static_domains >> $config _file
static_srvhosts >> $dyn _file
static_mxhosts >> $config _file
static_srvhosts >> $config_file
if [ $dynamicdns -eq 1 ]; then
nsupdate -l -v $dyn_file
nsupdate -l -v $dyn_file
rm -f $dyn_file
rm -f $dyn_file