From owner-freebsd-hackers Wed Jan 10 13:49:24 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id EDB2337B400; Wed, 10 Jan 2001 13:49:05 -0800 (PST) Received: from fledge.watson.org (robert@fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.11.1/8.11.1) with SMTP id f0ALml784324; Wed, 10 Jan 2001 16:48:47 -0500 (EST) (envelope-from robert@fledge.watson.org) Date: Wed, 10 Jan 2001 16:48:47 -0500 (EST) From: Robert Watson X-Sender: robert@fledge.watson.org To: Samuel Tardieu Cc: Josef Karthauser , hackers@FreeBSD.ORG, n_hibma@FreeBSD.ORG Subject: Re: Link up/down events In-Reply-To: <2001-01-10-18-06-45+trackit+sam@inf.enst.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 10 Jan 2001, Samuel Tardieu wrote: > On 10/01, Robert Watson wrote: > > | Presumably at some point in the stack, that notification is translated > | from a hardware event, which might be associated with devd in some manner > | (and possibly also exposed there). > > This is the ideal situation. The other one being that the status can be > read, which would require some polling to monitor the link status. If can already be polled, I believe through an ioctl, in -CURRENT at least: fxp0: flags=8802 mtu 1500 ether 00:d0:b7:68:4a:7b media: autoselect status: no carrier supported media: autoselect 100baseTX 100baseTX 10baseT/UTP 10baseT/UTP P 10baseT/UTP xl0: flags=8843 mtu 1500 inet6 fe80::2b0:d0ff:fe2b:76d5%xl0 prefixlen 64 scopeid 0x3 inet 10.33.40.80 netmask 0xffff0000 broadcast 10.33.255.255 ether 00:b0:d0:2b:76:d5 media: autoselect (10baseT/UTP) status: active supported media: autoselect 100baseTX 100baseTX 10baseT/UTP 10baseT/UTP Not that fxp0 is reporting no carrier, whereas xl0 is reporting an active link. A quick glance at the ifmedia.c from ifconfig shows: if (ifmr.ifm_status & IFM_AVALID) { printf(" status: "); switch (IFM_TYPE(ifmr.ifm_active)) { case IFM_ETHER: if (ifmr.ifm_status & IFM_ACTIVE) printf("active"); else printf("no carrier"); break; case IFM_FDDI: case IFM_TOKEN: if (ifmr.ifm_status & IFM_ACTIVE) printf("inserted"); else printf("no ring"); break; } As I stated previously, I believe that the link change event should be propagated up through the network stack and announced to applications via the routing socket primitive, which already announces the arrival and departure of interfaces. Robert N M Watson FreeBSD Core Team, TrustedBSD Project robert@fledge.watson.org NAI Labs, Safeport Network Services To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message