aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/ip6.h29
-rw-r--r--src/vnet/tcp/tcp.h1
-rw-r--r--src/vnet/tcp/tcp_output.c16
3 files changed, 36 insertions, 10 deletions
diff --git a/src/vnet/ip/ip6.h b/src/vnet/ip/ip6.h
index 94c5080a0aa..28b1af749f6 100644
--- a/src/vnet/ip/ip6.h
+++ b/src/vnet/ip/ip6.h
@@ -655,21 +655,23 @@ void ip6_hbh_set_next_override (uword next);
* @param src - source IP
* @param dst - destination IP
* @param prot - payload proto
+ * @param flow_label - flow label
*
* @return - pointer to start of IP header
*/
always_inline void *
-vlib_buffer_push_ip6 (vlib_main_t * vm, vlib_buffer_t * b,
- ip6_address_t * src, ip6_address_t * dst, int proto)
+vlib_buffer_push_ip6_custom (vlib_main_t * vm, vlib_buffer_t * b,
+ ip6_address_t * src, ip6_address_t * dst,
+ int proto, u32 flow_label)
{
ip6_header_t *ip6h;
u16 payload_length;
/* make some room */
ip6h = vlib_buffer_push_uninit (b, sizeof (ip6_header_t));
-
+ ASSERT (flow_label < 1 << 20);
ip6h->ip_version_traffic_class_and_flow_label =
- clib_host_to_net_u32 (0x6 << 28);
+ clib_host_to_net_u32 ((0x6 << 28) | flow_label);
/* calculate ip6 payload length */
payload_length = vlib_buffer_length_in_chain (vm, b);
@@ -689,6 +691,25 @@ vlib_buffer_push_ip6 (vlib_main_t * vm, vlib_buffer_t * b,
return ip6h;
}
+/**
+ * Push IPv6 header to buffer
+ *
+ * @param vm - vlib_main
+ * @param b - buffer to write the header to
+ * @param src - source IP
+ * @param dst - destination IP
+ * @param prot - payload proto
+ *
+ * @return - pointer to start of IP header
+ */
+always_inline void *
+vlib_buffer_push_ip6 (vlib_main_t * vm, vlib_buffer_t * b,
+ ip6_address_t * src, ip6_address_t * dst, int proto)
+{
+ return vlib_buffer_push_ip6_custom (vm, b, src, dst, proto,
+ 0 /* flow label */ );
+
+}
#endif /* included_ip_ip6_h */
/*
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 7309e0ad109..4b0a0ddea53 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -435,6 +435,7 @@ typedef struct _tcp_connection
u32 last_fib_check; /**< Last time we checked fib route for peer */
u16 mss; /**< Our max seg size that includes options */
u32 timestamp_delta; /**< Offset for timestamp */
+ u32 ipv6_flow_label; /**< flow label for ipv6 header */
} tcp_connection_t;
/* *INDENT-OFF* */
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 71e9d7bbdb0..c7e9792afaa 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -842,8 +842,10 @@ tcp_send_reset_w_pkt (tcp_connection_t * tc, vlib_buffer_t * pkt,
int bogus = ~0;
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_custom (vm, b, &pkt_ih6->dst_address,
+ &pkt_ih6->src_address,
+ IP_PROTOCOL_TCP,
+ tc->ipv6_flow_label);
th->checksum = ip6_tcp_udp_icmp_compute_checksum (vm, b, ih6, &bogus);
ASSERT (!bogus);
}
@@ -909,8 +911,9 @@ tcp_push_ip_hdr (tcp_worker_ctx_t * wrk, tcp_connection_t * tc,
ip6_header_t *ih;
int bogus = ~0;
- ih = vlib_buffer_push_ip6 (vm, b, &tc->c_lcl_ip6,
- &tc->c_rmt_ip6, IP_PROTOCOL_TCP);
+ ih = vlib_buffer_push_ip6_custom (vm, b, &tc->c_lcl_ip6,
+ &tc->c_rmt_ip6, IP_PROTOCOL_TCP,
+ tc->ipv6_flow_label);
th->checksum = ip6_tcp_udp_icmp_compute_checksum (vm, b, ih, &bogus);
ASSERT (!bogus);
}
@@ -2278,8 +2281,9 @@ tcp_output_push_ip (vlib_main_t * vm, vlib_buffer_t * b0,
ih0 = vlib_buffer_push_ip4 (vm, b0, &tc0->c_lcl_ip4, &tc0->c_rmt_ip4,
IP_PROTOCOL_TCP, tcp_csum_offload (tc0));
else
- ih0 = vlib_buffer_push_ip6 (vm, b0, &tc0->c_lcl_ip6, &tc0->c_rmt_ip6,
- IP_PROTOCOL_TCP);
+ ih0 =
+ vlib_buffer_push_ip6_custom (vm, b0, &tc0->c_lcl_ip6, &tc0->c_rmt_ip6,
+ IP_PROTOCOL_TCP, tc0->ipv6_flow_label);
}