• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing ifnet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing ifnet


  • Subject: Re: Accessing ifnet
  • From: Vincent Lubet <email@hidden>
  • Date: Fri, 6 Jun 2008 08:03:51 -0700

For example:

#include <net/kpi_interface.h>

....

errno_t
printf_ifnets(void)
{
errno_t error = 0;
ifnet_t *ifnetlist = 0, ifp;
u_int32_t n, count;

error = ifnet_list_get(IFNET_FAMILY_ANY, &ifnetlist, &count);
if (error != 0) {
printf("ifnet_list_get failed %d\n", error);
goto out;
}
for (n = 0; n < count; n++) {
ifp = ifnetlist[n];
printf("ifp %p index: %d name: %s unit: %d family: %d type: %d flags: x\n",
ifp,
ifnet_index(ifp),
ifnet_name(ifp),
ifnet_unit(ifp),
ifnet_family(ifp),
ifnet_type(ifp),
ifnet_flags(ifp)
);
}
out:
if (ifnetlist != 0)
ifnet_list_free(ifnetlist);
return error;
}



Vincent

On Jun 6, 2008, at 7:21 AM, Adi Masputra wrote:


On Jun 6, 2008, at 1:17 AM, Michael Tüxen wrote:

Loop through all interfaces and addresses and add or delete them to
our own list of addresses. I guess that I could also use a kernel socket
and an ioctl to get the information, but the code is shared between the FreeBSD
kernel, other platforms and Mac OS X. I'm trying to keep the platform specific
code minimal...

Have you looked at ifnet_list_get/ifnet_list_free KPI in <net/ kpi_interface.h>?
SIOCGIFCONF is not for a kernel ioctl client.


Adi _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Accessing ifnet
      • From: Michael Tüxen <email@hidden>
References: 
 >Accessing ifnet (From: Michael Tüxen <email@hidden>)
 >Re: Accessing ifnet (From: Adi Masputra <email@hidden>)
 >Re: Accessing ifnet (From: Michael Tüxen <email@hidden>)
 >Re: Accessing ifnet (From: Adi Masputra <email@hidden>)

  • Prev by Date: Re: Accessing ifnet
  • Next by Date: Re: Accessing ifnet
  • Previous by thread: Re: Accessing ifnet
  • Next by thread: Re: Accessing ifnet
  • Index(es):
    • Date
    • Thread