Subject: Re: [PATCH 5/5] net: Loopback ifindex is constant now

From: Pavel Emelyanov <[email-masked]>
Date: Mon, 06 Aug 2012 16:13:35 +0400

On 08/06/2012 03:54 PM, Eric Dumazet wrote:
> On Mon, 2012-08-06 at 14:32 +0400, Pavel Emelyanov wrote:
>> As pointed out, there are places, that access net->loopback_dev->ifindex
>> and after ifindex generation is made per-net this value becomes constant
>> equals 1. So go ahead and introduce the LOOPBACK_IFINDEX constant and use
>> it where appropriate.
>>
>> Signed-off-by: Pavel Emelyanov <[email-masked]>
> 
> What guarantee do we have that loopback is the first device per net ?

In net_dev_init():

        /* The loopback device is special if any other network devices
         * is present in a network namespace the loopback device must
         * be present. Since we now dynamically allocate and free the
         * loopback device ensure this invariant is maintained by
         * keeping the loopback device as the first device on the
         * list of network devices.  Ensuring the loopback devices
         * is the first device that appears and the last network device
         * that disappears.
         */
        if (register_pernet_device(&loopback_net_ops))
                goto out;

> You should add this to the changelog because its not that obvious.

OK.

Thanks,
Pavel