From 9fa82a63e47e4ee274c54af366e6fce055a0cbab Mon Sep 17 00:00:00 2001 From: Reshma Pattan Date: Fri, 7 Apr 2017 16:51:27 +0100 Subject: * Add siphash file for calculating the sequence number. * l4fwd app changed to include new command line parameters hash and secret key for hash calculation. * Changed l4fwd library to integrate siphash support for calculating the sequence number. Change-Id: I29c60836c8b17a118d76b619fd79398fac200f67 Signed-off-by: Reshma Pattan --- lib/libtle_l4p/tcp_rxtx.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib/libtle_l4p/tcp_rxtx.c') diff --git a/lib/libtle_l4p/tcp_rxtx.c b/lib/libtle_l4p/tcp_rxtx.c index b525751..d4b6fdd 100644 --- a/lib/libtle_l4p/tcp_rxtx.c +++ b/lib/libtle_l4p/tcp_rxtx.c @@ -641,7 +641,9 @@ sync_ack(struct tle_tcp_stream *s, const union pkt_info *pi, get_syn_opts(&s->tcb.so, (uintptr_t)(th + 1), m->l4_len - sizeof(*th)); s->tcb.rcv.nxt = si->seq + 1; - seq = sync_gen_seq(pi, s->tcb.rcv.nxt, ts, s->tcb.so.mss); + seq = sync_gen_seq(pi, s->tcb.rcv.nxt, ts, s->tcb.so.mss, + s->s.ctx->prm.hash_alg, + &s->s.ctx->prm.secret_key); s->tcb.so.ts.ecr = s->tcb.so.ts.val; s->tcb.so.ts.val = sync_gen_ts(ts, s->tcb.so.wscale); s->tcb.so.wscale = (s->tcb.so.wscale == TCP_WSCALE_NONE) ? @@ -762,14 +764,17 @@ rx_check_seqack(struct tcb *tcb, uint32_t seq, uint32_t ack, uint32_t len, static inline int restore_syn_opt(struct syn_opts *so, const union pkt_info *pi, - const union seg_info *si, uint32_t ts, const struct rte_mbuf *mb) + const union seg_info *si, uint32_t ts, const struct rte_mbuf *mb, + uint32_t hash_alg, rte_xmm_t *secret_key) { int32_t rc; uint32_t len; const struct tcp_hdr *th; /* check that ACK, etc fields are what we expected. */ - rc = sync_check_ack(pi, si->seq, si->ack - 1, ts); + rc = sync_check_ack(pi, si->seq, si->ack - 1, ts, + hash_alg, + secret_key); if (rc < 0) return rc; @@ -918,12 +923,12 @@ rx_ack_listen(struct tle_tcp_stream *s, struct stbl *st, if (pi->tf.flags != TCP_FLAG_ACK || rx_check_stream(s, pi) != 0) return -EINVAL; - rc = restore_syn_opt(&so, pi, si, tms, mb); + ctx = s->s.ctx; + rc = restore_syn_opt(&so, pi, si, tms, mb, ctx->prm.hash_alg, + &ctx->prm.secret_key); if (rc < 0) return rc; - ctx = s->s.ctx; - /* allocate new stream */ ts = get_stream(ctx); cs = TCP_STREAM(ts); @@ -2059,7 +2064,9 @@ tx_syn(struct tle_tcp_stream *s, const struct sockaddr *addr) s->tcb.so.mss = calc_smss(s->tx.dst.mtu, &s->tx.dst); /* note that rcv.nxt is 0 here for sync_gen_seq.*/ - seq = sync_gen_seq(&pi, s->tcb.rcv.nxt, tms, s->tcb.so.mss); + seq = sync_gen_seq(&pi, s->tcb.rcv.nxt, tms, s->tcb.so.mss, + s->s.ctx->prm.hash_alg, + &s->s.ctx->prm.secret_key); s->tcb.snd.iss = seq; s->tcb.snd.rcvr = seq; s->tcb.snd.una = seq; -- cgit 1.2.3-korg