#NEWLINE# def __set_network_filter( self , qdisc_major_id ) : #NEWLINE# #INDENT# if all ( [ dataproperty . is_empty_string ( self . network ) , ( self . port is None ) ] ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# command_list = [ 'tc filter add' , ( 'dev ' + self . __get_tc_device ( ) ) , 'protocol ip' , ( 'parent %x:' % qdisc_major_id ) , 'prio 1 u32' , ( 'flowid %x:%d' % ( command_list , self . __get_qdisc_minor_id ( ) ) ) ] #NEWLINE# if dataproperty . is_not_empty_string ( self . network ) : #NEWLINE# #INDENT# command_list . append ( ( 'match ip %s %s' % ( self . __get_network_direction_str ( ) , self . network ) ) ) #NEWLINE# #UNINDENT# if ( self . port is not None ) : #NEWLINE# #INDENT# command_list . append ( ( 'match ip dport %d 0xffff' % self . port ) ) #NEWLINE# #UNINDENT# return self . __subproc_wrapper . run ( ' ' . join ( command_list ) )