zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: substitute_host_interface_macros                                 *
 *                                                                            *
 * Purpose: trying to resolve the macros in host interface                    *
 *                                                                            *
 ******************************************************************************/
substitute_host_interface_macros

Purpose: trying to resolve the macros in host interface
substitute_host_interface_macros Purpose : trying to resolve the macros in host interface
static void	substitute_host_interface_macros(ZBX_DC_INTERFACE *interface)
{
	int	macros;
	char	*addr;
	DC_HOST	host;
	macros = STR_CONTAINS_MACROS(interface->ip) ? 0x01 : 0;
	macros |= STR_CONTAINS_MACROS(interface->dns) ? 0x02 : 0;
	if (0 != macros)
	{
		DCget_host_by_hostid(&host, interface->hostid);
		if (0 != (macros & 0x01))
		{
			addr = zbx_strdup(NULL, interface->ip);
			substitute_simple_macros(NULL, NULL, NULL, NULL, NULL, &host, NULL, NULL, NULL, NULL, NULL,
					NULL, &addr, MACRO_TYPE_INTERFACE_ADDR, NULL, 0);
			if (SUCCEED == is_ip(addr) || SUCCEED == zbx_validate_hostname(addr))
				DCstrpool_replace(1, &interface->ip, addr);
			zbx_free(addr);
		}
		if (0 != (macros & 0x02))
		{
			addr = zbx_strdup(NULL, interface->dns);
			substitute_simple_macros(NULL, NULL, NULL, NULL, NULL, &host, NULL, NULL, NULL, NULL, NULL, NULL,
					&addr, MACRO_TYPE_INTERFACE_ADDR, NULL, 0);
			if (SUCCEED == is_ip(addr) || SUCCEED == zbx_validate_hostname(addr))
				DCstrpool_replace(1, &interface->dns, addr);
			zbx_free(addr);
		}
	}
}
static void substitute_host_interface_macros ( ZBX_DC_INTERFACE * interface ) { int macros ; char * addr ; DC_HOST host ; macros = STR_CONTAINS_MACROS ( interface -> ip ) ? 0x01 : 0 ; macros |= STR_CONTAINS_MACROS ( interface -> dns ) ? 0x02 : 0 ; if ( 0 != macros ) { DCget_host_by_hostid ( & host , interface -> hostid ) ; if ( 0 != ( macros & 0x01 ) ) { addr = zbx_strdup ( NULL , interface -> ip ) ; substitute_simple_macros ( NULL , NULL , NULL , NULL , NULL , & host , NULL , NULL , NULL , NULL , NULL , NULL , & addr , MACRO_TYPE_INTERFACE_ADDR , NULL , 0 ) ; if ( SUCCEED == is_ip ( addr ) || SUCCEED == zbx_validate_hostname ( addr ) ) DCstrpool_replace ( 1 , & interface -> ip , addr ) ; zbx_free ( addr ) ; } if ( 0 != ( macros & 0x02 ) ) { addr = zbx_strdup ( NULL , interface -> dns ) ; substitute_simple_macros ( NULL , NULL , NULL , NULL , NULL , & host , NULL , NULL , NULL , NULL , NULL , NULL , & addr , MACRO_TYPE_INTERFACE_ADDR , NULL , 0 ) ; if ( SUCCEED == is_ip ( addr ) || SUCCEED == zbx_validate_hostname ( addr ) ) DCstrpool_replace ( 1 , & interface -> dns , addr ) ; zbx_free ( addr ) ; } } }
Function: substitute_host_interface_macros                                 
                                                                            
 Purpose: trying to resolve the macros in host interface
Function : substitute_host_interface_macros Purpose : trying to resolve the macros in host interface