aboutsummaryrefslogtreecommitdiffstats
path: root/net/gnome-nettool
diff options
context:
space:
mode:
authormarcus <marcus@FreeBSD.org>2004-11-01 12:40:28 +0800
committermarcus <marcus@FreeBSD.org>2004-11-01 12:40:28 +0800
commitf9f9c2af72ce1f75db4eed382b3a59b3dd9d7023 (patch)
tree17b7ea555f29ba848651eee6f1d29a2fb22ab382 /net/gnome-nettool
parent669d1bcf510083480693629aef31c3bd5bc12584 (diff)
downloadfreebsd-ports-gnome-f9f9c2af72ce1f75db4eed382b3a59b3dd9d7023.tar.gz
freebsd-ports-gnome-f9f9c2af72ce1f75db4eed382b3a59b3dd9d7023.tar.zst
freebsd-ports-gnome-f9f9c2af72ce1f75db4eed382b3a59b3dd9d7023.zip
* Add support for obtaining the MAC address for supporting interfaces [1]
* Use the PPP interface icon for tun interfaces * Detect ATM interfaces (but they're still intertified as "other") Adapted from: sample C program on hackers@ by Alecs King wandys at gawab.com [1]
Diffstat (limited to 'net/gnome-nettool')
-rw-r--r--net/gnome-nettool/Makefile1
-rw-r--r--net/gnome-nettool/files/patch-src_info.c84
2 files changed, 77 insertions, 8 deletions
diff --git a/net/gnome-nettool/Makefile b/net/gnome-nettool/Makefile
index 6be37976f6cc..043149f3aa16 100644
--- a/net/gnome-nettool/Makefile
+++ b/net/gnome-nettool/Makefile
@@ -7,6 +7,7 @@
PORTNAME= gnomenettool
PORTVERSION= 0.99.3
+PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= net gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
diff --git a/net/gnome-nettool/files/patch-src_info.c b/net/gnome-nettool/files/patch-src_info.c
index c4bd8e09b1b9..0891475e90ff 100644
--- a/net/gnome-nettool/files/patch-src_info.c
+++ b/net/gnome-nettool/files/patch-src_info.c
@@ -1,16 +1,26 @@
--- src/info.c.orig Mon Jun 14 06:52:59 2004
-+++ src/info.c Fri Aug 20 15:52:34 2004
-@@ -37,6 +37,9 @@
++++ src/info.c Sun Oct 31 23:35:06 2004
+@@ -37,6 +37,11 @@
#include <sys/ioctl.h>
#include <stdlib.h>
#include <net/if.h>
+#ifdef __FreeBSD__
++#include <sys/sysctl.h>
++#include <net/if_dl.h>
+#include <net/if_media.h>
+#endif
#include "info.h"
#include "utils.h"
-@@ -97,9 +100,39 @@
+@@ -57,6 +62,7 @@
+ { N_("Ethernet Interface"), INFO_INTERFACE_ETH, "16_ethernet.xpm", "eth", NULL },
+ { N_("Wireless Interface"), INFO_INTERFACE_WLAN, "wavelan-16.png", "wlan", NULL },
+ { N_("Modem Interface"), INFO_INTERFACE_PPP, "16_ppp.xpm", "ppp", NULL },
++ { N_("Modem Interface"), INFO_INTERFACE_PPP, "16_ppp.xpm", "tun", NULL },
+ { N_("Parallel Line Interface"), INFO_INTERFACE_PLIP, "16_plip.xpm", "plip", NULL },
+ { N_("Infrared Interface"), INFO_INTERFACE_IRLAN, "irda-16.png", "irlan", NULL },
+ { N_("Loopback Interface"), INFO_INTERFACE_LO, "16_loopback.xpm", "lo", NULL },
+@@ -97,9 +103,42 @@
{
gint i;
gchar *path;
@@ -32,6 +42,9 @@
+ break;
+ case IFM_FDDI:
+ case IFM_TOKEN:
++#ifdef IFM_ATM
++ case IFM_ATM:
++#endif
+ dev_type = "other_type";
+ break;
+ case IFM_IEEE80211:
@@ -52,7 +65,7 @@
(*iface) = g_strdup_printf ("%s (%s)", info_iface_desc[i].name, dev_name);
if (info_iface_desc[i].pixbuf == NULL) {
path = g_build_filename (PIXMAPS_DIR, info_iface_desc[i].icon, NULL);
-@@ -187,17 +220,26 @@
+@@ -187,17 +226,26 @@
gchar tx[10], tx_error[10], tx_drop[10], tx_ovr[10];
*/
gchar iface[30]; /*, flags[30]; */
@@ -83,7 +96,7 @@
g_return_val_if_fail (info != NULL, FALSE);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (info->combo));
-@@ -206,21 +248,61 @@
+@@ -206,21 +254,61 @@
else
return FALSE;
/*text = gtk_entry_get_text (GTK_ENTRY (info->nic));*/
@@ -147,7 +160,7 @@
if (g_ascii_strcasecmp (iface, text) == 0) {
/*
-@@ -248,7 +330,9 @@
+@@ -248,7 +336,9 @@
}
g_io_channel_unref (io);
@@ -158,15 +171,24 @@
return TRUE;
}
-@@ -384,6 +468,7 @@
+@@ -382,8 +472,16 @@
+ InfoIpAddr *ip;
+ gint flags;
mii_data_result data;
++#ifdef __FreeBSD__
++ gint hwmib[6], hwlen;
++ gchar *hwbuf;
++ guchar *hwptr;
++ struct if_msghdr *hwifm;
++ struct sockaddr_dl *hwsinptr;
++#endif
getifaddrs (&ifa0);
+ memset (&data, 0, sizeof (data));
for (ifr6 = ifa0; ifr6; ifr6 = ifr6->ifa_next) {
if (strcmp (ifr6->ifa_name, nic) != 0) {
-@@ -429,7 +514,9 @@
+@@ -429,7 +527,9 @@
ifc.ifc_req = (struct ifreq *) buf;
ioctl (sockfd, SIOCGIFCONF, &ifc);
@@ -176,3 +198,49 @@
for (ptr = buf; ptr < buf + ifc.ifc_len;) {
ifr = (struct ifreq *) ptr;
+@@ -460,6 +560,45 @@
+ (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[3],
+ (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[4],
+ (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[5]);
++#elif defined(__FreeBSD__)
++ hwmib[0] = CTL_NET;
++ hwmib[1] = AF_ROUTE;
++ hwmib[2] = 0;
++ hwmib[3] = AF_LINK;
++ hwmib[4] = NET_RT_IFLIST;
++ if ((hwmib[5] = if_nametoindex (nic)) == 0) {
++ g_sprintf (dst, NOT_AVAILABLE);
++ goto hwfail;
++ }
++ if (sysctl (hwmib, 6, NULL, &hwlen, NULL, 0) < 0) {
++ g_sprintf (dst, NOT_AVAILABLE);
++ goto hwfail;
++ }
++ if ((hwbuf = g_malloc (hwlen)) == NULL) {
++ g_sprintf (dst, NOT_AVAILABLE);
++ goto hwfail;
++ }
++ if (sysctl (hwmib, 6, hwbuf, &hwlen, NULL, 0) < 0) {
++ g_sprintf (dst, NOT_AVAILABLE);
++ goto hwfail;
++ }
++
++ hwifm = (struct if_msghdr *) hwbuf;
++ hwsinptr = (struct sockaddr_dl *) (hwifm + 1);
++ hwptr = (guchar *) LLADDR (hwsinptr);
++ if (*hwptr != 0 || *(hwptr + 1) != 0 ||
++ *(hwptr + 2) != 0 || *(hwptr + 3) != 0 ||
++ *(hwptr + 4) != 0 || *(hwptr + 5) != 0) {
++ g_sprintf (dst, "%02x:%02x:%02x:%02x:%02x:%02x",
++ *hwptr, *(hwptr + 1), *(hwptr + 2),
++ *(hwptr + 3), *(hwptr + 4), *(hwptr + 5));
++ }
++ else {
++ g_sprintf (dst, NOT_AVAILABLE);
++ }
++ g_free (hwbuf);
++
++hwfail:
+ #else
+ g_sprintf (dst, NOT_AVAILABLE);
+ #endif /* SIOCGIFHWADDR */