#NEWLINE# def remove_chain( self , name , wrap = True ) : #NEWLINE# #INDENT# 'Remove named chain.\n\n        This removal "cascades". All rule in the chain are removed, as are\n        all rules in other chains that jump to it.\n\n        If the chain is not found, this is merely logged.\n\n        ' #NEWLINE# if wrap : #NEWLINE# #INDENT# chain_set = self . chains #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# chain_set = self . unwrapped_chains #NEWLINE# #UNINDENT# if ( name not in chain_set ) : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Attempted to remove chain %s which does not exist' ) , name ) #NEWLINE# return #NEWLINE# #UNINDENT# self . dirty = True #NEWLINE# if ( not wrap ) : #NEWLINE# #INDENT# self . remove_chains . add ( name ) #NEWLINE# #UNINDENT# chain_set . remove ( name ) #NEWLINE# if ( not wrap ) : #NEWLINE# #INDENT# self . remove_rules += [ r for r in self . rules if ( r . chain == name ) ] #NEWLINE# #UNINDENT# self . rules = [ r for r in self . rules if ( r . chain != name ) ] #NEWLINE# if wrap : #NEWLINE# #INDENT# jump_snippet = ( '-j %s-%s' % ( binary_name , name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# jump_snippet = ( '-j %s' % ( name , ) ) #NEWLINE# #UNINDENT# if ( not wrap ) : #NEWLINE# #INDENT# self . remove_rules += [ r for r in r . rules if ( jump_snippet in r . rule ) ] #NEWLINE# #UNINDENT# self . rules = [ r for r in self . rules if ( jump_snippet not in r . rule ) ]