summaryrefslogtreecommitdiffstats
path: root/net/gnome-netstatus/files
diff options
context:
space:
mode:
Diffstat (limited to 'net/gnome-netstatus/files')
-rw-r--r--net/gnome-netstatus/files/patch-configure10
-rw-r--r--net/gnome-netstatus/files/patch-src_netstatus-iface.c114
-rw-r--r--net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c160
3 files changed, 0 insertions, 284 deletions
diff --git a/net/gnome-netstatus/files/patch-configure b/net/gnome-netstatus/files/patch-configure
deleted file mode 100644
index f195f07b4..000000000
--- a/net/gnome-netstatus/files/patch-configure
+++ /dev/null
@@ -1,10 +0,0 @@
---- configure.orig Wed Dec 11 18:31:51 2002
-+++ configure Thu Dec 12 12:07:17 2002
-@@ -7414,6 +7414,7 @@
-
- # This can be used to rebuild libtool when needed
- LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
-+$ac_aux_dir/ltconfig $LIBTOOL_DEPS
-
- # Always use our own libtool.
- LIBTOOL='$(SHELL) $(top_builddir)/libtool'
diff --git a/net/gnome-netstatus/files/patch-src_netstatus-iface.c b/net/gnome-netstatus/files/patch-src_netstatus-iface.c
deleted file mode 100644
index f33269915..000000000
--- a/net/gnome-netstatus/files/patch-src_netstatus-iface.c
+++ /dev/null
@@ -1,114 +0,0 @@
---- src/netstatus-iface.c.orig Fri Oct 31 08:49:51 2003
-+++ src/netstatus-iface.c Fri Jan 2 23:29:27 2004
-@@ -32,9 +32,12 @@
-
- #include <libgnome/gnome-i18n.h>
-
-+#include <sys/types.h>
-+#include <sys/socket.h>
- #include <sys/ioctl.h>
- #include <net/if.h>
- #include <net/if_arp.h>
-+#include <netinet/in.h>
- #include <arpa/inet.h>
- #include <errno.h>
- #include <unistd.h>
-@@ -577,6 +580,7 @@
- iface);
-
- netstatus_iface_monitor_timeout (iface);
-+
- }
- }
-
-@@ -646,7 +650,11 @@
- strncpy (if_req.ifr_name, iface->priv->name, IF_NAMESIZE - 1);
- if_req.ifr_name [IF_NAMESIZE - 1] = '\0';
- if (mask && ioctl (fd, SIOCGIFNETMASK, &if_req) == 0)
-+#if !defined(__FreeBSD__)
- *mask = g_strdup (inet_ntoa (((struct sockaddr_in *) &if_req.ifr_netmask)->sin_addr));
-+#else
-+ *mask = g_strdup (inet_ntoa (((struct sockaddr_in *) &if_req.ifr_addr)->sin_addr));
-+#endif
-
- close (fd);
-
-@@ -925,6 +933,7 @@
- char **hw_addr)
-
- {
-+#ifdef SIOCGIFHWADDR
- static struct HwType *hw_type = NULL;
- struct ifreq if_req;
- int fd;
-@@ -973,6 +982,9 @@
- *hw_addr = hw_type->print_hw_addr (if_req.ifr_hwaddr.sa_data);
-
- return hw_type;
-+#else
-+ return NULL;
-+#endif
- }
-
- gboolean
-@@ -1083,8 +1095,11 @@
- struct ifconf *if_conf;
- GList *interfaces;
- GList *loopbacks;
-+ gchar *ptr;
- int fd;
-- int i;
-+ struct ifreq *if_req;
-+ int len;
-+ gboolean loopback;
-
- if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
- {
-@@ -1105,12 +1120,25 @@
- interfaces = NULL;
- loopbacks = NULL;
-
-- for (i = 0; i < if_conf->ifc_len / sizeof (struct ifreq); i++)
-+ for (ptr = if_conf->ifc_buf; ptr < if_conf->ifc_buf + if_conf->ifc_len;)
- {
-- struct ifreq if_req = if_conf->ifc_req [i];
-- gboolean loopback = FALSE;
-+ if_req = (struct ifreq *) ptr;
-+ loopback = FALSE;
-+ len = sizeof(struct sockaddr);
-+#if defined(HAVE_SOCKADDR_SA_LEN) || defined(__FreeBSD__)
-+ if (if_req->ifr_addr.sa_len > len)
-+ len = if_req->ifr_addr.sa_len;
-+#endif
-+
-+ ptr += sizeof(if_req->ifr_name) + len;
-+
-+ if (g_list_find_custom (interfaces, if_req->ifr_name,
-+ (GCompareFunc) g_ascii_strcasecmp) != NULL
-+ || g_list_find_custom (loopbacks, if_req->ifr_name,
-+ (GCompareFunc) g_ascii_strcasecmp) != NULL)
-+ continue;
-
-- if (ioctl (fd, SIOCGIFFLAGS, &if_req) < 0)
-+ if (ioctl (fd, SIOCGIFFLAGS, if_req) < 0)
- {
- if (error)
- *error = g_error_new (NETSTATUS_ERROR,
-@@ -1120,13 +1148,14 @@
- }
- else
- {
-- loopback = (if_req.ifr_flags & IFF_LOOPBACK);
-+ loopback = (if_req->ifr_flags & IFF_LOOPBACK);
- }
-
- if (!loopback)
-- interfaces = g_list_prepend (interfaces, g_strdup (if_req.ifr_name));
-+ interfaces = g_list_prepend (interfaces, g_strdup (if_req->ifr_name));
- else
-- loopbacks = g_list_prepend (loopbacks, g_strdup (if_req.ifr_name));
-+ loopbacks = g_list_prepend (loopbacks, g_strdup (if_req->ifr_name));
-+
- }
-
- interfaces = g_list_concat (interfaces, loopbacks);
diff --git a/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c b/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c
deleted file mode 100644
index 3598a24e6..000000000
--- a/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c
+++ /dev/null
@@ -1,160 +0,0 @@
---- src/netstatus-sysdeps.c.orig Mon Jun 9 13:18:04 2003
-+++ src/netstatus-sysdeps.c Fri Jan 2 23:29:16 2004
-@@ -27,10 +27,13 @@
-
- #include <stdio.h>
- #include <string.h>
-+#include <unistd.h>
- #include <errno.h>
- #include <glib.h>
- #include <libgnome/gnome-i18n.h>
-
-+#if !defined(__FreeBSD__)
-+
- static inline char *
- parse_iface_name (const char *buf)
- {
-@@ -90,6 +93,7 @@
- }
- }
- }
-+#endif
-
- static inline int
- parse_stats (char *buf,
-@@ -124,6 +128,8 @@
- return TRUE;
- }
-
-+#if !defined(__FreeBSD__)
-+
- static inline FILE *
- get_proc_net_dev_fh (void)
- {
-@@ -206,3 +212,126 @@
-
- return error_message;
- }
-+
-+#else
-+
-+static inline void
-+parse_header (char *buf,
-+ int *prx_idx,
-+ int *ptx_idx,
-+ int *brx_idx,
-+ int *btx_idx)
-+{
-+ char *p;
-+ int i;
-+
-+ *prx_idx = *ptx_idx = -1;
-+ *brx_idx = *btx_idx = -1;
-+
-+ p = strtok (buf, " \n\t");
-+ for (i = 0; p; i++, p = strtok (NULL, " \t\n"))
-+ {
-+ if (!strcmp (p, "Ipkts"))
-+ {
-+ *prx_idx = i;
-+ }
-+ else if (!strcmp (p, "Ibytes"))
-+ {
-+ *brx_idx = i;
-+ }
-+ else if (!strcmp (p, "Opkts"))
-+ {
-+ *ptx_idx = i;
-+ }
-+ else if (!strcmp (p, "Obytes"))
-+ {
-+ *btx_idx = i;
-+ }
-+ }
-+}
-+
-+char *
-+netstatus_sysdeps_read_iface_statistics (const char *iface,
-+ long *in_packets,
-+ long *out_packets,
-+ long *in_bytes,
-+ long *out_bytes)
-+{
-+ gchar *buf;
-+ gchar *cmd = NULL;
-+ gchar **command_line;
-+ int prx_idx, ptx_idx;
-+ int brx_idx, btx_idx;
-+ char *error_message = NULL;
-+ gchar *dir = g_get_current_dir ();
-+ gint pout;
-+ GIOChannel *channel;
-+ GError *err = NULL;
-+
-+ *in_packets = -1;
-+ *out_packets = -1;
-+ *in_bytes = -1;
-+ *out_bytes = -1;
-+
-+ cmd = g_strdup_printf ("/usr/bin/netstat netstat -n -I %s -b -f inet", iface);
-+ command_line = g_strsplit (cmd, " ", -1);
-+ g_free (cmd);
-+
-+ if (g_spawn_async_with_pipes (dir, command_line, NULL,
-+ G_SPAWN_FILE_AND_ARGV_ZERO, NULL,
-+ NULL, NULL, NULL, &pout,
-+ NULL, &err)) {
-+ g_strfreev (command_line);
-+ channel = g_io_channel_unix_new (pout);
-+ g_io_channel_read_line (channel, &buf, NULL, NULL, NULL);
-+
-+ parse_header (buf, &prx_idx, &ptx_idx, &brx_idx, &btx_idx);
-+ if (prx_idx == -1 || ptx_idx == -1 ||
-+ brx_idx == -1 || btx_idx == -1)
-+ {
-+ if (buf)
-+ g_free (buf);
-+ g_io_channel_unref (channel);
-+ g_io_channel_shutdown (channel, TRUE, NULL);
-+ close (pout);
-+ return g_strdup ("Could not parse netstat output. Unknown format");
-+ }
-+
-+ if (buf)
-+ g_free (buf);
-+ g_io_channel_read_line (channel, &buf, NULL, NULL, NULL);
-+
-+ if (!parse_stats (buf, prx_idx, ptx_idx, in_packets, out_packets,
-+ brx_idx, btx_idx, in_bytes, out_bytes))
-+ {
-+ if (error_message)
-+ g_free (error_message);
-+ error_message = g_strdup_printf (_("Could not parse interface statistics from '%s'. "
-+ "prx_idx = %d; ptx_idx = %d; brx_idx = %d; btx_idx = %d;"),
-+ buf, prx_idx, ptx_idx, brx_idx, btx_idx);
-+ }
-+
-+ if (buf)
-+ g_free (buf);
-+
-+ if ((*in_packets == -1 || *out_packets == -1 || *in_bytes == -1 || *out_bytes == -1) && !error_message)
-+ error_message = g_strdup_printf ("Could not obtain information on interface '%s' from netstat", iface);
-+
-+ g_io_channel_unref (channel);
-+ g_io_channel_shutdown (channel, TRUE, NULL);
-+ close (pout);
-+ }
-+ else {
-+ g_strfreev (command_line);
-+ if (error_message)
-+ g_free (error_message);
-+ error_message = g_strdup_printf ("Error running /usr/bin/netstat for '%s': %s",
-+ iface, err->message);
-+ g_error_free (err);
-+ }
-+
-+ g_free (dir);
-+
-+ return error_message;
-+}
-+#endif