[stgt] [RFC 1/1] iscsi_tcp: Support the keyword "ANY" for the iscsi_portal_addr string.

Boaz Harrosh bharrosh at panasas.com
Tue May 4 10:08:23 CEST 2010


On 05/02/2010 06:04 PM, Boaz Harrosh wrote:
> 
> Let the "ANY" keyword designate an INADDR_ANY/IN6ADDR_ANY_INIT when
> specifying the --iscsi portal=XXX command option to the iscsi_tcp protocol
> driver. (.i.e pass NULL as the first parameter to getaddrinfo());
> 
> This makes it easy to change just the port service number but
> keep tgtd bind on all interfaces. It is useful when the ISCSI
> default port is used by another demon and we want tgtd to export
> an alternative iscsi-target.
> 
> example usage:
> 	tgtd --iscsi portal=ANY:3251
> 
> Signed-off-by: Boaz Harrosh <bharrosh at panasas.com>

I know vger.kernel.org had an email problems the day I sent this.
Can anyone please comment on this patch?

Thanks in advance
Boaz

> ---
>  doc/tgtd.8.xml     |    6 ++++++
>  usr/iscsi/iscsid.c |   18 ++++++++++++------
>  2 files changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/doc/tgtd.8.xml b/doc/tgtd.8.xml
> index 33ef7f9..a6dd16c 100644
> --- a/doc/tgtd.8.xml
> +++ b/doc/tgtd.8.xml
> @@ -100,12 +100,18 @@
>        <para>
>  	This option is used to bind tgtd to a specific ip-address/portal and/or
>  	port. By default tgtd will bind to port 3260 on the wildcard address.
> +	The keyword "ANY" can be used to designate the wildcard address with a
> +	none-default port.
>        </para>
>        <para>
>        Example: to bind tgtd to a specific address and port
>        <screen format="linespecific">
>  	tgtd --iscsi portal=192.0.2.1:3260
>        </screen>
> +      Example: to bind tgtd to any address but none-default port
> +      <screen format="linespecific">
> +	tgtd --iscsi portal=ANY:3251
> +      </screen>
>        </para>
>      </refsect2>
>    </refsect1>
> diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
> index 2adc6a8..079acf3 100644
> --- a/usr/iscsi/iscsid.c
> +++ b/usr/iscsi/iscsid.c
> @@ -2312,13 +2312,19 @@ static int iscsi_param_parser(char *p)
>  			else
>  				q = strchr(addr, ',');
>  
> -			if (q)
> -				len = q - addr;
> -			else
> -				len = strlen(addr);
> +			if (0 == strncmp("ANY", addr, 3)) {
> +				if (iscsi_portal_addr)
> +					free(iscsi_portal_addr);
> +				iscsi_portal_addr = NULL;
> +			} else {
> +				if (q)
> +					len = q - addr;
> +				else
> +					len = strlen(addr);
>  
> -			iscsi_portal_addr = zalloc(len + 1);
> -			memcpy(iscsi_portal_addr, addr, len);
> +				iscsi_portal_addr = zalloc(len + 1);
> +				memcpy(iscsi_portal_addr, addr, len);
> +			}
>  		}
>  
>  		p += strcspn(p, ",");

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list