netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: Hasso Tepper <hasso@estpak.ee>, netdev@oss.sgi.com
Subject: [PATCH] ip link should print NO-CARRIER for !IFF_RUNNING && IFF_UP
Date: Mon, 14 Mar 2005 17:16:21 +0100	[thread overview]
Message-ID: <20050314161621.GQ31837@postel.suug.ch> (raw)
In-Reply-To: <200503141435.38227.hasso@estpak.ee>

> Till now I thought that IFF_RUNNING flag should be used for that. But some 
> time ago I tried to bug Stephen Hemminger about missing IFF_RUNNING flag in 
> ip output and got answer that IFF_RUNNING is BSD'ism and shouldn't be used 
> any more and /sys/class/net/eth0/carrier should be looked at.

The patch below changes ip link to print NO-CARRIER flag if there is
no carrier and the link is up.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/14 17:12:43+01:00 tgraf@suug.ch 
#   [LINK] Report if link has no carrier
# 
# ip/ipaddress.c
#   2005/03/14 17:12:43+01:00 tgraf@suug.ch +2 -0
#   [LINK] Report if link has no carrier
# 
diff -Nru a/ip/ipaddress.c b/ip/ipaddress.c
--- a/ip/ipaddress.c	2005-03-14 17:13:59 +01:00
+++ b/ip/ipaddress.c	2005-03-14 17:13:59 +01:00
@@ -77,6 +77,8 @@
 void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
 {
 	fprintf(fp, "<");
+	if (flags & IFF_UP && !(flags & IFF_RUNNING))
+		fprintf(fp, "NO-CARRIER%s", flags ? "," : "");
 	flags &= ~IFF_RUNNING;
 #define _PF(f) if (flags&IFF_##f) { \
                   flags &= ~IFF_##f ; \

      parent reply	other threads:[~2005-03-14 16:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-14 12:35 Link detection Hasso Tepper
2005-03-14 13:32 ` Thomas Graf
2005-03-14 14:05   ` Hasso Tepper
2005-03-14 14:57     ` Thomas Graf
2005-03-14 18:41       ` Hasso Tepper
2005-03-14 14:41   ` Hasso Tepper
2005-03-14 15:03     ` Thomas Graf
2005-03-14 16:54     ` Thomas Graf
2005-03-14 16:16 ` Thomas Graf [this message]

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=20050314161621.GQ31837@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=hasso@estpak.ee \
    --cc=netdev@oss.sgi.com \
    --cc=shemminger@osdl.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).