[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] tools/hotplug: Fix dhcpd symlink removal in vif-nat


  • To: Diego Sueiro <Diego.Sueiro@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 27 Aug 2020 14:14:24 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZvqSDfb/1ccgvyttqkh2Es9aEGtk3LSw8rl8fA4C1F4=; b=Lf1xY+oHvLPrtcMY6GX1lgyNfjb1EXtQ7teqYNxA5Bs9D2bzb7wDpDhfH5oLxLR4cUdiyGyLuK+FTKrgsUIkgyAAIuS56+c+C5Wf90/Bra39rvWuqEcd83SVHlThExBDufwJlrXThMUYRDZdk4/a8KmxuFy9OJO2YiXFinQnM17TZhVlv7OY8lOVvH9SF/JpVwO2uGnqbV0XdPMphr3LDYiKSugaORpkgJFA9FstemiXVBR0nGu/83AJSZvy/mAyEQNGSfRz9jZOAo2X2RhNCj79rwL9XZswpJHJ079mAUWxmE5Ncl/vNmKpwNZnj/jwhRTn9MpSXQeL3dH7ainw6A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tuq7mRmDXLTDJBc7W/xm1So5nLpMseJrt7JwQ8xhwtNmCwzvagrHnYmH+2OJOoWm1v8RmHrepuCoTontsdljpm9hHOWawuSLgFaJtM4e9jaEab6MRc5ILdwCzm/WPEBfCbqgJN0rjbe8+zDt1hlz0rkz7ASa6MzVzxK2KOc6/3pg5GcPVne7mjHFtmns/NORbpHriTBEBgv094o1vSk9BtQjwAFIrE12aoOHsxyKUtBVE39+iXW+TMlFTK0liLtFhwbYlw6FNLI5tq+IKmAf5DUvoVYsbPxhwyYAQS5Idm/asQ3BmAW+PdwwM8Cjk+OMiP70P2d90lu5eU+RWWjFxQ==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, nd <nd@xxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 27 Aug 2020 14:14:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWduFzi7tknqNOmkiLnZ0D+vERVqlMCvgA
  • Thread-topic: [PATCH 2/3] tools/hotplug: Fix dhcpd symlink removal in vif-nat


> On 20 Aug 2020, at 12:00, Diego Sueiro <Diego.Sueiro@xxxxxxx> wrote:
> 
> Copy temp files used to add/remove dhcpd configurations to avoid
> replacing potential symlinks.
> 
> Signed-off-by: Diego Sueiro <diego.sueiro@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

> ---
> tools/hotplug/Linux/vif-nat | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/hotplug/Linux/vif-nat b/tools/hotplug/Linux/vif-nat
> index 2614435..1ab80ed 100644
> --- a/tools/hotplug/Linux/vif-nat
> +++ b/tools/hotplug/Linux/vif-nat
> @@ -99,7 +99,8 @@ dhcparg_remove_entry()
>   then
>     rm "$tmpfile"
>   else
> -    mv "$tmpfile" "$dhcpd_arg_file"
> +    cp "$tmpfile" "$dhcpd_arg_file"
> +    rm "$tmpfile"
>   fi
> }
> 
> @@ -109,11 +110,11 @@ dhcparg_add_entry()
>   local tmpfile=$(mktemp)
>   # handle Red Hat, SUSE, and Debian styles, with or without quotes
>   sed -e 's/^DHCPDARGS="*\([^"]*\)"*/DHCPDARGS="\1'"${dev} "'"/' \
> -     "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
> +     "$dhcpd_arg_file" >"$tmpfile" && cp "$tmpfile" "$dhcpd_arg_file"
>   sed -e 's/^DHCPD_INTERFACE="*\([^"]*\)"*/DHCPD_INTERFACE="\1'"${dev} "'"/' \
> -     "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
> +     "$dhcpd_arg_file" >"$tmpfile" && cp "$tmpfile" "$dhcpd_arg_file"
>   sed -e 's/^INTERFACES="*\([^"]*\)"*/INTERFACES="\1'"${dev} "'"/' \
> -     "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
> +     "$dhcpd_arg_file" >"$tmpfile" && cp "$tmpfile" "$dhcpd_arg_file"
>   rm -f "$tmpfile"
> }
> 
> @@ -125,7 +126,8 @@ dhcp_remove_entry()
>   then
>     rm "$tmpfile"
>   else
> -    mv "$tmpfile" "$dhcpd_conf_file"
> +    cp "$tmpfile" "$dhcpd_conf_file"
> +    rm "$tmpfile"
>   fi
>   dhcparg_remove_entry
> }
> -- 
> 2.7.4
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.