Query on operstatus for link, can I change it?
Jeff.Haran at citrix.com
Tue Jul 14 15:34:42 EDT 2015
> -----Original Message-----
> From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-
> bounces at kernelnewbies.org] On Behalf Of Amit Agarwal
> Sent: Tuesday, July 14, 2015 11:41 AM
> To: Kernelnewbies
> Subject: Re: Query on operstatus for link, can I change it?
> Hi Jeff,
> On 15-07-14 16:06:39, Jeff Haran wrote:
> > > -----Original Message-----
> > You might be able to make something like this work using network
> namespaces and veth devices. Depends on whether you really need to use
> your extra physical interface as the tcpreplay device.
> Thanks for this pointer. I will check if I can achieve what I want with netns.
> Also, I was wondering if I can just copy the loopback.c file, build it as module
> and do insmod after changing the network name from "lo" to something
> else, will that work?
The last time I looked into this (and this was quite a while ago so take this with much salt) the lo device was not a "regular network device". The stack sets up an instance of lo in every network name space created, more or less automatically via the registration of its init routine in a struct pernet_operations. So lo doesn't initialize like most other network devices. You might have issues there. I know I did last time I tried to "borrow" loopback.c to do something similar for some prototyping I was doing.
If you are willing to monkey with kernel code, it might be easier to just twiddle the link sense routine in driver for the "other NIC" you were planning to use to always report the link as up regardless of what the PHY says.
More information about the Kernelnewbies