- From: amar deka <amar_nitw2000 AT yahoo.co.in>
- To: discussion AT sctp.de
- Subject: [SCTP-Discussion] adding new chunk type
- Date: Mon Mar 21 20:22:01 2005
- List-id: SCTP Discussions <discussion.sctp.de>
hi all
the terminal.c and echoserver.c progrms compiles and
runs but does not produce the intended output when we
modify the sctp implementation.
----->our intention was to add the HMAC of all the
chunks in the packet as an authentication chunk at the
end of the packet and to verify at the reciever.So we
sent a 20 byte string in an authentication chunk
defined by us
we defined a new chunk type in message.h as
#define CHUNK_AUTHENTICATION 0x11
#define AUTH_CHUNK_SIZE 24
.
.
in rbundling.c we modify the rbu_rcvDatagram()by
adding the following lines to the switch case
case CHUNK_AUTHENTICATION:
printf("AUTHENTICATION CHUNK
RECEIVED\n"); break;
.
.
.
we modified the sbundling.c in bu_sendAllChunks() as
follows to handle the new chunk type : the
modifications are marked with a >>
>
>flag
.
if (bu_ptr->sack_in_buffer) {
rxc_stop_sack_timer();
/* SACKs by default go to the last active
address, from which data arrived */
send_len = bu_ptr->sack_position; /* at least
sizeof(SCTP_common_header) */
/* at most pointing to the end of SACK chunk
*/
event_logi(VVERBOSE, "bu_sendAllChunks(sack) :
send_len == %d ", send_len);
if (bu_ptr->ctrl_chunk_in_buffer) {
memcpy(&send_buffer[send_len],
&(bu_ptr->ctrl_buf[sizeof(SCTP_common_header)]),
(bu_ptr->ctrl_position -
sizeof(SCTP_common_header)));
send_len += bu_ptr->ctrl_position -
sizeof(SCTP_common_header);
event_logi(VVERBOSE,
"bu_sendAllChunks(sack+ctrl) : send_len == %d ",
send_len);
}
if (bu_ptr->data_in_buffer) {
>
> flag=1;
memcpy(&send_buffer[send_len],
&(bu_ptr->data_buf[sizeof(SCTP_common_header)]),
(bu_ptr->data_position -
sizeof(SCTP_common_header)));
send_len += bu_ptr->data_position -
sizeof(SCTP_common_header);
event_logi(VVERBOSE,
"bu_sendAllChunks(sack+data) : send_len == %d ",
send_len);
}
} else if (bu_ptr->ctrl_chunk_in_buffer) {
send_len = bu_ptr->ctrl_position;
event_logi(VVERBOSE, "bu_sendAllChunks(ctrl) :
send_len == %d ", send_len);
if (bu_ptr->data_in_buffer) {
memcpy(&send_buffer[send_len],
&(bu_ptr->data_buf[sizeof(SCTP_common_header)]),
(bu_ptr->data_position -
sizeof(SCTP_common_header)));
send_len += bu_ptr->data_position -
sizeof(SCTP_common_header);
event_logi(VVERBOSE,
"bu_sendAllChunks(ctrl+data) : send_len == %d ",
send_len);
}
} else if (bu_ptr->data_in_buffer)
{
send_len = bu_ptr->data_position;
>> flag=1;
}
event_logi(VVERBOSE, "bu_sendAllChunks(finally) :
send_len == %d ", send_len);
>
> if(flag)
>
> {
>
> simpleChunk = (SCTP_simple_chunk *)
>
>malloc(sizeof(SCTP_simple_chunk));
>
> memset(simpleChunk, 0,
>
>sizeof(SCTP_simple_chunk));
>
> simpleChunk->chunk_header.chunk_id =
>
>CHUNK_AUTHENTICATION;
>
> simpleChunk->chunk_header.chunk_flags=0x02;
>
> simpleChunk->chunk_header.chunk_length =
AUTH_CHUNK_SIZE;
>
>memcpy(simpleChunk->simple_chunk_data,temp_buffer,AUTH_CHUNK_SIZE-4);
>
>memcpy(&send_buffer[send_len],(char*)simpleChunk,AUTH_CHUNK_SIZE);
>
> send_len += AUTH_CHUNK_SIZE;
>
> printf("adding authentication data:\n");
>
> flag=0;
>
> }
we modified the if condition in the functions
bu_put_ctrl_chunk,bu_put_dat_chunk and
bu_put_sack_chunk of sbundler.c
if (TOTAL_SIZE(bu_ptr) +
CHUNKP_LENGTH((SCTP_chunk_header *) chunk) >=
MAX_SCTP_PDU-AUTH_CHUNK_SIZE)
the problem is that when i run the echoserver and
terminal programs the data from the client reaches to
the server but the data is not transmitted back to the
client(this i found out through some print statements)
what could be the problem.If possible please suggest
some methods to deal with the problem.
Thankyou for taking time to read the mail.
amar
________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to:
http://yahoo.shaadi.com/india-matrimony
- [SCTP-Discussion] adding new chunk type, amar deka, 03/21/2005
Archive powered by MHonArc 2.6.19+.