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

Re: [libvirt] [PATCHv2] network: truncate bridges' dummy tap device names to IFNAMSIZ (15) chars



On 04/14/2011 01:06 PM, Laine Stump wrote:
> 
> (Change from V1 - define a static char[] containing the desired
> prefix, and use its size to figure out how much to truncate, rather
> than having a bunch of magic numbers. This also makes it simpler and
> less error-prone to change the suffix if we decide to.)

Indeed :)

> The solution is to shorten the part of the original name used to
> generate the tap device name. However, simply truncating it is
> insufficient, because the last few characters of an interface name are
> often a number used to indicate one of a list of several similar
> devices (for example, "verylongname123", "verylongname124", etc) and
> simple truncation would lead to duplicate names (eg "verlongnam-nic"
> and "verylongnam-nic"). So instead we take the first 8 characters of
> $bridgename ("verylong" in the example), add on the final 3 bytes
> ("123"), then add "-nic" (so "verylong123-nic").  Not pretty, but it
> is much more likely to generate a unique name, and is reproducible
> (unlike, say, a random number).
> ---
>  src/network/bridge_driver.c |   16 +++++++++++++++-
>  1 files changed, 15 insertions(+), 1 deletions(-)

Here's making my IRC review official:

ACK.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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