Source
ifr = (struct ifreq *)((char *)ifr + sizeof(*ifr) + (from->sa_len > sizeof(*from) ? from->sa_len - sizeof(*from) : 0));
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
static char buf_ctl[1024];
/* Low Level Discovery needs a way to get the list of network interfaces available */
/* on the monitored system. HP-UX versions starting from 11.31 have if_nameindex() */
/* available in libc, older versions have it in libipv6 which we do not want to */
/* depend on. So for older versions we use different code to get that list. */
/* More information: */
/* h20000.www2.hp.com/bc/docs/support/SupportManual/c02258083/c02258083.pdf */
static struct strbuf ctlbuf =
{
sizeof(buf_ctl),
0,
buf_ctl
};
static void add_if_name(char **if_list, size_t *if_list_alloc, size_t *if_list_offset, const char *name)
{
if (FAIL == str_in_list(*if_list, name, ZBX_IF_SEP))
{
if ('\0' != **if_list)
zbx_chrcpy_alloc(if_list, if_list_alloc, if_list_offset, ZBX_IF_SEP);
zbx_strcpy_alloc(if_list, if_list_alloc, if_list_offset, name);
}
}
static int get_if_names(char **if_list, size_t *if_list_alloc, size_t *if_list_offset)