76 lines
2.5 KiB
Plaintext
76 lines
2.5 KiB
Plaintext
$OpenBSD: patch-src_netstat_c,v 1.3 2011/09/12 07:28:53 jasper Exp $
|
|
|
|
From de912b09b281ea9c8645f9b3870c1635f1db4fea Mon Sep 17 00:00:00 2001
|
|
From: Antoine Jacoutot <ajacoutot@openbsd.org>
|
|
Date: Thu, 16 Jun 2011 09:35:43 +0000
|
|
Subject: Fix netstat routing table display on OpenBSD.
|
|
|
|
From 50b013254dfe239af364599f8ebfed14853e9390 Mon Sep 17 00:00:00 2001
|
|
From: Antoine Jacoutot <ajacoutot@openbsd.org>
|
|
Date: Wed, 15 Jun 2011 08:42:19 +0000
|
|
Subject: Add initial support (routing) for OpenBSD.
|
|
|
|
--- src/netstat.c.orig Thu Dec 2 10:26:14 2010
|
|
+++ src/netstat.c Thu Jun 16 11:25:57 2011
|
|
@@ -110,12 +110,20 @@ netstat_get_active_option (Netinfo * netinfo)
|
|
g_return_val_if_fail (netinfo != NULL, NULL);
|
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (netinfo->routing))) {
|
|
+#if defined (__OpenBSD__)
|
|
+ if (netinfo_is_ipv6_enable ()) {
|
|
+ option = g_strdup ("-rn");
|
|
+ } else {
|
|
+ option = g_strdup ("-rn -f inet");
|
|
+ }
|
|
+#else
|
|
/* Works for Solaris and Linux */
|
|
if (netinfo_is_ipv6_enable ()) {
|
|
option = g_strdup ("-rn -A inet -A inet6");
|
|
} else {
|
|
option = g_strdup ("-rn -A inet");
|
|
}
|
|
+#endif
|
|
|
|
if (netinfo->stbar_text)
|
|
g_free (netinfo->stbar_text);
|
|
@@ -485,8 +493,10 @@ netstat_route_tree_insert (GtkTreeView *widget, gchar
|
|
g_return_if_fail (line != NULL);
|
|
|
|
count = strip_route_line (line, &data);
|
|
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
|
|
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__DragonFly__)
|
|
if (count == 6) {
|
|
+#elif defined(__OpenBSD__)
|
|
+ if (count == 8) {
|
|
#else
|
|
if ((count == 8) || (count == 7)) {
|
|
#endif
|
|
@@ -557,16 +567,25 @@ strip_route_line (gchar * line, netstat_route_data *da
|
|
gint count = 0;
|
|
gchar flags[30];
|
|
gint ref, use;
|
|
-#ifndef __FreeBDD__
|
|
+#if !defined (__FreeBSD__) && !defined(__OpenBSD__)
|
|
gchar dest[50];
|
|
gchar **items;
|
|
#endif
|
|
+#if defined(__OpenBSD__)
|
|
+ gint mtu, prio;
|
|
+#endif
|
|
|
|
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
|
|
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
|
|
count = sscanf (line, NETSTAT_ROUTE_FORMAT,
|
|
data->destination,
|
|
data->gateway, flags,
|
|
&ref, &use, data->iface);
|
|
+#elif defined(__OpenBSD__)
|
|
+ count = sscanf (line, NETSTAT_ROUTE_FORMAT,
|
|
+ data->destination,
|
|
+ data->gateway, flags,
|
|
+ &ref, &use, &mtu, &prio,
|
|
+ data->iface);
|
|
#else
|
|
count = sscanf (line, NETSTAT_ROUTE_FORMAT,
|
|
data->destination,
|