Date: Fri, 12 Feb 2016 18:02:47 +0000 (UTC) From: Pallav Bose <pallav_bose@yahoo.com> To: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org> Cc: "rpokala@mac.com" <rpokala@mac.com> Subject: Re: C program API to determine negotiated link speed of a network interface? Message-ID: <604939402.3154674.1455300167449.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <249322925.1631277.1455058288002.JavaMail.yahoo@mail.yahoo.com> References: <249322925.1631277.1455058288002.JavaMail.yahoo.ref@mail.yahoo.com> <249322925.1631277.1455058288002.JavaMail.yahoo@mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Ravi,
That information you provided was very useful, thanks!
Regards,
Pallav
On Tuesday, February 9, 2016 2:51 PM, Pallav Bose <pallav_bose@yahoo.com> wrote:
Hi,
I'm writing a C program to list all available interfaces and their link speed. I can use getifaddrs(3) to obtain a list of network interfaces in a struct ifaddrs, but none of the fields in this struct gives me information about the negotiated link speed. From the man page of getifaddrs(3):
The ifaddrs structure contains at least the following entries:
struct ifaddrs *ifa_next; /* Pointer to next struct */
char *ifa_name; /* Interface name */
u_int ifa_flags; /* Interface flags */
struct sockaddr *ifa_addr; /* Interface address */
struct sockaddr *ifa_netmask; /* Interface netmask */
struct sockaddr *ifa_broadaddr; /* Interface broadcast address */
struct sockaddr *ifa_dstaddr; /* P2P interface destination */
void *ifa_data; /* Address specific data */
Running truss on ifconfig(8) tells me that the ioctl SIOCGIFMEDIA can be used, but it is not clear to me how. Is there an API in C which does this already?
# truss ifconfig em0....<snipped>....
ioctl(3,SIOCGIFMAC,0xffffe210) ERR#22 'Invalid argument'
ioctl(3,SIOCGIFMEDIA,0xffffe1f0) = 0 (0x0)
ioctl(3,SIOCGIFMEDIA,0xffffe1f0) = 0 (0x0)
media: Ethernet autoselect (1000baseT <full-duplex>)
write(1,"\tmedia: Ethernet autoselect (10"...,54) = 54 (0x36)
status: active
write(1,"\tstatus: active\n",16) = 16 (0x10)
Thanks,Pallav
From owner-freebsd-net@freebsd.org Fri Feb 12 21:02:10 2016
Return-Path: <owner-freebsd-net@freebsd.org>
Delivered-To: freebsd-net@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
[IPv6:2001:1900:2254:206a::19:1])
by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94EE2AA748A
for <freebsd-net@mailman.ysv.freebsd.org>;
Fri, 12 Feb 2016 21:02:10 +0000 (UTC)
(envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org (kenobi.freebsd.org
[IPv6:2001:1900:2254:206a::16:76])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client did not present a certificate)
by mx1.freebsd.org (Postfix) with ESMTPS id 86385F80
for <freebsd-net@FreeBSD.org>; Fri, 12 Feb 2016 21:02:10 +0000 (UTC)
(envelope-from bugzilla-noreply@freebsd.org)
Received: from bugs.freebsd.org ([127.0.1.118])
by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u1CL29kQ041577
for <freebsd-net@FreeBSD.org>; Fri, 12 Feb 2016 21:02:10 GMT
(envelope-from bugzilla-noreply@freebsd.org)
From: bugzilla-noreply@freebsd.org
To: freebsd-net@FreeBSD.org
Subject: [Bug 207087] kernel: r295285 in 10.2-STABLE breaks OpenVPN
functionality
Date: Fri, 12 Feb 2016 21:02:09 +0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: kern
X-Bugzilla-Version: 10.2-STABLE
X-Bugzilla-Keywords: regression
X-Bugzilla-Severity: Affects Only Me
X-Bugzilla-Who: g_amanakis@yahoo.com
X-Bugzilla-Status: New
X-Bugzilla-Resolution:
X-Bugzilla-Priority: ---
X-Bugzilla-Assigned-To: gnn@FreeBSD.org
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-207087-2472-eV1DQWNv11@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-207087-2472@https.bugs.freebsd.org/bugzilla/>
References: <bug-207087-2472@https.bugs.freebsd.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.20
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-net>,
<mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-net>,
<mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 12 Feb 2016 21:02:10 -0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207087
--- Comment #19 from g_amanakis@yahoo.com ---
Created attachment 166908
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=166908&action=edit
wan.pcap
--
You are receiving this mail because:
You are on the CC list for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?604939402.3154674.1455300167449.JavaMail.yahoo>
