summaryrefslogtreecommitdiff
path: root/net/netspeed_applet/files
diff options
context:
space:
mode:
authorJean-Yves Lefort <jylefort@FreeBSD.org>2006-05-03 01:19:50 +0000
committerJean-Yves Lefort <jylefort@FreeBSD.org>2006-05-03 01:19:50 +0000
commita3812d35be28da760a38da46740f6d0cc2b8b806 (patch)
tree978dccfad544594ee6472c6d2c8b82bda6f13388 /net/netspeed_applet/files
parent- Fix the GLIBTOP_IF_FLAGS_RUNNING and GLIBTOP_IF_FLAGS_OACTIVE flags. (diff)
Update to 0.13.
Diffstat (limited to 'net/netspeed_applet/files')
-rw-r--r--net/netspeed_applet/files/patch-src__backend.c29
-rw-r--r--net/netspeed_applet/files/patch-src__backend.h24
-rw-r--r--net/netspeed_applet/files/patch-src_backend.c56
-rw-r--r--net/netspeed_applet/files/patch-src_netspeed.c66
4 files changed, 91 insertions, 84 deletions
diff --git a/net/netspeed_applet/files/patch-src__backend.c b/net/netspeed_applet/files/patch-src__backend.c
deleted file mode 100644
index c7933235a296..000000000000
--- a/net/netspeed_applet/files/patch-src__backend.c
+++ /dev/null
@@ -1,29 +0,0 @@
---- src/backend.c.orig Thu Apr 21 11:12:12 2005
-+++ src/backend.c Thu Apr 21 11:23:38 2005
-@@ -158,6 +158,7 @@
- } else devinfo.ip = NULL;
-
- /* Get the hardware/physical adress/ MAC */
-+#ifndef __FreeBSD__
- if (ioctl(fd, SIOCGIFHWADDR, &request) == 0) {
- unsigned char hwaddr[6];
- struct sockaddr *hwaddress = &request.ifr_hwaddr;
-@@ -170,11 +171,17 @@
- #else
- hwaddr[5], hwaddr[4], hwaddr[3], hwaddr[2], hwaddr[1], hwaddr[0]);
- #endif
-- } else devinfo.hwaddr = NULL;
-+ } else
-+#endif
-+ devinfo.hwaddr = NULL;
-
- /* Get the subnetmask */
- if (ioctl(fd, SIOCGIFNETMASK, &request) == 0) {
-+#ifndef __FreeBSD__
- struct sockaddr_in *address = (struct sockaddr_in*)&request.ifr_netmask;
-+#else
-+ struct sockaddr_in *address = (struct sockaddr_in*)&request.ifr_addr;
-+#endif
- devinfo.netmask = g_strdup_printf("%s", inet_ntoa(address->sin_addr));
- } else devinfo.netmask = NULL;
-
diff --git a/net/netspeed_applet/files/patch-src__backend.h b/net/netspeed_applet/files/patch-src__backend.h
deleted file mode 100644
index 176efc3e79b1..000000000000
--- a/net/netspeed_applet/files/patch-src__backend.h
+++ /dev/null
@@ -1,24 +0,0 @@
---- src/backend.h.orig Wed Dec 1 13:43:47 2004
-+++ src/backend.h Fri Apr 22 01:28:34 2005
-@@ -20,18 +20,20 @@
- #ifndef _BACKEND_H
- #define _BACKEND_H
-
-+#include "config.h"
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <string.h>
- #include <ctype.h>
-+#include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <net/if.h>
- #include <sys/ioctl.h>
- #include <glib.h>
--#ifdef USE_GLIBTOP
-+#ifdef USE_LIBGTOP
- #include <glibtop/netload.h>
- #endif
-
diff --git a/net/netspeed_applet/files/patch-src_backend.c b/net/netspeed_applet/files/patch-src_backend.c
new file mode 100644
index 000000000000..041a6d941efd
--- /dev/null
+++ b/net/netspeed_applet/files/patch-src_backend.c
@@ -0,0 +1,56 @@
+--- src/backend.c.orig Wed May 3 02:41:00 2006
++++ src/backend.c Wed May 3 03:03:09 2006
+@@ -20,6 +20,7 @@
+ #include <config.h>
+ #include <glibtop/netlist.h>
+ #include <glibtop/netload.h>
++#include <net/if_media.h>
+ #include "backend.h"
+
+ /* Check for all available devices. This really should be
+@@ -131,7 +132,7 @@
+
+ g_strlcpy(request.ifr_name, devinfo->name, sizeof request.ifr_name);
+
+- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
++ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ goto out;
+
+ if (ioctl(fd, SIOCGIFFLAGS, &request) == -1)
+@@ -148,16 +149,20 @@
+ }
+ }
+
++ if (devinfo->type == DEV_UNKNOWN) {
++ struct ifmediareq ifmr;
+
+- if (ioctl(fd, SIOCGIWNAME, &request) >= 0) {
+- devinfo->type = DEV_WIRELESS;
+- }
++ memset(&ifmr, 0, sizeof(ifmr));
++ g_strlcpy(ifmr.ifm_name, devinfo->name, sizeof(ifmr.ifm_name));
+
+- if (ioctl(fd, SIOCGIWENCODE, &request) >= 0) {
+- g_assert_not_reached();
++ if (ioctl(fd, SIOCGIFMEDIA, &ifmr) >= 0) {
++ switch (IFM_TYPE(ifmr.ifm_current)) {
++ case IFM_ETHER: devinfo->type = DEV_ETHERNET; break;
++ case IFM_IEEE80211: devinfo->type = DEV_WIRELESS; break;
++ }
++ }
+ }
+
+-
+ out:
+ if(fd != -1)
+ close(fd);
+@@ -210,9 +215,6 @@
+ else {
+ devinfo.type = DEV_PPP;
+ }
+- }
+- else if (g_str_has_prefix(device, "eth")) {
+- devinfo.type = DEV_ETHERNET;
+ }
+
+ get_additional_info(&devinfo);
diff --git a/net/netspeed_applet/files/patch-src_netspeed.c b/net/netspeed_applet/files/patch-src_netspeed.c
index d19ecd4969a1..580d2bdd79f9 100644
--- a/net/netspeed_applet/files/patch-src_netspeed.c
+++ b/net/netspeed_applet/files/patch-src_netspeed.c
@@ -1,36 +1,40 @@
---- src/netspeed.c.orig Sat Apr 15 03:17:56 2006
-+++ src/netspeed.c Sat Apr 15 03:27:09 2006
-@@ -164,11 +164,17 @@ change_icons(NetspeedApplet *applet)
- {
- if (strstr(device, "ppp"))
- type = gdk_pixbuf_new_from_xpm_data(ICON_PPP);
-- else if (!strcmp(device, "lo"))
-+ else if (strstr(device, "tun"))
-+ type = gdk_pixbuf_new_from_xpm_data(ICON_PPP);
-+ else if (strstr(device, "lo"))
- type = gdk_pixbuf_new_from_xpm_data(ICON_LO);
-- else if (strstr(device, "lip"))
-+ else if (strstr(device, "plip"))
- type = gdk_pixbuf_new_from_xpm_data(ICON_PLIP);
-- else if (strstr(device, "wlan"))
-+ else if (strstr(device, "ath") || strstr(device, "an") ||
-+ strstr(device, "awi") || strstr(device, "iwi") ||
-+ strstr(device, "ipw") || strstr(device, "ndis") ||
-+ strstr(device, "ral") || strstr(device, "ural") ||
-+ strstr(device, "wi") || strstr(device, "wl"))
- type = gdk_pixbuf_new_from_xpm_data(ICON_WLAN);
- else
- type = gdk_pixbuf_new_from_xpm_data(ICON_ETH);
-@@ -386,7 +392,7 @@ search_for_up_if(NetspeedApplet *applet)
-
+--- src/netspeed.c.orig Mon May 1 19:36:46 2006
++++ src/netspeed.c Mon May 1 19:42:28 2006
+@@ -23,6 +23,7 @@
+ #include <panel-applet.h>
+ #include <panel-applet-gconf.h>
+ #include <gconf/gconf-client.h>
++#include <glibtop.h>
+ #include "backend.h"
+ #include "netspeed.h"
+
+@@ -391,7 +392,7 @@
+
devices = get_available_devices();
for (tmp = devices; tmp; tmp = g_list_next(tmp)) {
-- if (!g_str_equal(tmp->data, "lo")) {
-+ if (!g_str_equal(tmp->data, "lo0")) {
- info = get_device_info(tmp->data);
- if (info.running) {
- free_device_info(&applet->devinfo);
-@@ -1387,13 +1393,13 @@ netspeed_applet_factory(PanelApplet *app
+- if (strcmp(tmp->data, "lo") == 0) continue;
++ if (strcmp(tmp->data, "lo0") == 0) continue;
+ if (strncmp(tmp->data, "dummy", strlen("dummy")) == 0) continue;
+ info = get_device_info(tmp->data);
+ if (info.running) {
+@@ -1344,6 +1345,16 @@
+ if (strcmp (iid, "OAFIID:GNOME_NetspeedApplet"))
+ return FALSE;
+
++ /*
++ * Work around a design flaw in libgtop: force an initialisation
++ * of the server, otherwise glibtop_get_netlist() will find that
++ * the server is not needed and glibtop_get_netload() (which needs
++ * the server) will fail.
++ *
++ * Jean-Yves Lefort <jylefort@FreeBSD.org> 20060501
++ */
++ glibtop_init();
++
+ icon_theme = gtk_icon_theme_get_default();
+ gtk_icon_theme_append_search_path(icon_theme, DATADIR"/pixmaps/"PACKAGE);
+
+@@ -1432,13 +1443,13 @@
GList *ptr, *devices = get_available_devices();
ptr = devices;
while (ptr) {