Subject: [netatalk-admins] interface code test

From: a sun <[email-masked]>
Date: Tue, 14 Dec 1999 11:54:13 -0800

hi all,

i'm making some changes to the interface detection code. if you would
send me results of the code snippet at the end, i would appreciate
it. i'm especially interested in knowing what the various solaris
versions do with it. here's the type of information that i would like:
     os: linux 2.2 / glibc 2.1.1
results: compiles without problems. returns
	 iface: lo -> 1
	 iface: eth0 -> 2
	 iface: eth0:0 -> 2

#include <stdio.h>
#include <stdlib.h>
#include <net/if.h>

main()
{
  struct if_nameindex *ifstart, *ifs;

  ifstart = ifs = if_nameindex();
  while (ifs && (ifs->if_name)) {
    printf("iface: %s -> %u\n", ifs->if_name, ifs->if_index);
    ifs++;
  }
  
  if_freenameindex(ifstart);
}

---

From: [email-masked]
Date: Tue, 14 Dec 1999 17:17:17 -0500

> From:    a sun <[email-masked]>
> To:      [email-masked]

> versions do with it. here's the type of information that i would like:

Fails to compile.  After include a few more .h's, it's clear that
if_nameindex is neither a struct or a function under solaris (2.6, but
I think you'll find if_nameindex to be a -- probably recent --
Linux-ism).

:wes

---

From: Nicholas Riley <[email-masked]>
Date: Tue, 14 Dec 1999 17:32:44 -0500

> I think you'll find if_nameindex to be a -- probably recent --

ditto (large number of compilation errors) under solaris 2.5.1 and
2.7, and no sign of if_nameindex in /usr/include/.

-- 
Nicholas Riley <[email-masked]>

---

From: a sun <[email-masked]>
Date: Tue, 14 Dec 1999 14:35:57 -0800

oh darn. i was hoping that solaris would have something like that. are
you sure that nothing useful appears in <net/if.h>? hmm. aix's
if_nameindex needs libinet. does solaris have something similar? in
any case, i have that bit of code protected by an #ifdef SIOCGIFINDEX,
so things should be all right.

-a

---

From: Andrew Morgan <[email-masked]>
Date: Tue, 14 Dec 1999 14:39:04 -0800 (PST)

> results: compiles without problems. returns

os: linux 2.0.36 OR 2.2.9 OR 2.2.12 / glibc 2.0.7
results: errors compiling
iface.c: In function `main':
iface.c:9: warning: assignment makes pointer from integer without a cast
iface.c:10: dereferencing pointer to incomplete type
iface.c:11: dereferencing pointer to incomplete type
iface.c:11: dereferencing pointer to incomplete type
iface.c:12: increment of pointer to unknown structure
iface.c:12: arithmetic on pointer to an incomplete type

os: linux 2.2.13 / glibc 2.1.1
results: compiles without problems
iface: lo -> 1
iface: eth0 -> 2

	Andy