Skip to contentSkip to conversation

switch->netjig patch 1

uml-devel Michael Richardson 1 participant 1 message Jun 3, 2004 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore 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.

uml_router/nethub.h +109 -0
diff -x CVS -x '*~' -u -N -r uml_tools.orig/uml_router/nethub.h uml_tools/uml_router/nethub.h
@@ -0,0 +1,109 @@
+/*
+ * @(#) jig to exercise a UML/FreeSWAN kernel with two interfaces
+ *
+ * Copyright (C) 2001 Michael Richardson  <[email protected]>
+ * 
+ * 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

uml_router/uml_switch.c +2 -51

65 lines not on this page · raw message

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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel