Skip to content

handshake: support extracting record size limit value #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/tlshd/handshake.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ static void tlshd_save_nagle(gnutls_session_t session, int *saved)
void tlshd_start_tls_handshake(gnutls_session_t session,
struct tlshd_handshake_parms *parms)
{
ssize_t record_size_limit;
int saved, ret;
char *desc;

Expand Down Expand Up @@ -112,6 +113,11 @@ void tlshd_start_tls_handshake(gnutls_session_t session,
gnutls_free(desc);

parms->session_status = tlshd_initialize_ktls(session);
record_size_limit = gnutls_record_get_record_size_limit(session);
if (record_size_limit <= 0)
tlshd_log_notice("Inavlid Record size limit: %zd\n", record_size_limit);
else
parms->record_size_limit = (uint32_t)record_size_limit;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/tlshd/netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ static const struct tlshd_handshake_parms tlshd_default_handshake_parms = {
.peerids = NULL,
.remote_peerids = NULL,
.msg_status = 0,
.record_size_limit = 0,
.session_status = EIO,
};

Expand Down Expand Up @@ -505,6 +506,12 @@ void tlshd_genl_done(struct tlshd_handshake_parms *parms)
if (err < 0)
goto out_free;

err = nla_put_u32(msg, HANDSHAKE_A_DONE_RECORD_SIZE_LIMIT, parms->record_size_limit);
if (err < 0) {
tlshd_log_nl_error("nla_put record_size_limit", err);
goto out_free;
}

sendit:
if (tlshd_delay_done) {
/* Undocumented tlshd.conf parameter:
Expand Down
1 change: 1 addition & 0 deletions src/tlshd/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ enum {
HANDSHAKE_A_DONE_STATUS = 1,
HANDSHAKE_A_DONE_SOCKFD,
HANDSHAKE_A_DONE_REMOTE_AUTH,
HANDSHAKE_A_DONE_RECORD_SIZE_LIMIT,

__HANDSHAKE_A_DONE_MAX,
HANDSHAKE_A_DONE_MAX = (__HANDSHAKE_A_DONE_MAX - 1)
Expand Down
1 change: 1 addition & 0 deletions src/tlshd/tlshd.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct tlshd_handshake_parms {
GArray *peerids;
GArray *remote_peerids;
int msg_status;
uint32_t record_size_limit;

unsigned int session_status;
};
Expand Down
Loading