Skip to content

Commit

Permalink
observe manual settings in dhcp range
Browse files Browse the repository at this point in the history
partial fix for issue #42
  • Loading branch information
jaromil committed Oct 5, 2017
1 parent cbbbf61 commit cb44546
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions daemons/dhcpd
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
# 02139, USA.

dhcpd-conf() {
netzero=${address%.*}.0
netC=${netzero%.*}
netB=${netC%.*}
netzero=${dowse_net}
# if no base network specified, use class C
# TODO: better deduction based on netmask if known
[[ "$netzero" = "" ]] && netzero=${address%.*}.0
range_start=${dowse_guests[(ws:,:)1]}
range_stop=${dowse_guests[(ws:,:)2]}
cat <<EOF
option routers $address;
option domain-name "dowse.it";
Expand All @@ -36,7 +39,7 @@ local-address $address;
omapi-port 7911;
subnet ${netzero} netmask $netmask {
range ${netC}.101 ${netC}.249;
range ${range_start} ${range_stop};
on commit {
set clip = binary-to-ascii(10, 8, ".", leased-address);
Expand Down
8 changes: 7 additions & 1 deletion dowse
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ mkdir -p $H
TEXTDOMAIN=dowse

# path and debugging
vars+=(R H E debug quiet script fun settings network)
vars+=(R H E debug quiet script fun network)
vars+=(last_notice last_act last_func)
vars+=(root sql)
arrs+=(mods)

# network configuration

vars+=(settings address interface hostname wan lan firewall)
vars+=(dowse_uid dowse_gid dowse_net netmask dowse_guests)

# use mysql
sql_wp=(launch mysql --defaults-file=$H/run/mysqld.conf -A -u root)
sql=(launch mysql --defaults-file=$H/run/mysqld.conf -A -u root -pp4ssw0rd)
Expand Down
5 changes: 1 addition & 4 deletions zlibs/confstore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env zsh

vars+=(settings address interface hostname wan lan firewall)
vars+=(dowse_uid dowse_gid dowse_net netmask dowse_guests)

conf-load() {
fn conf-load

Expand Down Expand Up @@ -53,7 +50,7 @@ conf-load() {
dowse_guests=$subn.0.101,$subn.255.199,48h
elif [[ $range == 8 ]]; then
subn=${wan[(ws:.:)1]}
dowsenet=${subn}.0.0.0/8
dowse_net=${subn}.0.0.0/8
netmask=255.0.0.0
dowse_guests=$subn.0.0.101,$subn.255.255.199,48h
fi
Expand Down

0 comments on commit cb44546

Please sign in to comment.