(self, ifname)
Get the index of a given interface name
Get the index of a given interface name
Get the index of a given interface name
def _get_ifindex(self, ifname):
        """Get the index of a given interface name"""
        if (ifname is not None):
            ifreq = struct.pack('16si', ifname.encode(), 0)
            res = fcntl.ioctl(self.sock.fileno(), SIOCGIFINDEX, ifreq)
            self.ifindex = int(struct.unpack('16si', res)[1])
        else:
            self.ifindex = 0
def _get_ifindex ( self , ifname ) : if ( ifname is not None ) : ifreq = struct . pack ( '16si' , ifname . encode ( ) , 0 ) res = fcntl . ioctl ( self . sock . fileno ( ) , SIOCGIFINDEX , ifreq ) self . ifindex = int ( struct . unpack ( '16si' , res ) [ 1 ] ) else : self . ifindex = 0