Re: Wired NIC bridged through WLAN AP doesn't auto-connect



On Fri, 2008-02-15 at 19:28 +0100, Steinar Bang wrote:
> >>>>> Dan Williams <dcbw redhat com>:
> 
> > What hardware is the wired NIC?  It could be that your NIC doesn't
> > support carrier detection, at which point NetworkManager will not
> > automatically bring the NIC up because it has no way of knowing if a
> > cable is plugged in or not.
> 
> The mii-tool measurements I did seemed to indicate that the NIC could do
> carrier detect.
> 
> But nm-tool seems to think it can't:
> 
> NetworkManager Tool
> 
> State: connected
> 
> - Device: eth0 ----------------------------------------------------------------
>   NM Path:           /org/freedesktop/NetworkManager/Devices/eth0
>   Type:              Wired
>   Driver:            tlan
>   Active:            yes
>   HW Address:        00:80:5F:8B:29:C1
> 
>   Capabilities:
>     Supported:       yes
> 
>   Wired Settings
>     Hardware Link:   yes
> 
>   IP Settings:
>     IP Address:      10.10.10.10
>     Subnet Mask:     255.255.255.0
>     Broadcast:       10.10.10.255
>     Gateway:         10.10.10.1
>     Primary DNS:     10.10.10.1
>     Secondary DNS:   0.0.0.0
> 
> The wired NIC on my laptop (tg3 driver) reports 
>     Carrier Detect:  yes
> under Capabilities.
> 
> Is the content of the capabilities something NetworkManger gets from the
> NIC itself?  Or is it set somewhere in the NetworkManager config?

It's autodetected from the card.  NM will try to get the carrier state
through ethtool, then through mii-tool.  If both methods fail, it will
assume that your card doesn't support carrier detection.  For MII, the
device must support the SIOCGMIIPHY ioctl and allow reading of the
MII_BMSR register.

Can you run the attached tool and report what it says?  Compile it like:

gcc -o miitest miitest.c

and run it as root like:

sudo ./miitest eth0

Dan


#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <string.h>
#include <linux/if.h>

#include <linux/mii.h>
#include <linux/sockios.h>

int main (int argc, char **argv)
{
	int fd, err;
	struct ifreq ifr;
	struct mii_ioctl_data *mii;

	if (argc != 2) {
		fprintf (stderr, "Usage: %s <interface>\n", argv[0]);
		return 1;
	}

	fd = socket (PF_INET, SOCK_DGRAM, 0);
	if (fd < 0) {
		fprintf (stderr, "Error: couldn't open socket.\n");
		return 1;
	}

	strncpy (ifr.ifr_name, argv[1], sizeof (ifr.ifr_name) - 1);
	err = ioctl (fd, SIOCGMIIPHY, &ifr);
	if (err != 0) {
		fprintf (stderr, "Error: couldn't ioctl(GMIIPHY).  errno %d\n", errno);
		close (fd);
		return 1;
	}

	mii = (struct mii_ioctl_data *) &(ifr.ifr_ifru);
	mii->reg_num = MII_BMSR;

	/* If we can read the BMSR register, we assume that the card supports MII link detection */
	if (ioctl (fd, SIOCGMIIREG, &ifr) >= 0)
		fprintf (stdout, "%s supports MII carrier detection\n", argv[1]);
	else
		fprintf (stdout, "%s does not support MII carrier detect\n", argv[1]);

	close (fd);
	return 0;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]