| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] fix invalid frontend path for set_mtu
 On Wed, Apr 27, 2022 at 02:20:53PM +0100, James Dingwall wrote:
> commit f6ec92717522e74b4cc3aa4160b8ad6884e0b50c
> Author: James Dingwall <james@xxxxxxxxxxxxxx>
> Date:   Tue Apr 19 12:45:31 2022 +0100
> 
>     The set_mtu() function of xen-network-common.sh currently has this code:
>     
>             if [ ${type_if} = vif ]
>             then
>                 local dev_=${dev#vif}
>                 local domid=${dev_%.*}
>                 local devid=${dev_#*.}
>     
>                 local FRONTEND_PATH="/local/domain/$domid/device/vif/$devid"
>     
>                 xenstore_write "$FRONTEND_PATH/mtu" ${mtu}
>             fi
>     
>     This works fine if the device has its default name but if the xen config
>     defines the vifname parameter the FRONTEND_PATH is incorrectly 
> constructed.
>     Learn the frontend path by reading the appropriate value from the backend.
>     
>     Also change use of `...` to $(...) for a consistent style in the script.
>     
>     Signed-off-by: James Dingwall <james@xxxxxxxxxxxxxx>
Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Thanks!
> diff --git a/tools/hotplug/Linux/xen-network-common.sh 
> b/tools/hotplug/Linux/xen-network-common.sh
> index 42fa704e8d..7a63308a9e 100644
> --- a/tools/hotplug/Linux/xen-network-common.sh
> +++ b/tools/hotplug/Linux/xen-network-common.sh
> @@ -171,7 +171,7 @@ set_mtu () {
>      local mtu=$(xenstore_read_default "$XENBUS_PATH/mtu" "")
>      if [ -z "$mtu" ]
>      then
> -        mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`"
> +        mtu="$(ip link show dev ${bridge}| awk '/mtu/ { print $5 }')"
>          if [ -n "$mtu" ]
>          then
>              log debug "$bridge MTU is $mtu"
> @@ -184,11 +184,7 @@ set_mtu () {
>  
>          if [ ${type_if} = vif ]
>          then
> -            local dev_=${dev#vif}
> -            local domid=${dev_%.*}
> -            local devid=${dev_#*.}
> -
> -            local FRONTEND_PATH="/local/domain/$domid/device/vif/$devid"
> +            local FRONTEND_PATH="$(xenstore_read "$XENBUS_PATH/frontend")"
>  
>              xenstore_write "$FRONTEND_PATH/mtu" ${mtu}
>          fi
-- 
Anthony PERARD
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |