[OpenWrt-Devel] [PATCH 1/4] netifd: Fix device ifindex overwrite when processing netlink event messages

Felix Fietkau nbd at openwrt.org
Thu Nov 13 09:00:52 EST 2014


On 2014-11-13 14:35, Hans Dedecker wrote:
> When a device with the same name is deleted and created again in the kernel
> the ifindex changes.
> A race condition will occur when netlink event messages linked to the old device
> are processed and will thus overwrite the correct ifindex of the new device.
> Further make sure a valid ifindex is in place for both external and internal
> devices when setting the state to enabled.
> 
> Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
> ---
> diff --git a/system-dummy.c b/system-dummy.c
> index 8e420e1..94b3308 100644
> --- a/system-dummy.c
> +++ b/system-dummy.c
> @@ -96,6 +96,13 @@ int system_if_check(struct device *dev)
>  	return 0;
>  }
>  
> +int system_if_resolve(struct device *dev)
> +{
> +	dev->ifindex = 0;
> +
> +	return 0;
You can leave out the dev->ifindex assignment here.

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list