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

Re: udev naming problems for eth*

Md wrote:
> SuSE uses some scripts to handle persistent interface names
> [...] I had no time yet to investigate the details.

I just looked at the "rename_netiface" script in that package.  The
following comments in the script give an idea of how it handles the
race problem.

    # look for a network interface name that is still not
    # used as persistent name. At first it tries the name the
    # interface currently has. If this name is already occupied,
    # then increase the number and try again.
    # To check if a name is occupied we have to look in
    # /etc/udev/rules.d/60-net_*.rules and in /tmp/used_interface_names*.
    # The latter serves as temporary registration file to avoid race
    # conditions. It will be removed when the script exits.

    # Simply try to rename directly, because it will work in most cases

    # Generate a temporary interface name

    # Rename it to the temporary name.
    # Then try several times to rename it to new name

Now "trying several times", etc., may work, but it's a kludge.  There are
sound ways of resolving contention for a shared resource.
Thomas Hood

Reply to: