Ignore:
Timestamp:
2011-09-23T10:35:50+02:00 (5 years ago)
Author:
jow
Message:

[package] base-files: make ip matching in dns add/remove functions more explicit, avoids overmatching pairs like 1.2.3.35 and 1.2.3.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/base-files/files/lib/network/config.sh

    r28241 r28291  
    107107        local add 
    108108        for dns in "$@"; do 
    109                 grep -qsF "nameserver $dns" /tmp/resolv.conf.auto || { 
     109                grep -qsE "^nameserver ${dns//./\\.}$" /tmp/resolv.conf.auto || { 
    110110                        add="${add:+$add }$dns" 
    111111                        echo "nameserver $dns" >> /tmp/resolv.conf.auto 
     
    127127                        local dns=$(uci_get_state network "$cfg" resolv_dns) 
    128128                        for dns in $dns; do 
    129                                 sed -i -e "/^nameserver $dns$/d" /tmp/resolv.conf.auto 
     129                                sed -i -e "/^nameserver ${dns//./\\.}$/d" /tmp/resolv.conf.auto 
    130130                        done 
    131131                } 
Note: See TracChangeset for help on using the changeset viewer.