Mike Christie 3949e1
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/include/config.h open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/include/config.h
Mike Christie 3949e1
--- open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/include/config.h	2011-08-14 22:58:02.000000000 -0500
Mike Christie 3949e1
+++ open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/include/config.h	2011-08-15 00:05:23.000000000 -0500
Mike Christie 3949e1
@@ -22,6 +22,7 @@
Mike Christie 3949e1
 
Mike Christie 3949e1
 #include <netdb.h>
Mike Christie 3949e1
 #include "list.h"
Mike Christie 3949e1
+#include "iscsi_net_util.h"
Mike Christie 3949e1
 
Mike Christie 3949e1
 /* ISIDs now have a typed naming authority in them.  We use an OUI */
Mike Christie 3949e1
 #define DRIVER_ISID_0  0x00
Mike Christie 3949e1
@@ -31,18 +32,33 @@
Mike Christie 3949e1
 /* max len of interface */
Mike Christie 3949e1
 #define ISCSI_MAX_IFACE_LEN	65
Mike Christie 3949e1
 
Mike Christie 3949e1
-#if (ISCSID_VERSION == 872) /* 2.0-872 (RHEL 6.0) */
Mike Christie 3949e1
-
Mike Christie 3949e1
 #define ISCSI_HWADDRESS_BUF_SIZE 18
Mike Christie 3949e1
 #define ISCSI_TRANSPORT_NAME_MAXLEN 16
Mike Christie 3949e1
+#define ISCSI_MAX_STR_LEN 80
Mike Christie 3949e1
 
Mike Christie 3949e1
 typedef struct iface_rec {
Mike Christie 3949e1
 	struct list_head	list;
Mike Christie 3949e1
 	/* iscsi iface record name */
Mike Christie 3949e1
 	char			name[ISCSI_MAX_IFACE_LEN];
Mike Christie 3949e1
+	uint32_t		iface_num;
Mike Christie 3949e1
 	/* network layer iface name (eth0) */
Mike Christie 3949e1
 	char			netdev[IFNAMSIZ];
Mike Christie 3949e1
 	char			ipaddress[NI_MAXHOST];
Mike Christie 3949e1
+	char			subnet_mask[NI_MAXHOST];
Mike Christie 3949e1
+	char			gateway[NI_MAXHOST];
Mike Christie 3949e1
+	char			bootproto[ISCSI_MAX_STR_LEN];
Mike Christie 3949e1
+	char			ipv6_linklocal[NI_MAXHOST];
Mike Christie 3949e1
+	char			ipv6_router[NI_MAXHOST];
Mike Christie 3949e1
+	char			ipv6_autocfg[NI_MAXHOST];
Mike Christie 3949e1
+	char			linklocal_autocfg[NI_MAXHOST];
Mike Christie 3949e1
+	char			router_autocfg[NI_MAXHOST];
Mike Christie 3949e1
+	uint16_t		vlan_id;
Mike Christie 3949e1
+	uint8_t			vlan_priority;
Mike Christie 3949e1
+	char			vlan_state[ISCSI_MAX_STR_LEN];
Mike Christie 3949e1
+	char			state[ISCSI_MAX_STR_LEN]; /* 0 = disable,
Mike Christie 3949e1
+							   * 1 = enable */
Mike Christie 3949e1
+	uint16_t		mtu;
Mike Christie 3949e1
+	uint16_t		port;
Mike Christie 3949e1
 	/*
Mike Christie 3949e1
 	 * TODO: we may have to make this bigger and interconnect
Mike Christie 3949e1
 	 * specific for infinniband 
Mike Christie 3949e1
@@ -55,40 +71,6 @@ typedef struct iface_rec {
Mike Christie 3949e1
 	 */
Mike Christie 3949e1
 	char			alias[TARGET_NAME_MAXLEN + 1];
Mike Christie 3949e1
 	char			iname[TARGET_NAME_MAXLEN + 1];
Mike Christie 3949e1
-
Mike Christie 3949e1
-	char			vlan[ISCSI_MAX_IFACE_LEN];
Mike Christie 3949e1
-} iface_rec_t;
Mike Christie 3949e1
-
Mike Christie 3949e1
-#else /* 2.0-871 (RHEL 5.5)  */
Mike Christie 3949e1
-/* number of possible connections per session */
Mike Christie 3949e1
-#define ISCSI_CONN_MAX		1
Mike Christie 3949e1
-
Mike Christie 3949e1
-#define ISCSI_TRANSPORT_NAME_MAXLEN 16
Mike Christie 3949e1
-
Mike Christie 3949e1
-typedef struct iface_rec {
Mike Christie 3949e1
-	struct list_head	list;
Mike Christie 3949e1
-	/* iscsi iface record name */
Mike Christie 3949e1
-	char			name[ISCSI_MAX_IFACE_LEN];
Mike Christie 3949e1
-	/* network layer iface name (eth0) */
Mike Christie 3949e1
-	char			netdev[IFNAMSIZ];
Mike Christie 3949e1
-	char			ipaddress[NI_MAXHOST];
Mike Christie 3949e1
-
Mike Christie 3949e1
-	/*
Mike Christie 3949e1
-	 * TODO: we may have to make this bigger and interconnect
Mike Christie 3949e1
-	 * specific for infinniband 
Mike Christie 3949e1
-	 */
Mike Christie 3949e1
-	char			hwaddress[ISCSI_MAX_IFACE_LEN];
Mike Christie 3949e1
-	char			transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
Mike Christie 3949e1
-	/*
Mike Christie 3949e1
-	 * This is only used for boot now, but the iser guys
Mike Christie 3949e1
-	 * can use this for their virtualization idea.
Mike Christie 3949e1
-	 */
Mike Christie 3949e1
-	char			alias[TARGET_NAME_MAXLEN + 1];
Mike Christie 3949e1
-	char			iname[TARGET_NAME_MAXLEN + 1];
Mike Christie 3949e1
-
Mike Christie 3949e1
-	char			vlan[ISCSI_MAX_IFACE_LEN];
Mike Christie 3949e1
 } iface_rec_t;
