Bug#312095: netspeed: "Always monitor a connected device, if
possible" - but not lo or dummy0
Loïc Minier
Loïc Minier <lool@dooz.org>, 312095@bugs.debian.org
Sun, 5 Jun 2005 20:31:58 +0200
--s/l3CgOIzMHHjg/5
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
tags 312095 + patch upstream pending
thanks
Hi,
On Sun, Jun 05, 2005, Hans Ulrich Niedermann wrote:
> However, the same reasoning applies to the "dummy+" interfaces, so
> dummy0 should never be chosen automatically, and the "dummy+"
> interfaces should probably added to the same exception list where "lo"
> already is.
I wrote the attached patch, I tested it quicly, and it seems ok with
a dummy0 device. This only works when netspeed search for the next
interface because it has been brought down, it won't work on startup I
think.
Bye,
--=20
Lo=EFc Minier <lool@dooz.org>
"Neutral President: I have no strong feelings one way or the other."
--s/l3CgOIzMHHjg/5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="20_debian_skip-dummy-intf.patch"
diff -urN netspeed-0.11.orig/src/netspeed.c netspeed-0.11.new/src/netspeed.c
--- netspeed-0.11.orig/src/netspeed.c 2004-12-01 16:59:34.000000000 +0100
+++ netspeed-0.11.new/src/netspeed.c 2005-06-05 17:43:24.474739408 +0200
@@ -384,16 +384,30 @@
devices = get_available_devices();
for (tmp = devices; tmp; tmp = g_list_next(tmp)) {
- if (!g_str_equal(tmp->data, "lo")) {
- info = get_device_info(tmp->data);
- if (info.running) {
- free_device_info(&applet->devinfo);
- applet->devinfo = info;
- applet->device_has_changed = TRUE;
- break;
+ /* skip lo */
+ if (g_str_equal(tmp->data, "lo")) {
+ continue;
+ }
+ /* skip "^dummy[0-9].*" interfaces */
+ if (g_str_has_prefix(tmp->data, "dummy")) {
+ /* interface name starts with "dummy" */
+ if (tmp->data[5] != 0) {
+ if (g_ascii_isdigit(tmp->data[5])) {
+ /* interface name starts with
+ * "dummy[0-9]" */
+ continue;
+ }
}
- free_device_info(&info);
}
+ /* we got an interesting interface */
+ info = get_device_info(tmp->data);
+ if (info.running) {
+ free_device_info(&applet->devinfo);
+ applet->devinfo = info;
+ applet->device_has_changed = TRUE;
+ break;
+ }
+ free_device_info(&info);
}
free_devices_list(devices);
}
--s/l3CgOIzMHHjg/5--