public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Xunlei Pang <xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kdump-team-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH 1/2] network: dhcp before parsing specified dns through cmdline
Date: Tue, 7 Jun 2016 11:15:35 +0200	[thread overview]
Message-ID: <3d3f670e-adda-5d96-d438-d533d4863166@redhat.com> (raw)
In-Reply-To: <1461665111-7385-1-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Am 26.04.2016 um 12:05 schrieb Xunlei Pang:
> I met a problem when passing kdump dns to dracut via "nameserver=x.x.x.x",
> the dns I provided didn't appear in the "/etc/resolv.conf".
> 
> After some debugging, found that when setup dhcp DNS, in setup_interface() 
> and setup_interface6(), it has:
>     echo "search $search $domain" > /tmp/net.$netif.resolv.conf
> 
> So if "$search $domain" isn't NULL(this is ture in my kdump environment),
> the dns contents(that is, dns1, dns2, nameserver) in "ifup" before dhcp 
> will be discarded.
> 
> This patch addresses it by handling dhcp first. In fact this is also the
> way the NetworkManager in 1st kernel works.
> 
> Signed-off-by: Xunlei Pang <xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  modules.d/40network/ifup.sh | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
> index 7c179bd..702b8dc 100755
> --- a/modules.d/40network/ifup.sh
> +++ b/modules.d/40network/ifup.sh
> @@ -321,16 +321,16 @@ fi
>  ip=$(getarg ip)
>  
>  if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
> -    for s in $(getargs nameserver); do
> -        [ -n "$s" ] || continue
> -        echo nameserver $s >> /tmp/net.$netif.resolv.conf
> -    done
> -
>      if [ "$netroot" = "dhcp6" ]; then
>          do_dhcp -6
>      else
>          do_dhcp -4
>      fi
> +
> +    for s in $(getargs nameserver); do
> +        [ -n "$s" ] || continue
> +        echo nameserver $s >> /tmp/net.$netif.resolv.conf
> +    done
>  fi
>  
>  
> @@ -355,17 +355,6 @@ for p in $(getargs ip=); do
>      # If this option isn't directed at our interface, skip it
>      [ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
>  
> -    # setup nameserver
> -    for s in "$dns1" "$dns2" $(getargs nameserver); do
> -        [ -n "$s" ] || continue
> -        echo nameserver $s >> /tmp/net.$netif.resolv.conf
> -    done
> -
> -    # Store config for later use
> -    for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
> -        eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
> -    done > /tmp/net.$netif.override
> -
>      for autoopt in $(str_replace "$autoconf" "," " "); do
>          case $autoopt in
>              dhcp|on|any)
> @@ -381,6 +370,17 @@ for p in $(getargs ip=); do
>      done
>      ret=$?
>  
> +    # setup nameserver
> +    for s in "$dns1" "$dns2" $(getargs nameserver); do
> +        [ -n "$s" ] || continue
> +        echo nameserver $s >> /tmp/net.$netif.resolv.conf
> +    done
> +
> +    # Store config for later use
> +    for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
> +        eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
> +    done > /tmp/net.$netif.override
> +
>      if [ $ret -eq 0 ]; then
>          > /tmp/net.${netif}.up
>  
> 

Thanks! Pushed

      parent reply	other threads:[~2016-06-07  9:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26 10:05 [PATCH 1/2] network: dhcp before parsing specified dns through cmdline Xunlei Pang
     [not found] ` <1461665111-7385-1-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-26 10:05   ` [PATCH 2/2] network/net-lib.sh: delete duplicated DNS items from "/etc/resolv.conf" Xunlei Pang
     [not found]     ` <1461665111-7385-2-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-26 11:03       ` Dracut GitHub Import Bot
2016-06-07  9:16       ` Harald Hoyer
2016-06-07  9:15   ` Harald Hoyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d3f670e-adda-5d96-d438-d533d4863166@redhat.com \
    --to=harald-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kdump-team-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox