Ticket #2167: dhcp-3.0.4-dns-1.patch

File dhcp-3.0.4-dns-1.patch, 1.3 KB (added by jonathan.oksman@…, 18 years ago)

This is Jürg Billeter's dhcp-3.0.3-dns-1.patch, updated against 3.0.4 - the only change is the patch now has up to date numbers in it since it was fully compatable. It fixes the proposed issue in this ticket. Thanks to Dan Nicholson for pointing me to Jürg's work, making it potentially available for the next book!

  • client/scripts/linux

    Submitted By: Jonathan Oksman (jonathan.oksman at gmail dot com)
    Date: 2006-09-29
    Initial Package Version: 3.0.2
    Origin: Jürg Billeter's dhcp-3.0.3-dns-1.patch
    Description: Allows the client script to properly update resolv.conf when
                 the server/router fails to send a domain name. 
    Upstream Status:  Not submitted
    
    old new  
    2323# of the $1 in its args.
    2424
    2525make_resolv_conf() {
    26   if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
    27     echo search $new_domain_name >/etc/resolv.conf
     26  if [ "x$new_domain_name" != x ] || [ x"$new_domain_name_servers" != x ]; then
     27    echo "; resolv.conf - generated by dhclient-script" >/etc/resolv.conf
    2828    chmod 644 /etc/resolv.conf
    29     for nameserver in $new_domain_name_servers; do
    30       echo nameserver $nameserver >>/etc/resolv.conf
    31     done
     29    if [ "x$new_domain_name" != x ]; then
     30      echo search $new_domain_name >>/etc/resolv.conf
     31    fi
     32    if [ "x$new_domain_name_servers" != x ]; then
     33      for nameserver in $new_domain_name_servers; do
     34        echo nameserver $nameserver >>/etc/resolv.conf
     35      done
     36    fi
    3237  fi
    3338}
    3439