Changeset 31816


Ignore:
Timestamp:
2012-05-19T22:17:56+02:00 (6 years ago)
Author:
jow
Message:

dnsmasq: allow forcing options

The option 'force' when set to '1' will transform a dhcp-option to dhcp-option-force instead in the config.

This is useful for forcing options to be sent back to a client (even options it didn't ask for).

Signed-off-by: Philip Prindeville <philipp@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/dnsmasq/files/dnsmasq.init

    r31815 r31816  
    158158        xappend "--dhcp-subscrid=$networkid,$subscriberid" 
    159159 
    160         dhcp_option_add "$cfg" "$networkid" 
     160        config_get_bool force "$cfg" force 0 
     161 
     162        dhcp_option_add "$cfg" "$networkid" "$force" 
    161163} 
    162164 
     
    172174        xappend "--dhcp-remoteid=$networkid,$remoteid" 
    173175 
    174         dhcp_option_add "$cfg" "$networkid" 
     176        config_get_bool force "$cfg" force 0 
     177 
     178        dhcp_option_add "$cfg" "$networkid" "$force" 
    175179} 
    176180 
     
    186190        xappend "--dhcp-circuitid=$networkid,$circuitid" 
    187191 
    188         dhcp_option_add "$cfg" "$networkid" 
     192        config_get_bool force "$cfg" force 0 
     193 
     194        dhcp_option_add "$cfg" "$networkid" "$force" 
    189195} 
    190196 
     
    200206        xappend "--dhcp-userclass=$networkid,$userclass" 
    201207 
    202         dhcp_option_add "$cfg" "$networkid" 
     208        config_get_bool force "$cfg" force 0 
     209 
     210        dhcp_option_add "$cfg" "$networkid" "$force" 
    203211} 
    204212 
     
    214222        xappend "--dhcp-vendorclass=$networkid,$vendorclass" 
    215223 
    216         dhcp_option_add "$cfg" "$networkid" 
     224        config_get_bool force "$cfg" force 0 
     225 
     226        dhcp_option_add "$cfg" "$networkid" "$force" 
    217227} 
    218228 
     
    220230        local cfg="$1" 
    221231 
    222         config_get networkid "$cfg" networkid 
    223         [ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid" 
     232        config_get_bool force "$cfg" force 0 
     233 
     234        config_get networkid "$cfg" networkid 
     235        [ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid" "$force" 
    224236 
    225237        config_get name "$cfg" name 
     
    283295        xappend "--dhcp-boot=${networkid:+net:$networkid,}$filename,$servername,$serveraddress" 
    284296 
    285         dhcp_option_add "$cfg" "$networkid" 
     297        config_get_bool force "$cfg" force 0 
     298 
     299        dhcp_option_add "$cfg" "$networkid" "$force" 
    286300} 
    287301 
     
    343357        local cfg="$1" 
    344358        local networkid="$2" 
     359        local force="$3" 
     360 
     361        [ "$force" = "0" ] && force= 
    345362 
    346363        config_get dhcp_option "$cfg" dhcp_option 
    347364        for o in $dhcp_option; do 
    348                 xappend "--dhcp-option=$networkid","$o" 
     365                xappend "--dhcp-option${force:+-force}=$networkid","$o" 
    349366        done 
    350367 
Note: See TracChangeset for help on using the changeset viewer.