LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: joshk@triplehelix.org (Joshua Kwan)
To: Tigran Aivazian <tigran@veritas.com>
Cc: linux-kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: consistent ioctl for getting all net interfaces?
Date: Sun, 23 May 2004 08:29:15 -0700	[thread overview]
Message-ID: <20040523152914.GH25346@triplehelix.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0405231616290.3600-100000@einstein.homenet>

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

On Sun, May 23, 2004 at 04:20:57PM +0100, Tigran Aivazian wrote:
> Note that a more simple solution is also possible but is less portable
> (because will depend on glibc version).

That uses if_nameindex, right? It's also affected by kernel version.

> 		if(ioctl(fd, SIOCGIFCONF, &ifc) < 0) {
> 			DPRINTF("ioctl(SIOCGIFCONF), errno=%d (%s)\n",
> 					errno, strerror(errno));
> 			if (ifc.ifc_buf)
> 				free(ifc.ifc_buf);
> 			ret = TERR_IOCTL;
> 			goto outclose;
> 		}

As I said, when I tried SIOCGIFCONF, results varied..
I think it's slightly more reliable to just keep using /proc/net/dev for
now. (My parser is more robust than viro's ;))

I took a look at the net-tools ifconfig source and saw that it also
parsed /proc/net/dev to pick up what SIOCGIFCONF didn't. Shudder.

-- 
Joshua Kwan

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 881 bytes --]

  parent reply	other threads:[~2004-05-23 15:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-23  4:28 Joshua Kwan
2004-05-23  5:35 ` viro
2004-05-23  5:57   ` Joshua Kwan
2004-05-23  6:05     ` viro
2004-05-23 15:20 ` Tigran Aivazian
2004-05-23 15:25   ` Tigran Aivazian
2004-05-23 15:29   ` Joshua Kwan [this message]
2004-05-30 20:25 ` Olaf Hering
2004-05-23 12:35 Albert Cahalan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040523152914.GH25346@triplehelix.org \
    --to=joshk@triplehelix.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tigran@veritas.com \
    --subject='Re: consistent ioctl for getting all net interfaces?' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).