linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SIOCGMIIPHY and SIOCGIFCONF
@ 2004-07-07  7:31 Lejanson C. Go
  2004-07-07  8:27 ` Glynn Clements
  0 siblings, 1 reply; 4+ messages in thread
From: Lejanson C. Go @ 2004-07-07  7:31 UTC (permalink / raw)
  To: linux-c-programming

Good day,

I am a newbie in this list. I am bit confused in this 2 flags.
I am planning to make a network program which determines if the
interface is still up, down or unknown in real time.
Which of the 2 should I used? Which is more advisable?

Thanks a lot.

Lejanson

-- 
Revenge is best served when cold.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIOCGMIIPHY and SIOCGIFCONF
  2004-07-07  7:31 SIOCGMIIPHY and SIOCGIFCONF Lejanson C. Go
@ 2004-07-07  8:27 ` Glynn Clements
  2004-07-07  8:45   ` Lejanson C. Go
  0 siblings, 1 reply; 4+ messages in thread
From: Glynn Clements @ 2004-07-07  8:27 UTC (permalink / raw)
  To: Lejanson C. Go; +Cc: linux-c-programming


Lejanson C. Go wrote:

> I am a newbie in this list. I am bit confused in this 2 flags.
> I am planning to make a network program which determines if the
> interface is still up, down or unknown in real time.
> Which of the 2 should I used? Which is more advisable?

SIOCGIFCONF returns the "logical" status of the interface. SIOCGMIIPHY
returns the contents of MII registers directly from the hardware.

SIOCGIFCONF will tell you if the interface is enabled, but it won't
tell you e.g. whether the ethernet cable is plugged in. OTOH,
SIOCGIFCONF works on all network interfaces, while SIOCGMIIPHY only
works on ethernet interfaces, and only on those which support the MII
interface.

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIOCGMIIPHY and SIOCGIFCONF
  2004-07-07  8:27 ` Glynn Clements
@ 2004-07-07  8:45   ` Lejanson C. Go
  2004-07-07 21:34     ` John Richard Moser
  0 siblings, 1 reply; 4+ messages in thread
From: Lejanson C. Go @ 2004-07-07  8:45 UTC (permalink / raw)
  To: Glynn Clements; +Cc: linux-c-programming


Does most ethernet interface support MII interface? I also
tried SIOCGIFCONF but even if the cable is unplugged it will
still report LINK UP while SIOCGMIIPHY returns LINK DOWN when
the cable is unplugged.

How will I be able to override the SIOCGIFCONF so I can support
all network interfaces? I already tried using SIOCGMIIPHY and its
okay. But I am looking for ways to override the SIOCGIFCONF
behavior.

Thanks alot.


Glynn Clements wrote:
> Lejanson C. Go wrote:
> 
> 
>>I am a newbie in this list. I am bit confused in this 2 flags.
>>I am planning to make a network program which determines if the
>>interface is still up, down or unknown in real time.
>>Which of the 2 should I used? Which is more advisable?
> 
> 
> SIOCGIFCONF returns the "logical" status of the interface. SIOCGMIIPHY
> returns the contents of MII registers directly from the hardware.
> 
> SIOCGIFCONF will tell you if the interface is enabled, but it won't
> tell you e.g. whether the ethernet cable is plugged in. OTOH,
> SIOCGIFCONF works on all network interfaces, while SIOCGMIIPHY only
> works on ethernet interfaces, and only on those which support the MII
> interface.
> 

-- 
Revenge is best served when cold.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIOCGMIIPHY and SIOCGIFCONF
  2004-07-07  8:45   ` Lejanson C. Go
@ 2004-07-07 21:34     ` John Richard Moser
  0 siblings, 0 replies; 4+ messages in thread
From: John Richard Moser @ 2004-07-07 21:34 UTC (permalink / raw)
  To: Lejanson C. Go; +Cc: Glynn Clements, linux-c-programming

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

SIOCGIFCONF tells you if the interface is administratively down.
SIOMIIPHY tells you if the link is active.

Thus, you have three interesting states, similar to those on a CISCO router:

"Interface is administratively down."
The interface is disabled, i.e. via ifconfig.

"Interface is up, link is down."
The interface is enabled, i.e. via ifconfig; the link is physically
down, i.e. no cable.

"Interface is up, link is up."
The interface is enabled, and the link is physically up and usable.
Pinging accross this to another up/up interface attached to the opposite
end of the cable should be possible.

For cards without an MII controller, the best you can get is:
"Interface is up, link state unknown."

Lejanson C. Go wrote:
|
| Does most ethernet interface support MII interface? I also
| tried SIOCGIFCONF but even if the cable is unplugged it will
| still report LINK UP while SIOCGMIIPHY returns LINK DOWN when
| the cable is unplugged.
|
| How will I be able to override the SIOCGIFCONF so I can support
| all network interfaces? I already tried using SIOCGMIIPHY and its
| okay. But I am looking for ways to override the SIOCGIFCONF
| behavior.
|
| Thanks alot.
|
|
| Glynn Clements wrote:
|
|> Lejanson C. Go wrote:
|>
|>
|>> I am a newbie in this list. I am bit confused in this 2 flags.
|>> I am planning to make a network program which determines if the
|>> interface is still up, down or unknown in real time.
|>> Which of the 2 should I used? Which is more advisable?
|>
|>
|>
|> SIOCGIFCONF returns the "logical" status of the interface. SIOCGMIIPHY
|> returns the contents of MII registers directly from the hardware.
|>
|> SIOCGIFCONF will tell you if the interface is enabled, but it won't
|> tell you e.g. whether the ethernet cable is plugged in. OTOH,
|> SIOCGIFCONF works on all network interfaces, while SIOCGMIIPHY only
|> works on ethernet interfaces, and only on those which support the MII
|> interface.
|>
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA7Gx7hDd4aOud5P8RApGmAJ92J239z12Dk6e0O7M8DEDFibvU6ACfWaSJ
IQZlcPmpHIT6axYEoWR9znU=
=1kBS
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-07-07 21:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-07  7:31 SIOCGMIIPHY and SIOCGIFCONF Lejanson C. Go
2004-07-07  8:27 ` Glynn Clements
2004-07-07  8:45   ` Lejanson C. Go
2004-07-07 21:34     ` John Richard Moser

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).