pytun.py
def open(self):
        """ Create the tunnel.
            If the tunnel is already opened, the function will
            raised an AlreadyOpened exception.
        """

        if self.fd is not None:
            raise self.AlreadyOpened()

        logger.debug("Opening %s..." % (TUN_KO_PATH, ))
        self.fd = os.open(TUN_KO_PATH, os.O_RDWR)
        
        logger.debug("Opening %s tunnel '%s'..." % (self.mode_name.upper(), self.pattern, ))
        try:
            ret = fcntl.ioctl(self.fd, self.TUNSETIFF, struct.pack("16sH", self.pattern, self.mode | self.no_pi))

        except IOError, e:
            if e.errno == 1:
                logger.error("Cannot open a %s tunnel because the operation is not permitted." % (self.mode_name.upper(), ))
                raise self.NotPermitted()

            raise

        self.name = ret[:16].strip("\x00")

        logger.info("Tunnel '%s' opened." % (self.name, ))
 Create the tunnel.
            If the tunnel is already opened, the function will
            raised an AlreadyOpened exception.
        
Create the tunnel.
If the tunnel is already opened, the function will
raised an AlreadyOpened exception.
Create the tunnel . If the tunnel is already opened the function will raised an AlreadyOpened exception .
def open(self):
        if self.fd is not None:
            raise self.AlreadyOpened()
        logger.debug("Opening %s..." % (TUN_KO_PATH, ))
        self.fd = os.open(TUN_KO_PATH, os.O_RDWR)
        logger.debug("Opening %s tunnel '%s'..." % (self.mode_name.upper(), self.pattern, ))
        try:
            ret = fcntl.ioctl(self.fd, self.TUNSETIFF, struct.pack("16sH", self.pattern, self.mode | self.no_pi))
        except IOError, e:
            if e.errno == 1:
                logger.error("Cannot open a %s tunnel because the operation is not permitted." % (self.mode_name.upper(), ))
                raise self.NotPermitted()
            raise
        self.name = ret[:16].strip("\x00")
        logger.info("Tunnel '%s' opened." % (self.name, ))
def open ( self ) : if self . fd is not None : raise self . AlreadyOpened ( ) logger . debug ( "Opening %s..." % ( TUN_KO_PATH , ) ) self . fd = os . open ( TUN_KO_PATH , os . O_RDWR ) logger . debug ( "Opening %s tunnel '%s'..." % ( self . mode_name . upper ( ) , self . pattern , ) ) try : ret = fcntl . ioctl ( self . fd , self . TUNSETIFF , struct . pack ( "16sH" , self . pattern , self . mode | self . no_pi ) ) except IOError , e : if e . errno == 1 : logger . error ( "Cannot open a %s tunnel because the operation is not permitted." % ( self . mode_name . upper ( ) , ) ) raise self . NotPermitted ( ) raise self . name = ret [ : 16 ] . strip ( "\x00" ) logger . info ( "Tunnel '%s' opened." % ( self . name , ) )
Create the tunnel.
Create the tunnel .
""" Create the tunnel.
            If the tunnel is already opened, the function will
            raised an AlreadyOpened exception.
        """
self