On Fri, 17 Sep 2010 18:02:05 -0700 Chandra Seetharaman <sekharan at us.ibm.com> wrote: > Implement the calling of user defined callback. > > Basically, the callback is called from target_redirected() to get > redirect address, redirect port and redirect reason in > "string_addr:string_port:string_reason" syntax. > > Signed-Off-By: Chandra Seetharaman <sekharan at us.ibm.com> > --- > usr/iscsi/target.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > Index: tgt-1.0.8/usr/iscsi/target.c > =================================================================== > --- tgt-1.0.8.orig/usr/iscsi/target.c > +++ tgt-1.0.8/usr/iscsi/target.c > @@ -197,7 +197,38 @@ int target_redirected(struct iscsi_targe > socklen_t len; > int ret, rsn; > char *p, *q, *str, *port, *addr; > + char buffer[NI_MAXHOST + NI_MAXSERV + 4]; > > + if (target->redirect_info.callback) { > + bzero(buffer, NI_MAXHOST + NI_MAXSERV + 4); > + ret = call_program(target->redirect_info.callback, > + NULL, NULL, buffer, NI_MAXHOST + NI_MAXSERV + 4, 0); > + if (ret) > + goto predefined; > + > + /* syntax is string_addr:string_port:string_reason */ > + addr = p = buffer; > + while (*p != ':' && *p != '\0') > + p++; > + if (!*p) > + goto predefined; > + *p = '\0'; > + port = ++p; > + while (*p != ':' && *p != '\0') > + p++; > + if (!*p) > + goto predefined; > + *p = '\0'; Can this handle an ipv6 address like [2001:2c0:418:1::2]:3260? -- 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 |