Bug 9735
Summary: | ifup should handle editing named.conf as well as resolv.conf | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Major <major> |
Component: | initscripts | Assignee: | Bill Nottingham <notting> |
Status: | CLOSED WONTFIX | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.1 | CC: | rvokal |
Target Milestone: | --- | Keywords: | FutureFeature |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Enhancement | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2005-09-29 19:01:39 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Major
2000-02-24 06:11:57 UTC
I tried to attach the patch as a file, but bugzilla claimed I didn't (No file was provided, or it was empty.) --- Major Here it is: 9a10 > 31,32c32,54 < if [ "$PEERDNS" != no -a -n "$DNS1" ] && < tr=`mktemp /tmp/resolv.XXXXXX` ; then --- > case "$PEERDNS" in > named) > if [ -n "$DNS1" ] && tmp=`mktemp /tmp/named.XXXXXX` > then > > conf=/etc/named.conf > forwarders="{ $DNS1" > if [ "$DNS2" != "" ] > then > forwarders="$forwarders; $DNS2" > fi > forwarders="$forwarders; }" > grep -v "forwarders" $conf \ > | awk -v forwarders="$forwarders" '{print} > /options/ {print " forwarders " forwarders ";" }' >$tmp > cat $tmp >$conf > rm -f $tmp > kill -1 $(cat /var/run/named.pid) > fi > ;; > resolv) > if [ -n "$DNS1" ] && tr=`mktemp /tmp/resolv.XXXXXX` > then 38c60 < case $answer in --- > case $answer in 58,62c80,86 < done < # maintain permissions < cat $tr > /etc/resolv.conf < rm -f $tr < fi --- > done > # maintain permissions > cat $tr > /etc/resolv.conf > rm -f $tr > fi > ;; > esac Please attach the patch in diff -u format; thanks. --- ifup-post.dist Thu Feb 24 07:49:09 2000 +++ ifup-post Thu Feb 24 14:30:00 2000 @@ -7,6 +7,7 @@ CONFIG=$1 source_config + DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"` REALDEVICE=`echo $DEVICE | sed 's/:.*//g'` if echo $DEVICE | grep -q ':' ; then @@ -28,14 +29,35 @@ eval `/bin/ipcalc --silent --hostname ${IPADDR}` && set_hostname $HOSTNAME fi -if [ "$PEERDNS" != no -a -n "$DNS1" ] && - tr=`mktemp /tmp/resolv.XXXXXX` ; then +case "$PEERDNS" in +named) + if [ -n "$DNS1" ] && tmp=`mktemp /tmp/named.XXXXXX` + then + + conf=/etc/named.conf + forwarders="{ $DNS1" + if [ "$DNS2" != "" ] + then + forwarders="$forwarders; $DNS2" + fi + forwarders="$forwarders; }" + grep -v "forwarders" $conf \ + | awk -v forwarders="$forwarders" '{print} + /options/ {print " forwarders " forwarders ";" }' >$tmp + cat $tmp >$conf + rm -f $tmp + kill -1 $(cat /var/run/named.pid) + fi + ;; +resolv) + if [ -n "$DNS1" ] && tr=`mktemp /tmp/resolv.XXXXXX` + then # replace only the first two nameserver lines; cannot count on awk # and do not know if sed is capable of this... current_replacement="$DNS1" next_replacement="$DNS2" (cat /etc/resolv.conf ; echo EOF ; echo EOF) | while read answer ; do - case $answer in + case $answer in nameserver*|EOF) if [ -n "$current_replacement" ] ; then echo "nameserver $current_replacement" >> $tr @@ -55,11 +77,13 @@ echo "$answer" >> $tr ;; esac - done - # maintain permissions - cat $tr > /etc/resolv.conf - rm -f $tr -fi + done + # maintain permissions + cat $tr > /etc/resolv.conf + rm -f $tr + fi + ;; +esac # Notify programs that have requested notification do_netreport In the future, something like this would fall to NetworkManager; ergo, I'm not really willing to change the intiscripts behavior in this area at this time. |