linux-um archives
 help / color / mirror / Atom feed
From: Michael Richardson <Michael.Richardson@seawaynetworks.com>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] switch->netjig patch 1
Date: Thu, 03 Jun 2004 17:00:35 -0400	[thread overview]
Message-ID: <27617.1086296435@camelot-054> (raw)


Jeff, this patch creates the file nethub.h, and moves the hub
information from uml_switch.c to this file.
(also at http://www.sandelman.ca/tmp/jig1.patch )

There is no functional change at all.



diff -x CVS -x '*~' -u -N -r uml_tools.orig/uml_router/nethub.h uml_tools/uml_router/nethub.h
--- uml_tools.orig/uml_router/nethub.h	Wed Dec 31 19:00:00 1969
+++ uml_tools/uml_router/nethub.h	Thu Jun  3 14:54:48 2004
@@ -0,0 +1,109 @@
+/*
+ * @(#) jig to exercise a UML/FreeSWAN kernel with two interfaces
+ *
+ * Copyright (C) 2001 Michael Richardson  <mcr@freeswan.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * RCSID $Id: nethub.h,v 1.7 2003/04/02 20:25:53 mcr Exp $
+ *
+ * @(#) based upon uml_router from User-Mode-Linux tools package
+ *
+ */
+
+#ifndef _NETHUB_H_
+
+#include <net/ethernet.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/queue.h>
+#include <netinet/in.h>
+
+enum request_type { REQ_NEW_CONTROL };
+
+struct request_v0 {
+  enum request_type type;
+  union {
+    struct {
+      unsigned char addr[ETH_ALEN];
+      struct sockaddr_un name;
+    } new_control;
+  } u;
+};
+
+#define SWITCH_MAGIC 0xfeedface
+
+struct request_v1 {
+  unsigned long magic;
+  enum request_type type;
+  union {
+    struct {
+      unsigned char addr[ETH_ALEN];
+      struct sockaddr_un name;
+    } new_control;
+  } u;
+};
+
+struct request_v2 {
+  unsigned long magic;
+  int version;
+  enum request_type type;
+  struct sockaddr_un sock;
+};
+
+struct reply_v2 {
+  unsigned char mac[ETH_ALEN];
+  struct sockaddr_un sock;
+};
+
+struct request_v3 {
+  unsigned long magic;
+  int version;
+  enum request_type type;
+  struct sockaddr_un sock;
+};
+
+union request {
+  struct request_v0 v0;
+  struct request_v1 v1;
+  struct request_v2 v2;
+  struct request_v3 v3;
+};
+
+#define HASH_SIZE 128
+#define HASH_MOD 11
+
+struct port;
+
+struct packet {
+  struct {
+    unsigned char dest[6];
+    unsigned char src[6];
+    u_int16_t     proto;
+  } header;
+  unsigned char data[1500];
+};
+
+#define xmalloc(X) xmalloc1((X), __FILE__, __LINE__)
+
+#define _NETHUB_H_
+
+#endif /* _NETHUB_H_ */
+
+/*
+ * $Log: nethub.h,v $
+ *
+ * Local variables:
+ * c-file-style: "linux"
+ * c-basic-offset: 8
+ * End:
+ *
+ */
Binary files uml_tools.orig/uml_router/uml_switch and uml_tools/uml_router/uml_switch differ
diff -x CVS -x '*~' -u -N -r uml_tools.orig/uml_router/uml_switch.c uml_tools/uml_router/uml_switch.c
--- uml_tools.orig/uml_router/uml_switch.c	Fri Aug 15 15:03:58 2003
+++ uml_tools/uml_router/uml_switch.c	Thu Jun  3 14:54:17 2004
@@ -20,6 +20,8 @@
 #include "tuntap.h"
 #endif
 
+#include "nethub.h"
+
 #ifdef notdef
 #include <stddef.h>
 #endif
@@ -27,57 +29,6 @@
 static int hub = 0;
 static int compat_v0 = 0;
 
-enum request_type { REQ_NEW_CONTROL };
-
-struct request_v0 {
-  enum request_type type;
-  union {
-    struct {
-      unsigned char addr[ETH_ALEN];
-      struct sockaddr_un name;
-    } new_control;
-  } u;
-};
-
-#define SWITCH_MAGIC 0xfeedface
-
-struct request_v1 {
-  uint32_t magic;
-  enum request_type type;
-  union {
-    struct {
-      unsigned char addr[ETH_ALEN];
-      struct sockaddr_un name;
-    } new_control;
-  } u;
-};
-
-struct request_v2 {
-  uint32_t magic;
-  uint32_t version;
-  enum request_type type;
-  struct sockaddr_un sock;
-};
-
-struct reply_v2 {
-  unsigned char mac[ETH_ALEN];
-  struct sockaddr_un sock;
-};
-
-struct request_v3 {
-  uint32_t magic;
-  uint32_t version;
-  enum request_type type;
-  struct sockaddr_un sock;
-};
-
-union request {
-  struct request_v0 v0;
-  struct request_v1 v1;
-  struct request_v2 v2;
-  struct request_v3 v3;
-};
-
 static char *ctl_socket = "/tmp/uml.ctl";
 
 static char *data_socket = NULL;
Binary files uml_tools.orig/uml_router/uml_switch.o and uml_tools/uml_router/uml_switch.o differ







-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

                 reply	other threads:[~2004-06-03 21:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27617.1086296435@camelot-054 \
    --to=michael.richardson@seawaynetworks.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox