aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
authorroot <root@wasa-ucs-13.linuxfoundation.org>2017-08-15 12:58:31 -0400
committerFlorin Coras <florin.coras@gmail.com>2017-08-16 16:47:44 +0000
commitc9d1c5b6b3668e243bbdd978069976cc1184892b (patch)
tree58442fb9d3f12f1562c0f24c4aaa4eccac666f67 /src/vnet/tcp
parentab9a59c19a2765e001dd24a8f3e51882b6806e2d (diff)
tcp: fix v6 sessions
Change-Id: Ia6dd5e948b17b2f3866fe70838eabb09e35415e1 Signed-off-by: Dave Barach <dbarach@cisco.com> Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/tcp.c17
-rw-r--r--src/vnet/tcp/tcp_input.c16
-rw-r--r--src/vnet/tcp/tcp_output.c6
3 files changed, 18 insertions, 21 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 75c9d8dcc3d..d16900229ff 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -362,7 +362,11 @@ ip_interface_get_first_ip (u32 sw_if_index, u8 is_ip4)
/* *INDENT-OFF* */
foreach_ip_interface_address (lm6, ia, sw_if_index, 1 /* unnumbered */ ,
({
- return ip_interface_address_get_address (lm6, ia);
+ ip6_address_t *rv;
+ rv = ip_interface_address_get_address (lm6, ia);
+ /* Trying to use a link-local ip6 src address is a fool's errand */
+ if (!ip6_address_is_link_local_unicast (rv))
+ return rv;
}));
/* *INDENT-ON* */
}
@@ -635,6 +639,14 @@ tcp_connection_open (transport_endpoint_t * rmt)
else
{
ip6 = ip_interface_get_first_ip (sw_if_index, 0);
+ if (ip6 == 0)
+ {
+ clib_warning ("no routable ip6 addresses on %U",
+ format_vnet_sw_if_index_name, vnet_get_main (),
+ sw_if_index);
+ return -1;
+ }
+
clib_memcpy (&lcl_addr.ip6, ip6, sizeof (*ip6));
}
}
@@ -1109,7 +1121,6 @@ tcp_timer_establish_handler (u32 conn_index)
if (tc)
{
ASSERT (tc->state == TCP_STATE_SYN_SENT);
- tc->timers[TCP_TIMER_ESTABLISH] = TCP_TIMER_HANDLE_INVALID;
stream_session_connect_notify (&tc->connection, 1 /* fail */ );
}
else
@@ -1117,6 +1128,7 @@ tcp_timer_establish_handler (u32 conn_index)
tc = tcp_connection_get (conn_index, vlib_get_thread_index ());
ASSERT (tc->state == TCP_STATE_SYN_RCVD);
}
+ tc->timers[TCP_TIMER_ESTABLISH] = TCP_TIMER_HANDLE_INVALID;
tcp_connection_cleanup (tc);
}
@@ -1231,6 +1243,7 @@ tcp_main_enable (vlib_main_t * vm)
pi->unformat_pg_edit = unformat_pg_tcp_header;
ip4_register_protocol (IP_PROTOCOL_TCP, tcp4_input_node.index);
+ ip6_register_protocol (IP_PROTOCOL_TCP, tcp6_input_node.index);
/* Register as transport with session layer */
session_register_transport (TRANSPORT_PROTO_TCP, 1, &tcp_proto);
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index a3c4f1d8903..6f9e4c7a2ce 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -1877,26 +1877,12 @@ tcp46_syn_sent_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
tc0 =
tcp_half_open_connection_get (vnet_buffer (b0)->
tcp.connection_index);
+ ASSERT (tc0);
ack0 = vnet_buffer (b0)->tcp.ack_number;
seq0 = vnet_buffer (b0)->tcp.seq_number;
tcp0 = tcp_buffer_hdr (b0);
- if (!tc0)
- {
- ip4_header_t *ip40 = vlib_buffer_get_current (b0);
- tcp0 = ip4_next_header (ip40);
- tc0 =
- (tcp_connection_t *)
- stream_session_lookup_transport_wt4 (&ip40->dst_address,
- &ip40->src_address,
- tcp0->dst_port,
- tcp0->src_port,
- SESSION_TYPE_IP4_TCP,
- my_thread_index);
- ASSERT (0);
- goto drop;
- }
if (PREDICT_FALSE
(!tcp_ack (tcp0) && !tcp_rst (tcp0) && !tcp_syn (tcp0)))
goto drop;
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 5a395b9f25e..e6a211babf6 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -775,12 +775,10 @@ tcp_send_reset (tcp_connection_t * tc, vlib_buffer_t * pkt, u8 is_ip4)
else
{
int bogus = ~0;
- pkt_ih6 = (ip6_header_t *) (pkt_th - 1);
ASSERT ((pkt_ih6->ip_version_traffic_class_and_flow_label & 0xF0) ==
0x60);
- ih6 =
- vlib_buffer_push_ip6 (vm, b, &pkt_ih6->dst_address,
- &pkt_ih6->src_address, IP_PROTOCOL_TCP);
+ ih6 = vlib_buffer_push_ip6 (vm, b, &pkt_ih6->dst_address,
+ &pkt_ih6->src_address, IP_PROTOCOL_TCP);
th->checksum = ip6_tcp_udp_icmp_compute_checksum (vm, b, ih6, &bogus);
ASSERT (!bogus);
}