|  | @@ -87,6 +87,12 @@ const char* snmp_args_list[] =
 | 
	
		
			
				|  |  |      "community",
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +const char* whitelist_args_list[] =
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	"info",
 | 
	
		
			
				|  |  | +	"range",
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const char* ntp_args_list[] =
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |  	"ENA",
 | 
	
	
		
			
				|  | @@ -161,6 +167,13 @@ static portBASE_TYPE prvTaskNetworkCommand( int8_t *pcWriteBuffer, size_t xWrite
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  static portBASE_TYPE prvTaskSNMPCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +#ifdef HARDWARE_BT6708
 | 
	
		
			
				|  |  | +/*
 | 
	
		
			
				|  |  | + * Implements the whitelist command.
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +static portBASE_TYPE prvTaskWhiteListCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /*
 | 
	
		
			
				|  |  |   * Implements the change password command.
 | 
	
		
			
				|  |  |   */
 | 
	
	
		
			
				|  | @@ -272,6 +285,19 @@ static const CLI_Command_Definition_t prvSNMPCommandDefinition =
 | 
	
		
			
				|  |  |  	-1 /* The user can enter any number of commands. */
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +#ifdef HARDWARE_BT6708
 | 
	
		
			
				|  |  | +/* Structure that defines the "whitelist" command line command.   This
 | 
	
		
			
				|  |  | +generates a table that shows how much run time each task has */
 | 
	
		
			
				|  |  | +static const CLI_Command_Definition_t prvWhiteListCommandDefinition =
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	( const int8_t * const ) "whitelist", /* The command string to type. */
 | 
	
		
			
				|  |  | +	( const int8_t * const ) "\twhitelist info: вывод информации о текущем белом списке IP адресов контроллера\r\n"
 | 
	
		
			
				|  |  | +	 	 	 	 	 	 	 "\twhitelist range <NUM> <A.B.C.D/E>: установка диапазона IP адресов\r\n",
 | 
	
		
			
				|  |  | +	prvTaskWhiteListCommand, /* The function to run. */
 | 
	
		
			
				|  |  | +	-1 /* The user can enter any number of commands. */
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /* Structure that defines the "user" command line command.   This
 | 
	
		
			
				|  |  |  generates a table that shows how much run time each task has */
 | 
	
		
			
				|  |  |  static const CLI_Command_Definition_t prvUserCommandDefinition =
 | 
	
	
		
			
				|  | @@ -375,6 +401,9 @@ void vRegisterCLICommands( void )
 | 
	
		
			
				|  |  |  	FreeRTOS_CLIRegisterCommand( &prvNTPCommandDefinition );
 | 
	
		
			
				|  |  |  	FreeRTOS_CLIRegisterCommand( &prvNetworkCommandDefinition );
 | 
	
		
			
				|  |  |  	FreeRTOS_CLIRegisterCommand( &prvSNMPCommandDefinition );
 | 
	
		
			
				|  |  | +#ifdef HARDWARE_BT6708
 | 
	
		
			
				|  |  | +	FreeRTOS_CLIRegisterCommand( &prvWhiteListCommandDefinition );
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  |  	FreeRTOS_CLIRegisterCommand( &prvUserCommandDefinition );
 | 
	
		
			
				|  |  |  	FreeRTOS_CLIRegisterCommand( &prvConfigCommandDefinition );
 | 
	
		
			
				|  |  |  	FreeRTOS_CLIRegisterCommand( &prvNetConfigCommandDefinition );
 | 
	
	
		
			
				|  | @@ -1210,6 +1239,140 @@ static portBASE_TYPE prvTaskSNMPCommand( int8_t *pcWriteBuffer, size_t xWriteBuf
 | 
	
		
			
				|  |  |  	return xReturn;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +#ifdef HARDWARE_BT6708
 | 
	
		
			
				|  |  | +/*
 | 
	
		
			
				|  |  | + * Implements the whitelist command.
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +static portBASE_TYPE prvTaskWhiteListCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ){
 | 
	
		
			
				|  |  | +	int8_t *pcParameterString;
 | 
	
		
			
				|  |  | +	signed portBASE_TYPE xParameterStringLength, xReturn;
 | 
	
		
			
				|  |  | +	portBASE_TYPE xParameterNumber = 1;
 | 
	
		
			
				|  |  | +	char str[20];
 | 
	
		
			
				|  |  | +	char temp_str[20];
 | 
	
		
			
				|  |  | +	uint8_t i;
 | 
	
		
			
				|  |  | +	char *beginValue;
 | 
	
		
			
				|  |  | +	uint8_t len;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	( void ) pcCommandString;
 | 
	
		
			
				|  |  | +	( void ) xWriteBufferLen;
 | 
	
		
			
				|  |  | +	configASSERT( pcWriteBuffer );
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	memset(pcWriteBuffer, 0, configCOMMAND_INT_MAX_OUTPUT_SIZE);
 | 
	
		
			
				|  |  | +	/* Obtain the parameter string. */
 | 
	
		
			
				|  |  | +	pcParameterString = ( int8_t * ) FreeRTOS_CLIGetParameter
 | 
	
		
			
				|  |  | +															(
 | 
	
		
			
				|  |  | +																pcCommandString,		/* The command string itself. */
 | 
	
		
			
				|  |  | +																xParameterNumber,		/* Return the next parameter. */
 | 
	
		
			
				|  |  | +																&xParameterStringLength	/* Store the parameter string length. */
 | 
	
		
			
				|  |  | +															);
 | 
	
		
			
				|  |  | +	if(pcParameterString == NULL){
 | 
	
		
			
				|  |  | +		strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +		return pdFALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	for(i = 0; i < ARG_WHITELIST_ALL; i ++){
 | 
	
		
			
				|  |  | +		if( strncmp( ( const char * ) pcParameterString, whitelist_args_list[i], strlen(whitelist_args_list[i]) ) == 0 ){
 | 
	
		
			
				|  |  | +			break;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	if(telnet_code_auth != ADMIN && i !=ARG_WHITELIST_INFO){
 | 
	
		
			
				|  |  | +		strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) );
 | 
	
		
			
				|  |  | +		return pdFALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	xParameterNumber ++;
 | 
	
		
			
				|  |  | +	/* Obtain the parameter string. */
 | 
	
		
			
				|  |  | +	pcParameterString = ( int8_t * ) FreeRTOS_CLIGetParameter
 | 
	
		
			
				|  |  | +															(
 | 
	
		
			
				|  |  | +																pcCommandString,		/* The command string itself. */
 | 
	
		
			
				|  |  | +																xParameterNumber,		/* Return the next parameter. */
 | 
	
		
			
				|  |  | +																&xParameterStringLength	/* Store the parameter string length. */
 | 
	
		
			
				|  |  | +															);
 | 
	
		
			
				|  |  | +	xParameterNumber ++;
 | 
	
		
			
				|  |  | +	if(pcParameterString == NULL){
 | 
	
		
			
				|  |  | +		if(i == ARG_WHITELIST_INFO){
 | 
	
		
			
				|  |  | +			whitelist_config_param(pcWriteBuffer);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		else{
 | 
	
		
			
				|  |  | +			strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return pdFALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	memset(str, 0, sizeof(str));
 | 
	
		
			
				|  |  | +	if(xParameterStringLength > (int32_t)sizeof(str))
 | 
	
		
			
				|  |  | +		xParameterStringLength = sizeof(str) - 1;
 | 
	
		
			
				|  |  | +	strncat(str, ( const char * ) pcParameterString, xParameterStringLength);
 | 
	
		
			
				|  |  | +	switch(i){
 | 
	
		
			
				|  |  | +	case ARG_WHITELIST_RANGE:
 | 
	
		
			
				|  |  | +		if(xParameterStringLength == 1 && isdigit_int(str[0])){
 | 
	
		
			
				|  |  | +			int32_t temp = atoi(str);
 | 
	
		
			
				|  |  | +			if(temp > 0 && temp < 6){
 | 
	
		
			
				|  |  | +				pcParameterString = ( int8_t * ) FreeRTOS_CLIGetParameter
 | 
	
		
			
				|  |  | +																		(
 | 
	
		
			
				|  |  | +																			pcCommandString,		/* The command string itself. */
 | 
	
		
			
				|  |  | +																			xParameterNumber,		/* Return the next parameter. */
 | 
	
		
			
				|  |  | +																			&xParameterStringLength	/* Store the parameter string length. */
 | 
	
		
			
				|  |  | +																		);
 | 
	
		
			
				|  |  | +				if(pcParameterString != NULL){
 | 
	
		
			
				|  |  | +					memset(str, 0, sizeof(str));
 | 
	
		
			
				|  |  | +					xParameterStringLength = strlen(( const char * ) pcParameterString);
 | 
	
		
			
				|  |  | +					if(xParameterStringLength > (int32_t)sizeof(str))
 | 
	
		
			
				|  |  | +						xParameterStringLength = sizeof(str) - 1;
 | 
	
		
			
				|  |  | +					strncat(str, ( const char * ) pcParameterString, strlen(( const char * ) pcParameterString));
 | 
	
		
			
				|  |  | +					if(xParameterStringLength <= 19){
 | 
	
		
			
				|  |  | +						beginValue = strpbrk(str,"/");
 | 
	
		
			
				|  |  | +						if(beginValue == NULL){
 | 
	
		
			
				|  |  | +							strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +							return pdFALSE;
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +						len = beginValue - str;
 | 
	
		
			
				|  |  | +						memset(temp_str, 0, sizeof(temp_str));
 | 
	
		
			
				|  |  | +						strncpy(temp_str, str, len);
 | 
	
		
			
				|  |  | +						for(uint8_t j = (len + 1); j < xParameterStringLength; j++){
 | 
	
		
			
				|  |  | +							if(!isdigit_int(str[j])){
 | 
	
		
			
				|  |  | +								strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +								return pdFALSE;
 | 
	
		
			
				|  |  | +							}
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +						if(ipaddr_addr(temp_str) != IPADDR_NONE){
 | 
	
		
			
				|  |  | +							SetWhiteListSTR(str, (temp - 1));
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +						else{
 | 
	
		
			
				|  |  | +							strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +					else{
 | 
	
		
			
				|  |  | +						strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +				else{
 | 
	
		
			
				|  |  | +					memset(str, 0, sizeof(str));
 | 
	
		
			
				|  |  | +					SetWhiteListSTR(str, temp);
 | 
	
		
			
				|  |  | +					if(temp > 0 && temp < 6){
 | 
	
		
			
				|  |  | +						SETTINGS_Save();
 | 
	
		
			
				|  |  | +						log_event_data(LOG_SETTING_SAVE, name_login_telnet);
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			else{
 | 
	
		
			
				|  |  | +				strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		else{
 | 
	
		
			
				|  |  | +			strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	default:
 | 
	
		
			
				|  |  | +		strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	xReturn = pdFALSE;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return xReturn;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /*
 | 
	
		
			
				|  |  |   * Implements the change password command.
 | 
	
		
			
				|  |  |   */
 | 
	
	
		
			
				|  | @@ -1360,6 +1523,11 @@ static portBASE_TYPE prvTaskConfigCommand( int8_t *pcWriteBuffer, size_t xWriteB
 | 
	
		
			
				|  |  |  			case PARAM_CONFIG_INOUTS:
 | 
	
		
			
				|  |  |  				inouts_config_param(pcWriteBuffer);
 | 
	
		
			
				|  |  |  				break;
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +#ifdef HARDWARE_BT6708
 | 
	
		
			
				|  |  | +			case PARAM_CONFIG_WHITELIST:
 | 
	
		
			
				|  |  | +				whitelist_config_param(pcWriteBuffer);
 | 
	
		
			
				|  |  | +				break;
 | 
	
		
			
				|  |  |  #endif
 | 
	
		
			
				|  |  |  			case PARAM_CONFIG_NET:
 | 
	
		
			
				|  |  |  				net_config_param(pcWriteBuffer);
 | 
	
	
		
			
				|  | @@ -1459,7 +1627,7 @@ static portBASE_TYPE prvTaskNetConfigCommand( int8_t *pcWriteBuffer, size_t xWri
 | 
	
		
			
				|  |  |  		  if (GetStateWebReinit() == true)
 | 
	
		
			
				|  |  |  		  {
 | 
	
		
			
				|  |  |  			  start = 1;
 | 
	
		
			
				|  |  | -		  telnet_act = true;
 | 
	
		
			
				|  |  | +			  telnet_act = true;
 | 
	
		
			
				|  |  |  			SetWebReinitFlag(true);
 | 
	
		
			
				|  |  |  			HTTP_SaveSettings();
 | 
	
		
			
				|  |  |  			strcpy( ( char * ) pcWriteBuffer, "\t\tНастройки сохранены! Контроллер будет перезагружен\r\n\tПосле перезагрузки подтвердите изменения сетевых настроек\r\n");
 |