gnome-nettool-01-sun-patch.diff revision 14027
14027N/Adiff -urN gnome-nettool-2.22.0.orig/configure.in gnome-nettool-2.22.0.hacked/configure.in
14027N/A--- gnome-nettool-2.22.0.orig/configure.in 2008-03-10 18:07:42.000000000 +0000
14027N/A+++ gnome-nettool-2.22.0.hacked/configure.in 2008-07-17 15:42:01.347558000 +0100
14027N/A@@ -16,7 +16,7 @@
14027N/A AC_PROG_CC
14027N/A AC_HEADER_STDC([])
14027N/A AC_CHECK_HEADERS(sys/sockio.h)
14027N/A-AC_CHECK_HEADERS(sys/socket.h ifaddrs.h,,AC_MSG_ERROR(Required header not found: $ac_header))
14027N/A+AC_CHECK_HEADERS(sys/socket.h,,AC_MSG_ERROR(Required header not found: $ac_header))
14027N/A dnl AC_ARG_PROGRAM
14027N/A AM_PROG_LIBTOOL
14027N/A
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/Makefile.am gnome-nettool-2.22.0.hacked/src/Makefile.am
14027N/A--- gnome-nettool-2.22.0.orig/src/Makefile.am 2008-02-12 18:25:08.000000000 +0000
14027N/A+++ gnome-nettool-2.22.0.hacked/src/Makefile.am 2008-08-04 11:32:51.208692000 +0100
14027N/A@@ -8,11 +8,12 @@
14027N/A @NETTOOL_CFLAGS@
14027N/A
14027N/A LDADD = \
14027N/A- $(NETTOOL_LIBS)
14027N/A+ $(NETTOOL_LIBS)
14027N/A
14027N/A bin_PROGRAMS = gnome-nettool
14027N/A
14027N/A gnome_nettool_SOURCES = \
14027N/A+ getifaddrs.c ifaddrs.h \
14027N/A callbacks.c callbacks.h \
14027N/A nettool.c nettool.h \
14027N/A gn-combo-history.c gn-combo-history.h \
14027N/A@@ -29,7 +30,9 @@
14027N/A util-mii-wireless.h \
14027N/A main.c
14027N/A
14027N/A-gnome_nettool_LDADD = @NETTOOL_LIBS@
14027N/A+gnome_nettool_LDADD = @NETTOOL_LIBS@ \
14027N/A+ -lresolv \
14027N/A+ -lkstat
14027N/A
14027N/A EXTRA_DIST = \
14027N/A gnome-nettool.desktop.in \
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/getifaddrs.c gnome-nettool-2.22.0.hacked/src/getifaddrs.c
14027N/A--- gnome-nettool-2.22.0.orig/src/getifaddrs.c 1970-01-01 01:00:00.000000000 +0100
14027N/A+++ gnome-nettool-2.22.0.hacked/src/getifaddrs.c 2008-08-01 11:00:40.965611000 +0100
14027N/A@@ -0,0 +1,217 @@
14027N/A+/*
14027N/A+ * Copyright (c) 2006 WIDE Project. All rights reserved.
14027N/A+ *
14027N/A+ * Redistribution and use in source and binary forms, with or without
14027N/A+ * modification, are permitted provided that the following conditions
14027N/A+ * are met:
14027N/A+ * 1. Redistributions of source code must retain the above copyright
14027N/A+ * notice, this list of conditions and the following disclaimer.
14027N/A+ * 2. Redistributions in binary form must reproduce the above copyright
14027N/A+ * notice, this list of conditions and the following disclaimer in the
14027N/A+ * documentation and/or other materials provided with the distribution.
14027N/A+ * 3. Neither the name of the project nor the names of its contributors
14027N/A+ * may be used to endorse or promote products derived from this software
14027N/A+ * without specific prior written permission.
14027N/A+ *
14027N/A+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
14027N/A+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14027N/A+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
14027N/A+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
14027N/A+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
14027N/A+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
14027N/A+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
14027N/A+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
14027N/A+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
14027N/A+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
14027N/A+ * SUCH DAMAGE.
14027N/A+ */
14027N/A+
14027N/A+#include <unistd.h>
14027N/A+#include <stdlib.h>
14027N/A+#include <errno.h>
14027N/A+#include <string.h>
14027N/A+#include <sys/sockio.h>
14027N/A+#include <sys/socket.h>
14027N/A+#include <net/if.h>
14027N/A+
14027N/A+#include "ifaddrs.h"
14027N/A+
14027N/A+static int
14027N/A+get_lifreq(int fd, struct lifreq **ifr_ret)
14027N/A+{
14027N/A+ struct lifnum lifn;
14027N/A+ struct lifconf lifc;
14027N/A+ struct lifreq *lifrp;
14027N/A+
14027N/A+ lifn.lifn_family = AF_UNSPEC;
14027N/A+ lifn.lifn_flags = 0;
14027N/A+ if (ioctl(fd, SIOCGLIFNUM, &lifn) == -1)
14027N/A+ lifn.lifn_count = 16;
14027N/A+ else
14027N/A+ lifn.lifn_count += 16;
14027N/A+
14027N/A+ for (;;) {
14027N/A+ lifc.lifc_len = lifn.lifn_count * sizeof (*lifrp);
14027N/A+ lifrp = malloc(lifc.lifc_len);
14027N/A+ if (lifrp == NULL)
14027N/A+ return (-1);
14027N/A+
14027N/A+ lifc.lifc_family = AF_UNSPEC;
14027N/A+ lifc.lifc_flags = 0;
14027N/A+ lifc.lifc_buf = (char *)lifrp;
14027N/A+ if (ioctl(fd, SIOCGLIFCONF, &lifc) == -1) {
14027N/A+ free(lifrp);
14027N/A+ if (errno == EINVAL) {
14027N/A+ lifn.lifn_count <<= 1;
14027N/A+ continue;
14027N/A+ }
14027N/A+ (void) close(fd);
14027N/A+ return (-1);
14027N/A+ }
14027N/A+ if (lifc.lifc_len < (lifn.lifn_count - 1) * sizeof (*lifrp))
14027N/A+ break;
14027N/A+ free(lifrp);
14027N/A+ lifn.lifn_count <<= 1;
14027N/A+ }
14027N/A+
14027N/A+ *ifr_ret = lifrp;
14027N/A+
14027N/A+ return (lifc.lifc_len / sizeof (*lifrp));
14027N/A+}
14027N/A+
14027N/A+static size_t
14027N/A+nbytes(const struct lifreq *lifrp, int nlif, size_t socklen)
14027N/A+{
14027N/A+ size_t len = 0;
14027N/A+ size_t slen;
14027N/A+
14027N/A+ while (nlif > 0) {
14027N/A+ slen = strlen(lifrp->lifr_name) + 1;
14027N/A+ len += sizeof (struct ifaddrs) + ((slen + 3) & ~3);
14027N/A+ len += 3 * socklen;
14027N/A+ lifrp++;
14027N/A+ nlif--;
14027N/A+ }
14027N/A+ return (len);
14027N/A+}
14027N/A+
14027N/A+static struct sockaddr *
14027N/A+addrcpy(struct sockaddr_storage *addr, char **bufp)
14027N/A+{
14027N/A+ char *buf = *bufp;
14027N/A+ size_t len;
14027N/A+
14027N/A+ len = addr->ss_family == AF_INET ? sizeof (struct sockaddr_in) :
14027N/A+ sizeof (struct sockaddr_in6);
14027N/A+ (void) memcpy(buf, addr, len);
14027N/A+ *bufp = buf + len;
14027N/A+ return ((struct sockaddr *)buf);
14027N/A+}
14027N/A+
14027N/A+static int
14027N/A+populate(struct ifaddrs *ifa, int fd, struct lifreq *lifrp, int nlif, int af,
14027N/A+ char **bufp)
14027N/A+{
14027N/A+ char *buf = *bufp;
14027N/A+ size_t slen;
14027N/A+
14027N/A+ while (nlif > 0) {
14027N/A+ ifa->ifa_next = (nlif > 1) ? ifa + 1 : NULL;
14027N/A+ (void) strcpy(ifa->ifa_name = buf, lifrp->lifr_name);
14027N/A+ slen = strlen(lifrp->lifr_name) + 1;
14027N/A+ buf += (slen + 3) & ~3;
14027N/A+ if (ioctl(fd, SIOCGLIFFLAGS, lifrp) == -1)
14027N/A+ ifa->ifa_flags = 0;
14027N/A+ else
14027N/A+ ifa->ifa_flags = lifrp->lifr_flags;
14027N/A+ if (ioctl(fd, SIOCGLIFADDR, lifrp) == -1)
14027N/A+ ifa->ifa_addr = NULL;
14027N/A+ else
14027N/A+ ifa->ifa_addr = addrcpy(&lifrp->lifr_addr, &buf);
14027N/A+ if (ioctl(fd, SIOCGLIFNETMASK, lifrp) == -1)
14027N/A+ ifa->ifa_netmask = NULL;
14027N/A+ else
14027N/A+ ifa->ifa_netmask = addrcpy(&lifrp->lifr_addr, &buf);
14027N/A+ if (ifa->ifa_flags & IFF_POINTOPOINT) {
14027N/A+ if (ioctl(fd, SIOCGLIFDSTADDR, lifrp) == -1)
14027N/A+ ifa->ifa_dstaddr = NULL;
14027N/A+ else
14027N/A+ ifa->ifa_dstaddr =
14027N/A+ addrcpy(&lifrp->lifr_dstaddr, &buf);
14027N/A+ } else if (ifa->ifa_flags & IFF_BROADCAST) {
14027N/A+ if (ioctl(fd, SIOCGLIFBRDADDR, lifrp) == -1)
14027N/A+ ifa->ifa_broadaddr = NULL;
14027N/A+ else
14027N/A+ ifa->ifa_broadaddr =
14027N/A+ addrcpy(&lifrp->lifr_broadaddr, &buf);
14027N/A+ } else {
14027N/A+ ifa->ifa_dstaddr = NULL;
14027N/A+ }
14027N/A+
14027N/A+ ifa++;
14027N/A+ nlif--;
14027N/A+ lifrp++;
14027N/A+ }
14027N/A+ *bufp = buf;
14027N/A+ return (0);
14027N/A+}
14027N/A+
14027N/A+int
14027N/A+getifaddrs(struct ifaddrs **ifap)
14027N/A+{
14027N/A+ int fd4, fd6;
14027N/A+ int nif4, nif6 = 0;
14027N/A+ struct lifreq *ifr4 = NULL;
14027N/A+ struct lifreq *ifr6 = NULL;
14027N/A+ struct ifaddrs *ifa = NULL;
14027N/A+ char *buf;
14027N/A+
14027N/A+ if ((fd4 = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
14027N/A+ return (-1);
14027N/A+ if ((fd6 = socket(AF_INET6, SOCK_DGRAM, 0)) == -1 &&
14027N/A+ errno != EAFNOSUPPORT) {
14027N/A+ (void) close(fd4);
14027N/A+ return (-1);
14027N/A+ }
14027N/A+
14027N/A+ if ((nif4 = get_lifreq(fd4, &ifr4)) == -1 ||
14027N/A+ (fd6 != -1 && (nif6 = get_lifreq(fd6, &ifr6)) == -1))
14027N/A+ goto failure;
14027N/A+
14027N/A+ if (nif4 == 0 && nif6 == 0) {
14027N/A+ *ifap = NULL;
14027N/A+ return (0);
14027N/A+ }
14027N/A+
14027N/A+ ifa = malloc(nbytes(ifr4, nif4, sizeof (struct sockaddr_in)) +
14027N/A+ nbytes(ifr6, nif6, sizeof (struct sockaddr_in6)));
14027N/A+ if (ifa == NULL)
14027N/A+ goto failure;
14027N/A+
14027N/A+ buf = (char *)(ifa + nif4 + nif6);
14027N/A+
14027N/A+ if (populate(ifa, fd4, ifr4, nif4, AF_INET, &buf) == -1)
14027N/A+ goto failure;
14027N/A+ if (nif4 > 0 && nif6 > 0)
14027N/A+ ifa[nif4 - 1].ifa_next = ifa + nif4;
14027N/A+ if (populate(ifa + nif4, fd6, ifr6, nif6, AF_INET6, &buf) == -1)
14027N/A+ goto failure;
14027N/A+
14027N/A+ *ifap = ifa;
14027N/A+ return (0);
14027N/A+
14027N/A+failure:
14027N/A+ free(ifa);
14027N/A+ (void) close(fd4);
14027N/A+ if (fd6 != -1)
14027N/A+ (void) close(fd6);
14027N/A+ free(ifr4);
14027N/A+ free(ifr6);
14027N/A+ return (-1);
14027N/A+}
14027N/A+
14027N/A+void
14027N/A+freeifaddrs(struct ifaddrs *ifa)
14027N/A+{
14027N/A+ free(ifa);
14027N/A+}
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/ifaddrs.h gnome-nettool-2.22.0.hacked/src/ifaddrs.h
14027N/A--- gnome-nettool-2.22.0.orig/src/ifaddrs.h 1970-01-01 01:00:00.000000000 +0100
14027N/A+++ gnome-nettool-2.22.0.hacked/src/ifaddrs.h 2008-07-28 16:03:13.251431000 +0100
14027N/A@@ -0,0 +1,48 @@
14027N/A+/*
14027N/A+ * Copyright (c) 2006 WIDE Project. All rights reserved.
14027N/A+ *
14027N/A+ * Redistribution and use in source and binary forms, with or without
14027N/A+ * modification, are permitted provided that the following conditions
14027N/A+ * are met:
14027N/A+ * 1. Redistributions of source code must retain the above copyright
14027N/A+ * notice, this list of conditions and the following disclaimer.
14027N/A+ * 2. Redistributions in binary form must reproduce the above copyright
14027N/A+ * notice, this list of conditions and the following disclaimer in the
14027N/A+ * documentation and/or other materials provided with the distribution.
14027N/A+ * 3. Neither the name of the project nor the names of its contributors
14027N/A+ * may be used to endorse or promote products derived from this software
14027N/A+ * without specific prior written permission.
14027N/A+ *
14027N/A+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
14027N/A+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14027N/A+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
14027N/A+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
14027N/A+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
14027N/A+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
14027N/A+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
14027N/A+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
14027N/A+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
14027N/A+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
14027N/A+ * SUCH DAMAGE.
14027N/A+ */
14027N/A+
14027N/A+#ifndef __IFADDRS_H
14027N/A+#define __IFADDRS_H
14027N/A+
14027N/A+#include <sys/types.h>
14027N/A+
14027N/A+#undef ifa_broadaddr
14027N/A+#undef ifa_dstaddr
14027N/A+struct ifaddrs {
14027N/A+ struct ifaddrs *ifa_next; /* Pointer to next struct */
14027N/A+ char *ifa_name; /* Interface name */
14027N/A+ uint64_t ifa_flags; /* Interface flags */
14027N/A+ struct sockaddr *ifa_addr; /* Interface address */
14027N/A+ struct sockaddr *ifa_netmask; /* Interface netmask */
14027N/A+ struct sockaddr *ifa_dstaddr; /* P2P interface destination */
14027N/A+};
14027N/A+#define ifa_broadaddr ifa_dstaddr
14027N/A+
14027N/A+extern int getifaddrs(struct ifaddrs **);
14027N/A+extern void freeifaddrs(struct ifaddrs *);
14027N/A+#endif
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/info.c gnome-nettool-2.22.0.hacked/src/info.c
14027N/A--- gnome-nettool-2.22.0.orig/src/info.c 2008-02-12 18:25:08.000000000 +0000
14027N/A+++ gnome-nettool-2.22.0.hacked/src/info.c 2008-08-04 11:32:11.119602000 +0100
14027N/A@@ -20,6 +20,8 @@
14027N/A #include <gtk/gtk.h>
14027N/A #include <glib/gi18n.h>
14027N/A #include <glib/gprintf.h>
14027N/A+#include <errno.h>
14027N/A+#include <kstat.h>
14027N/A
14027N/A #ifdef HAVE_CONFIG_H
14027N/A # include <config.h>
14027N/A@@ -208,6 +210,106 @@
14027N/A gtk_combo_box_set_active (GTK_COMBO_BOX (info->combo), 0);
14027N/A }
14027N/A
14027N/A+char *
14027N/A+netstatus_sysdeps_read_iface_statistics (const char *iface,
14027N/A+ gulong *out_bytes,
14027N/A+ gulong *out_packets,
14027N/A+ gulong *out_errors,
14027N/A+ gulong *in_bytes,
14027N/A+ gulong *in_packets,
14027N/A+ gulong *in_errors,
14027N/A+ gulong *collisions,
14027N/A+ gulong *if_speed)
14027N/A+{
14027N/A+ char *error_message = NULL;
14027N/A+ static kstat_ctl_t *kc = NULL;
14027N/A+ kstat_t *ksp;
14027N/A+ kstat_named_t *kn;
14027N/A+
14027N/A+ /*
14027N/A+ * The linux-specific code uses -1 as the default value. But if we return -1
14027N/A+ * (see comment below), then it gets interpreted as (unsigned long)-1, which
14027N/A+ * looks stupid and is definitely more wrong than just showing 0.
14027N/A+ */
14027N/A+
14027N/A+ *out_bytes = 0;
14027N/A+ *out_packets = 0;
14027N/A+ *out_errors = 0;
14027N/A+ *in_bytes = 0;
14027N/A+ *in_packets = 0;
14027N/A+ *in_errors = 0;
14027N/A+ *collisions = 0;
14027N/A+ *if_speed = 0;
14027N/A+
14027N/A+ if (kc == NULL)
14027N/A+ {
14027N/A+ if ((kc = kstat_open ()) == NULL)
14027N/A+ return g_strdup_printf ("Cannot open /dev/kstat: %s",
14027N/A+ g_strerror (errno));
14027N/A+ }
14027N/A+ else
14027N/A+ {
14027N/A+ if (kstat_chain_update (kc) < 0)
14027N/A+ {
14027N/A+ int e = errno;
14027N/A+ kstat_close (kc);
14027N/A+ kc = NULL;
14027N/A+ return g_strdup_printf ("Cannot update kstats: %s",
14027N/A+ g_strerror (e));
14027N/A+ }
14027N/A+ }
14027N/A+
14027N/A+ if ((ksp = kstat_lookup (kc, NULL, -1, iface)) == NULL)
14027N/A+ {
14027N/A+ kstat_close (kc);
14027N/A+ kc = NULL;
14027N/A+ return g_strdup_printf ("Cannot find information on interface '%s'",
14027N/A+ iface);
14027N/A+ }
14027N/A+
14027N/A+ if (kstat_read (kc, ksp, NULL) < 0)
14027N/A+ {
14027N/A+ kstat_close (kc);
14027N/A+ kc = NULL;
14027N/A+ return g_strdup_printf ("Cannot read kstat");
14027N/A+ }
14027N/A+
14027N/A+ if ((kn = kstat_data_lookup (ksp, "rbytes")) != NULL)
14027N/A+ *in_bytes = kn->value.ui32;
14027N/A+
14027N/A+ if ((kn = kstat_data_lookup (ksp, "opackets")) != NULL)
14027N/A+ *out_packets = kn->value.ui32;
14027N/A+
14027N/A+ if ((kn = kstat_data_lookup (ksp, "oerrors")) != NULL)
14027N/A+ *out_errors = kn->value.ui32;
14027N/A+
14027N/A+ if ((kn = kstat_data_lookup (ksp, "obytes")) != NULL)
14027N/A+ *out_bytes = kn->value.ui32;
14027N/A+
14027N/A+ if ((kn = kstat_data_lookup (ksp, "ipackets")) != NULL)
14027N/A+ *in_packets = kn->value.ui32;
14027N/A+
14027N/A+ if ((kn = kstat_data_lookup (ksp, "ierrors")) != NULL)
14027N/A+ *in_errors = kn->value.ui32;
14027N/A+
14027N/A+ if ((kn = kstat_data_lookup (ksp, "collisions")) != NULL)
14027N/A+ *collisions = kn->value.ui32;
14027N/A+
14027N/A+ if ((kn = kstat_data_lookup (ksp, "ifspeed")) != NULL)
14027N/A+ *if_speed = kn->value.ui32;
14027N/A+
14027N/A+
14027N/A+
14027N/A+ /*
14027N/A+ * On Solaris, loopback doesn't report bytes, just packets. The behavior of
14027N/A+ * the linux-specific code reports an error if all the data is not present,
14027N/A+ * and that shuts the applet down. So perhaps it's best to simply return
14027N/A+ * success if we can access the data at all.
14027N/A+ */
14027N/A+
14027N/A+ return NULL;
14027N/A+}
14027N/A+
14027N/A static gboolean
14027N/A info_nic_update_stats (gpointer data)
14027N/A {
14027N/A@@ -279,6 +381,28 @@
14027N/A g_io_channel_unref (io);
14027N/A #endif /* defined(__linux__) */
14027N/A
14027N/A+ gulong out_bytes, out_pkts, out_err, in_bytes, in_pkts, in_err, collisions, ifspeed;
14027N/A+ char buf[128];
14027N/A+
14027N/A+ netstatus_sysdeps_read_iface_statistics (text, &out_bytes, &out_pkts, &out_err,
14027N/A+ &in_bytes, &in_pkts, &in_err,
14027N/A+ &collisions, &ifspeed);
14027N/A+ snprintf (buf, 128, "%ld", out_bytes);
14027N/A+ gtk_label_set_text (GTK_LABEL (info->tx_bytes), buf);
14027N/A+ snprintf (buf, 128, "%ld", out_pkts);
14027N/A+ gtk_label_set_text (GTK_LABEL (info->tx), buf);
14027N/A+ snprintf (buf, 128, "%ld", out_err);
14027N/A+ gtk_label_set_text (GTK_LABEL (info->tx_errors), buf);
14027N/A+ snprintf (buf, 128, "%ld", in_bytes);
14027N/A+ gtk_label_set_text (GTK_LABEL (info->rx_bytes), buf);
14027N/A+ snprintf (buf, 128, "%ld", in_pkts);
14027N/A+ gtk_label_set_text (GTK_LABEL (info->rx), buf);
14027N/A+ snprintf (buf, 128, "%ld", in_err);
14027N/A+ gtk_label_set_text (GTK_LABEL (info->rx_errors), buf);
14027N/A+ snprintf (buf, 128, "%ld", collisions);
14027N/A+ gtk_label_set_text (GTK_LABEL (info->collisions), buf);
14027N/A+ snprintf (buf, 128, "%ld", ifspeed);
14027N/A+ gtk_label_set_text (GTK_LABEL (info->link_speed), buf);
14027N/A return TRUE;
14027N/A }
14027N/A
14027N/A@@ -369,7 +493,7 @@
14027N/A scope = g_strdup ("Link");
14027N/A else if (IN6_IS_ADDR_SITELOCAL (&sinptr6->sin6_addr))
14027N/A scope = g_strdup ("Site");
14027N/A- else if (IN6_IS_ADDR_GLOBAL (&sinptr6->sin6_addr))
14027N/A+ else if (IN6_IS_ADDR_MC_GLOBAL (&sinptr6->sin6_addr))
14027N/A scope = g_strdup ("Global");
14027N/A else if (IN6_IS_ADDR_MC_ORGLOCAL (&sinptr6->sin6_addr))
14027N/A scope = g_strdup ("Global");
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/main.c gnome-nettool-2.22.0.hacked/src/main.c
14027N/A--- gnome-nettool-2.22.0.orig/src/main.c 2008-02-12 18:25:08.000000000 +0000
14027N/A+++ gnome-nettool-2.22.0.hacked/src/main.c 2008-07-28 15:45:28.844550000 +0100
14027N/A@@ -151,6 +151,7 @@
14027N/A current_page = INFO;
14027N/A info_set_nic (info, info_input);
14027N/A }
14027N/A+
14027N/A if (ping_input) {
14027N/A current_page = PING;
14027N/A netinfo_set_host (pinger, ping_input);
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/netstat.h gnome-nettool-2.22.0.hacked/src/netstat.h
14027N/A--- gnome-nettool-2.22.0.orig/src/netstat.h 2008-02-12 18:25:08.000000000 +0000
14027N/A+++ gnome-nettool-2.22.0.hacked/src/netstat.h 2008-07-17 15:47:02.608512000 +0100
14027N/A@@ -30,10 +30,11 @@
14027N/A # define NETSTAT_ROUTE6_FORMAT "%s %s %s %d %d %d %s"
14027N/A # define NETSTAT_MULTICAST_FORMAT "%s %d %s"
14027N/A
14027N/A-#elif defined(__FreeBSD__) || defined(__OpenBSD__)
14027N/A+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(sun)
14027N/A # define NETSTAT_PROTOCOL_FORMAT "%s %d %d %d.%d.%d.%d.%s %s %s"
14027N/A # define ALT_NETSTAT_PROTOCOL_FORMAT "%s %d %d *.%s %s %s"
14027N/A # define NETSTAT_ROUTE_FORMAT "%s %s %s %d %d %s"
14027N/A+# define NETSTAT_ROUTE6_FORMAT "%s %s %s %d %d %d %s"
14027N/A # define NETSTAT_MULTICAST_FORMAT "%s %d %s"
14027N/A
14027N/A #endif
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/ping.c gnome-nettool-2.22.0.hacked/src/ping.c
14027N/A--- gnome-nettool-2.22.0.orig/src/ping.c 2008-02-12 18:25:08.000000000 +0000
14027N/A+++ gnome-nettool-2.22.0.hacked/src/ping.c 2008-07-17 15:40:39.680340000 +0100
14027N/A@@ -310,7 +310,7 @@
14027N/A }
14027N/A
14027N/A if (program != NULL) {
14027N/A-#if defined(__sun__) || defined(__hpux__)
14027N/A+#if defined(sun) || defined(__hpux__)
14027N/A if (ip_version == IPV4)
14027N/A command =
14027N/A g_strdup_printf (PING_PROGRAM_FORMAT, program, host,
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/ping.h gnome-nettool-2.22.0.hacked/src/ping.h
14027N/A--- gnome-nettool-2.22.0.orig/src/ping.h 2008-02-12 18:25:08.000000000 +0000
14027N/A+++ gnome-nettool-2.22.0.hacked/src/ping.h 2008-07-17 15:40:16.548135000 +0100
14027N/A@@ -35,7 +35,7 @@
14027N/A # define PING_PROGRAM_FORMAT_6 "%s ping6 -c %d -n %s"
14027N/A # define PING_FORMAT "%d bytes from %s icmp_seq=%d ttl=%d time=%s %s"
14027N/A # define PING_PARAMS_6
14027N/A-#elif defined(__sun__)
14027N/A+#elif defined(sun)
14027N/A # define PING_PROGRAM_FORMAT "%s ping -s -n %s 56 %d"
14027N/A # define PING_PROGRAM_FORMAT_6 "%s ping -s -A inet6 -a -n %s 56 %d"
14027N/A # define PING_FORMAT "%d bytes from %s icmp_seq=%d. time=%f %s"
14027N/Adiff -urN gnome-nettool-2.22.0.orig/src/utils.h gnome-nettool-2.22.0.hacked/src/utils.h
14027N/A--- gnome-nettool-2.22.0.orig/src/utils.h 2008-02-12 18:25:08.000000000 +0000
14027N/A+++ gnome-nettool-2.22.0.hacked/src/utils.h 2008-07-21 11:42:26.388716000 +0100
14027N/A@@ -29,6 +29,8 @@
14027N/A # include <config.h>
14027N/A #endif
14027N/A
14027N/A+#define gethostbyname2 res_gethostbyname2
14027N/A+
14027N/A #if (GLIB_MINOR_VERSION < 2)
14027N/A
14027N/A # define _g_vsprintf vsprintf