version 1.156, 2008/07/04 23:08:25 |
version 1.157, 2008/07/10 18:08:11 |
|
|
u_int32_t seqnr; |
u_int32_t seqnr; |
u_int32_t packets; |
u_int32_t packets; |
u_int64_t blocks; |
u_int64_t blocks; |
|
u_int64_t bytes; |
} p_read, p_send; |
} p_read, p_send; |
|
|
static u_int64_t max_blocks_in, max_blocks_out; |
static u_int64_t max_blocks_in, max_blocks_out; |
|
|
buffer_init(&outgoing_packet); |
buffer_init(&outgoing_packet); |
buffer_init(&incoming_packet); |
buffer_init(&incoming_packet); |
TAILQ_INIT(&outgoing); |
TAILQ_INIT(&outgoing); |
|
p_send.packets = p_read.packets = 0; |
} |
} |
} |
} |
|
|
|
|
} |
} |
|
|
void |
void |
packet_get_state(int mode, u_int32_t *seqnr, u_int64_t *blocks, u_int32_t *packets) |
packet_get_state(int mode, u_int32_t *seqnr, u_int64_t *blocks, u_int32_t *packets, |
|
u_int64_t *bytes) |
{ |
{ |
struct packet_state *state; |
struct packet_state *state; |
|
|
state = (mode == MODE_IN) ? &p_read : &p_send; |
state = (mode == MODE_IN) ? &p_read : &p_send; |
*seqnr = state->seqnr; |
if (seqnr) |
*blocks = state->blocks; |
*seqnr = state->seqnr; |
*packets = state->packets; |
if (blocks) |
|
*blocks = state->blocks; |
|
if (packets) |
|
*packets = state->packets; |
|
if (bytes) |
|
*bytes = state->bytes; |
} |
} |
|
|
void |
void |
packet_set_state(int mode, u_int32_t seqnr, u_int64_t blocks, u_int32_t packets) |
packet_set_state(int mode, u_int32_t seqnr, u_int64_t blocks, u_int32_t packets, |
|
u_int64_t bytes) |
{ |
{ |
struct packet_state *state; |
struct packet_state *state; |
|
|
|
|
state->seqnr = seqnr; |
state->seqnr = seqnr; |
state->blocks = blocks; |
state->blocks = blocks; |
state->packets = packets; |
state->packets = packets; |
|
state->bytes = bytes; |
} |
} |
|
|
/* returns 1 if connection is via ipv4 */ |
/* returns 1 if connection is via ipv4 */ |
|
|
fprintf(stderr, "encrypted: "); |
fprintf(stderr, "encrypted: "); |
buffer_dump(&output); |
buffer_dump(&output); |
#endif |
#endif |
|
p_send.packets++; |
|
p_send.bytes += len + buffer_len(&outgoing_packet); |
buffer_clear(&outgoing_packet); |
buffer_clear(&outgoing_packet); |
|
|
/* |
/* |
|
|
if (!(datafellows & SSH_BUG_NOREKEY)) |
if (!(datafellows & SSH_BUG_NOREKEY)) |
fatal("XXX too many packets with same key"); |
fatal("XXX too many packets with same key"); |
p_send.blocks += (packet_length + 4) / block_size; |
p_send.blocks += (packet_length + 4) / block_size; |
|
p_send.bytes += packet_length + 4; |
buffer_clear(&outgoing_packet); |
buffer_clear(&outgoing_packet); |
|
|
if (type == SSH2_MSG_NEWKEYS) |
if (type == SSH2_MSG_NEWKEYS) |
|
|
buffer_append(&incoming_packet, buffer_ptr(&compression_buffer), |
buffer_append(&incoming_packet, buffer_ptr(&compression_buffer), |
buffer_len(&compression_buffer)); |
buffer_len(&compression_buffer)); |
} |
} |
|
p_read.packets++; |
|
p_read.bytes += padded_len + 4; |
type = buffer_get_char(&incoming_packet); |
type = buffer_get_char(&incoming_packet); |
if (type < SSH_MSG_MIN || type > SSH_MSG_MAX) |
if (type < SSH_MSG_MIN || type > SSH_MSG_MAX) |
packet_disconnect("Invalid ssh1 packet type: %d", type); |
packet_disconnect("Invalid ssh1 packet type: %d", type); |
|
|
if (!(datafellows & SSH_BUG_NOREKEY)) |
if (!(datafellows & SSH_BUG_NOREKEY)) |
fatal("XXX too many packets with same key"); |
fatal("XXX too many packets with same key"); |
p_read.blocks += (packet_length + 4) / block_size; |
p_read.blocks += (packet_length + 4) / block_size; |
|
p_read.bytes += packet_length + 4; |
|
|
/* get padlen */ |
/* get padlen */ |
cp = buffer_ptr(&incoming_packet); |
cp = buffer_ptr(&incoming_packet); |