* net.cc (get_2k_ifconf): Change multiple IP address naming scheme
to Linux style. Patch by Alexander Gottwald <ago@informatik.tu-chemnitz.de>: * net.cc (get_2k_ifconf): Added support for multiple IP addresses on one interface.
This commit is contained in:
parent
8b6234ca12
commit
c270dc2555
|
@ -1,3 +1,13 @@
|
|||
2001-10-22 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* net.cc (get_2k_ifconf): Change multiple IP address naming scheme
|
||||
to Linux style.
|
||||
|
||||
Sun Oct 21 19:04:37 2001 Alexander Gottwald <ago@informatik.tu-chemnitz.de>
|
||||
|
||||
* net.cc (get_2k_ifconf): Added support for multiple IP addresses on
|
||||
one interface.
|
||||
|
||||
2001-10-22 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* miscfuncs.cc (__check_invalid_read_ptr_errno): Return error, if any.
|
||||
|
|
|
@ -1551,7 +1551,7 @@ static void
|
|||
get_2k_ifconf (struct ifconf *ifc, int what)
|
||||
{
|
||||
int cnt = 0;
|
||||
char eth[2] = "/", ppp[2] = "/", slp[2] = "/";
|
||||
char eth[2] = "/", ppp[2] = "/", slp[2] = "/", sub[2] = "0";
|
||||
|
||||
/* Union maps buffer to correct struct */
|
||||
struct ifreq *ifr = ifc->ifc_req;
|
||||
|
@ -1571,11 +1571,21 @@ get_2k_ifconf (struct ifconf *ifc, int what)
|
|||
!GetIfTable(ift, &siz_if_table, TRUE) &&
|
||||
!GetIpAddrTable(ipt, &siz_ip_table, TRUE))
|
||||
{
|
||||
/* Iterate over all known interfaces */
|
||||
for (if_cnt = 0; if_cnt < ift->dwNumEntries; ++if_cnt)
|
||||
{
|
||||
*sub = '0';
|
||||
/* Iterate over all configured IP-addresses */
|
||||
for (ip_cnt = 0; ip_cnt < ipt->dwNumEntries; ++ip_cnt)
|
||||
{
|
||||
/* Does the IP address belong to the interface? */
|
||||
if (ipt->table[ip_cnt].dwIndex == ift->table[if_cnt].dwIndex)
|
||||
{
|
||||
/* Setup the interface name */
|
||||
switch (ift->table[if_cnt].dwType)
|
||||
{
|
||||
case MIB_IF_TYPE_ETHERNET:
|
||||
if (*sub == '0')
|
||||
++*eth;
|
||||
strcpy (ifr->ifr_name, "eth");
|
||||
strcat (ifr->ifr_name, eth);
|
||||
|
@ -1596,9 +1606,13 @@ get_2k_ifconf (struct ifconf *ifc, int what)
|
|||
default:
|
||||
continue;
|
||||
}
|
||||
for (ip_cnt = 0; ip_cnt < ipt->dwNumEntries; ++ip_cnt)
|
||||
if (ipt->table[ip_cnt].dwIndex == ift->table[if_cnt].dwIndex)
|
||||
if (*sub > '0')
|
||||
{
|
||||
strcat (ifr->ifr_name, ":");
|
||||
strcat (ifr->ifr_name, sub);
|
||||
}
|
||||
++*sub;
|
||||
/* setup sockaddr struct */
|
||||
switch (what)
|
||||
{
|
||||
case SIOCGIFCONF:
|
||||
|
@ -1647,7 +1661,7 @@ get_2k_ifconf (struct ifconf *ifc, int what)
|
|||
if ((caddr_t) ++ifr >
|
||||
ifc->ifc_buf + ifc->ifc_len - sizeof (struct ifreq))
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue