Matt Benjamin
2008-01-03 03:19:22 UTC
Hi List,
I'm trying to set the T_SCTP_SID option using the TPI interface
(streams-0.9.2.3, strxnet-0.9.2.11, strsctp-0.9.2.8), and I'm getting
TBADOPT.
I'm sure the problem is obvious, but I haven't been able to deduce it
after much staring.
Here's a snippet of code--fd is opened on /dev/sctp_t, bound, and
connected (received T_CONN_CON):
typedef struct tpi_scalar_option {
struct t_opthdr opt_hdr;
t_scalar_t opt_val;
} tpi_scalar_option;
int
set_stream_id(int fd, t_scalar_t stream_id)
{
struct {
struct T_optmgmt_req msg_hdr;
struct tpi_scalar_option opt;
} opt_req;
struct {
struct T_optmgmt_ack msg_hdr;
struct tpi_scalar_option opt;
} opt_ack;
int code, flags;
struct T_error_ack *error_ack;
struct strbuf ctlbuf;
opt_req.opt.opt_hdr.len = sizeof(opt_req.opt.opt_val);
opt_req.opt.opt_hdr.level = T_INET_SCTP;
opt_req.opt.opt_hdr.name = T_SCTP_SID;
opt_req.opt.opt_val = stream_id;
opt_req.msg_hdr.PRIM_type = T_OPTMGMT_REQ;
opt_req.msg_hdr.OPT_length = sizeof(opt_req.opt);
opt_req.msg_hdr.OPT_offset = sizeof(opt_req.msg_hdr);
opt_req.msg_hdr.MGMT_flags = T_NEGOTIATE;
ctlbuf.len = sizeof(opt_req);
ctlbuf.buf = (char*) &opt_req;
code = putmsg(fd, &ctlbuf, NULL, 0);
ctlbuf.maxlen = sizeof(opt_ack);
ctlbuf.len = 0;
ctlbuf.buf = (char*) &opt_ack;
flags = 0;
code = getmsg(fd, &ctlbuf, NULL, &flags);
/* ack is error, TBADOPT */
}
Any pointers (or something) appreciated.
Thanks,
Matt
- --
Matt Benjamin
The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI 48104
http://linuxbox.com
tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309
I'm trying to set the T_SCTP_SID option using the TPI interface
(streams-0.9.2.3, strxnet-0.9.2.11, strsctp-0.9.2.8), and I'm getting
TBADOPT.
I'm sure the problem is obvious, but I haven't been able to deduce it
after much staring.
Here's a snippet of code--fd is opened on /dev/sctp_t, bound, and
connected (received T_CONN_CON):
typedef struct tpi_scalar_option {
struct t_opthdr opt_hdr;
t_scalar_t opt_val;
} tpi_scalar_option;
int
set_stream_id(int fd, t_scalar_t stream_id)
{
struct {
struct T_optmgmt_req msg_hdr;
struct tpi_scalar_option opt;
} opt_req;
struct {
struct T_optmgmt_ack msg_hdr;
struct tpi_scalar_option opt;
} opt_ack;
int code, flags;
struct T_error_ack *error_ack;
struct strbuf ctlbuf;
opt_req.opt.opt_hdr.len = sizeof(opt_req.opt.opt_val);
opt_req.opt.opt_hdr.level = T_INET_SCTP;
opt_req.opt.opt_hdr.name = T_SCTP_SID;
opt_req.opt.opt_val = stream_id;
opt_req.msg_hdr.PRIM_type = T_OPTMGMT_REQ;
opt_req.msg_hdr.OPT_length = sizeof(opt_req.opt);
opt_req.msg_hdr.OPT_offset = sizeof(opt_req.msg_hdr);
opt_req.msg_hdr.MGMT_flags = T_NEGOTIATE;
ctlbuf.len = sizeof(opt_req);
ctlbuf.buf = (char*) &opt_req;
code = putmsg(fd, &ctlbuf, NULL, 0);
ctlbuf.maxlen = sizeof(opt_ack);
ctlbuf.len = 0;
ctlbuf.buf = (char*) &opt_ack;
flags = 0;
code = getmsg(fd, &ctlbuf, NULL, &flags);
/* ack is error, TBADOPT */
}
Any pointers (or something) appreciated.
Thanks,
Matt
- --
Matt Benjamin
The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI 48104
http://linuxbox.com
tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309