Hi Dan, On Sun, 06 Feb 2005 14:07:20 +0200, Paul Ionescu wrote: > Hi Dan, > > On Sun, 06 Feb 2005 00:07:08 -0500, Dan Williams wrote: >> Hi, >> >> Ok, so I did non-MII link detection as follows: >> >> Every wired device has a timout function running in the device thread, >> that every 2s checks the numbers in: >> >> /sys/class/net/<dev>/statistics/rx_packets >> /sys/class/net/<dev>/statistics/collisions >> >> If the numbers have changed within the last 10s, then the code sets link >> status to TRUE. If they have not changed, it sets link status to FALSE. >> >> While this works great at the office, where there are a lot of broadcast >> packets around, this works badly for my home network with 1 server and >> just the laptop, using a Belkin F5D5020 that doesn't support either MII >> or ethtool. There just isn't enough traffic to update the statistics >> within 10s necessarily. > > I have a suggestion, but I don't really know if we can do this in NM, or > if it will work as expected, because I never tried it. > > Every X seconds we send a special frame on the wire, the destination > address is our own MAC address of that interface, which means that we > are the end destination of that packet. The ether-type can be 0x9000 > which is > registered for loopback packets. > If the link is up, we should receive this packet because it has our own > mac address as destination, which will be reflected in rx_packets > counter. Now, if we miss Y packet in a row, we could assume the link is > off. > > X is a user configurable interval, and have a sane default, like 5 or 10 > secs, and Y is the number of replies we are allow to loose before we > declare the link down. > > What do you think about it ?
I actually did some further test, and so far I like what I found. I used only ready available tools (like ping) because I did not have time to do some real programs. Here is what I did: Plug out the network cable from the eth0. On eth0 I have IP addr 10.1.1.1/24. I did "ping -b 10.1.1.255" and I could see TX bytes growing, the RX bytes were remaining the same. Then I plugged a HARD LOOPBACK RJ-45 in the eth0 network card, to simulate a silent network, and redid the ping -b. And the surprise was that it actually worked as I expected, meaning that RX bytes were growing this time, because ping -b sends a ping to the broadcast mac address. Now, this is just a proof a concept that is works this way. Comments ? _______________________________________________ NetworkManager-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/networkmanager-list
