Ticket #10803: 0001-add-dhcp-option-force.patch

File 0001-add-dhcp-option-force.patch, 3.3 KB (added by Eric Decker <cire831@…>, 6 years ago)

dnsmasq: dhcp_option_force patch

  • package/dnsmasq/files/dhcp.conf

    From 32b5d28fb85b0f33eaa39a4c1094f1268cc41f01 Mon Sep 17 00:00:00 2001
    From: "Eric B. Decker" <cire831@gmail.com>
    Date: Tue, 17 Jan 2012 22:57:14 -0800
    Subject: [PATCH] add dhcp-option-force
    
    ---
     package/dnsmasq/files/dhcp.conf    |    2 ++
     package/dnsmasq/files/dnsmasq.init |   24 +++++++++++++++++++++++-
     2 files changed, 25 insertions(+), 1 deletions(-)
    
    diff --git a/package/dnsmasq/files/dhcp.conf b/package/dnsmasq/files/dhcp.conf
    index 660b06a..3ee10ab 100644
    a b config dhcp lan 
    2525        option start    100 
    2626        option limit    150 
    2727        option leasetime        12h 
     28        #list dhcp_option       '42,192,168.2.1'    # if asked for 
     29        #list dhcp_option_force '42,192.168.2.1'    # force ntp server 
    2830 
    2931config dhcp wan 
    3032        option interface        wan 
  • package/dnsmasq/files/dnsmasq.init

    diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init
    index b0c2cd2..9d0b91a 100644
    a b dhcp_subscrid_add() { 
    148148        append args "--dhcp-subscrid=$networkid,$subscriberid" 
    149149 
    150150        dhcp_option_add "$cfg" "$networkid" 
     151        dhcp_option_force_add "$cfg" "$networkid" 
    151152} 
    152153 
    153154dhcp_remoteid_add() { 
    dhcp_remoteid_add() { 
    162163        append args "--dhcp-remoteid=$networkid,$remoteid" 
    163164 
    164165        dhcp_option_add "$cfg" "$networkid" 
     166        dhcp_option_force_add "$cfg" "$networkid" 
    165167} 
    166168 
    167169dhcp_circuitid_add() { 
    dhcp_circuitid_add() { 
    176178        append args "--dhcp-circuitid=$networkid,$circuitid" 
    177179 
    178180        dhcp_option_add "$cfg" "$networkid" 
     181        dhcp_option_force_add "$cfg" "$networkid" 
    179182} 
    180183 
    181184dhcp_userclass_add() { 
    dhcp_userclass_add() { 
    190193        append args "--dhcp-userclass=$networkid,$userclass" 
    191194 
    192195        dhcp_option_add "$cfg" "$networkid" 
     196        dhcp_option_force_add "$cfg" "$networkid" 
    193197} 
    194198 
    195199dhcp_vendorclass_add() { 
    dhcp_vendorclass_add() { 
    204208        append args "--dhcp-vendorclass=$networkid,$vendorclass" 
    205209 
    206210        dhcp_option_add "$cfg" "$networkid" 
     211        dhcp_option_force_add "$cfg" "$networkid" 
    207212} 
    208213 
    209214dhcp_host_add() { 
    210215        local cfg="$1" 
    211216 
    212217        config_get networkid "$cfg" networkid 
    213         [ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid" 
     218        [ -n "$networkid" ] && { 
     219                dhcp_option_add "$cfg" "$networkid" 
     220                dhcp_option_force_add "$cfg" "$networkid" 
     221        } 
    214222 
    215223        config_get name "$cfg" name 
    216224        config_get ip "$cfg" ip 
    dhcp_mac_add() { 
    236244        append args "--dhcp-mac=$networkid,$mac" 
    237245 
    238246        dhcp_option_add "$cfg" "$networkid" 
     247        dhcp_option_force_add "$cfg" "$networkid" 
    239248} 
    240249 
    241250dhcp_boot_add() { 
    dhcp_boot_add() { 
    255264        append args "--dhcp-boot=${networkid:+net:$networkid,}$filename,$servername,$serveraddress" 
    256265 
    257266        dhcp_option_add "$cfg" "$networkid" 
     267        dhcp_option_force_add "$cfg" "$networkid" 
    258268} 
    259269 
    260270 
    dhcp_add() { 
    309319        append args "--dhcp-range=$networkid,$START,$END,$NETMASK,$leasetime${options:+ $options}" 
    310320 
    311321        dhcp_option_add "$cfg" "$networkid" 
     322        dhcp_option_force_add "$cfg" "$networkid" 
    312323} 
    313324 
    314325dhcp_option_add() { 
    dhcp_option_add() { 
    322333 
    323334} 
    324335 
     336dhcp_option_force_add() { 
     337        local cfg="$1" 
     338        local networkid="$2" 
     339 
     340        config_get dhcp_option_force "$cfg" dhcp_option_force 
     341        for o in $dhcp_option_force; do 
     342                append args "--dhcp-option-force=$networkid","$o" 
     343        done 
     344 
     345} 
     346 
    325347dhcp_domain_add() { 
    326348        local cfg="$1" 
    327349        local ip name names