add a parameter to se the iscsi port to use
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 17 Sep 2009 22:04:49 +0000 (08:04 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 17 Sep 2009 22:04:49 +0000 (08:04 +1000)
dbench.c
dbench.h
iscsi.c

index bde99a3..1989193 100644 (file)
--- a/dbench.c
+++ b/dbench.c
@@ -47,6 +47,7 @@ struct options options = {
        .run_once            = 0,
        .allow_scsi_writes   = 0,
        .trunc_io            = 0,
+       .iscsi_lun           = 3260,
 };
 
 static struct timeval tv_start;
@@ -401,6 +402,8 @@ static void process_opts(int argc, const char **argv)
                  "iSCSI LUN to send I/O to", NULL },
                { "iscsi-portal",  0, POPT_ARG_STRING, &options.iscsi_portal, 0, 
                  "ip address of iscsi target", NULL },
+               { "iscsi-port", 0, POPT_ARG_INT, &options.iscsi_port, 0, 
+                 "iSCSI tcp port to connect to", NULL },
                { "iscsi-target",  0, POPT_ARG_STRING, &options.iscsi_target, 0, 
                  "iscsi IQN name of target", NULL },
                { "warmup", 0, POPT_ARG_INT, &options.warmup, 0, 
index bda26b6..865f0d8 100644 (file)
--- a/dbench.h
+++ b/dbench.h
@@ -157,6 +157,7 @@ struct options {
        const char *iscsi_portal;
        const char *iscsi_target;
        int iscsi_lun;
+       int iscsi_port;
 };
 
 
diff --git a/iscsi.c b/iscsi.c
index 1ee5bbd..bc4ed54 100644 (file)
--- a/iscsi.c
+++ b/iscsi.c
@@ -553,7 +553,7 @@ static void iscsi_setup(struct child_struct *child)
        }
 
        sin.sin_family      = AF_INET;
-       sin.sin_port        = htons(3260);
+       sin.sin_port        = htons(options.iscsi_port);
        if (inet_pton(AF_INET, sd->portal, &sin.sin_addr) != 1) {
                printf("Failed to convert \"%s\" into an address\n", sd->portal);
                exit(10);
@@ -618,7 +618,7 @@ static int iscsi_init(void)
        }
 
        sin.sin_family      = AF_INET;
-       sin.sin_port        = htons(3260);
+       sin.sin_port        = htons(options.iscsi_port);
        if (inet_pton(AF_INET, sd->portal, &sin.sin_addr) != 1) {
                printf("Failed to convert \"%s\" into an address\n", sd->portal);
                return 1;