Hi, Thanks for reply. Yes, i am talking about ifIndex returned by SIOCGIFINDEX. Let me describe my system and issue. On my router system i have two cards (blades) NP-Blade - one blade has network processor to handle data traffic at line rate. This blade is not running linux and has itw own TCP/UDP/IP stack. The network interfaces of router are on this blade. The software on this board assigns ifIndex to these network interfaces as 1,2,3 .... 10, as there are ten network interfaces on the board. NP-blade and CP-blade use IP for communication. CP-Blade -second blade is intel processor based, where we are running routing protocols ( OSPF, RIP , BGP , ISIS, LDP, RSVP) and linux is running on it. These protocols use socket layer of Linux to get protocol messages from other routers in the network. We are creating virtual software interfaces of "network interfaces" in NP-blade on CP-Blade. Now, when we are creating these interfaces in CP-blade the ifIndex assigned by linux are not same as what we have assigned on NP-blade. Also, in linux it depends in which sequence we create network interfaces and ifIndex get assigned. Say, In linux if we create an interface and delete it and bring up again, then we will get different ifIndex. For software/system point of view we have to keep NP-blade ifIndex fixed and NP-blade assumes that ifIndex coming from CP-blade is 1,2,3 ...10. CP-blade routing protocols creating forwarding table use ifIndex as assigned by Linux to calculate ifIndex of next-hop router etc. So, when CP-blade is sending routing update to NP-blade we have to do mapping so that next-hop index, sent to NP-blade is what CP-blade is expecting. To avoid this mapping we thought better solution will be to force NP-blade ifIndex to linux on CP-blade when creating interfaces and on CP-blade we don't need to do any mapping of IfIndex from CP-blade ifIndex to NP-blade ifIndex. But in Linux using ioctl we are not able to find any option to set ifIndex. Regards, Anil On 1/24/07, Stephen Hemminger <shemminger@xxxxxxxxxxxxxxxxxxxx> wrote:
On Tue, 23 Jan 2007 06:55:17 +0530 "Anil Kumar" <anil123@xxxxxxxxx> wrote: > Hi, > > I want to control the interface index assigned to network > interfaces when they are created in Linux Operating System. > I am using TUN/TAP driver to create virtual network interfaces in > linux from user application. Normally by default Linux by itself > assigns the interface index to the inetrfaces. I can get the inetrface > information by reading the file /proc/net/igmp or ioctl command. > My requirement is that i need to assign some fixed interfaces > index to these interfaces > created in linux. For example: > Interface name Interface Index > ============================= > interface-0 > 10 > interface-1 11 > etc. > > Using ioctl i am not finding information how to change the > interface index. Please let me know how can i assign the fixed > interface index to network interfaces created in linux OR is there any > way to control interface index assignment to network interfaces in > Linux. > > > Regards, > Anil I assume you mean the ifindex returned by SIOCGIFINDEX and in /sys/class/net/XXX/ifindex. There is no API to set it, why do you need it to be set? It is assigned as a unique value by the kernel for each new device added. -- Stephen Hemminger <shemminger@xxxxxxxxxxxxxxxxxxxx>
- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html