#NEWLINE# def make_route( self , host = None , net = None , gw = None , dev = None ) : #NEWLINE# #INDENT# if ( host is not None ) : #NEWLINE# #INDENT# ( thenet , msk ) = ( host , 32 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( net is not None ) : #NEWLINE# #INDENT# ( thenet , msk ) = net . split ( '/' ) #NEWLINE# msk = int ( msk ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Scapy_Exception ( 'make_route: Incorrect parameters. You should specify a host or a net' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( gw is None ) : #NEWLINE# #INDENT# gw = '0.0.0.0' #NEWLINE# #UNINDENT# if ( dev is None ) : #NEWLINE# #INDENT# if gw : #NEWLINE# #INDENT# nhop = gw #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nhop = thenet #NEWLINE# #UNINDENT# ( dev , ifaddr , x ) = self . route ( nhop ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ifaddr = get_if_addr ( dev ) #NEWLINE# #UNINDENT# return ( atol ( thenet ) , itom ( msk ) , gw , dev , ifaddr )