Changeset 1435d00 in freewrt


Ignore:
Timestamp:
Jun 18, 2006, 7:16:02 PM (19 years ago)
Author:
Waldemar Brodkorb <wbx@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
76c5e9f
Parents:
5f931bf9
Message:

change to a very KISS like startup script. no magic at all.
works for every system without having special vars. everything
is configured in /etc/dnsmasq.conf.

git-svn-id: svn://www.freewrt.org/trunk/freewrt@107 afb5a338-a214-0410-bd46-81f09a774fd1

Location:
package/dnsmasq/files
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • package/dnsmasq/files/dnsmasq.conf

    r5f931bf9 r1435d00  
    1010expand-hosts
    1111
    12 @ifdef dhcp_enable
    13 dhcp-range=@@start@@,@@end@@,@@netmask@@,@@lease@@
    14 @endif
    15 @ifdef wan_ifname
    16 except-interface=@@wan_ifname@@
    17 @endif
     12# add more dhcp-range options for every subnet
     13dhcp-range=192.168.1.100,192.168.1.254,255.255.255.0,24h
     14except-interface=vlan1
    1815
    19 # enable dhcp (start,end,netmask,leasetime)
    2016dhcp-authoritative
    2117dhcp-leasefile=/tmp/dhcp.leases
    2218
    23 # use /etc/ethers for static hosts; same format as --dhcp-host
     19# use /etc/ethers for static hosts
    2420# <hwaddr> <ipaddr>
    25 read-ethers
     21#read-ethers
    2622
    2723# other useful options:
  • package/dnsmasq/files/dnsmasq.init

    r5f931bf9 r1435d00  
    11#!/bin/sh
    2 . /etc/config/network
    3 
    4 # The following is to automatically configure the DHCP settings
    5 # based on config settings. Feel free to replace all this crap
    6 # with a simple "dnsmasq" and manage everything via the
    7 # /etc/dnsmasq.conf config file
    82
    93[ -f /etc/dnsmasq.conf ] || exit
    104
    11 args=""
    12 iface=lan
    13 eval "ifname=\${${iface}_ifname}"
     5case $1 in
     6start)
     7        /usr/sbin/dnsmasq
     8        ;;
     9stop)
     10        killall dnsmasq
     11restart)
     12        $0 stop
     13        $0 start
     14        ;;
     15*)
     16        echo "Usage: $0 {start | stop | restart}"
     17        ;;
     18esac
     19exit 0
    1420
    15 dhcp_enable="${dhcp_enable:-1}"
    16 dhcp_start="${dhcp_start:-100}"
    17 dhcp_num="${dhcp_num:-50}"
    18 dhcp_lease="${dhcp_lease:-12h}"
    19 
    20 # if dhcp_enable is unset and there is a dhcp server on the network already, default to dhcp_enable=0
    21 [ -z "$dhcp_enable" ] && udhcpc -n -q -R -s /bin/true -i $ifname >&- && dhcp_enable="${dhcp_enable:-0}"
    22 
    23 # dhcp_enable=0 disables the dhcp server
    24 (
    25         [ -z "$dhcp_enable" -o "$dhcp_enable" -eq 1 ] && {
    26                 # no existing DHCP server?
    27 
    28                 # calculate settings
    29                 eval "ipaddr=\${${iface}_ipaddr}"
    30                 eval "netmask=\${${iface}_netmask}"
    31                 eval $(ipcalc $ipaddr $netmask ${dhcp_start:-100} ${dhcp_num:-150})
    32                
    33                 # and pass the args via config parser defines
    34                 echo "@define dhcp_enable 1"
    35                 echo "@define netmask $NETMASK"
    36                 echo "@define start $START"
    37                 echo "@define end $END"
    38                 echo "@define lease ${dhcp_lease:-12h}"
    39         }
    40 
    41         # ignore requests from wan interface
    42         [ -z "$wan_proto" -o "$wan_proto" = "none" ] || echo "@define wan_ifname $wan_ifname"
    43 
    44         cat /etc/dnsmasq.conf
    45 ) | awk -f /usr/lib/parse-config.awk | dnsmasq -C /proc/self/fd/0
Note: See TracChangeset for help on using the changeset viewer.