[gnome-nettool] Add initial support (routing) for OpenBSD.
- From: Jasper Lievisse Adriaanse <jasperla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nettool] Add initial support (routing) for OpenBSD.
- Date: Wed, 15 Jun 2011 08:42:54 +0000 (UTC)
commit 50b013254dfe239af364599f8ebfed14853e9390
Author: Antoine Jacoutot <ajacoutot openbsd org>
Date: Wed Jun 15 10:42:19 2011 +0200
Add initial support (routing) for OpenBSD.
src/netstat.c | 17 ++++++++++++++---
src/netstat.h | 8 +++++++-
2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/netstat.c b/src/netstat.c
index 6db508a..42cc7e9 100644
--- a/src/netstat.c
+++ b/src/netstat.c
@@ -485,8 +485,10 @@ netstat_route_tree_insert (GtkTreeView *widget, gchar *line)
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 +559,25 @@ strip_route_line (gchar * line, netstat_route_data *data)
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(__FreeBSD_kernel__) || 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,
diff --git a/src/netstat.h b/src/netstat.h
index c6f7ec3..22efab8 100644
--- a/src/netstat.h
+++ b/src/netstat.h
@@ -30,12 +30,18 @@
# define NETSTAT_ROUTE6_FORMAT "%s %s %s %d %d %d %s"
# define NETSTAT_MULTICAST_FORMAT "%s %d %s"
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__DragonFly__)
# define NETSTAT_PROTOCOL_FORMAT "%s %d %d %d.%d.%d.%d.%s %s %s"
# define ALT_NETSTAT_PROTOCOL_FORMAT "%s %d %d *.%s %s %s"
# define NETSTAT_ROUTE_FORMAT "%s %s %s %d %d %s"
# define NETSTAT_MULTICAST_FORMAT "%s %d %s"
+#elif defined(__OpenBSD__)
+# define NETSTAT_PROTOCOL_FORMAT "%s %d %d %d.%d.%d.%d.%s %s %s"
+# define ALT_NETSTAT_PROTOCOL_FORMAT "%s %d %d *.%s %s %s"
+# define NETSTAT_ROUTE_FORMAT "%s %s %s %d %d %s %d %s"
+# define NETSTAT_MULTICAST_FORMAT "%s %d %s"
+
#endif
typedef enum {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]