Mike Christie 3949e1
 
Mike Christie 3949e1
-#endif /* ISCSID_VERSION */
Mike Christie 3949e1
-
Mike Christie 3949e1
 #endif /* CONFIG_H */
Mike Christie 3949e1
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/include/iscsi_net_util.h open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/include/iscsi_net_util.h
Mike Christie 3949e1
--- open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/include/iscsi_net_util.h	1969-12-31 18:00:00.000000000 -0600
Mike Christie 3949e1
+++ open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/include/iscsi_net_util.h	2011-08-14 23:20:09.000000000 -0500
Mike Christie 3949e1
@@ -0,0 +1,11 @@
Mike Christie 3949e1
+#ifndef __ISCSI_NET_UTIL_h__
Mike Christie 3949e1
+#define __ISCSI_NET_UTIL_h__
Mike Christie 3949e1
+
Mike Christie 3949e1
+#define ISCSI_HWADDRESS_BUF_SIZE 18
Mike Christie 3949e1
+
Mike Christie 3949e1
+extern int net_get_transport_name_from_netdev(char *netdev, char *transport);
Mike Christie 3949e1
+extern int net_get_netdev_from_hwaddress(char *hwaddress, char *netdev);
Mike Christie 3949e1
+extern int net_setup_netdev(char *netdev, char *local_ip, char *mask,
Mike Christie 3949e1
+			    char *gateway, char *remote_ip, int needs_bringup);
Mike Christie 3949e1
+
Mike Christie 3949e1
+#endif
Mike Christie 3949e1
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/src/unix/iscsid_ipc.c open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/src/unix/iscsid_ipc.c
Mike Christie 3949e1
--- open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/src/unix/iscsid_ipc.c	2011-08-14 22:58:02.000000000 -0500
Mike Christie 3949e1
+++ open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/src/unix/iscsid_ipc.c	2011-08-14 23:37:00.000000000 -0500
Mike Christie 3949e1
@@ -221,18 +221,11 @@ static int parse_iface(void *arg)
Mike Christie 3949e1
 	data = (iscsid_uip_broadcast_t *) arg;
Mike Christie 3949e1
 
Mike Christie 3949e1
 	LOG_INFO(PFX "Received request for '%s' to set IP address: '%s' "
Mike Christie 3949e1
-		 "VLAN: '%s'",
Mike Christie 3949e1
+		 "VLAN: '%d'",
Mike Christie 3949e1
 		 data->u.iface_rec.rec.netdev,
Mike Christie 3949e1
-		 data->u.iface_rec.rec.ipaddress, data->u.iface_rec.rec.vlan);
Mike Christie 3949e1
+		 data->u.iface_rec.rec.ipaddress, data->u.iface_rec.rec.vlan_id);
Mike Christie 3949e1
 
Mike Christie 3949e1
-	vlan = atoi(data->u.iface_rec.rec.vlan);
Mike Christie 3949e1
-	if ((valid_vlan(vlan) == 0) &&
Mike Christie 3949e1
-	    (strcmp(data->u.iface_rec.rec.vlan, "") != 0)) {
Mike Christie 3949e1
-		LOG_ERR(PFX "Invalid VLAN tag: '%s'",
Mike Christie 3949e1
-			data->u.iface_rec.rec.vlan)
Mike Christie 3949e1
-		    rc = -EIO;
Mike Christie 3949e1
-		goto early_exit;
Mike Christie 3949e1
-	}
Mike Christie 3949e1
+	vlan = data->u.iface_rec.rec.vlan_id;
Mike Christie 3949e1
 
Mike Christie 3949e1
 	/*  Detect for CIDR notation and strip off the netmask if present */
Mike Christie 3949e1
 	rc = decode_cidr(data->u.iface_rec.rec.ipaddress, &ipam, &prefix_len);
Mike Christie 3949e1
@@ -590,7 +583,7 @@ int process_iscsid_broadcast(int s2)
Mike Christie 3949e1
 	}
Mike Christie 3949e1
 
Mike Christie 3949e1
 	/*  This will be freed by parse_iface_thread() */
Mike Christie 3949e1
-	data = (iscsid_uip_broadcast_t *) malloc(sizeof(*data));
Mike Christie 3949e1
+	data = (iscsid_uip_broadcast_t *) calloc(1, sizeof(*data));
Mike Christie 3949e1
 	if (data == NULL) {
Mike Christie 3949e1
 		LOG_ERR(PFX "Couldn't allocate memory for iface data");
Mike Christie 3949e1
 		return -ENOMEM;