diff options
author | Ben Magistro <koncept1@gmail.com> | 2022-01-29 17:32:25 +0000 |
---|---|---|
committer | Konstantin Ananyev <konstantin.ananyev@intel.com> | 2022-02-04 11:49:31 +0000 |
commit | fef6f51d19e390757db6007127878d56a17c4e24 (patch) | |
tree | 56108a776fdb0bd50160e9f7e6fe8e3109f533f1 | |
parent | 324b4cfd81e2db76d0b817f886ee34ba12e42a3c (diff) |
Set a default MSS when establishing tcb if unset
While the caller to tle_tcp_stream_establish, should provide a complete
connection info to include mss, if it is not provided it will trigger a
divide by zero in tle_tcp_stream_writev. RFCs have defined a default
value for IPv4 and IPv6, which is leveraged if left unspecified.
Signed-off-by: Ben Magistro <koncept1@gmail.com>
Change-Id: Ic29f4398b22a601eddf2a501e9cc185106457303
-rw-r--r-- | lib/libtle_l4p/tcp_rxtx.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libtle_l4p/tcp_rxtx.c b/lib/libtle_l4p/tcp_rxtx.c index a702177..3d1c550 100644 --- a/lib/libtle_l4p/tcp_rxtx.c +++ b/lib/libtle_l4p/tcp_rxtx.c @@ -2277,7 +2277,17 @@ tcb_establish(struct tle_tcp_stream *s, const struct tle_tcp_conn_info *ci) uint32_t mss, tms; tms = tcp_get_tms(s->s.ctx->cycles_ms_shift); - mss = calc_smss(ci->so.mss, &s->tx.dst); + + /* set a default MSS if it is unset (0) */ + if ((ci->so.mss == 0) && (s->s.type == TLE_V4)) { + mss = calc_smss(TCP4_MIN_MSS, &s->tx.dst); + } + else if ((ci->so.mss == 0) && (s->s.type == TLE_V6)) { + mss = calc_smss(TCP6_MIN_MSS, &s->tx.dst); + } + else { + mss = calc_smss(ci->so.mss, &s->tx.dst); + } s->tcb.so = ci->so; fill_tcb_snd(&s->tcb, ci->ack, ci->seq, mss, |